       1                                ;;;;;
       2                                ;
       3                                ; Test that commas create empty macro arguments.
       4                                ;
       5                                        .macro  tstarg a1,a2,a3,a4
       6                                        .narg   label
       7                                        .endm
       8                                
       9 000000                         start:  tstarg          ; 0 args
       1        000000                          .narg   label
      10 000000                                 tstarg   123    ; 1 arg
       1        000001                          .narg   label
      11 000000                                 tstarg   1,     ; 2 args
       1        000002                          .narg   label
      12 000000                                 tstarg   ,2     ; 2 args
       1        000002                          .narg   label
      13 000000                                 tstarg   ,      ; 2 args
       1        000002                          .narg   label
      14 000000                                 tstarg   ,,     ; 3 args
       1        000003                          .narg   label
      15 000000                                 tstarg   1,,    ; 3 args
       1        000003                          .narg   label
      16 000000                                 tstarg   ,,3    ; 3 args
       1        000003                          .narg   label
      17 000000                                 tstarg   1,,3   ; 3 args
       1        000003                          .narg   label
      18 000000                                 tstarg   1,2,3  ; 3 args
       1        000003                          .narg   label
      19                                
      20                                ;;;;;
      21                                ;
      22                                ; Test what happens if we have invalid bracketed strings.
      23                                ; For now we fall back to treating them like unbracketed strings,
      24                                ; that will hopefully alert the user the best.
      25                                ;
      26                                        .macro  braket  arg
      27                                        ; arg
      28                                        .endm
      29                                
      30 000000                                 braket  <plain>
       1                                        ; plain
      31 000000                                 braket  ^/simple/
       1                                        ; simple
      32 000000                                 braket  <broken
       1                                        ; <broken
      33 000000                                 braket  ^/broken
       1                                        ; ^/broken
      34 000000                                 braket  <bro<ken>
       1                                        ; <bro<ken>
      35 000000                                 braket  <bro<ken> string
       1                                        ; <bro<ken>
      36                                
      37                                ;
      38                                ; Test that commas work with default arguments
      39                                ;
      40                                        .macro  tstarg a1,a2=default,a3,a4
      41                                        .narg   label	; second arg is "a2"
      42                                        .endm
      43                                
      44 000000                         start:  tstarg          ; 0 args
       1        000000                          .narg   label	; second arg is "default"
      45 000000                                 tstarg   123    ; 1 arg
       1        000001                          .narg   label	; second arg is "default"
      46 000000                                 tstarg   1,     ; 2 args
       1        000002                          .narg   label	; second arg is ""
      47 000000                                 tstarg   ,2     ; 2 args
       1        000002                          .narg   label	; second arg is "2"
      48 000000                                 tstarg   ,      ; 2 args
       1        000002                          .narg   label	; second arg is ""
      49 000000                                 tstarg   ,,     ; 3 args
       1        000003                          .narg   label	; second arg is "default"
      50 000000                                 tstarg   1,,    ; 3 args
       1        000003                          .narg   label	; second arg is "default"
      51 000000                                 tstarg   ,,3    ; 3 args
       1        000003                          .narg   label	; second arg is "default"
      52 000000                                 tstarg   1,,3   ; 3 args
       1        000003                          .narg   label	; second arg is "default"
      53 000000                                 tstarg   1,2,3  ; 3 args
       1        000003                          .narg   label	; second arg is "2"
      54                                
      55                                ;
      56                                ; Test default args and strange commas
      57                                ;
      58                                	.macro	tstdef	a=1,b=2
      59                                	.word	a,b
      60                                	.endm
      61                                
      62 000000                         	tstdef
       1 000000 000001  000002          	.word	1,2
      63 000004                         	tstdef	4,5
       1 000004 000004  000005          	.word	4,5
      64 000010                         	tstdef	4,5,6		; Excess argument is ignored
       1 000010 000004  000005          	.word	4,5
      65 000014                         	tstdef	b=42
       1 000014 000001  000042          	.word	1,42
      66 000020                         	tstdef	a=73
       1 000020 000073  000002          	.word	73,2
      67 000024                         	tstdef	,b=11
       1 000024 000001  000011          	.word	1,11
      68 000030                         	tstdef	a=5,b=4
       1 000030 000005  000004          	.word	5,4
      69 000034                         	tstdef	,a=5,b=4	; Strange case seen in some sources
       1 000034 000005  000004          	.word	5,4
      70 000040                         	tstdef	a=5,a=4		; Duplicate keyword argument -- legal!
       1 000040 000004  000002          	.word	4,2
      70                                


Symbol table

.       000044R      001 LABEL = 000003           START   000000R      001 


Program sections:

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