       1                                ;;;;;
       2                                ;
       3                                ; Test nested macros and name on .ENDM
       4                                ;
       5                                
       6                                    .macro      M1
       7                                    .word       1
       8                                    .endm       M1      ; ok
       9                                
      10 000000                             M1
       1 000000 000001                      .word       1
      11                                
      12                                    .macro      M2
      13                                    .word       2
      14                                    .macro      M3
      15                                    .word       3
      16                                    .endm       M3      ; ok
      17                                    .endm       M2      ; ok
      18                                
      19 000002                             M2
       1 000002 000002                      .word       2
       2                                    .macro      M3
       3                                    .word       3
       4                                    .endm       M3      ; ok
      20 000004                             M3
       1 000004 000003                      .word       3
      21                                
      22                                    .macro      M4
      23                                    .word       4
      24                                    .macro      M4
      25                                    .endm       M4      ; ok
      26                                    .endm       M4      ; ok
      27                                
      28 000006                             M4
       1 000006 000004                      .word       4
       2                                    .macro      M4
       3                                    .endm       M4      ; ok
      29 000010                             M4                  ; should be empty now
      30                                
      31                                    .macro      M5
      32                                    .word       5
      33                                    .macro      M5
      34                                    .endm       notM5   ; wrong; detected when M5 is expanded
      35                                    .endm       M5      ; ok
      36                                
      37 000010                             M5
       1 000010 000005                      .word       5
       2                                    .macro      M5
test-endm.mac:37->M5:3: ***ERROR .ENDM 'NOTM5' does not match .MACRO 'M5'
       3                                    .endm       notM5   ; wrong; detected when M5 is expanded
      38 000012                             M5
      39                                
      40                                    .macro      M6
test-endm.mac:41: ***ERROR .ENDM 'NOTM6' does not match .MACRO 'M6'
      41                                    .endm       notM6   ; wrong
      42                                
test-endm.mac:43: ***ERROR No macro definition block active
      43                                    .endm               ; end without macro
test-endm.mac:44: ***ERROR No repeat block active
      44                                    .endr               ; end without repetition
test-endm.mac:45: ***ERROR No conditional block active
      45                                    .endc               ; end without condition
      46                                
      47                                    ; Test that a macro that is defined inside another macro isn't already
      48                                    ; defined while defining the outer macro.
      49                                    ; This is a bit tricky: macros are kept between passes, so just
      50                                    ; testing M3 before M2 (like above) won't work.
      51                                
      52                                    .macro      M7
      53                                     .word      7
      54                                     .if        p2
      55                                      .macro    M8      ; only defined in pass 2
      56                                       .word    8.
      57                                      .endm     M8      ; ok
      58                                     .endc
      59                                    .endm       M7      ; ok
      60                                
      61 000012 000000G                     M8                  ; not defined yet; will be taken as implied .word.
      62 000014                             M7                  ; defines M8.
       1 000014 000007                       .word      7
       2                                     .if        p2
       3                                      .macro    M8      ; only defined in pass 2
       4                                       .word    8.
       5                                      .endm     M8      ; ok
       6                                     .endc
      63 000016                             M8                  ; which can now be used.
       1 000016 000010                         .word    8.
      63                                


Symbol table

.       000020R      001 M8    = ****** GX        


Program sections:

. ABS.  000000    000   (RW,I,GBL,ABS,OVR,NOSAV)
        000020    001   (RW,I,LCL,REL,CON,NOSAV)
