mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
New definition syntax with leading DEF keyword
This will enable fixing #457 later once the old definition syntax is removed.
This commit is contained in:
29
test/asm/def.asm
Normal file
29
test/asm/def.asm
Normal file
@@ -0,0 +1,29 @@
|
||||
def variable = 1
|
||||
println variable
|
||||
def variable set 2
|
||||
println variable
|
||||
redef variable = 3
|
||||
println variable
|
||||
redef variable set 4
|
||||
println variable
|
||||
|
||||
DEF constant EQU 42
|
||||
println constant
|
||||
|
||||
DEF string EQUS "here"
|
||||
println "{string}"
|
||||
|
||||
rsreset
|
||||
def _x rb
|
||||
def _y rw 2
|
||||
def _z rl
|
||||
def _size rb 0
|
||||
println "{_x} {_y} {_z} {_size}"
|
||||
|
||||
def constant equ 6*7 ; fails
|
||||
println constant
|
||||
|
||||
redef string equs "there"
|
||||
println "{string}"
|
||||
|
||||
redef constant equ 6*9 ; syntax error
|
||||
5
test/asm/def.err
Normal file
5
test/asm/def.err
Normal file
@@ -0,0 +1,5 @@
|
||||
ERROR: def.asm(23):
|
||||
'constant' already defined at def.asm(10)
|
||||
ERROR: def.asm(29):
|
||||
syntax error, unexpected EQU, expecting SET or = or EQUS
|
||||
error: Assembly aborted (2 errors)!
|
||||
9
test/asm/def.out
Normal file
9
test/asm/def.out
Normal file
@@ -0,0 +1,9 @@
|
||||
$1
|
||||
$2
|
||||
$3
|
||||
$4
|
||||
$2A
|
||||
here
|
||||
$0 $1 $5 $9
|
||||
$2A
|
||||
there
|
||||
5
test/asm/def.simple.err
Normal file
5
test/asm/def.simple.err
Normal file
@@ -0,0 +1,5 @@
|
||||
ERROR: def.asm(23):
|
||||
'constant' already defined at def.asm(10)
|
||||
ERROR: def.asm(29):
|
||||
syntax error
|
||||
error: Assembly aborted (2 errors)!
|
||||
Reference in New Issue
Block a user