EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t8349: Formal %variables in nested macros.


Description
Test demonstrates overlapping of formal and user-defined %variables in macros.
See also
t8347  
Tested procedures
VarCheckFormal   CtxFind  
Source file t8349.asm
      EUROASM DUMP=ON, DUMPALL=YES, DUMPWIDTH=32, \
              LIST=ON, LISTVAR=NO, LISTMACRO=YES
t8349 PROGRAM FORMAT=BIN, LISTMAP=OFF, LISTGLOBALS=OFF

; Assign user %variables outside macros.
%Ext1 %SET 0x11   ; Assign user value 0x11.
%Ext2 %SET 0x22   ; Assign user value 0x22.
%Ext3 %SET 0x33   ; Assign user value 0x33.

; Declare macro Inner, which will be invoked later from Outer with
;  arguments 0xDD, 0xBB, 0x88.
Inner %MACRO Inn1, Inn2, Inn3
; Assign three user %variables inside the macro Inner.
%Ext1   %SET 0x44 ; Reassign user value from 0x11 to 0x44.
%Inn2   %SET 0x55 ; W2510 expected. Formal %Inn2 keeps its previous value 0xBB.
%Out3   %SET 0x66 ; W2510 expected. Formal parent's %Out3 keeps its previous value 0xCC.
        DB %Ext1  ; Reassigned (by Inner) user value 0x44 expected.
        DB %Ext2  ; Reassigned (by Outer) user value 0x77 expected.
        DB %Ext3  ; Assigned user value 0x33 expected.
        DB %Out1  ; Formal Outer value 0xAA expected.
        DB %Out2  ; Formal Outer value 0xBB expected.
        DB %Out3  ; Formal Outer value 0xCC expected.
        DB %Inn1  ; Formal Inner value 0xDD expected.
        DB %Inn2  ; Formal Inner value 0xBB expected.
        DB %Inn3  ; Formal Inner value 0x88 expected.
      %ENDMACRO Inner

; Declare macro Outer, which will be invoked later in program with
;  arguments 0xAA, 0xBB, 0xCC.
Outer %MACRO Out1, Out2, Out3
; Assign three user %variables inside the macro Inner.
%Ext2   %SET 0x77 ; Reassigning from 0x22 to 0x77.
%Inn3   %SET 0x88 ; Assign user value 0x88.
%Out1   %SET 0x99 ; W2510 expected. Formal %Out1 keeps its previous value 0xAA.
        DB %Ext1  ; Assigned user value 0x11 expected.
        DB %Ext2  ; Reassigned (by Outer) user value 0x77 expected.
        DB %Ext3  ; Assigned user value 0x33 expected.
        DB %Out1  ; Formal value 0xAA expected.
        DB %Out2  ; Formal value 0xBB expected.
        DB %Out3  ; Formal value 0xCC expected.
        DB %Inn1  ; Unassigned value expected.
        DB %Inn2  ; Unassigned value expected.
        DB %Inn3  ; Assigned (by Outer) user value 0x88 expected.
        Inner 0xDD, %Out2, %Inn3 ; Macro Inner invoked with 0xDD,0xBB,0x88.
        DB %Inn1  ; Unassigned value expected.
        DB %Inn2  ; Assigned (by Inner) user value 0x55 expected.
        DB %Inn3  ; Assigned (by Outer) user value 0x88 expected.
      %ENDMACRO Outer

; Demonstrate values of all %variables before macro invocation.
        DB %Ext1  ; Assigned user value 0x11 expected.
        DB %Ext2  ; Assigned user value 0x22 expected.
        DB %Ext3  ; Assigned user value 0x33 expected.
        DB %Out1  ; Unassigned value expected.
        DB %Out2  ; Unassigned value expected.
        DB %Out3  ; Unassigned value expected.
        DB %Inn1  ; Unassigned value expected.
        DB %Inn2  ; Unassigned value expected.
        DB %Inn3  ; Unassigned value expected.
      Outer 0xAA, 0xBB, 0xCC ; invocation of macro Outer.
; Demonstrate values of all %variables after Outer expansion.
        DB %Ext1  ; Reassigned (by Inner) value 0x44 expected.
        DB %Ext2  ; Reassigned (by Outer) value 0x77 expected.
        DB %Ext3  ; Assigned user value 0x33 expected.
        DB %Out1  ; Assigned (by Outer) user value 0x99 expected.
        DB %Out2  ; Unassigned value expected.
        DB %Out3  ; Assigned (by Inner) user value 0x66 expected.
        DB %Inn1  ; Unassigned value expected.
        DB %Inn2  ; Assigned (by Inner) user value 0x55 expected.
        DB %Inn3  ; Assigned (by Outer) user value 0x88 expected.
ENDPROGRAM t8349
Expected listing t8349.asm.lst
| | EUROASM DUMP=ON, DUMPALL=YES, DUMPWIDTH=32, \ | | LIST=ON, LISTVAR=NO, LISTMACRO=YES | |t8349 PROGRAM FORMAT=BIN, LISTMAP=OFF, LISTGLOBALS=OFF |[BIN] ::::Section changed. |0000: | |0000: |; Assign user %variables outside macros. |30783131 |%Ext1 %SET 0x11 ; Assign user value 0x11. |30783232 |%Ext2 %SET 0x22 ; Assign user value 0x22. |30783333 |%Ext3 %SET 0x33 ; Assign user value 0x33. |0000: | |0000: |; Declare macro Inner, which will be invoked later from Outer with |0000: |; arguments 0xDD, 0xBB, 0x88. | |Inner %MACRO Inn1, Inn2, Inn3 | |; Assign three user %variables inside the macro Inner. | |%Ext1 %SET 0x44 ; Reassign user value from 0x11 to 0x44. | |%Inn2 %SET 0x55 ; W2510 expected. Formal %Inn2 keeps its previous value 0xBB. | |%Out3 %SET 0x66 ; W2510 expected. Formal parent's %Out3 keeps its previous value 0xCC. | | DB %Ext1 ; Reassigned (by Inner) user value 0x44 expected. | | DB %Ext2 ; Reassigned (by Outer) user value 0x77 expected. | | DB %Ext3 ; Assigned user value 0x33 expected. | | DB %Out1 ; Formal Outer value 0xAA expected. | | DB %Out2 ; Formal Outer value 0xBB expected. | | DB %Out3 ; Formal Outer value 0xCC expected. | | DB %Inn1 ; Formal Inner value 0xDD expected. | | DB %Inn2 ; Formal Inner value 0xBB expected. | | DB %Inn3 ; Formal Inner value 0x88 expected. | | %ENDMACRO Inner |0000: | |0000: |; Declare macro Outer, which will be invoked later in program with |0000: |; arguments 0xAA, 0xBB, 0xCC. | |Outer %MACRO Out1, Out2, Out3 | |; Assign three user %variables inside the macro Inner. | |%Ext2 %SET 0x77 ; Reassigning from 0x22 to 0x77. | |%Inn3 %SET 0x88 ; Assign user value 0x88. | |%Out1 %SET 0x99 ; W2510 expected. Formal %Out1 keeps its previous value 0xAA. | | DB %Ext1 ; Assigned user value 0x11 expected. | | DB %Ext2 ; Reassigned (by Outer) user value 0x77 expected. | | DB %Ext3 ; Assigned user value 0x33 expected. | | DB %Out1 ; Formal value 0xAA expected. | | DB %Out2 ; Formal value 0xBB expected. | | DB %Out3 ; Formal value 0xCC expected. | | DB %Inn1 ; Unassigned value expected. | | DB %Inn2 ; Unassigned value expected. | | DB %Inn3 ; Assigned (by Outer) user value 0x88 expected. | | Inner 0xDD, %Out2, %Inn3 ; Macro Inner invoked with 0xDD,0xBB,0x88. | | DB %Inn1 ; Unassigned value expected. | | DB %Inn2 ; Assigned (by Inner) user value 0x55 expected. | | DB %Inn3 ; Assigned (by Outer) user value 0x88 expected. | | %ENDMACRO Outer |0000: | |0000: |; Demonstrate values of all %variables before macro invocation. |0000:11 | DB %Ext1 ; Assigned user value 0x11 expected. |0001:22 | DB %Ext2 ; Assigned user value 0x22 expected. |0002:33 | DB %Ext3 ; Assigned user value 0x33 expected. |0003: | DB %Out1 ; Unassigned value expected. |0003: | DB %Out2 ; Unassigned value expected. |0003: | DB %Out3 ; Unassigned value expected. |0003: | DB %Inn1 ; Unassigned value expected. |0003: | DB %Inn2 ; Unassigned value expected. |0003: | DB %Inn3 ; Unassigned value expected. |0003: | Outer 0xAA, 0xBB, 0xCC ; invocation of macro Outer. | +Outer %MACRO Out1, Out2, Out3 |0003: +; Assign three user %variables inside the macro Inner. |30783737 +%Ext2 %SET 0x77 ; Reassigning from 0x22 to 0x77. |30783838 +%Inn3 %SET 0x88 ; Assign user value 0x88. |30783939 +%Out1 %SET 0x99 ; W2510 expected. Formal %Out1 keeps its previous value 0xAA. |## W2510 Formal variable "%Out1" will not be overwritten. |0003:11 + DB %Ext1 ; Assigned user value 0x11 expected. |0004:77 + DB %Ext2 ; Reassigned (by Outer) user value 0x77 expected. |0005:33 + DB %Ext3 ; Assigned user value 0x33 expected. |0006:AA + DB %Out1 ; Formal value 0xAA expected. |0007:BB + DB %Out2 ; Formal value 0xBB expected. |0008:CC + DB %Out3 ; Formal value 0xCC expected. |0009: + DB %Inn1 ; Unassigned value expected. |0009: + DB %Inn2 ; Unassigned value expected. |0009:88 + DB %Inn3 ; Assigned (by Outer) user value 0x88 expected. |000A: + Inner 0xDD, %Out2, %Inn3 ; Macro Inner invoked with 0xDD,0xBB,0x88. | +Inner %MACRO Inn1, Inn2, Inn3 |000A: +; Assign three user %variables inside the macro Inner. |30783434 +%Ext1 %SET 0x44 ; Reassign user value from 0x11 to 0x44. |30783535 +%Inn2 %SET 0x55 ; W2510 expected. Formal %Inn2 keeps its previous value 0xBB. |## W2510 Formal variable "%Inn2" will not be overwritten. |30783636 +%Out3 %SET 0x66 ; W2510 expected. Formal parent's %Out3 keeps its previous value 0xCC. |## W2510 Formal variable "%Out3" will not be overwritten. |000A:44 + DB %Ext1 ; Reassigned (by Inner) user value 0x44 expected. |000B:77 + DB %Ext2 ; Reassigned (by Outer) user value 0x77 expected. |000C:33 + DB %Ext3 ; Assigned user value 0x33 expected. |000D:AA + DB %Out1 ; Formal Outer value 0xAA expected. |000E:BB + DB %Out2 ; Formal Outer value 0xBB expected. |000F:CC + DB %Out3 ; Formal Outer value 0xCC expected. |0010:DD + DB %Inn1 ; Formal Inner value 0xDD expected. |0011:BB + DB %Inn2 ; Formal Inner value 0xBB expected. |0012:88 + DB %Inn3 ; Formal Inner value 0x88 expected. | + %ENDMACRO Inner |0013: + DB %Inn1 ; Unassigned value expected. |0013:55 + DB %Inn2 ; Assigned (by Inner) user value 0x55 expected. |0014:88 + DB %Inn3 ; Assigned (by Outer) user value 0x88 expected. | + %ENDMACRO Outer |0015: |; Demonstrate values of all %variables after Outer expansion. |0015:44 | DB %Ext1 ; Reassigned (by Inner) value 0x44 expected. |0016:77 | DB %Ext2 ; Reassigned (by Outer) value 0x77 expected. |0017:33 | DB %Ext3 ; Assigned user value 0x33 expected. |0018:99 | DB %Out1 ; Assigned (by Outer) user value 0x99 expected. |0019: | DB %Out2 ; Unassigned value expected. |0019:66 | DB %Out3 ; Assigned (by Inner) user value 0x66 expected. |001A: | DB %Inn1 ; Unassigned value expected. |001A:55 | DB %Inn2 ; Assigned (by Inner) user value 0x55 expected. |001B:88 | DB %Inn3 ; Assigned (by Outer) user value 0x88 expected. | |ENDPROGRAM t8349
Expected messages t8349.out
I0180 Assembling source file "t8349.asm". I0270 Assembling source "t8349". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t8349". "t8349.asm"{3} I0510 Assembling program pass 1. "t8349.asm"{3} W2510 Formal variable "%Out1" will not be overwritten. "t8349.asm"{34} "t8349.asm"{60} W2510 Formal variable "%Inn2" will not be overwritten. "t8349.asm"{15} "t8349.asm"{44} "t8349.asm"{60} W2510 Formal variable "%Out3" will not be overwritten. "t8349.asm"{16} "t8349.asm"{44} "t8349.asm"{60} I0530 Assembling program pass 2 - final. "t8349.asm"{3} W2510 Formal variable "%Out1" will not be overwritten. "t8349.asm"{34} "t8349.asm"{60} W2510 Formal variable "%Inn2" will not be overwritten. "t8349.asm"{15} "t8349.asm"{44} "t8349.asm"{60} W2510 Formal variable "%Out3" will not be overwritten. "t8349.asm"{16} "t8349.asm"{44} "t8349.asm"{60} I0660 16bit TINY BIN file "t8349.bin" created, size=28. "t8349.asm"{71} I0650 Program "t8349" assembled in 2 passes with errorlevel 2. "t8349.asm"{71} I0750 Source "t8349" (71 lines) assembled in 2 passes with errorlevel 2. I0860 Listing file "t8349.asm.lst" created, size=9152. I0990 EuroAssembler terminated with errorlevel 2.

▲Back to the top▲