Rev 129 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download
# file opened: ifused_test.asm
1 0000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 0000 ;; Test case for IFUSED / IFNUSED ;;
3 0000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4 0000
5 0000 ;; Compilation:
6 0000 ;; sjasmplus.exe ifused_test.asm --lstlab --lst=ifused_test.lst
7 0000 ;;
8 0000 ;; After compilation, please check the listing file "ifused_test.lst"
9 0000
10 0000
11 0000 ;; This must generate syntax errors
12 0000
ifused_test.asm(13): error: [IFUSED/IFNUSED] no label defined ahead
13 0000 IFUSED ; in comments
ifused_test.asm(14): error: [IFUSED/IFNUSED] no label defined ahead
14 0000 IFNUSED ; in comments
15 0000
16 0000 ;; All rest of code must be compiled without errors
17 0000
18 0000 start
19 0000
20 0000 ;; Some little user program :)
21 0000
22 0000 CD 0E 00 .noused call EnableInt
23 0003 CD 10 00 .used call Wait
24 0006 18 FB jr .used
25 0008
26 0008 ;; Some little direct tests
27 0008
28 0008 IFUSED ; in comments
29 0008 6F 6B db 'ok'
30 000A ELSE
31 000A ~ fail
32 000A ENDIF
33 000A
34 000A IFNUSED ; in comments
35 000A ~ fail
36 000A ELSE
37 000A 6F 6B db 'ok'
38 000C ENDIF
39 000C
40 000C IFUSED .used ; in comments
41 000C 6F 6B db 'ok'
42 000E ELSE
43 000E ~ fail
44 000E ENDIF
45 000E IFUSED start.used ; in comments
46 000E org $-2
46 000C 6F 6B db 'ok'
47 000E ELSE
48 000E ~ fail
49 000E ENDIF
50 000E IFUSED @start.used ; in comments
51 000E org $-2
51 000C 6F 6B db 'ok'
52 000E ELSE
53 000E ~ fail
54 000E ENDIF
55 000E
56 000E IFUSED .noused ; in comments
57 000E ~ fail
58 000E ENDIF
59 000E IFUSED start.noused ; in comments
60 000E ~ fail
61 000E ENDIF
62 000E IFUSED @start.noused ; in comments
63 000E ~ fail
64 000E ENDIF
65 000E
66 000E IFUSED not_defined_label ; in comments
67 000E ~ fail
68 000E ENDIF
69 000E
70 000E ;; Some little library :)
71 000E
72 000E EnableInt
73 000E IFUSED EnableInt
74 000E FB ei
75 000F C9 ret
76 0010 ENDIF
77 0010
78 0010 Wait IFUSED
79 0010 06 FF ld b,#FF
80 0012 .loop
81 0012 IFUSED EnableInt
82 0012 76 .halter halt
83 0013 ELSE
84 0013 ~ ld c,#FF ;; When the "call EnableInt" is commented out,
85 0013 ~ .cycle dec c ;; this branch after ELSE must be generated.
86 0013 ~ jr nz,.cycle
87 0013 ENDIF ;; End of IFUSED EnableInt
88 0013
89 0013 10 FD djnz .loop
90 0015 C9 ret
91 0016 ENDIF ;; End of IFUSED Wait
92 0016
93 0016 ;; ADDENDUM: different code path to generate some more syntax errors
ifused_test.asm(94): error: Unexpected: &Label
94 0016 IFUSED Invalid&Label
ifused_test.asm(95): error: Unexpected: %Label
95 0016 IFNUSED Invalid%Label
ifused_test.asm(96): error: Invalid labelname: .InvalidLabel
96 0016 IFUSED ..InvalidLabel
ifused_test.asm(97): error: Invalid labelname: .InvalidLabel
97 0016 IFNUSED ..InvalidLabel
98 0016
# file closed: ifused_test.asm
Value Label
------ - -----------------------------------------------------------
0x0000 X start
0x0000 X start.noused
0x000E EnableInt
0x0003 start.used
0x0010 Wait
0x0012 Wait.loop
0x0012 X Wait.halter