Rev 126 | Rev 539 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download
# file opened: ifused_test.asm1 0000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2 0000 ;; Test case for IFUSED / IFNUSED ;;3 0000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4 00005 0000 ;; Compilation:6 0000 ;; sjasmplus.exe ifused_test.asm --lstlab --lst=ifused_test.lst7 0000 ;;8 0000 ;; After compilation, please check the listing file "ifused_test.lst"9 000010 000011 0000 ;; This must generate syntax errors12 0000ifused_test.asm(13): error: [IFUSED] Syntax error: IFUSED13 0000 IFUSEDifused_test.asm(14): error: [IFUSED] Syntax error: IFNUSED14 0000 IFNUSED15 000016 0000 ;; All rest of code must be compiled without errors17 000018 0000 start19 000020 0000 ;; Some little user program :)21 000022 0000 CD 0E 00 .noused call EnableInt23 0003 CD 10 00 .used call Wait24 0006 18 FB jr .used25 000826 0008 ;; Some little direct tests27 000828 0008 IFUSED29 0008 6F 6B db 'ok'30 000A ELSE31 000A ~ db 'fail'32 000A ENDIF33 000A34 000A IFNUSED35 000A ~ db 'fail'36 000A ELSE37 000A 6F 6B db 'ok'38 000C ENDIF39 000C40 000C IFUSED .used41 000C 6F 6B db 'ok'42 000E ENDIF43 000E44 000E IFUSED .noused45 000E ~ db 'fail'46 000E ENDIF47 000E48 000E IFUSED not_defined_label49 000E ~ db 'fail'50 000E ENDIF51 000E52 000E ;; Some little library :)53 000E54 000E EnableInt55 000E IFUSED EnableInt56 000E FB ei57 000F C9 ret58 0010 ENDIF59 001060 0010 Wait IFUSED61 0010 06 FF ld b,#FF62 0012 .loop63 0012 IFUSED EnableInt64 0012 76 .halter halt65 0013 ELSE66 0013 ~ ld c,#FF ;; When the "call EnableInt" is commented out,67 0013 ~ .cycle dec c ;; this branch after ELSE must be generated.68 0013 ~ jr nz,.cycle69 0013 ENDIF ;; End of IFUSED EnableInt70 001371 0013 10 FD djnz .loop72 0015 C9 ret73 0016 ENDIF ;; End of IFUSED Wait74 001675 0016 ;; ADDENDUM: different code path to generate some more syntax errorsifused_test.asm(76): error: [IFUSED] Syntax error: IFUSED Invalid&Label76 0016 IFUSED Invalid&Label ; there's no obvious way how to hit "invalid label"ifused_test.asm(77): error: [IFUSED] Syntax error: IFNUSED Invalid%Label77 0016 IFNUSED Invalid%Label ; error message, the GetID is too much foolproof.78 0016# file closed: ifused_test.asmValue Label------ - -----------------------------------------------------------0x0000 X start0x0000 X start.noused0x000E EnableInt0x0003 start.used0x0010 Wait0x0012 Wait.loop0x0012 X Wait.halter