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

# Test t7347: Assigning user %variables which collide with formal %variables

See also
  t7345
Tested procedures
  VarCheckFormal VarCheckId

Source file t7347.asm

            EUROASM DUMP=ON, DUMPALL=YES, DUMPWIDTH=32, \
                    LIST=ON, LISTVAR=NO, LISTMACRO=YES
      t7347 PROGRAM FORMAT=BIN, LISTMAP=OFF, LISTGLOBALS=OFF
      [DATA]
      %Var11 %SET 0x11 ; Assign user %variable outside the macro.

      Sample %MACRO Var11,Var22,Var33=0x33,Var44=0x44 ; Declare a macro.
       %Var22 %SET 0x02 ; Assign user %variables with colliding names. W2510 expected.
       %Var33 %SET 0x03
       %Var44 %SET 0x04
        DB %Var11       ; Expand the 1st formal operand  with provided value 0x55.
        DB %Var22       ; Expand the 2nd formal operand  with provided value 0x66,
        DB %Var33       ; Expand the 1st keyword operand with provided value 0x77.
        DB %Var44       ; Expand the 2nd keyword operand with default value  0x44.
      %ENDMACRO Sample

        Sample 0x55,0x66,Var33=0x77 ; Provide operands and expand the macro.

        DB %Var11       ; Define byte with value 0x11 assigned outside the macro.
        DB %Var22       ; Define byte with value 0x02 assigned inside the macro.
        DB %Var33       ; Define byte with value 0x03 assigned inside the macro.
        DB %Var44       ; Define byte with value 0x04 assigned inside the macro.
      ENDPROGRAM t7347

Expected listing t7347.asm.lst
  `| | EUROASM DUMP=ON, DUMPALL=YES, DUMPWIDTH=32, \ | | LIST=ON, LISTVAR=NO, LISTMACRO=YES | |t7347 PROGRAM FORMAT=BIN, LISTMAP=OFF, LISTGLOBALS=OFF |[DATA] |[DATA] |30783131 |%Var11 %SET 0x11 ; Assign user %variable outside the macro. |0000: | | |Sample %MACRO Var11,Var22,Var33=0x33,Var44=0x44 ; Declare a macro. | | %Var22 %SET 0x02 ; Assign user %variables with colliding names. W2510 expected. | | %Var33 %SET 0x03 | | %Var44 %SET 0x04 | | DB %Var11 ; Expand the 1st formal operand with provided value 0x55. | | DB %Var22 ; Expand the 2nd formal operand with provided value 0x66, | | DB %Var33 ; Expand the 1st keyword operand with provided value 0x77. | | DB %Var44 ; Expand the 2nd keyword operand with default value 0x44. | |%ENDMACRO Sample |0000: | |0000: | Sample 0x55,0x66,Var33=0x77 ; Provide operands and expand the macro. | +Sample %MACRO Var11,Var22,Var33=0x33,Var44=0x44 ; Declare a macro. |30783032 + %Var22 %SET 0x02 ; Assign user %variables with colliding names. W2510 expected. |## W2510 Formal variable "%Var22" will not be overwritten. |30783033 + %Var33 %SET 0x03 |## W2510 Formal variable "%Var33" will not be overwritten. |30783034 + %Var44 %SET 0x04 |## W2510 Formal variable "%Var44" will not be overwritten. |0000:55 + DB %Var11 ; Expand the 1st formal operand with provided value 0x55. |0001:66 + DB %Var22 ; Expand the 2nd formal operand with provided value 0x66, |0002:77 + DB %Var33 ; Expand the 1st keyword operand with provided value 0x77. |0003:44 + DB %Var44 ; Expand the 2nd keyword operand with default value 0x44. | +%ENDMACRO Sample |0004: | |0004:11 | DB %Var11 ; Define byte with value 0x11 assigned outside the macro. |0005:02 | DB %Var22 ; Define byte with value 0x02 assigned inside the macro. |0006:03 | DB %Var33 ; Define byte with value 0x03 assigned inside the macro. |0007:04 | DB %Var44 ; Define byte with value 0x04 assigned inside the macro. | |ENDPROGRAM t7347`

Expected messages t7347.out
  `I0180 Assembling source file "t7347.asm". I0270 Assembling source "t7347". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t7347". "t7347.asm"{3} I0510 Assembling program pass 1. "t7347.asm"{3} W2510 Formal variable "%Var22" will not be overwritten. "t7347.asm"{8} "t7347.asm"{17} W2510 Formal variable "%Var33" will not be overwritten. "t7347.asm"{9} "t7347.asm"{17} W2510 Formal variable "%Var44" will not be overwritten. "t7347.asm"{10} "t7347.asm"{17} I0530 Assembling program pass 2 - final. "t7347.asm"{3} W2510 Formal variable "%Var22" will not be overwritten. "t7347.asm"{8} "t7347.asm"{17} W2510 Formal variable "%Var33" will not be overwritten. "t7347.asm"{9} "t7347.asm"{17} W2510 Formal variable "%Var44" will not be overwritten. "t7347.asm"{10} "t7347.asm"{17} I0660 16bit TINY BIN file "t7347.bin" created, size=8. "t7347.asm"{23} I0650 Program "t7347" assembled in 2 passes with errorlevel 2. "t7347.asm"{23} I0750 Source "t7347" (23 lines) assembled in 2 passes with errorlevel 2. I0860 Listing file "t7347.asm.lst" created, size=2872. I0990 EuroAssembler terminated with errorlevel 2.`

▲Back to the top▲