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

# Test t7362: Automatic variable %.

Description
  Test demonstrates how expansion counter %. changes its value in preprocessing blocks and outside the block.
Tested procedures
  CtxExpansionNrUpdate

Source file t7362.asm

            EUROASM DUMP=ON, DUMPALL=YES, DUMPWIDTH=32, \
                    LIST=ON, LISTVAR=NO, LISTREPEAT=YES,listmacro=1
      t7362 PROGRAM FORMAT=BIN, LISTMAP=OFF, LISTGLOBALS=OFF
      [DATA]
      Sample %MACRO          ; Macro definition.
               DB 'M','0'+%.
               DB 'A','0'+%.
               DB 'C','0'+%.
               DB 'R','0'+%.
               DB 'O','0'+%.
        %ENDMACRO Sample
             Sample          ; Macro expansion.
               DB 'X','0'+%. ; Expansion counter outside block scope.
      char   %FOR 'F','O','R'
               DB %char,'0'+%.
             %ENDFOR char
               DB 'X','0'+%. ; Expansion counter outside block scope.
      %cnt %SETA 3
             %REPEAT
               DB 'R','0'+%.
               DB 'P','0'+%.
               DB 'T','0'+%.
               %cnt %SETA %cnt-1
             %UNTIL %cnt=0
               DB 'X','0'+%. ; Expansion counter outside block scope.
      ENDPROGRAM t7362

Expected listing t7362.asm.lst
  `| | EUROASM DUMP=ON, DUMPALL=YES, DUMPWIDTH=32, \ | | LIST=ON, LISTVAR=NO, LISTREPEAT=YES,listmacro=1 | |t7362 PROGRAM FORMAT=BIN, LISTMAP=OFF, LISTGLOBALS=OFF |[DATA] |[DATA] | |Sample %MACRO ; Macro definition. | | DB 'M','0'+%. | | DB 'A','0'+%. | | DB 'C','0'+%. | | DB 'R','0'+%. | | DB 'O','0'+%. | | %ENDMACRO Sample |0000: | Sample ; Macro expansion. | +Sample %MACRO ; Macro definition. |0000:4D31 + DB 'M','0'+%. |0002:4131 + DB 'A','0'+%. |0004:4331 + DB 'C','0'+%. |0006:5231 + DB 'R','0'+%. |0008:4F31 + DB 'O','0'+%. | + %ENDMACRO Sample |000A:5830 | DB 'X','0'+%. ; Expansion counter outside block scope. |274627 |char %FOR 'F','O','R' |000C:4632 | DB %char,'0'+%. | + %ENDFOR char |274F27 +char %FOR 'F','O','R' |000E:4F33 + DB %char,'0'+%. | + %ENDFOR char |275227 +char %FOR 'F','O','R' |0010:5234 + DB %char,'0'+%. | + %ENDFOR char | +char %FOR 'F','O','R' | + DB %char,'0'+%. | | %ENDFOR char |0012:5830 | DB 'X','0'+%. ; Expansion counter outside block scope. |33 |%cnt %SETA 3 | | %REPEAT |0014:5235 | DB 'R','0'+%. |0016:5035 | DB 'P','0'+%. |0018:5435 | DB 'T','0'+%. |32 | %cnt %SETA %cnt-1 |FALSE + %UNTIL %cnt=0 | + %REPEAT |001A:5236 + DB 'R','0'+%. |001C:5036 + DB 'P','0'+%. |001E:5436 + DB 'T','0'+%. |31 + %cnt %SETA %cnt-1 |FALSE + %UNTIL %cnt=0 | + %REPEAT |0020:5237 + DB 'R','0'+%. |0022:5037 + DB 'P','0'+%. |0024:5437 + DB 'T','0'+%. |30 + %cnt %SETA %cnt-1 |TRUE | %UNTIL %cnt=0 |0026:5830 | DB 'X','0'+%. ; Expansion counter outside block scope. | |ENDPROGRAM t7362`

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

Expected output file t7362. bin

      0000: 4D 31 41 31 43 31 52 31 4F 31 58 30 46 32 4F 33  M1A1C1R1O1X0F2O3
      0010: 52 34 58 30 52 35 50 35 54 35 52 36 50 36 54 36  R4X0R5P5T5R6P6T6
      0020: 52 37 50 37 54 37 58 30                          R7P7T7X0

▲Back to the top▲