diff --git a/docs/gbz80.7.pdf b/docs/gbz80.7.pdf index 277bc866..a20d4eb5 100644 Binary files a/docs/gbz80.7.pdf and b/docs/gbz80.7.pdf differ diff --git a/docs/rgbasm.1.pdf b/docs/rgbasm.1.pdf index 9d56c889..dbecfbb8 100644 Binary files a/docs/rgbasm.1.pdf and b/docs/rgbasm.1.pdf differ diff --git a/docs/rgbasm.5.html b/docs/rgbasm.5.html index 5194a9c0..5dc2158a 100644 --- a/docs/rgbasm.5.html +++ b/docs/rgbasm.5.html @@ -936,8 +936,19 @@
BANK
(arg)DEF
(symbol)ISCONST
(arg)IF
), or 0 if only
+ RGBLINK can compute its value.BANK
(arg)@
, this function returns the bank of the current
section. If arg is a string, it returns the bank of
@@ -966,17 +977,6 @@ DEF
(symbol)ISCONST
(arg)IF
), or 0 if only
- RGBLINK can compute its value.options are comma-separated and may include:
BANK
[bank]BANK
[bank]SECTION "Cool Stuff",ROMX+
SECTION "Cool Stuff", ROMX
SECTION "Cool Stuff",ROMX[$4567]+
SECTION "Cool Stuff", ROMX[$4567]
SECTION "Cool Stuff",ROMX[$4567],BANK[3]+
SECTION "Cool Stuff", ROMX[$4567], BANK[3]
SECTION "Cool Stuff",ROMX,BANK[7]+
SECTION "Cool Stuff", ROMX, BANK[7]
SECTION "OAM Data",WRAM0,ALIGN[8] ; align to 256 bytes -SECTION "VRAM Data",ROMX,BANK[2],ALIGN[4] ; align to 16 bytes+
SECTION "OAM Data", WRAM0, ALIGN[8] ; align to 256 bytes +SECTION "VRAM Data", ROMX, BANK[2], ALIGN[4] ; align to 16 bytes
RB
+ DEF
+ name RB
constexpr_RS
- and adds constexpr
- to _RS
.RW
+ _RS
and then adds
+ constexpr to
+ _RS
.DEF
+ name RW
constexpr_RS
- and adds constexpr
- * 2 to _RS
.RL
+ _RS
and then adds
+ constexpr * 2 to
+ _RS
.DEF
+ name RL
constexpr_RS
- and adds constexpr
- * 4 to _RS
._RS
and then adds
+ constexpr * 4 to
+ _RS
.If the argument to RB
,
- RW
, or RL
is omitted, it's
- assumed to be 1.
If the constexpr argument to
+ RB
, RW
, or
+ RL
is omitted, it's assumed to be 1.
Note that colons ‘:
’
following the name are not allowed.
Declaring an offset constant with This will be interpreted as: String constants can also be used to define small one-line
@@ -1609,8 +1615,8 @@ EXPORT
@@ -1567,14 +1573,14 @@
DEF COUNTREG EQUS "[hl+]"
- ld a,COUNTREG
+ ld a, COUNTREG
DEF PLAYER_NAME EQUS "\"John\""
db PLAYER_NAME
ld a,[hl+]
+
ld a, [hl+]
db "John"
Macros
on input using IF
constructs.
MACRO MyMacro - ld a, 80 - call MyFunc + ld a, 80 + call MyFunc ENDM
The example above defines @@ -1623,8 +1629,8 @@
MACRO outer MACRO inner PRINTLN "Hello!" - ENDM -ENDM+ ENDM ; this actually ends the 'outer' macro... +ENDM ; ...and then this is a syntax error!
But this will:
c.asm
’:
SECTION "C", ROM0[0] - dw LabelA - dw ExportedLabelB1 - dw ExportedLabelB2+ dw LabelA + dw ExportedLabelB1 + dw ExportedLabelB2
Then ‘c.asm
’ can use
‘ExportedLabelB1
’ and
@@ -1910,7 +1916,7 @@
INCBIN "data.bin",78,256+
INCBIN "data.bin", 78, 256
The length argument is optional. If only the start position is specified, the bytes from the start position until the end of the file will @@ -1967,10 +1973,10 @@
You execute the macro by inserting its name.
add a,b - ld sp,hl - MyMacro ; This will be expanded - sub a,87+
add a, b + ld sp, hl + MyMacro ; This will be expanded + sub a, 87
It's valid to call a macro from a macro (yes, even the same one).
@@ -1981,10 +1987,11 @@MACRO LoopyMacro - xor a,a -.loop ld [hl+],a - dec c - jr nz,.loop + xor a, a +.loop + ld [hl+], a + dec c + jr nz, .loop ENDM
This is fine, but only if you use the macro no more than once per @@ -1994,10 +2001,11 @@
MACRO LoopyMacro - xor a,a -.loop\@ ld [hl+],a - dec c - jr nz,.loop\@ + xor a, a +.loop\@ + ld [hl+], a + dec c + jr nz, .loop\@ ENDM
Important note: Since a macro can call itself @@ -2014,19 +2022,20 @@
MACRO LoopyMacro - ld hl,\1 - ld c,\2 - xor a,a -.loop\@ ld [hl+],a - dec c - jr nz,.loop\@ - ENDM+ ld hl, \1 + ld c, \2 + xor a, a +.loop\@ + ld [hl+], a + dec c + jr nz, .loop\@ +ENDM
Now you can call the macro specifying two arguments, the first being the address and the second being a byte count. The generated code will then reset all bytes in this range.
LoopyMacro MyVars,54+
LoopyMacro MyVars, 54
Arguments are passed as string constants, although there's no need to enclose them in quotes. Thus, an expression will not be evaluated first @@ -2128,10 +2137,10 @@
ENDR
will be repeated a number of times just as if
you had done a copy/paste operation yourself. The following example will
- assemble ‘add a,c
’ four times:
+ assemble ‘add a, c
’ four times:
REPT 4 - add a,c + add a, c ENDR
You can also use REPT
to generate tables
@@ -2156,21 +2165,21 @@
FOR N, 256 - dw N * N + dw N * N ENDR
It acts just as if you had done:
N = 0 - dw N * N -N = 1 - dw N * N -N = 2 - dw N * N +DEF N = 0 + dw N * N +DEF N = 1 + dw N * N +DEF N = 2 + dw N * N ; ... -N = 255 - dw N * N -N = 256+DEF N = 255 + dw N * N +DEF N = 256
You can customize the range of FOR
values,
similarly to Python's ‘range
’
@@ -2217,10 +2226,10 @@
FOR V, 4, 25, 5 - PRINT "{d:V} " - DEF V *= 2 + PRINT "{d:V} " + DEF V *= 2 ENDR - PRINTLN "done {d:V}"+ PRINTLN "done {d:V}"
This will print: