       1                                ;;;;;
       2                                ;
       3                                ; Test various conditions of the condition directive
       4                                ;
       5                                
       6        000000                  zero	= 0
       7        000001                  one	= 1
       8        000002                  defd	= 2
       9        000003                  defd2   = 3
      10        177777                  min1	= -1
      11                                
      12                                	; defined
      13 000000    001                  	.iif df defd		.byte 1
      14                                	.iif df undf		.byte 0
      15                                	.iif ndf defd		.byte 0
      16 000001    001                  	.iif ndf undf		.byte 1
      17                                
      18                                	.ifdf defd
      19 000002    001                  				.byte 1
      20                                	.endc
      21                                	.ifdf undf
      22                                				.byte 0
      23                                	.endc
      24                                	.ifndf defd
      25                                				.byte 0
      26                                	.endc
      27                                	.ifndf undf
      28 000003    001                  				.byte 1
      29                                	.endc
      30                                
      31                                	; multiple df and ndf
      32 000004    001                  	.iif df defd & defd2,   .byte 1
      33                                	.iif df defd & undefd   .byte 0
      34                                	.iif df undefd & defd,  .byte 0
      35                                	.iif df undefd & undefd .byte 0
      36                                
      37                                	.iif ndf defd & defd2    .byte 0
      38                                	.iif ndf defd & undefd,  .byte 0
      39                                	.iif ndf undefd & defd,  .byte 0
      40 000005    001                  	.iif ndf undefd & undefd .byte 1
      41                                
      42                                	; multiple df or ndf
      43 000006    001                  	.iif df defd ! defd2,   .byte 1
      44 000007    001                  	.iif df defd ! undefd   .byte 1
      45 000010    001                  	.iif df undefd ! defd,  .byte 1
      46                                	.iif df undefd ! undefd .byte 0
      47                                
      48                                	.iif ndf defd ! defd2,   .byte 0
      49 000011    001                  	.iif ndf defd ! undefd   .byte 1
      50 000012    001                  	.iif ndf undefd ! defd   .byte 1
      51 000013    001                  	.iif ndf undefd ! undefd .byte 1
      52                                
      53                                	; blank (string)
      54 000014    001                  	.iif b ^//		.byte 1
      55                                	.iif b <x>		.byte 0
      56                                	.iif nb <>		.byte 0
      57 000015    001                  	.iif nb ^/x/		.byte 1
      58                                
      59                                	; identical (strings)
      60 000016    001                  	.iif idn ^/a/ <a>	.byte 1
      61                                	.iif idn ^/a/ <b>	.byte 0
      62                                	.iif dif ^/a/ <a>	.byte 0
      63 000017    001                  	.iif dif ^/a/ <b>	.byte 1
      64                                
      65                                	; skip P1 and P2
      66                                	
      67                                	; equal to zero (value)
      68        000000   001            	.iif eq	zero		.byte 1
      69        000001                  	.iif eq	one		.byte 0
      70        000000                  	.iif ne	zero		.byte 0
      71        000001   001            	.iif ne	one		.byte 1
      72                                
      73        000000   001            	.iif z 	zero		.byte 1
      74        000001                  	.iif z 	one		.byte 0
      75        000000                  	.iif nz	zero		.byte 0
      76        000001   001            	.iif nz	one		.byte 1
      77                                
      78                                	; greater than zero (value)
      79        177777                  	.iif gt	min1		.byte 0
      80        000000                  	.iif gt	zero		.byte 0
      81        000001   001            	.iif gt	one		.byte 1
      82                                
      83        177777                  	.iif g 	min1		.byte 0
      84        000000                  	.iif g 	zero		.byte 0
      85        000001   001            	.iif g 	one		.byte 1
      86                                
      87                                	; greater than or equal to zero (value)
      88        177777                  	.iif ge	min1		.byte 0
      89        000000   001            	.iif ge	zero		.byte 1
      90        000001   001            	.iif ge	one		.byte 1
      91                                
      92                                	; less than zero (value)
      93        177777   001            	.iif lt	min1		.byte 1
      94        000000                  	.iif lt	zero		.byte 0
      95        000001                  	.iif lt	one		.byte 0
      96                                
      97        177777   001            	.iif l 	min1		.byte 1
      98        000000                  	.iif l 	zero		.byte 0
      99        000001                  	.iif l 	one		.byte 0
     100                                
     101                                	; less than or equal to zero (value)
     102        177777   001            	.iif le	min1		.byte 1
     103        000000   001            	.iif le	zero		.byte 1
     104        000001                  	.iif le	one		.byte 0
     105                                
     106                                	; expression with separating comma
     107        000000   001            	.iif z	one - one,	.byte 1
     108        000000                  	.iif nz	one - one,	.byte 0
     109        000001   001            	.iif nz	2 - one,	.byte 1
     110                                
     111                                	; labels
     112        000000   001            	.iif z	zero,	lab1:	.byte 1
     113        000001   001            	.iif nz	one,	lab2:	.byte 1
     114                                
     115                                	; multiline conditions
     116        000001                  	.if ne one
     117 000040    001                  	    .byte 1
     118                                	.iff
     119                                	    .byte 0
     120                                	.ift
     121 000041    001                  	    .byte 1
     122                                	.iftf
     123 000042    001                  	    .byte 1
     124                                	.endc
     125                                
     126        000001                  	.if eq one
     127                                	    .byte 0
     128                                	.iff
     129 000043    001                  	    .byte 1
     130                                	.ift
     131                                	    .byte 0
     132                                	.iftf
     133 000044    001                  	    .byte 1
     134                                	.endc
     135                                
     136                                	; errors
test-if.mac:137: ***ERROR Missing .(I)IF condition
     137                                	.iif
test-if.mac:138: ***ERROR Missing .(I)IF condition
     138                                	.iif 0
test-if.mac:139: ***ERROR Missing .(I)IF condition
     139                                	.iif 1
test-if.mac:140: ***ERROR Bad .IF expression
     140        000000                  	.iif undefd
test-if.mac:141: ***ERROR Bad .IF expression
     141        000000                  	.iif zero
test-if.mac:142: ***ERROR Bad .IF expression
     142        000000                  	.iif one
test-if.mac:143: ***ERROR Bad .IF expression
     143        000000                  	.iif z
     143                                


Symbol table

.       000045R      001 DEFD2 = 000003           LAB2    000037R      001 ONE   = 000001           
DEFD  = 000002           LAB1    000036R      001 MIN1  = 177777           ZERO  = 000000           


Program sections:

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