Add anonymous labels

Fix #497
This commit is contained in:
ISSOtm
2020-12-12 11:52:06 +01:00
committed by Eldred Habert
parent 0e40543757
commit 8f2a894b88
12 changed files with 151 additions and 8 deletions

View File

@@ -0,0 +1,18 @@
: ; Outside of section
SECTION "Anonymous label errors test", ROM0
db :-- ; Reference goes too far back
; Uncomment this if you're a badass with a *lot* of RAM
; REPT 2147483647
; :
; ENDR
; REPT 2147483647
; :
; ENDR
; db :+ ; OK
; db :++ ; Reference goes too far
:: ; Syntax error, can't export this

View File

@@ -0,0 +1,7 @@
ERROR: anon-label-bad.asm(2):
Label "!0" created outside of a SECTION
ERROR: anon-label-bad.asm(6):
Reference to anonymous label 2 before, when only 1 has been created so far
ERROR: anon-label-bad.asm(18):
syntax error
error: Assembly aborted (3 errors)!

View File

12
test/asm/anon-label.asm Normal file
View File

@@ -0,0 +1,12 @@
SECTION "Anonymous label test", ROM0[0]
ld hl, :++
: ld a, [hli]
ldh [c], a
dec c
jr nz, :-
ret
:
dw $7FFF, $1061, $03E0, $58A5

0
test/asm/anon-label.err Normal file
View File

0
test/asm/anon-label.out Normal file
View File

BIN
test/asm/anon-label.out.bin Normal file

Binary file not shown.