diff --git a/test/asm/align-large.asm b/test/asm/align-large.asm index 748f1d52..10dd2662 100644 --- a/test/asm/align-large.asm +++ b/test/asm/align-large.asm @@ -1,2 +1,2 @@ - -SECTION "You lost the game", ROM0[17] +SECTION "You lost the game", ROM0, ALIGN[17, 99] +ALIGN 17, 99 diff --git a/test/asm/align-large.err b/test/asm/align-large.err new file mode 100644 index 00000000..af607f25 --- /dev/null +++ b/test/asm/align-large.err @@ -0,0 +1,5 @@ +error: align-large.asm(1): + Alignment must be between 0 and 16, not 17 +error: align-large.asm(2): + Alignment must be between 0 and 16, not 17 +error: Assembly aborted (2 errors)! diff --git a/test/asm/const-not.asm b/test/asm/const-not.asm new file mode 100644 index 00000000..03d65dca --- /dev/null +++ b/test/asm/const-not.asm @@ -0,0 +1,3 @@ +section "test", rom0, align[8] +ds 42 +assert !@ diff --git a/test/asm/const-not.err b/test/asm/const-not.err new file mode 100644 index 00000000..9c34779c --- /dev/null +++ b/test/asm/const-not.err @@ -0,0 +1,3 @@ +error: const-not.asm(3): + Assertion failed +error: Assembly aborted (1 error)! diff --git a/test/asm/double-purge.asm b/test/asm/double-purge.asm new file mode 100644 index 00000000..f97fe91a --- /dev/null +++ b/test/asm/double-purge.asm @@ -0,0 +1,3 @@ +def n equ 42 +purge n +purge n diff --git a/test/asm/double-purge.err b/test/asm/double-purge.err new file mode 100644 index 00000000..75092f64 --- /dev/null +++ b/test/asm/double-purge.err @@ -0,0 +1,3 @@ +error: double-purge.asm(3): + 'n' was already purged +error: Assembly aborted (1 error)! diff --git a/test/asm/invalid-opt.asm b/test/asm/invalid-opt.asm index df78e35a..341420e1 100644 --- a/test/asm/invalid-opt.asm +++ b/test/asm/invalid-opt.asm @@ -1,7 +1,11 @@ opt b123 opt g12345 +opt pxy opt p1234 +opt Qxy opt Q1234 opt Q32 +opt r99999999999999999999999999 opt W opt +popo diff --git a/test/asm/invalid-opt.err b/test/asm/invalid-opt.err index 09b19391..0a736032 100644 --- a/test/asm/invalid-opt.err +++ b/test/asm/invalid-opt.err @@ -5,11 +5,19 @@ error: invalid-opt.asm(2): error: invalid-opt.asm(3): Invalid argument for option 'p' error: invalid-opt.asm(4): - Invalid argument for option 'Q' + Invalid argument for option 'p' error: invalid-opt.asm(5): - Argument for option 'Q' must be between 1 and 31 + Invalid argument for option 'Q' error: invalid-opt.asm(6): - Must specify an argument for option 'W' + Invalid argument for option 'Q' error: invalid-opt.asm(7): + Argument for option 'Q' must be between 1 and 31 +error: invalid-opt.asm(8): + Argument to 'r' is out of range ("99999999999999999999999999") +error: invalid-opt.asm(9): + Must specify an argument for option 'W' +error: invalid-opt.asm(10): syntax error, unexpected newline, expecting string -error: Assembly aborted (7 errors)! +error: invalid-opt.asm(11): + No entries in the option stack +error: Assembly aborted (11 errors)! diff --git a/test/asm/load-pushs.asm b/test/asm/load-pushs.asm index 9896cd2e..b2782f36 100644 --- a/test/asm/load-pushs.asm +++ b/test/asm/load-pushs.asm @@ -8,8 +8,7 @@ SECTION "Output", ROM0[0] SECTION "ROM CODE",ROM0 ds $80 LOAD "RAM CODE",SRAM -PUSHS -SECTION "HRAM",HRAM +PUSHS "HRAM",HRAM ds 1 POPS ENDL diff --git a/test/asm/use-purged-symbol.asm b/test/asm/use-purged-symbol.asm new file mode 100644 index 00000000..540c9427 --- /dev/null +++ b/test/asm/use-purged-symbol.asm @@ -0,0 +1,26 @@ +SECTION "test", ROM0 + +MACRO m +ENDM +PURGE m + m + +DEF argi EQU 1 +MACRO m2 + println "(\)!" +ENDM + PURGE argi + m2 hello + +DEF n EQU argi + +PRINTLN "({argi})" + +Label:: +PURGE Label +DEF x = Label +DEF x = BANK(Label) + +Label2:: +PURGE Label2 +DEF x EQUS SECTION(Label2) ; fatal diff --git a/test/asm/use-purged-symbol.err b/test/asm/use-purged-symbol.err new file mode 100644 index 00000000..1c64a292 --- /dev/null +++ b/test/asm/use-purged-symbol.err @@ -0,0 +1,18 @@ +error: use-purged-symbol.asm(6): + Macro "m" not defined; it was purged +error: use-purged-symbol.asm(13) -> use-purged-symbol.asm::m2(10): + Bracketed symbol "argi" does not exist; it was purged +error: use-purged-symbol.asm(15): + Expected constant expression: 'argi' is not constant at assembly time; it was purged +error: use-purged-symbol.asm(17): + Interpolated symbol "argi" does not exist; it was purged +warning: use-purged-symbol.asm(20): [-Wpurge] + Purging an exported symbol "Label" +error: use-purged-symbol.asm(21): + Expected constant expression: 'Label' is not constant at assembly time; it was purged +error: use-purged-symbol.asm(22): + Expected constant expression: "Label"'s bank is not known; it was purged +warning: use-purged-symbol.asm(25): [-Wpurge] + Purging an exported symbol "Label2" +FATAL: use-purged-symbol.asm(26): + Unknown symbol "Label2"; it was purged diff --git a/test/asm/use-purged-symbol.out b/test/asm/use-purged-symbol.out new file mode 100644 index 00000000..e0191ca8 --- /dev/null +++ b/test/asm/use-purged-symbol.out @@ -0,0 +1,2 @@ +()! +() diff --git a/test/link/map-file/a.asm b/test/link/map-file/a.asm new file mode 100644 index 00000000..dd9f676e --- /dev/null +++ b/test/link/map-file/a.asm @@ -0,0 +1,27 @@ +SECTION "rom0", ROM0 +Label0:: ds 1 +.local:: + +SECTION "romx", ROMX +Label1:: ds 2 +.local:: + +SECTION "vram", VRAM +vLabel:: ds 3 +.local:: + +SECTION "sram", SRAM +sLabel:: ds 4 +.local:: + +SECTION "wram0", WRAM0 +wLabel0:: ds 5 +.local:: + +SECTION "wramx", WRAMX +wLabel1:: ds 6 +.local:: + +SECTION "hram", HRAM +hLabel:: ds 7 +.local:: diff --git a/test/link/map-file/out.err b/test/link/map-file/out.err new file mode 100644 index 00000000..e69de29b diff --git a/test/link/map-file/ref.out.bin b/test/link/map-file/ref.out.bin new file mode 100644 index 00000000..12f3be4d Binary files /dev/null and b/test/link/map-file/ref.out.bin differ diff --git a/test/link/map-file/ref.out.map b/test/link/map-file/ref.out.map new file mode 100644 index 00000000..5ad9797a --- /dev/null +++ b/test/link/map-file/ref.out.map @@ -0,0 +1,56 @@ +SUMMARY: + ROM0: 1 byte used / 16383 free + ROMX: 2 bytes used / 16382 free in 1 bank + SRAM: 4 bytes used / 8188 free in 1 bank + WRAM0: 5 bytes used / 4091 free + WRAMX: 6 bytes used / 4090 free in 1 bank + HRAM: 7 bytes used / 120 free + +ROM0 bank #0: + SECTION: $0000-$0000 ($0001 byte) ["rom0"] + $0000 = Label0 + $0001 = Label0.local + EMPTY: $0001-$3fff ($3fff bytes) + TOTAL EMPTY: $3fff bytes + +ROMX bank #1: + SECTION: $4000-$4001 ($0002 bytes) ["romx"] + $4000 = Label1 + $4002 = Label1.local + EMPTY: $4002-$7fff ($3ffe bytes) + TOTAL EMPTY: $3ffe bytes + +VRAM bank #0: + SECTION: $8000-$8002 ($0003 bytes) ["vram"] + $8000 = vLabel + $8003 = vLabel.local + EMPTY: $8003-$9fff ($1ffd bytes) + TOTAL EMPTY: $1ffd bytes + +SRAM bank #0: + SECTION: $a000-$a003 ($0004 bytes) ["sram"] + $a000 = sLabel + $a004 = sLabel.local + EMPTY: $a004-$bfff ($1ffc bytes) + TOTAL EMPTY: $1ffc bytes + +WRAM0 bank #0: + SECTION: $c000-$c004 ($0005 bytes) ["wram0"] + $c000 = wLabel0 + $c005 = wLabel0.local + EMPTY: $c005-$cfff ($0ffb bytes) + TOTAL EMPTY: $0ffb bytes + +WRAMX bank #1: + SECTION: $d000-$d005 ($0006 bytes) ["wramx"] + $d000 = wLabel1 + $d006 = wLabel1.local + EMPTY: $d006-$dfff ($0ffa bytes) + TOTAL EMPTY: $0ffa bytes + +HRAM bank #0: + SECTION: $ff80-$ff86 ($0007 bytes) ["hram"] + $ff80 = hLabel + $ff87 = hLabel.local + EMPTY: $ff87-$fffe ($0078 bytes) + TOTAL EMPTY: $0078 bytes diff --git a/test/link/test.sh b/test/link/test.sh index fbf11e6f..6bf716aa 100755 --- a/test/link/test.sh +++ b/test/link/test.sh @@ -181,6 +181,16 @@ rgblinkQuiet -o "$gbtemp2" "$outtemp" tryCmp "$gbtemp" "$gbtemp2" evaluateTest +test="map-file" +startTest +"$RGBASM" -o "$otemp" "$test"/a.asm +continueTest +rgblinkQuiet -o "$gbtemp" -m "$outtemp2" "$otemp" 2>"$outtemp" +tryDiff "$test"/out.err "$outtemp" +tryDiff "$test"/ref.out.map "$outtemp2" +tryCmpRom "$test"/ref.out.bin +evaluateTest + test="overlay/smaller" startTest "$RGBASM" -o "$otemp" "$test"/a.asm