| Index | Manual | Download | Source | Macros | Embedded word Case ins.
Sitemap | Links | Forum | Tests | Projects

# Test t2702: Pseudoinstruction %WHILE nested

Description
  Block identifiers used with repeating pseudoinstructions help to keep proper block nesting, and if used with %EXITblock, it allows to select which loop to prematurely break.
See also
  t5760
Tested procedures
  PseudopcWHILE PseudopcENDWHILE PseudopcEXITWHILE

Source & expected listing t2702.htm.lst
  `| | EUROASM LIST=ON, DUMP=ON, DUMPWIDTH=16, LISTREPEAT=OFF | |t2702 PROGRAM FORMAT=BIN,MODEL=TINY,WIDTH=16,MAXEXPANSIONS=99,LISTMAP=OFF,LISTGLOBALS=OFF,IMAGEBASE=0 |[BIN] |[BIN] SEGMENT WIDTH=16, PURPOSE=DATA |313630 |%O %SETA 0xA0 ; Initialization of outer block control %variable. |TRUE |Outer %WHILE %O < 0xF0 |31 |%I %SETA 0x01 ; Initialization of inner block control %variable. |TRUE |Inner %WHILE %I < 0x09 |FALSE | %IF %I > 0x04 | | %EXITWHILE Inner ; Premature break of inner block. | | %ENDIF |0000:A1 | DB %O + %I ; Actual emitting statement. |32 | %I %SETA %I + 0x01 ; Modification of inner block control %variable. | | %ENDWHILE Inner |313736 | %O %SETA %O + 0x10 ; Modification of outer block control %variable. | | %ENDWHILE Outer |0014:00000000~| ALIGN OWORD |0020: |; Assemble the double loop again, this time prematurely breaking the outer loop: |313630 |%O %SETA 0xA0 ; Initialization of outer block control %variable. |TRUE |Outer %WHILE %O < 0xF0 |31 |%I %SETA 0x01 ; Initialization of inner block control %variable. |TRUE |Inner %WHILE %I < 0x09 |FALSE | %IF %I > 0x04 | | %EXITWHILE Outer ; Premature break of outer block. | | %ENDIF |0020:A1 | DB %O + %I ; Actual emitting statement. |32 | %I %SETA %I + 0x01 ; Modification of inner block control %variable. | | %ENDWHILE Inner | | %O %SETA %O + 0x10 ; Modification of outer block control %variable. | | %ENDWHILE Outer | | ENDPROGRAM t2702`

Expected messages t2702.out
  `I0180 Assembling source file "t2702.htm". I0270 Assembling source "t2702". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t2702". "t2702.htm"{63} I0510 Assembling program pass 1. "t2702.htm"{63} I0530 Assembling program pass 2 - final. "t2702.htm"{63} I0660 16bit TINY BIN file "t2702.bin" created, size=36. "t2702.htm"{91} I0650 Program "t2702" assembled in 2 passes with errorlevel 0. "t2702.htm"{91} I0750 Source "t2702" (116 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t2702.htm.lst" created, size=1935. I0990 EuroAssembler terminated with errorlevel 0.`

Expected output file t2702. bin

      0000: A1 A2 A3 A4 B1 B2 B3 B4 C1 C2 C3 C4 D1 D2 D3 D4  ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
      0010: E1 E2 E3 E4 00 00 00 00 00 00 00 00 00 00 00 00  ¤¤¤¤°°°°°°°°°°°°
      0020: A1 A2 A3 A4                                      ¤¤¤¤

▲Back to the top▲