From 210a4a957aebd605d8f79e39d1e6e5079c8c5cc9 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 15 Sep 2020 18:39:22 +0200 Subject: [PATCH] Get rid of in-repo HTML documentation The online documentation is now managed by a CI hook --- {src => .github/actions}/doc_postproc.awk | 0 .github/actions/get-pages.sh | 2 +- Makefile | 28 +- docs/gbz80.7.html | 1670 -------------------- docs/index.html | 36 - docs/mandoc.css | 347 ---- docs/rgbasm.1.html | 295 ---- docs/rgbasm.5.html | 1751 --------------------- docs/rgbds.5.html | 363 ----- docs/rgbds.7.html | 80 - docs/rgbds.css | 63 - docs/rgbfix.1.html | 220 --- docs/rgbgfx.1.html | 220 --- docs/rgblink.1.html | 192 --- docs/rgblink.5.html | 111 -- 15 files changed, 2 insertions(+), 5376 deletions(-) rename {src => .github/actions}/doc_postproc.awk (100%) delete mode 100644 docs/gbz80.7.html delete mode 100644 docs/index.html delete mode 100644 docs/mandoc.css delete mode 100644 docs/rgbasm.1.html delete mode 100644 docs/rgbasm.5.html delete mode 100644 docs/rgbds.5.html delete mode 100644 docs/rgbds.7.html delete mode 100644 docs/rgbds.css delete mode 100644 docs/rgbfix.1.html delete mode 100644 docs/rgbgfx.1.html delete mode 100644 docs/rgblink.1.html delete mode 100644 docs/rgblink.5.html diff --git a/src/doc_postproc.awk b/.github/actions/doc_postproc.awk similarity index 100% rename from src/doc_postproc.awk rename to .github/actions/doc_postproc.awk diff --git a/.github/actions/get-pages.sh b/.github/actions/get-pages.sh index 7ccac0df..660f383a 100755 --- a/.github/actions/get-pages.sh +++ b/.github/actions/get-pages.sh @@ -77,7 +77,7 @@ EOF if [ $stem = rgbasm.5 ]; then options+=,toc fi - mandoc -Thtml -I os=Linux -O$options "${PAGES[$page]##*/}" | src/doc_postproc.awk >> "$1/$2/$page" + mandoc -Thtml -I os=Linux -O$options "${PAGES[$page]##*/}" | .github/actions/doc_postproc.awk >> "$1/$2/$page" if [ $update_redirects -ne 0 ]; then cat - >"$1/$page" < docs/rgbds.7.html - $Qmandoc ${MANDOC} src/gbz80.7 | src/doc_postproc.awk > docs/gbz80.7.html - $Qmandoc ${MANDOC} src/rgbds.5 | src/doc_postproc.awk > docs/rgbds.5.html - $Qmandoc ${MANDOC} src/asm/rgbasm.1 | src/doc_postproc.awk > docs/rgbasm.1.html - $Qmandoc ${MANDOC} src/asm/rgbasm.5 | src/doc_postproc.awk > docs/rgbasm.5.html - $Qmandoc ${MANDOC} src/fix/rgbfix.1 | src/doc_postproc.awk > docs/rgbfix.1.html - $Qmandoc ${MANDOC} src/link/rgblink.1 | src/doc_postproc.awk > docs/rgblink.1.html - $Qmandoc ${MANDOC} src/link/rgblink.5 | src/doc_postproc.awk > docs/rgblink.5.html - $Qmandoc ${MANDOC} src/gfx/rgbgfx.1 | src/doc_postproc.awk > docs/rgbgfx.1.html - # This target is used during development in order to prevent adding new issues # to the source code. All warnings are treated as errors in order to block the # compilation and make the continous integration infrastructure return failure. diff --git a/docs/gbz80.7.html b/docs/gbz80.7.html deleted file mode 100644 index 27e1fa65..00000000 --- a/docs/gbz80.7.html +++ /dev/null @@ -1,1670 +0,0 @@ - - - - - - - - - GBZ80(7) - - - - - - - - -
GBZ80(7)Miscellaneous Information ManualGBZ80(7)
-
-
-

-gbz80 — -CPU opcode reference -
-
-

-This is the list of opcodes supported by rgbasm(1), including - a short description, the number of bytes needed to encode them and the number - of CPU cycles at 1MHz (or 2MHz in GBC dual speed mode) needed to complete - them. -

Note: All arithmetic/logic operations that use register - A as destination can omit the destination as it is assumed - to be register A by default. The following two lines have - the same effect:

-
-
-OR A,B
-OR B
-
-
-
-
-

-List of abbreviations used in this document. -
-
r8
-
Any of the 8-bit registers (A, B, - C, D, E, - H, L).
-
r16
-
Any of the general-purpose 16-bit registers (BC, - DE, HL).
-
n8
-
8-bit integer constant.
-
n16
-
16-bit integer constant.
-
e8
-
8-bit offset (-128 to 127).
-
u3
-
3-bit unsigned integer constant (0 to - 7).
-
cc
-
Condition codes: -
-
Z
-
Execute if Z is set.
-
NZ
-
Execute if Z is not set.
-
C
-
Execute if C is set.
-
NC
-
Execute if C is not set.
-
-
-
vec
-
One of the RST vectors (0x00, - 0x08, 0x10, 0x18, - 0x20, 0x28, 0x30 and - 0x38).
-
-
-
-

-
-

-
-
ADC A,r8
-
-
ADC A,[HL]
-
-
ADC A,n8
-
-
ADD A,r8
-
-
ADD A,[HL]
-
-
ADD A,n8
-
-
AND A,r8
-
-
AND A,[HL]
-
-
AND A,n8
-
-
CP A,r8
-
-
CP A,[HL]
-
-
CP A,n8
-
-
DEC r8
-
-
DEC [HL]
-
-
INC r8
-
-
INC [HL]
-
-
OR A,r8
-
-
OR A,[HL]
-
-
OR A,n8
-
-
SBC A,r8
-
-
SBC A,[HL]
-
-
SBC A,n8
-
-
SUB A,r8
-
-
SUB A,[HL]
-
-
SUB A,n8
-
-
XOR A,r8
-
-
XOR A,[HL]
-
-
XOR A,n8
-
-
-
-
-

-
-
ADD HL,r16
-
-
DEC r16
-
-
INC r16
-
-
-
-
-

-
-
BIT u3,r8
-
-
BIT u3,[HL]
-
-
RES u3,r8
-
-
RES u3,[HL]
-
-
SET u3,r8
-
-
SET u3,[HL]
-
-
SWAP r8
-
-
SWAP [HL]
-
-
-
-
-

-
-
RL r8
-
-
RL [HL]
-
-
RLA
-
-
RLC r8
-
-
RLC [HL]
-
-
RLCA
-
-
RR r8
-
-
RR [HL]
-
-
RRA
-
-
RRC r8
-
-
RRC [HL]
-
-
RRCA
-
-
SLA r8
-
-
SLA [HL]
-
-
SRA r8
-
-
SRA [HL]
-
-
SRL r8
-
-
SRL [HL]
-
-
-
-
-

-
-
LD r8,r8
-
-
LD r8,n8
-
-
LD r16,n16
-
-
LD [HL],r8
-
-
LD [HL],n8
-
-
LD r8,[HL]
-
-
LD [r16],A
-
-
LD [n16],A
-
-
LDH [n16],A
-
-
LDH [C],A
-
-
LD A,[r16]
-
-
LD A,[n16]
-
-
LDH A,[n16]
-
-
LDH A,[C]
-
-
LD [HLI],A
-
-
LD [HLD],A
-
-
LD A,[HLI]
-
-
LD A,[HLD]
-
-
-
-
-

-
-
CALL n16
-
-
CALL cc,n16
-
-
JP HL
-
-
JP n16
-
-
JP cc,n16
-
-
JR e8
-
-
JR cc,e8
-
-
RET cc
-
-
RET
-
-
RETI
-
-
RST vec
-
-
-
-
-

-
-
ADD HL,SP
-
-
ADD SP,e8
-
-
DEC SP
-
-
INC SP
-
-
LD SP,n16
-
-
LD [n16],SP
-
-
LD HL,SP+e8
-
-
LD SP,HL
-
-
POP AF
-
-
POP r16
-
-
PUSH AF
-
-
PUSH r16
-
-
-
-
-

-
-
CCF
-
-
CPL
-
-
DAA
-
-
DI
-
-
EI
-
-
HALT
-
-
NOP
-
-
SCF
-
-
STOP
-
-
-
-
-
-

-
-

-Add the value in r8 plus the carry flag to - A. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
Set if overflow from bit 3.
-
C
-
Set if overflow from bit 7.
-
-
-
-

-Add the byte pointed to by HL plus the carry flag to - A. -

Cycles: 2

-

Bytes: 1

-

Flags: See ADC A,r8

-
-
-

-Add the value n8 plus the carry flag to - A. -

Cycles: 2

-

Bytes: 2

-

Flags: See ADC A,r8

-
-
-

-Add the value in r8 to A. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
Set if overflow from bit 3.
-
C
-
Set if overflow from bit 7.
-
-
-
-

-Add the byte pointed to by HL to A. -

Cycles: 2

-

Bytes: 1

-

Flags: See ADD A,r8

-
-
-

-Add the value n8 to A. -

Cycles: 2

-

Bytes: 2

-

Flags: See ADD A,r8

-
-
-

-Add the value in r16 to HL. -

Cycles: 2

-

Bytes: 1

-

Flags:

-
-
N
-
0
-
H
-
Set if overflow from bit 11.
-
C
-
Set if overflow from bit 15.
-
-
-
-

-Add the value in SP to HL. -

Cycles: 2

-

Bytes: 1

-

Flags: See ADD HL,r16

-
-
-

-Add the signed value e8 to SP. -

Cycles: 4

-

Bytes: 2

-

Flags:

-
-
Z
-
0
-
N
-
0
-
H
-
Set if overflow from bit 3.
-
C
-
Set if overflow from bit 7.
-
-
-
-

-Bitwise AND between the value in r8 and - A. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
1
-
C
-
0
-
-
-
-

-Bitwise AND between the byte pointed to by HL and - A. -

Cycles: 2

-

Bytes: 1

-

Flags: See AND A,r8

-
-
-

-Bitwise AND between the value in n8 and - A. -

Cycles: 2

-

Bytes: 2

-

Flags: See AND A,r8

-
-
-

-Test bit u3 in register r8, set the - zero flag if bit not set. -

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if the selected bit is 0.
-
N
-
0
-
H
-
1
-
-
-
-

-Test bit u3 in the byte pointed by HL, - set the zero flag if bit not set. -

Cycles: 3

-

Bytes: 2

-

Flags: See BIT u3,r8

-
-
-

-Call address n16. This pushes the address of the - instruction after the CALL on the stack, such that - RET can pop it later; then, it executes an - implicit JP n16. -

Cycles: 6

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Call address n16 if condition cc is - met. -

Cycles: 6 taken / 3 untaken

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Complement Carry Flag. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
N
-
0
-
H
-
0
-
C
-
Inverted.
-
-
-
-

-Subtract the value in r8 from A and set - flags accordingly, but don't store the result. This is useful for ComParing - values. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
1
-
H
-
Set if borrow from bit 4.
-
C
-
Set if borrow (i.e. if r8 > - A).
-
-
-
-

-Subtract the byte pointed to by HL from A - and set flags accordingly, but don't store the result. -

Cycles: 2

-

Bytes: 1

-

Flags: See CP A,r8

-
-
-

-Subtract the value n8 from A and set - flags accordingly, but don't store the result. -

Cycles: 2

-

Bytes: 2

-

Flags: See CP A,r8

-
-
-

-ComPLement accumulator (A = ~A). -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
N
-
1
-
H
-
1
-
-
-
-

-Decimal Adjust Accumulator to get a correct BCD representation after an - arithmetic instruction. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
H
-
0
-
C
-
Set or reset depending on the operation.
-
-
-
-

-Decrement value in register r8 by 1. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
1
-
H
-
Set if borrow from bit 4.
-
-
-
-

-Decrement the byte pointed to by HL by 1. -

Cycles: 3

-

Bytes: 1

-

Flags: See DEC r8

-
-
-

-Decrement value in register r16 by 1. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Decrement value in register SP by 1. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Disable Interrupts by clearing the IME flag. -

Cycles: 1

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Enable Interrupts by setting the IME flag. The flag is only - set after the instruction following EI. -

Cycles: 1

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Enter CPU low-power consumption mode until an interrupt occurs. The exact - behavior of this instruction depends on the state of the IME - flag. -
-
IME set
-
The CPU enters low-power mode until after an interrupt - is about to be serviced. The handler is executed normally, and the CPU - resumes execution after the HALT when that - returns.
-
IME not set
-
The behavior depends on whether an interrupt is pending (i.e. - ‘[IE] & [IF]’ is non-zero). -
-
None pending
-
As soon as an interrupt becomes pending, the CPU resumes execution. - This is like the above, except that the handler is - not called.
-
Some pending
-
The CPU continues execution after the HALT, - but the byte after it is read twice in a row (PC is - not incremented, due to a hardware bug).
-
-
-
-

Cycles: -

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Increment value in register r8 by 1. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
Set if overflow from bit 3.
-
-
-
-

-Increment the byte pointed to by HL by 1. -

Cycles: 3

-

Bytes: 1

-

Flags: See INC r8

-
-
-

-Increment value in register r16 by 1. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Increment value in register SP by 1. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Jump to address n16; effectively, store - n16 into PC. -

Cycles: 4

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Jump to address n16 if condition cc - is met. -

Cycles: 4 taken / 3 untaken

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Jump to address in HL; effectively, load PC - with value in register HL. -

Cycles: 1

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Relative Jump by adding e8 to the address of the - instruction following the JR. To clarify, an operand of 0 is - equivalent to no jumping. -

Cycles: 3

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Relative Jump by adding e8 to the current address if - condition cc is met. -

Cycles: 3 taken / 2 untaken

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Load (copy) value in register on the right into register on the left. -

Cycles: 1

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Load value n8 into register r8. -

Cycles: 2

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Load value n16 into register r16. -

Cycles: 3

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Store value in register r8 into byte pointed to by - register HL. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Store value n8 into byte pointed to by register - HL. -

Cycles: 3

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Load value into register r8 from byte pointed to by - register HL. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Store value in register A into byte pointed to by register - r16. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Store value in register A into byte at address - n16. -

Cycles: 4

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Store value in register A into byte at address - n16, provided it is between - $FF00 and $FFFF. -

Cycles: 3

-

Bytes: 2

-

Flags: None affected.

-

This is sometimes written as ‘ldio [n16], - a’, or ‘ld [$ff00+n8], - a’.

-
-
-

-Store value in register A into byte at address - $FF00+C. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-

This is sometimes written as ‘ldio [c], - a’, or ‘ld [$ff00+c], - a’.

-
-
-

-Load value in register A from byte pointed to by register - r16. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Load value in register A from byte at address - n16. -

Cycles: 4

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Load value in register A from byte at address - n16, provided it is between - $FF00 and $FFFF. -

Cycles: 3

-

Bytes: 2

-

Flags: None affected.

-

This is sometimes written as ‘ldio a, - [n16]’, or ‘ld a, - [$ff00+n8]’.

-
-
-

-Load value in register A from byte at address - $FF00+c. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-

This is sometimes written as ‘ldio a, - [c]’, or ‘ld a, - [$ff00+c]’.

-
-
-

-Store value in register A into byte pointed by - HL and increment HL afterwards. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Store value in register A into byte pointed by - HL and decrement HL afterwards. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Load value into register A from byte pointed by - HL and decrement HL afterwards. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Load value into register A from byte pointed by - HL and increment HL afterwards. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Load value n16 into register SP. -

Cycles: 3

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Store SP & $FF at address n16 and - SP >> 8 at address n16 + 1. -

Cycles: 5

-

Bytes: 3

-

Flags: None affected.

-
-
-

-Add the signed value e8 to SP and store - the result in HL. -

Cycles: 3

-

Bytes: 2

-

Flags:

-
-
Z
-
0
-
N
-
0
-
H
-
Set if overflow from bit 3.
-
C
-
Set if overflow from bit 7.
-
-
-
-

-Load register HL into register SP. -

Cycles: 2

-

Bytes: 1

-

Flags: None affected.

-
-
-

-No OPeration. -

Cycles: 1

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Store into A the bitwise OR of the value in - r8 and A. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
0
-
-
-
-

-Store into A the bitwise OR of the byte pointed to by - HL and A. -

Cycles: 2

-

Bytes: 1

-

Flags: See OR A,r8

-
-
-

-Store into A the bitwise OR of n8 and - A. -

Cycles: 2

-

Bytes: 2

-

Flags: See OR A,r8

-
-
-

-Pop register AF from the stack. This is roughly equivalent to - the following imaginary instructions: -
-
-ld f, [sp] ; See below for individual flags
-inc sp
-ld a, [sp]
-inc sp
-
-
-

Cycles: 3

-

Bytes: 1

-

Flags:

-
-
Z
-
Set from bit 7 of the popped low byte.
-
N
-
Set from bit 6 of the popped low byte.
-
H
-
Set from bit 5 of the popped low byte.
-
C
-
Set from bit 4 of the popped low byte.
-
-
-
-

-Pop register r16 from the stack. This is roughly - equivalent to the following imaginary instructions: -
-
-ld LOW(r16), [sp] ; C, E or L
-inc sp
-ld HIGH(r16), [sp] ; B, D or H
-inc sp
-
-
-

Cycles: 3

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Push register AF into the stack. This is roughly equivalent to - the following imaginary instructions: -
-
-dec sp
-ld [sp], a
-dec sp
-ld [sp], flag_Z << 7 | flag_N << 6 | flag_H << 5 | flag_C << 4
-
-
-

Cycles: 4

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Push register r16 into the stack. This is roughly - equivalent to the following imaginary instructions: -
-
-dec sp
-ld [sp], HIGH(r16) ; B, D or H
-dec sp
-ld [sp], LOW(r16) ; C, E or L
-
-
-

Cycles: 4

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Set bit u3 in register r8 to 0. Bit - 0 is the rightmost one, bit 7 the leftmost one. -

Cycles: 2

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Set bit u3 in the byte pointed by HL to - 0. Bit 0 is the rightmost one, bit 7 the leftmost one. -

Cycles: 4

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Return from subroutine. This is basically a POP PC (if such an - instruction existed). See POP r16 for an - explanation of how POP works. -

Cycles: 4

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Return from subroutine if condition cc is met. -

Cycles: 5 taken / 2 untaken

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Return from subroutine and enable interrupts. This is basically equivalent to - executing EI then - RET, meaning that IME is set - right after this instruction. -

Cycles: 4

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Rotate bits in register r8 left through carry. -

-
C <- [7 <- 0] <- C
-

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Rotate byte pointed to by HL left through carry. -

-
C <- [7 <- 0] <- C
-

Cycles: 4

-

Bytes: 2

-

Flags: See RL r8

-
-
-

-Rotate register A left through carry. -

-
C <- [7 <- 0] <- C
-

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
0
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Rotate register r8 left. -

-
C <- [7 <- 0] <- [7]
-

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Rotate byte pointed to by HL left. -

-
C <- [7 <- 0] <- [7]
-

Cycles: 4

-

Bytes: 2

-

Flags: See RLC r8

-
-
-

-Rotate register A left. -

-
C <- [7 <- 0] <- [7]
-

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
0
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Rotate register r8 right through carry. -

-
C -> [7 -> 0] -> C
-

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Rotate byte pointed to by HL right through carry. -

-
C -> [7 -> 0] -> C
-

Cycles: 4

-

Bytes: 2

-

Flags: See RR r8

-
-
-

-Rotate register A right through carry. -

-
C -> [7 -> 0] -> C
-

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
0
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Rotate register r8 right. -

-
[0] -> [7 -> 0] -> C
-

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Rotate byte pointed to by HL right. -

-
[0] -> [7 -> 0] -> C
-

Cycles: 4

-

Bytes: 2

-

Flags: See RRC r8

-
-
-

-Rotate register A right. -

-
[0] -> [7 -> 0] -> C
-

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
0
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Call address vec. This is a shorter and faster equivalent - to CALL for suitable values of - vec. -

Cycles: 4

-

Bytes: 1

-

Flags: None affected.

-
-
-

-Subtract the value in r8 and the carry flag from - A. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
1
-
H
-
Set if borrow from bit 4.
-
C
-
Set if borrow (i.e. if (r8 + carry) > - A).
-
-
-
-

-Subtract the byte pointed to by HL and the carry flag from - A. -

Cycles: 2

-

Bytes: 1

-

Flags: See SBC A,r8

-
-
-

-Subtract the value n8 and the carry flag from - A. -

Cycles: 2

-

Bytes: 2

-

Flags: See SBC A,r8

-
-
-

-Set Carry Flag. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
N
-
0
-
H
-
0
-
C
-
1
-
-
-
-

-Set bit u3 in register r8 to 1. Bit - 0 is the rightmost one, bit 7 the leftmost one. -

Cycles: 2

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Set bit u3 in the byte pointed by HL to - 1. Bit 0 is the rightmost one, bit 7 the leftmost one. -

Cycles: 4

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Shift Left Arithmetic register r8. -

-
C <- [7 <- 0] <- 0
-

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Shift Left Arithmetic byte pointed to by HL. -

-
C <- [7 <- 0] <- 0
-

Cycles: 4

-

Bytes: 2

-

Flags: See SLA r8

-
-
-

-Shift Right Arithmetic register r8. -

-
[7] -> [7 -> 0] -> C
-

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Shift Right Arithmetic byte pointed to by HL. -

-
[7] -> [7 -> 0] -> C
-

Cycles: 4

-

Bytes: 2

-

Flags: See SRA r8

-
-
-

-Shift Right Logic register r8. -

-
0 -> [7 -> 0] -> C
-

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
Set according to result.
-
-
-
-

-Shift Right Logic byte pointed to by HL. -

-
0 -> [7 -> 0] -> C
-

Cycles: 4

-

Bytes: 2

-

Flags: See SRA r8

-
-
-

-Enter CPU very low power mode. Also used to switch between double and normal - speed CPU modes in GBC. -

Cycles: -

-

Bytes: 2

-

Flags: None affected.

-
-
-

-Subtract the value in r8 from A. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
1
-
H
-
Set if borrow from bit 4.
-
C
-
Set if borrow (set if r8 > - A).
-
-
-
-

-Subtract the byte pointed to by HL from A. -

Cycles: 2

-

Bytes: 1

-

Flags: See SUB A,r8

-
-
-

-Subtract the value n8 from A. -

Cycles: 2

-

Bytes: 2

-

Flags: See SUB A,r8

-
-
-

-Swap upper 4 bits in register r8 and the lower 4 ones. -

Cycles: 2

-

Bytes: 2

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
0
-
-
-
-

-Swap upper 4 bits in the byte pointed by HL and the lower 4 - ones. -

Cycles: 4

-

Bytes: 2

-

Flags: See SWAP r8

-
-
-

-Bitwise XOR between the value in r8 and - A. -

Cycles: 1

-

Bytes: 1

-

Flags:

-
-
Z
-
Set if result is 0.
-
N
-
0
-
H
-
0
-
C
-
0
-
-
-
-

-Bitwise XOR between the byte pointed to by HL and - A. -

Cycles: 2

-

Bytes: 1

-

Flags: See XOR A,r8

-
-
-

-Bitwise XOR between the value in n8 and - A. -

Cycles: 2

-

Bytes: 2

-

Flags: See XOR A,r8

-
-
-
-

-rgbasm(1), rgbds(7) -
-
-

-rgbds was originally written by Carsten Sørensen - as part of the ASMotor package, and was later packaged in RGBDS by Justin - Lloyd. It is now maintained by a number of contributors at - https://github.com/rednex/rgbds. -
-
- - - - - -
February 23, 2018General
- - diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 721dddf2..00000000 --- a/docs/index.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - General Information - - - -

RGBDS — Rednex Game Boy Development System

-

Table of Contents

-
    -
  1. General information - -
  2. Language description - -
  3. Command line usage - -
-

GitHub Repository:

- - diff --git a/docs/mandoc.css b/docs/mandoc.css deleted file mode 100644 index 085f5c08..00000000 --- a/docs/mandoc.css +++ /dev/null @@ -1,347 +0,0 @@ -/* $Id: mandoc.css,v 1.45 2019/03/01 10:57:18 schwarze Exp $ */ -/* - * Standard style sheet for mandoc(1) -Thtml and man.cgi(8). - * - * Written by Ingo Schwarze . - * I place this file into the public domain. - * Permission to use, copy, modify, and distribute it for any purpose - * with or without fee is hereby granted, without any conditions. - */ - -/* Global defaults. */ - -html { max-width: 65em; } -body { font-family: Helvetica,Arial,sans-serif; } -table { margin-top: 0em; - margin-bottom: 0em; - border-collapse: collapse; } -/* Some browsers set border-color in a browser style for tbody, - * but not for table, resulting in inconsistent border styling. */ -tbody { border-color: inherit; } -tr { border-color: inherit; } -td { vertical-align: top; - padding-left: 0.2em; - padding-right: 0.2em; - border-color: inherit; } -ul, ol, dl { margin-top: 0em; - margin-bottom: 0em; } -li, dt { margin-top: 1em; } - -.permalink { border-bottom: thin dotted; - color: inherit; - font: inherit; - text-decoration: inherit; } -* { clear: both } - -/* Search form and search results. */ - -fieldset { border: thin solid silver; - border-radius: 1em; - text-align: center; } -input[name=expr] { - width: 25%; } - -table.results { margin-top: 1em; - margin-left: 2em; - font-size: smaller; } - -/* Header and footer lines. */ - -table.head { width: 100%; - border-bottom: 1px dotted #808080; - margin-bottom: 1em; - font-size: smaller; } -td.head-vol { text-align: center; } -td.head-rtitle { - text-align: right; } - -table.foot { width: 100%; - border-top: 1px dotted #808080; - margin-top: 1em; - font-size: smaller; } -td.foot-os { text-align: right; } - -/* Sections and paragraphs. */ - -.manual-text { - margin-left: 3.8em; } -.Nd { } -section.Sh { } -h1.Sh { margin-top: 1.2em; - margin-bottom: 0.6em; - margin-left: -3.2em; - font-size: 110%; } -section.Ss { } -h2.Ss { margin-top: 1.2em; - margin-bottom: 0.6em; - margin-left: -1.2em; - font-size: 105%; } -.Pp { margin: 0.6em 0em; } -.Sx { } -.Xr { } - -/* Displays and lists. */ - -.Bd { } -.Bd-indent { margin-left: 3.8em; } - -.Bl-bullet { list-style-type: disc; - padding-left: 1em; } -.Bl-bullet > li { } -.Bl-dash { list-style-type: none; - padding-left: 0em; } -.Bl-dash > li:before { - content: "\2014 "; } -.Bl-item { list-style-type: none; - padding-left: 0em; } -.Bl-item > li { } -.Bl-compact > li { - margin-top: 0em; } - -.Bl-enum { padding-left: 2em; } -.Bl-enum > li { } -.Bl-compact > li { - margin-top: 0em; } - -.Bl-diag { } -.Bl-diag > dt { - font-style: normal; - font-weight: bold; } -.Bl-diag > dd { - margin-left: 0em; } -.Bl-hang { } -.Bl-hang > dt { } -.Bl-hang > dd { - margin-left: 5.5em; } -.Bl-inset { } -.Bl-inset > dt { } -.Bl-inset > dd { - margin-left: 0em; } -.Bl-ohang { } -.Bl-ohang > dt { } -.Bl-ohang > dd { - margin-left: 0em; } -.Bl-tag { margin-top: 0.6em; - margin-left: 5.5em; } -.Bl-tag > dt { - float: left; - margin-top: 0em; - margin-left: -5.5em; - padding-right: 0.5em; - vertical-align: top; } -.Bl-tag > dd { - clear: right; - width: 100%; - margin-top: 0em; - margin-left: 0em; - margin-bottom: 0.6em; - vertical-align: top; - overflow: auto; } -.Bl-compact { margin-top: 0em; } -.Bl-compact > dd { - margin-bottom: 0em; } -.Bl-compact > dt { - margin-top: 0em; } - -.Bl-column { } -.Bl-column > tbody > tr { } -.Bl-column > tbody > tr > td { - margin-top: 1em; } -.Bl-compact > tbody > tr > td { - margin-top: 0em; } - -.Rs { font-style: normal; - font-weight: normal; } -.RsA { } -.RsB { font-style: italic; - font-weight: normal; } -.RsC { } -.RsD { } -.RsI { font-style: italic; - font-weight: normal; } -.RsJ { font-style: italic; - font-weight: normal; } -.RsN { } -.RsO { } -.RsP { } -.RsQ { } -.RsR { } -.RsT { text-decoration: underline; } -.RsU { } -.RsV { } - -.eqn { } -.tbl td { vertical-align: middle; } - -.HP { margin-left: 3.8em; - text-indent: -3.8em; } - -/* Semantic markup for command line utilities. */ - -table.Nm { } -code.Nm { font-style: normal; - font-weight: bold; - font-family: inherit; } -.Fl { font-style: normal; - font-weight: bold; - font-family: inherit; } -.Cm { font-style: normal; - font-weight: bold; - font-family: inherit; } -.Ar { font-style: italic; - font-weight: normal; } -.Op { display: inline; } -.Ic { font-style: normal; - font-weight: bold; - font-family: inherit; } -.Ev { font-style: normal; - font-weight: normal; - font-family: monospace; } -.Pa { font-style: italic; - font-weight: normal; } - -/* Semantic markup for function libraries. */ - -.Lb { } -code.In { font-style: normal; - font-weight: bold; - font-family: inherit; } -a.In { } -.Fd { font-style: normal; - font-weight: bold; - font-family: inherit; } -.Ft { font-style: italic; - font-weight: normal; } -.Fn { font-style: normal; - font-weight: bold; - font-family: inherit; } -.Fa { font-style: italic; - font-weight: normal; } -.Vt { font-style: italic; - font-weight: normal; } -.Va { font-style: italic; - font-weight: normal; } -.Dv { font-style: normal; - font-weight: normal; - font-family: monospace; } -.Er { font-style: normal; - font-weight: normal; - font-family: monospace; } - -/* Various semantic markup. */ - -.An { } -.Lk { } -.Mt { } -.Cd { font-style: normal; - font-weight: bold; - font-family: inherit; } -.Ad { font-style: italic; - font-weight: normal; } -.Ms { font-style: normal; - font-weight: bold; } -.St { } -.Ux { } - -/* Physical markup. */ - -.Bf { display: inline; } -.No { font-style: normal; - font-weight: normal; } -.Em { font-style: italic; - font-weight: normal; } -.Sy { font-style: normal; - font-weight: bold; } -.Li { font-style: normal; - font-weight: normal; - font-family: monospace; } - -/* Tooltip support. */ - -h1.Sh, h2.Ss { position: relative; } -.An, .Ar, .Cd, .Cm, .Dv, .Em, .Er, .Ev, .Fa, .Fd, .Fl, .Fn, .Ft, -.Ic, code.In, .Lb, .Lk, .Ms, .Mt, .Nd, code.Nm, .Pa, .Rs, -.St, .Sx, .Sy, .Va, .Vt, .Xr { - display: inline-block; - position: relative; } - -.An::before { content: "An"; } -.Ar::before { content: "Ar"; } -.Cd::before { content: "Cd"; } -.Cm::before { content: "Cm"; } -.Dv::before { content: "Dv"; } -.Em::before { content: "Em"; } -.Er::before { content: "Er"; } -.Ev::before { content: "Ev"; } -.Fa::before { content: "Fa"; } -.Fd::before { content: "Fd"; } -.Fl::before { content: "Fl"; } -.Fn::before { content: "Fn"; } -.Ft::before { content: "Ft"; } -.Ic::before { content: "Ic"; } -code.In::before { content: "In"; } -.Lb::before { content: "Lb"; } -.Lk::before { content: "Lk"; } -.Ms::before { content: "Ms"; } -.Mt::before { content: "Mt"; } -.Nd::before { content: "Nd"; } -code.Nm::before { content: "Nm"; } -.Pa::before { content: "Pa"; } -.Rs::before { content: "Rs"; } -h1.Sh::before { content: "Sh"; } -h2.Ss::before { content: "Ss"; } -.St::before { content: "St"; } -.Sx::before { content: "Sx"; } -.Sy::before { content: "Sy"; } -.Va::before { content: "Va"; } -.Vt::before { content: "Vt"; } -.Xr::before { content: "Xr"; } - -.An::before, .Ar::before, .Cd::before, .Cm::before, -.Dv::before, .Em::before, .Er::before, .Ev::before, -.Fa::before, .Fd::before, .Fl::before, .Fn::before, .Ft::before, -.Ic::before, code.In::before, .Lb::before, .Lk::before, -.Ms::before, .Mt::before, .Nd::before, code.Nm::before, -.Pa::before, .Rs::before, -h1.Sh::before, h2.Ss::before, .St::before, .Sx::before, .Sy::before, -.Va::before, .Vt::before, .Xr::before { - opacity: 0; - transition: .15s ease opacity; - pointer-events: none; - position: absolute; - bottom: 100%; - box-shadow: 0 0 .35em #000; - padding: .15em .25em; - white-space: nowrap; - font-family: Helvetica,Arial,sans-serif; - font-style: normal; - font-weight: bold; - color: black; - background: #fff; } -.An:hover::before, .Ar:hover::before, .Cd:hover::before, .Cm:hover::before, -.Dv:hover::before, .Em:hover::before, .Er:hover::before, .Ev:hover::before, -.Fa:hover::before, .Fd:hover::before, .Fl:hover::before, .Fn:hover::before, -.Ft:hover::before, .Ic:hover::before, code.In:hover::before, -.Lb:hover::before, .Lk:hover::before, .Ms:hover::before, .Mt:hover::before, -.Nd:hover::before, code.Nm:hover::before, .Pa:hover::before, -.Rs:hover::before, h1.Sh:hover::before, h2.Ss:hover::before, .St:hover::before, -.Sx:hover::before, .Sy:hover::before, .Va:hover::before, .Vt:hover::before, -.Xr:hover::before { - opacity: 1; - pointer-events: inherit; } - -/* Overrides to avoid excessive margins on small devices. */ - -@media (max-width: 37.5em) { -.manual-text { - margin-left: 0.5em; } -h1.Sh, h2.Ss { margin-left: 0em; } -.Bd-indent { margin-left: 2em; } -.Bl-hang > dd { - margin-left: 2em; } -.Bl-tag { margin-left: 2em; } -.Bl-tag > dt { - margin-left: -2em; } -.HP { margin-left: 2em; - text-indent: -2em; } -} diff --git a/docs/rgbasm.1.html b/docs/rgbasm.1.html deleted file mode 100644 index 961a5e94..00000000 --- a/docs/rgbasm.1.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - - - - RGBASM(1) - - - - - - - - -
RGBASM(1)General Commands ManualRGBASM(1)
-
-
-

-rgbasm — -Game Boy assembler -
-
-

- - - - - -
rgbasm[-EhLVvw] [-b - chars] [-D - name[=value]] - [-g chars] - [-i path] - [-M depend_file] - [-MG] [-MP] - [-MT target_file] - [-MQ target_file] - [-o out_file] - [-p pad_value] - [-r recursion_depth] - [-W warning] - file ...
-
-
-

-The rgbasm program creates an RGB object file from an - assembly source file. The input file can be a file path, - or - denoting stdin. -

Note that options can be abbreviated as long as the abbreviation - is unambiguous: --verb is - --verbose, but - --ver is invalid because it - could also be --version. The - arguments are as follows:

-
-
- chars, - --binary-digits - chars
-
Change the two characters used for binary constants. The defaults are - 01.
-
- name[=value], - - -define - name[=value]
-
Add a string symbol to the compiled source code. This is equivalent to - ‘name EQUS - "value"’ in code, or - ‘name EQUS - "1"’ if value is not - specified.
-
, - --export-all
-
Export all labels, including unreferenced and local labels.
-
- chars, - --gfx-chars - chars
-
Change the four characters used for gfx constants. The defaults are - 0123.
-
, - --halt-without-nop
-
By default, rgbasm inserts a - nop instruction immediately after any - halt instruction. The -h - option disables this behavior.
-
- path, - --include - path
-
Add an include path.
-
, - --preserve-ld
-
Disable the optimization that turns loads of the form LD - [$FF00+n8],A into the opcode LDH - [$FF00+n8],A in order to have full control of the result in the - final ROM.
-
- depend_file, - --dependfile - depend_file
-
Print make(1) dependencies to - depend_file.
-
-
To be used in conjunction with -M. This makes - rgbasm assume that missing files are - auto-generated: when INCLUDE or - INCBIN is attempted on a non-existent file, it is - added as a dependency, then rgbasm exits normally - instead of erroring out. This feature is used in automatic updating of - makefiles.
-
-
When enabled, this causes a phony target to be added for each dependency - other than the main file. This prevents make(1) from - erroring out when dependency files are deleted.
-
- target_file
-
Add a target to the rules emitted by -M. The exact - string provided will be written, including spaces and special characters. -
-MT - -fileA -MT - -fileB
- is equivalent to -
-MT - -'fileA - -fileB'.
- If neither this nor -MQ is specified, the output - file name is used.
-
- target_file
-
Same as -MT, but additionally escapes any special - make(1) characters, essentially ‘$’.
-
- out_file, - --output - out_file
-
Write an object file to the given filename.
-
- pad_value, - --pad-value - pad_value
-
When padding an image, pad with this value. The default is 0x00.
-
- recursion_depth, - --recursion-depth - recursion_depth
-
Specifies the recursion depth at which RGBASM will assume being in an - infinite loop.
-
, - --version
-
Print the version of the program and exit.
-
, - --verbose
-
Be verbose.
-
- warning, - --warning - warning
-
Set warning flag warning. A warning message will be - printed if warning is an unknown warning flag. See - the DIAGNOSTICS section for a list - of warnings.
-
-
Disable all warning output, even when turned into errors.
-
-
-
-

-Warnings are diagnostic messages that indicate possibly erroneous behavior that - does not necessarily compromise the assembling process. The following options - alter the way warnings are processed. -
-
-
Make all warnings into errors.
-
-
Make the specified warning into an error. A warning's name is appended - (example: -Werror=obsolete), and this warning is - implicitly enabled and turned into an error. This is an error if used with - a meta warning, such as -Werror=all.
-
-

The following warnings are “meta” warnings, that - enable a collection of other warnings. If a specific warning is toggled via - a meta flag and a specific one, the more specific one takes priority. The - position on the command-line acts as a tie breaker, the last one taking - effect.

-
-
-
This enables warnings that are likely to indicate an error or undesired - behavior, and that can easily be fixed.
-
-
This enables extra warnings that are less likely to pose a problem, but - that may still be wanted.
-
-
Enables literally every warning.
-
-

The following warnings are actual warning flags; with each - description, the corresponding warning flag is included. Note that each of - these flag also has a negation (for example, - -Wempty-entry enables the warning that - -Wno-empty-entry disables). Only the non-default - flag is listed here. Ignoring the “no-” prefix, entries are - listed alphabetically.

-
-
-
Warns when WARN-type - assertions fail. (See “Aborting the assembly process” in - rgbasm(5) for ASSERT).
-
-
Warn about incorrect arguments to built-in functions, such as - STRSUB() with indexes outside of the string's - bounds. This warning is enabled by -Wall.
-
-
Warn when dividing the smallest negative integer by -1, which yields - itself due to integer overflow.
-
-
Warn when an empty entry is encountered in a db, - dw, dl list. This warning - is enabled by -Wextra.
-
-
Warn when a constant too large to fit in a signed 32-bit integer is - encountered. This warning is enabled by - -Wall.
-
-
Warn when a string too long to fit in internal buffers is encountered. - This warning is enabled by -Wall.
-
-
Warn when obsolete constructs such as the jp [hl] - instruction or HOME section type are - encountered.
-
-
Warn when shifting right a negative value. Use a division by 2^N - instead.
-
-
Warn when a shift's operand is negative or greater than 32.
-
-
Warn when an implicit truncation (for example, db) - loses some bits.
-
-
Warn when the WARN built-in is executed. (See - “Aborting the assembly process” in - rgbasm(5) for WARN).
-
-
-
-

-You can assemble a source file in two ways. -

Straightforward way:

-
$ rgbasm -o bar.o - foo.asm
-

Pipes way:

-
$ cat foo.asm | rgbasm -o bar.o - -
-
$ rgbasm -o bar.o - < - foo.asm
-

The resulting object file is not yet a usable ROM image—it - must first be run through rgblink(1) and then - rgbfix(1).

-
-
-

-Please report bugs on - GitHub. -
-
-

-rgbasm(5), rgbfix(1), - rgblink(1), rgbds(5), - rgbds(7), gbz80(7) -
-
-

-rgbasm was originally written by Carsten Sørensen - as part of the ASMotor package, and was later packaged in RGBDS by Justin - Lloyd. It is now maintained by a number of contributors at - https://github.com/rednex/rgbds. -
-
- - - - - -
July 8, 2019General
- - diff --git a/docs/rgbasm.5.html b/docs/rgbasm.5.html deleted file mode 100644 index 89f0a898..00000000 --- a/docs/rgbasm.5.html +++ /dev/null @@ -1,1751 +0,0 @@ - - - - - - - - - RGBASM(5) - - - - - - - - -
RGBASM(5)File Formats ManualRGBASM(5)
-
-
-

-rgbasm — -language documentation -
-
-

-This is the full description of the language used by - rgbasm(1). The description of the instructions supported by - the Game Boy CPU is in gbz80(7). -

It is strongly recommended to have some familiarity with the Game - Boy hardware before reading this document. RGBDS is specifically targeted at - the Game Boy, and thus a lot of its features tie directly to its concepts. - This document is not intended to be a Game Boy hardware reference.

-

Generally, “the linker” will refer to - rgblink(1), but any program that processes RGB object - files (described in rgbds(5)) can be used in its - place.

-
-
-

-The syntax is line‐based, just as in any other assembler, meaning that - you do one instruction or pseudo‐op per line: -

-
[label] - [instruction] - [; comment]
-

Example:

-
-
-John: ld a,87 ;Weee
-
-
-

All reserved keywords (pseudo‐ops, mnemonics, registers - etc.) are case‐insensitive, all identifiers (symbol names) are - case-sensitive.

-

Comments are used to give humans information about the code, such - as explanations. The assembler always ignores comments and - their contents.

-

There are two syntaxes for comments. The most common is that - anything that follows a semicolon ‘;’ - not inside a string, is a comment until the end of the line. The other is - that lines beginning with a ‘*’ (not - even spaces before it) are ignored. This second syntax is deprecated (will - be removed in a future version) and should be replaced with the first - one.

-

Sometimes lines can be too long and it may be necessary to split - them. To do so, put a backslash at the end of the line:

-
-
-    DB 1, 2, 3, \
-       4, 5, 6, \ ; Put it before any comments
-       7, 8, 9
-
-
-

This works anywhere in the code except inside of strings. To split - strings it is needed to use STRCAT() like this:

-
-
-    db STRCAT("Hello ", \
-              "world!")
-
-
-
-
-

-An expression can be composed of many things. Numerical expressions are always - evaluated using signed 32-bit math. Zero is considered to be the only - "false" number, all non-zero numbers (including negative) are - "true". -

An expression is said to be "constant" if - rgbasm knows its value. This is generally always the - case, unless a label is involved, as explained in the - SYMBOLS section.

-

The instructions in the macro-language generally require constant - expressions.

-
-

-There are a number of numeric formats. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Format typePrefixAccepted characters
Hexadecimal$0123456789ABCDEF
Decimalnone0123456789
Octal&01234567
Binary%01
Fixed point (16.16)none01234.56789
Character constantnone"ABYZ"
Gameboy graphics`0123
-

The "character constant" form yields the value the - character maps to in the current charmap. For example, by default (refer to - ascii(7)) ‘"A"’ yields 65. See - Character maps for information on - charmaps.

-

The last one, Gameboy graphics, is quite interesting and useful. - After the backtick, 8 digits between 0 and 3 are expected, corresponding to - pixel values. The resulting value is the two bytes of tile data that would - produce that row of pixels. For example, ‘`01012323’ is - equivalent to ‘$0F55’.

-

You can also use symbols, which are implicitly replaced with their - value.

-
-
-

-A great number of operators you can use in expressions are available (listed - from highest to lowest precedence): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OperatorMeaning
Precedence override
Built-in function call
Unary complement/plus/minus
Multiply/divide/modulo
Shift left/right
Binary and/or/xor
Add/subtract
Comparison
Boolean and/or
Unary not
-

~ complements a value by inverting all its - bits.

-

% is used to get the remainder of the - corresponding division. ‘5 % 2’ is 1.

-

Shifting works by shifting all bits in the left operand either - left (‘<<’) or right (‘>>’) by the - right operand's amount. When shifting left, all newly-inserted bits are - reset; when shifting right, they are copies of the original most significant - bit instead. This makes ‘a << b’ and ‘a >> - b’ equivalent to multiplying and dividing by 2 to the power of b, - respectively.

-

Comparison operators return 0 if the comparison is false, and 1 - otherwise.

-

Unlike in a lot of languages, and for technical reasons, - rgbasm still evaluates both operands of - ‘&&’ and ‘||’.

-

! returns 1 if the operand was 0, and 0 otherwise.

-
-
-

-Fixed-point numbers are basically normal (32-bit) integers, which count - 65536th's instead of entire units, offering better precision than integers but - limiting the range of values. The upper 16 bits are used for the integer part - and the lower 16 bits are used for the fraction (65536ths). Since they are - still akin to integers, you can use them in normal integer expressions, and - some integer operators like ‘+’ and ‘-’ don't care - whether the operands are integers or fixed-point. You can easily truncate a - fixed-point number into an integer by shifting it right by 16 bits. It follows - that you can convert an integer to a fixed-point number by shifting it left. -

The following functions are designed to operate with fixed-point - numbers:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameOperation
DIV(x, - y) - - x÷y - -
MUL(x, - y) - - x×y - -
SIN(x) - - sin(x) - -
COS(x) - - cos(x) - -
TAN(x) - - tan(x) - -
ASIN(x) - - asin(x) - -
ACOS(x) - - acos(x) - -
ATAN(x) - - atan(x) - -
ATAN2(x, - y)Angle between - - (x,y) - - and - - (1,0) - -
-

These functions are useful for automatic generation of various - tables. Example: assuming a circle has 65536.0 degrees, and sine values are - in range [-1.0 ; 1.0]:

-
-
-; --
-; -- Generate a 256-byte sine table with values between 0 and 128
-; --
-ANGLE = 0.0
-      REPT 256
-      db MUL(64.0, SIN(ANGLE) + 1.0) >> 16
-ANGLE = ANGLE + 256.0 ; 256 = 65536 / table_len, with table_len = 256
-      ENDR
-
-
-
-
-

-The most basic string expression is any number of characters contained in double - quotes (‘"for instance"’). The - backslash character ‘\’ is special in - that it causes the character following it to be “escaped”, - meaning that it is treated differently from normal. There are a number of - escape sequences you can use within a string: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StringMeaning
\\Produces a backslash
\"Produces a double quote without terminating
\,Comma
\{Curly bracket left
\}Curly bracket right
\nNewline ($0A)
\rCarriage return ($0D)
\tTab ($09)
“\1” – “\9”Macro argument (Only the body of a macro, see - Invoking macros)
\@Label name suffix (Only in the body of macros and REPTs)
-(Note that some of those can be used outside of strings, when noted further in - this document.) -

A funky feature is - ‘{symbol}’ within a string, called - “symbol interpolation”. This will paste - symbol's contents as a string. If it's a string - symbol, the string is simply inserted. If it's a numeric symbol, its value - is converted to hexadecimal notation with a dollar sign ‘$’ - prepended.

-
-
-TOPIC equs "life, the universe, and everything"
-ANSWER = 42
-; Prints "The answer to life, the universe, and everything is $2A"
-PRINTT "The answer to {TOPIC} is {ANSWER}\n"
-
-
-

Symbol interpolations can be nested, too!

-

It's possible to change the way numeric symbols are converted by - specifying a print type like so: - ‘{d:symbol}’. Valid print types - are:

- - - - - - - - - - - - - - - - - - - - - - - - - - -
Print typeFormatExample
dDecimal42
xLowercase hexadecimal2a
XUppercase hexadecimal2A
bBinary101010
-

Note that print types should only be used with numeric values, not - strings.

-

HINT: The {symbol} construct can also be - used outside strings. The symbol's value is again inserted directly.

-

The following functions operate on string expressions. Most of - them return a string, however some of these functions actually return an - integer and can be used as part of an integer expression!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameOperation
STRLEN(string)Returns the number of characters in string.
STRCAT(str1, - str2)Appends str2 to - str1.
STRCMP(str1, - str2)Returns negative if str1 is - alphabetically lower than str2 , - zero if they match, positive if - str1 is greater than - str2.
STRIN(str1, - str2)Returns the position of str2 - in str1 or - zero if it's not present (first character is position 1).
STRSUB(str, - pos, len)Returns a substring from str - starting at pos (first - character is position 1) and len - characters long.
STRUPR(str)Converts all characters in str to - capitals and returns the new string.
STRLWR(str)Converts all characters in str to - lower case and returns the new string.
-
-
-

-When writing text that is meant to be displayed in the Game Boy, the characters - used in the source code may have a different encoding than the default of - ASCII. For example, the tiles used for uppercase letters may be placed - starting at tile index 128, which makes it difficult to add text strings to - the ROM. -

Character maps allow mapping strings up to 16 characters long to - an abitrary 8-bit value:

-
-
-CHARMAP "<LF>", 10
-CHARMAP "&iacute", 20
-CHARMAP "A", 128
-
-
-By default, a character map contains ASCII encoding. -

It is possible to create multiple character maps and then switch - between them as desired. This can be used to encode debug information in - ASCII and use a different encoding for other purposes, for example. - Initially, there is one character map called ‘main’ and it is - automatically selected as the current character map from the beginning. - There is also a character map stack that can be used to save and restore - which character map is currently active.

- - - - - - - - - - - - - - - - - - - - - - - - - -
CommandMeaning
- nameCreates a new, empty character map called - name.
- name, basenameCreates a new character map called name, - copied from character map - basename.
- nameSwitch to character map name.
Push the current character map onto the stack.
Pop a character map off the stack and switch to it.
-

Note: Character maps affect all strings in the - file from the point in which they are defined, until switching to a - different character map. This means that any string that the code may want - to print as debug information will also be affected by it.

-

Note: The output value of a mapping can be 0. If - this happens, the assembler will treat this as the end of the string and the - rest of it will be trimmed.

-
-
-

-There are a few other functions that do various useful things: - - - - - - - - - - - - - - - - - - - - - - - - - -
NameOperation
BANK(arg)Returns a bank number. If arg is the symbol - @, this function returns the bank of the current - section. If arg is a string, it returns the bank of - the section that has that name. If arg is a label, - it returns the bank number the label is in. The result may be constant if - rgbasm is able to compute it.
DEF(label)Returns TRUE (1) if label has been defined, FALSE - (0) otherwise. String symbols are not expanded within the - parentheses.
HIGH(arg)Returns the top 8 bits of the operand if arg - is a label or constant, or the top 8-bit register if it - is a 16-bit register.
LOW(arg)Returns the bottom 8 bits of the operand if arg - is a label or constant, or the bottom 8-bit register if - it is a 16-bit register (AF - isn't a valid register for this function).
ISCONST(arg)Returns 1 if arg's value is known by RGBASM (e.g. - if it can be an argument to IF), or 0 if only - RGBLINK can compute its value.
-
-
-
-

-Before you can start writing code, you must define a section. This tells the - assembler what kind of information follows and, if it is code, where to put - it. -

-
SECTION name, - type
-
SECTION name, - type, options
-
SECTION name, - type[addr]
-
SECTION name, - type[addr], - options
-

name is a string enclosed in double quotes, - and can be a new name or the name of an existing section. If the type - doesn't match, an error occurs. All other sections must have a unique name, - even in different source files, or the linker will treat it as an error.

-

Possible section types are as follows:

-
-
-
A ROM section. addr can range from - $0000 to $3FFF, or - $0000 to $7FFF if tiny ROM - mode is enabled in the linker.
-
-
A banked ROM section. addr can range from - $4000 to $7FFF. - bank can range from 1 to 511. Becomes an alias for - ROM0 if tiny ROM mode is enabled in the - linker.
-
-
A banked video RAM section. addr can range from - $8000 to $9FFF. - bank can be 0 or 1, but bank 1 is unavailable if DMG - mode is enabled in the linker.
-
-
A banked external (save) RAM section. addr can range - from $A000 to $BFFF. - bank can range from 0 to 15.
-
-
A general-purpose RAM section. addr can range from - $C000 to $CFFF, or - $C000 to $DFFF if WRAM0 - mode is enabled in the linker.
-
-
A banked general-purpose RAM section. addr can range - from $D000 to $DFFF. - bank can range from 1 to 7. Becomes an alias for - WRAM0 if WRAM0 mode is enabled in the linker.
-
-
An object attribute RAM section. addr can range from - $FE00 to $FE9F.
-
-
A high RAM section. addr can range from - $FF80 to $FFFE. -

Note: While rgbasm - will automatically optimize ld instructions to - the smaller and faster ldh (see - gbz80(7)) whenever possible, it is generally unable to - do so when a label is involved. Using the ldh - instruction directly is recommended. This forces the assembler to emit a - ldh instruction and the linker to check if the - value is in the correct range.

-
-
-

Since RGBDS produces ROMs, code and data can only be placed in - ROM0 and ROMX sections. To - put some in RAM, have it stored in ROM, and copy it to RAM.

-

options are comma-separated and may - include:

-
-
[bank]
-
Specify which bank for the linker to place the - section in. See above for possible values for bank, - depending on type.
-
[align, - offset]
-
Place the section at an address whose align - least‐significant bits are equal to offset. - (Note that ALIGN[align] is a - shorthand for ALIGN[align, - 0]). This option can be used with - [addr], as long as they don't contradict eachother. - It's also possible to request alignment in the middle of a section, see - Requesting alignment - below.
-
-

If [addr] is not specified, the section is - considered “floating”; the linker will automatically calculate - an appropriate address for the section. Similarly, if - BANK[bank] is not specified, - the linker will automatically find a bank with enough space.

-

Sections can also be placed by using a linker script file. The - format is described in rgblink(5). They allow the user to - place floating sections in the desired bank in the order specified in the - script. This is useful if the sections can't be placed at an address - manually because the size may change, but they have to be together.

-

Section examples:

-
    -
  • -
    -
    -SECTION "Cool Stuff",ROMX
    -    
    -
    - This switches to the section called “CoolStuff”, creating it - if it doesn't already exist. It can end up in any ROM bank. Code and data - may follow.
  • -
  • If it is needed, the the base address of the section can be specified: -
    -
    -SECTION "Cool Stuff",ROMX[$4567]
    -    
    -
    -
  • -
  • An example with a fixed bank: -
    -
    -SECTION "Cool Stuff",ROMX[$4567],BANK[3]
    -    
    -
    -
  • -
  • And if you want to force only the section's bank, and not its position - within the bank, that's also possible: -
    -
    -SECTION "Cool Stuff",ROMX,BANK[7]
    -    
    -
    -
  • -
  • Alignment examples: The first one could be useful for defining an OAM - buffer to be DMA'd, since it must be aligned to 256 bytes. The second - could also be appropriate for GBC HDMA, or for an optimized copy code that - requires alignment. -
    -
    -SECTION "OAM Data",WRAM0,ALIGN[8] ; align to 256 bytes
    -SECTION "VRAM Data",ROMX,BANK[2],ALIGN[4] ; align to 16 bytes
    -    
    -
    -
  • -
-
-

-POPS and PUSHS provide the - interface to the section stack. The number of entries in the stack is limited - only by the amount of memory in your machine. -

PUSHS will push the current section - context on the section stack. POPS can then later be - used to restore it. Useful for defining sections in included files when you - don't want to override the section context at the point the file was - included.

-
-
-

-Sometimes you want to have some code in RAM. But then you can't simply put it in - a RAM section, you have to store it in ROM and copy it to RAM at some point. -

This means the code (or data) will not be stored in the place it - gets executed. Luckily, LOAD blocks are the perfect - solution to that. Here's an example of how to use them:

-
-
-SECTION "LOAD example", ROMX
-CopyCode:
-    ld de, RAMCode
-    ld hl, RAMLocation
-    ld c, RAMLocation.end - RAMLocation
-.loop
-    ld a, [de]
-    inc de
-    ld [hli], a
-    dec c
-    jr nz, .loop
-    ret
-
-RAMCode:
-  LOAD "RAM code", WRAM0
-RAMLocation:
-    ld hl, .string
-    ld de, $9864
-.copy
-    ld a, [hli]
-    ld [de], a
-    inc de
-    and a
-    jr nz, .copy
-    ret
-
-.string
-    db "Hello World!", 0
-.end
-  ENDL
-
-
-

A LOAD block feels similar to a - SECTION declaration because it creates a new one. - All data and code generated within such a block is placed in the current - section like usual, but all labels are created as if they were placed in - this newly-created section.

-

In the example above, all of the code and data will end up in the - "LOAD example" section. You will notice the - ‘RAMCode’ and ‘RAMLocation’ labels. The former - is situated in ROM, where the code is stored, the latter in RAM, where the - code will be loaded.

-

You cannot nest LOAD blocks, nor can you - change the current section within them.

-
-
-

-When you're tight on RAM, you may want to define overlapping blocks of - variables, as explained in the Unions - section. However, the UNION keyword only works within - a single file, which prevents e.g. defining temporary variables on a single - memory area across several files. Unionized sections solve this problem. To - declare an unionized section, add a UNION keyword - after the SECTION one; the declaration is otherwise - not different. Unionized sections follow some different rules from normal - sections: -
    -
  • The same unionized section (= having the same name) can be declared - several times per rgbasm invocation, and across - several invocations. Different declarations are treated and merged - identically whether within the same invocation, or different ones.
  • -
  • If one section has been declared as unionized, all sections with the same - name must be declared unionized as well.
  • -
  • All declarations must have the same type. For example, even if - rgblink(1)'s -w flag is used, - WRAM0 and WRAMX types are - still considered different.
  • -
  • Different constraints (alignment, bank, etc.) can be specified for each - unionized section declaration, but they must all be compatible. For - example, alignment must be compatible with any fixed address, all - specified banks must be the same, etc.
  • -
  • Unionized sections cannot have type ROM0 or - ROMX.
  • -
-

Different declarations of the same unionized section are not - appended, but instead overlaid on top of eachother, just like - Unions. Similarly, the size of an unionized - section is the largest of all its declarations.

-
-
-

-Section fragments are sections with a small twist: when several of the same name - are encountered, they are concatenated instead of producing an error. This - works within the same file (paralleling the behavior "plain" - sections has in previous versions), but also across object files. However, - similarly to Unionized Sections, - some rules must be followed: -
    -
  • If one section has been declared as fragment, all sections with the same - name must be declared fragments as well.
  • -
  • All declarations must have the same type. For example, even if - rgblink(1)'s -w flag is used, - WRAM0 and WRAMX types are - still considered different.
  • -
  • Different constraints (alignment, bank, etc.) can be specified for each - unionized section declaration, but they must all be compatible. For - example, alignment must be compatible with any fixed address, all - specified banks must be the same, etc.
  • -
  • A section fragment may not be unionized; after all, that wouldn't make - much sense.
  • -
-

When RGBASM merges two fragments, the one encountered later is - appended to the one encountered earlier.

-

When RGBLINK merges two fragments, the one whose file was - specified last is appended to the one whose file was specified first. For - example, assuming ‘bar.o’, - ‘baz.o’, and - ‘foo.o’ all contain a fragment with - the same name, the command

-
rgblink -o rom.gb baz.o foo.o - bar.o
-would produce the fragment from ‘baz.o’ - first, followed by the one from ‘foo.o’, - and the one from ‘bar.o’ last. -
-
-
-

-RGBDS supports several types of symbols: -
-
Label
-
Numerical symbol designating a memory location. May or may not have a - value known at assembly time.
-
Constant
-
Numerical symbol whose value has to be known at assembly time.
-
Macro
-
A block of rgbasm code that can be invoked - later.
-
String equate
-
String symbol that can be evaluated, similarly to a macro.
-
-

Symbol names can contain letters, numbers, underscores, hashes and - ‘@’. However, they must begin with either a letter, a number, - or an underscore. Periods are allowed exclusively for labels, as described - below. A symbol cannot have the same name as a reserved keyword. - In the line where a symbol is defined there mustn't be any - whitespace before it, otherwise rgbasm will - treat it as a macro invocation.

-
-
Label declaration
-
One of the assembler's main tasks is to keep track of addresses for you, - so you can work with meaningful names instead of "magic" - numbers. -

This can be done in a number of ways:

-
-
-GlobalLabel ; This syntax is deprecated,
-AnotherGlobal: ; please use this instead
-.locallabel
-.yet_a_local:
-AnotherGlobal.with_another_local:
-ThisWillBeExported:: ; Note the two colons
-ThisWillBeExported.too::
-    
-
-

Declaring a label (global or local) with - ‘::’ does an - EXPORT at the same time. (See - Exporting and - importing symbols below).

-

Any label whose name does not contain a period is a global - label, others are locals. Declaring a global label sets it as the - current label scope until the next one; any local label whose first - character is a period will have the global label's name implicitly - prepended. Local labels can be declared as - ‘scope.local:’ or simply as as - ‘.local:’. If the former notation - is used, then ‘scope’ must be the - actual current scope.

-

Local labels may have whitespace before their declaration as - the only exception to the rule.

-

A label's location (and thus value) is usually not determined - until the linking stage, so labels usually cannot be used as constants. - However, if the section in which the label is declared has a fixed base - address, its value is known at assembly time.

-

rgbasm is able to compute the - subtraction of two labels either if both are constant as described - above, or if both belong to the same section.

-
-
-
- allows defining constant symbols. Unlike SET - below, constants defined this way cannot be redefined. They can, for - example, be used for things such as bit definitions of hardware registers. -
-
-SCREEN_WIDTH   equ 160 ; In pixels
-SCREEN_HEIGHT  equ 144
-    
-
-

Note that colons ‘:’ - following the name are not allowed.

-
-
-
, - or its synonym =, defines constant symbols like - EQU, but those constants can be re-defined. This - is useful for variables in macros, for counters, etc. -
-
-ARRAY_SIZE EQU 4
-COUNT      SET 2
-COUNT      SET ARRAY_SIZE+COUNT
-; COUNT now has the value 6
-COUNT      = COUNT + 1
-    
-
-

Note that colons ‘:’ - following the name are not allowed.

-
-
, - RSRESET, RB, - RW
-
The RS group of commands is a handy way of defining structures: -
-
-              RSRESET
-str_pStuff    RW   1
-str_tData     RB   256
-str_bCount    RB   1
-str_SIZEOF    RB   0
-    
-
-

The example defines four constants as if by:

-
-
-str_pStuff EQU 0
-str_tData  EQU 2
-str_bCount EQU 258
-str_SIZEOF EQU 259
-    
-
-

There are five commands in the RS group of commands:

- - - - - - - - - - - - - - - - - - - - - - - - - -
CommandMeaning
Equivalent to ‘RSSET 0’.
- constexprSets the _RS counter - to constexpr.
- constexprSets the preceding symbol to _RS - and adds constexpr - to _RS.
- constexprSets the preceding symbol to _RS - and adds constexpr - * 2 to _RS.
- constexprSets the preceding symbol to _RS - and adds constexpr - * 4 to _RS. (In - practice, this one cannot be used due to a bug).
-

Note that colons ‘:’ - following the name are not allowed.

-
-
-
- is used to define string symbols. Wherever the assembler meets a string - symbol its name is replaced with its value. If you are familiar with C you - can think of it as similar to #define . -
-
-COUNTREG EQUS "[hl+]"
-    ld a,COUNTREG
-
-PLAYER_NAME EQUS "\"John\""
-    db PLAYER_NAME
-    
-
-

This will be interpreted as:

-
-
-    ld a,[hl+]
-    db "John"
-    
-
-

String symbols can also be used to define small one-line - macros:

-
-
-pusha EQUS "push af\npush bc\npush de\npush hl\n"
-    
-
-

Note that colons ‘:’ - following the name are not allowed. String equates can't be exported or - imported.

-

Important note: An - EQUS can be expanded to a string that contains - another EQUS and it will be expanded as well. If - this creates an infinite loop, rgbasm will error - out once a certain depth is reached. See the -r - command-line option in rgbasm(1). Also, a macro can - contain an EQUS which calls the same macro, - which causes the same problem.

-
-
-
One of the best features of an assembler is the ability to write macros - for it. Macros can be called with arguments, and can react depending on - input using IF constructs. -
-
-MyMacro: MACRO
-         ld   a,80
-         call MyFunc
-         ENDM
-    
-
-

Note that a single colon - ‘:’ following the macro's name is - required. Macros can't be exported or imported.

-
-
-
-

-Importing and exporting of symbols is a feature that is very useful when your - project spans many source files and, for example, you need to jump to a - routine defined in another file. -

Exporting of symbols has to be done manually, importing is done - automatically if rgbasm finds a symbol it does not - know about.

-

The following will cause symbol1, - symbol2 and so on to be accessible to other files - during the link process:

-
EXPORT - symbol1 [, symbol2, - ...]
-

GLOBAL is a deprecated synonym for - EXPORT, do not use it.

-

Note also that only exported symbols will appear in symbol and map - files produced by rgblink(1).

-
-
-

-PURGE allows you to completely remove a symbol from the - symbol table as if it had never existed. USE WITH EXTREME - CAUTION!!! I can't stress this enough, you seriously need to - know what you are doing. DON'T purge a symbol that you use in expressions - the linker needs to calculate. When not sure, it's probably not safe to purge - anything other than string symbols, macros, and constants. -
-
-Kamikaze EQUS  "I don't want to live anymore"
-AOLer    EQUS  "Me too"
-         PURGE Kamikaze, AOLer
-
-
-

Note that, as an exception, string symbols in the argument list of - a PURGE command will not be - expanded.

-
-
-

-The following symbols are defined by the assembler: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeNameContents
PC value
Fixed point π
_RS Counter
Number of arguments passed to macro
The current line number
The current filename
Today's date
The current time
ISO 8601 timestamp (local)
ISO 8601 timestamp (UTC)
Today's year
Today's month number, 1–12
Today's day of the month, 1–31
Current hour, 0–23
Current minute, 0–59
Current second, 0–59
Major version number of RGBDS
Minor version number of RGBDS
Patch version number of RGBDS
-
-
-
-

-
-

-DS allocates a number of empty bytes. This is the - preferred method of allocating space in a RAM section. You can also use - DB, DW and - DL without any arguments instead (see - Defining constant data - below). -
-
-DS 42 ; Allocates 42 bytes
-
-
-

Empty space in RAM sections will not be initialized. In ROM - sections, it will be filled with the value passed to the - -p command-line option, except when using overlays - with -O.

-
-
-

-DB defines a list of bytes that will be stored in the - final image. Ideal for tables and text. Note that strings are not - zero-terminated! -
-
-DB 1,2,3,4,"This is a string"
-
-
-

DS can also be used to fill a region of - memory with some value. The following produces 42 times the byte $FF:

-
-
-DS 42, $FF
-
-
-

Alternatively, you can use DW to store a - list of words (16-bit) or DL to store a list of - double-words/longs (32-bit). Strings are not allowed as arguments to - DW and DL.

-

You can also use DB, - DW and DL without arguments, - or leaving empty elements at any point in the list. This works exactly like - DS 1, DS 2 and - DS 4 respectively. Consequently, no-argument - DB, DW and - DL can be used in a WRAM0 / - WRAMX / HRAM / - VRAM / SRAM section.

-
-
-

-You probably have some graphics, level data, etc. you'd like to include. Use - INCBIN to include a raw binary file as it is. If the - file isn't found in the current directory, the include-path list passed to - rgbasm(1) (see the -i option) on the - command line will be searched. -
-
-INCBIN "titlepic.bin"
-INCBIN "sprites/hero.bin"
-
-
-

You can also include only part of a file with - INCBIN. The example below includes 256 bytes from - data.bin, starting from byte 78.

-
-
-INCBIN "data.bin",78,256
-
-
-
-
-

-Unions allow multiple memory allocations to overlap, like unions in C. This does - not increase the amount of memory available, but allows re-using the same - memory region for different purposes. -

A union starts with a UNION keyword, and - ends at the corresponding ENDU keyword. - NEXTU separates each block of allocations, and you - may use it as many times within a union as necessary.

-
-
-    ; Let's say PC = $C0DE here
-    UNION
-    ; Here, PC = $C0DE
-Name: ds 8
-    ; PC = $C0E6
-Nickname: ds 8
-    ; PC = $C0EE
-    NEXTU
-    ; PC is back to $C0DE
-Health: dw
-    ; PC = $C0E0
-Something: ds 6
-    ; And so on
-Lives: db
-    NEXTU
-VideoBuffer: ds 19
-    ENDU
-
-
-

In the example above, ‘Name, Health, VideoBuffer’ - all have the same value, as do ‘Nickname’ and - ‘Lives’. Thus, keep in mind that ld [Health], - a is identical to ld [Name], a.

-

The size of this union is 19 bytes, as this is the size of the - largest block (the last one, containing ‘VideoBuffer’). - Nesting unions is possible, with each inner union's size being considered as - described above.

-

Unions may be used in any section, but inside them may only be - DS - like commands (see - Declaring - variables in a RAM section).

-
-
-
-

-
-

-You execute the macro by inserting its name. -
-
-         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).

-

When rgbasm sees - MyMacro it will insert the macro definition (the - code enclosed in MACRO / - ENDM).

-

Suppose your macro contains a loop.

-
-
-LoopyMacro: MACRO
-            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 - scope. To get around this problem, there is the escape sequence - \@ that expands to a unique string.

-

\@ also works in - REPT blocks.

-
-
-LoopyMacro: MACRO
-            xor  a,a
-.loop\@     ld   [hl+],a
-            dec  c
-            jr   nz,.loop\@
-ENDM
-
-
-

Important note: Since a macro can call itself - (or a different macro that calls the first one), there can be circular - dependency problems. If this creates an infinite loop, - rgbasm will error out once a certain depth is - reached. See the -r command-line option in - rgbasm(1). Also, a macro can have inside an - EQUS which references the same macro, which has the same - problem.

-

It's possible to pass arguments to macros as well! You retrieve - the arguments by using the escape sequences \1 - through \9, \1 being the - first argument specified on the macro invocation.

-
-
-LoopyMacro: MACRO
-            ld   hl,\1
-            ld   c,\2
-            xor  a,a
-.loop\@     ld   [hl+],a
-            dec  c
-            jr   nz,.loop\@
-            ENDM
-
-
-

Now I 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
-
-
-

Arguments are passed as string equates, although there's no need - to enclose them in quotes. Thus, an expression will not be evaluated first - but kind of copy-pasted. This means that it's probably a very good idea to - use brackets around \1 to \9 - if you perform further calculations on them. For instance, consider the - following:

-
-
-print_double: MACRO
-    PRINTV \1 * 2
-ENDM
-    print_double 1 + 2
-
-
-

The PRINTV statement will expand to - ‘PRINTV 1 + 2 * 2’, which will print 5 - and not 6 as you might have expected.

-

Line continuations work as usual inside macros or lists of macro - arguments. However, some characters need to be escaped, as in the following - example:

-
-
-PrintMacro: MACRO
-    PRINTT \1
-ENDM
-
-    PrintMacro STRCAT("Hello "\, \
-                      "world\\n")
-
-
-

The comma needs to be escaped to avoid it being treated as - separating the macro's arguments. The backslash ‘\’ (from - ‘\n’) also needs to be escaped because of the way - rgbasm processes macro arguments.

-

In reality, up to 256 arguments can be passed to a macro, but you - can only use the first 9 like this. If you want to use the rest, you need to - use the SHIFT command.

-

SHIFT is a special command only available - in macros. Very useful in REPT blocks. It will shift - the arguments by one to the left. \1 will get the - value of \2, \2 will get the - value of \3, and so forth.

-

This is the only way of accessing the value of arguments from 10 - to 256.

-

SHIFT can optionally be given an integer - parameter, and will apply the above shifting that number of times.

-
-
-

-The next four commands print text and values to the standard output. Useful for - debugging macros, or wherever you may feel the need to tell yourself some - important information. -
-
-PRINTT "I'm the greatest programmer in the whole wide world\n"
-PRINTI (2 + 3) / 5
-PRINTV $FF00 + $F0
-PRINTF MUL(3.14, 3987.0)
-
-
-
-
-
prints out a string. Be careful to add a line feed (“\n”) at - the end, as it is not added automatically.
-
-
prints out an integer value in hexadecimal or, as in the example, the - result of a calculation. Unsurprisingly, you can also print out a constant - symbol's value.
-
-
prints out a signed integer value.
-
-
prints out a fixed point value.
-
-

Be careful that none of those automatically print a line feed; if - you need one, use PRINTT \n.

-
-
-

-Suppose you want to unroll a time consuming loop without copy-pasting it. - REPT is here for that purpose. Everything between - REPT and the matching 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: -
-
-REPT 4
-  add  a,c
-ENDR
-
-
-

You can also use REPT to generate tables - on the fly:

-
-
-; --
-; -- Generate a 256 byte sine table with values between 0 and 128
-; --
-ANGLE =   0.0
-      REPT  256
-      db    (MUL(64.0, SIN(ANGLE)) + 64.0) >> 16
-ANGLE = ANGLE+256.0
-      ENDR
-
-
-

As in macros, you can also use the escape sequence - \@. REPT blocks can be - nested.

-
-
-

-FAIL and WARN can be used to - print errors and warnings respectively during the assembly process. This is - especially useful for macros that get an invalid argument. - FAIL and WARN take a string as - the only argument and they will print this string out as a normal error with a - line number. -

FAIL stops assembling immediately while - WARN shows the message but continues afterwards.

-

If you need to ensure some assumption is correct when compiling, - you can use ASSERT and - STATIC_ASSERT. Syntax examples are given below:

-
-
-Function:
-      xor a
-ASSERT LOW(Variable) == 0
-      ld h, HIGH(Variable)
-      ld l, a
-      ld a, [hli]
-      ; You can also indent this!
-      ASSERT BANK(OtherFunction) == BANK(Function)
-      call OtherFunction
-; Lowercase also works
-assert Variable + 1 == OtherVariable
-      ld c, [hl]
-      ret
-.end
-      ; If you specify one, a message will be printed
-      STATIC_ASSERT .end - Function < 256, "Function is too large!"
-
-
-

First, the difference between ASSERT and - STATIC_ASSERT is that the former is evaluated by - RGBASM if it can, otherwise by RGBLINK; but the latter is only ever - evaluated by RGBASM. If RGBASM cannot compute the value of the argument to - STATIC_ASSERT, it will produce an error.

-

Second, as shown above, a string can be optionally added at the - end, to give insight into what the assertion is checking.

-

Finally, you can add one of WARN, - FAIL or FATAL as the first - optional argument to either ASSERT or - STATIC_ASSERT. If the assertion fails, - WARN will cause a simple warning (controlled by - rgbasm(1) flag -Wassert) to be - emitted; FAIL (the default) will cause a non-fatal - error; and FATAL immediately aborts.

-
-
-

-Use INCLUDE to process another assembler file and then - return to the current file when done. If the file isn't found in the current - directory the include path list (see the -i option in - rgbasm(1)) will be searched. You may nest - INCLUDE calls infinitely (or until you run out of - memory, whichever comes first). -
-
-    INCLUDE "irq.inc"
-
-
-
-
-

-The four commands IF, ELIF, - ELSE, and ENDC let you have - rgbasm skip over parts of your code depending on a - condition. This is a powerful feature commonly used in macros. -
-
-IF NUM < 0
-  PRINTT "NUM < 0\n"
-ELIF NUM == 0
-  PRINTT "NUM == 0\n"
-ELSE
-  PRINTT "NUM > 0\n"
-ENDC
-
-
-

The ELIF (standing for "else - if") and ELSE blocks are optional. - IF / ELIF / - ELSE / ENDC blocks can be - nested.

-

Note that if an ELSE block is found before - an ELIF block, the ELIF - block will be ignored. All ELIF blocks must go - before the ELSE block. Also, if there is more than - one ELSE block, all of them but the first one are - ignored.

-
-
-
-

-
-

-OPT can be used to change some of the options during - assembling from within the source, instead of defining them on the - command-line. -

OPT takes a comma-separated list of - options as its argument:

-
-
-PUSHO
-OPT   g.oOX ;Set the GB graphics constants to use these characters
-DW    `..ooOOXX
-POPO
-DW    `00112233
-
-
-

The options that OPT can modify are currently: - b, g and - p.

-

POPO and PUSHO - provide the interface to the option stack. PUSHO - will push the current set of options on the option stack. - POPO can then later be used to restore them. Useful - if you want to change some options in an include file and you don't want to - destroy the options set by the program that included your file. The stack's - number of entries is limited only by the amount of memory in your - machine.

-
-
-

-While ALIGN as presented in - SECTIONS is often useful as-is, sometimes - you instead want a particular piece of data (or code) in the middle of the - section to be aligned. This is made easier through the use of mid-section - align align, - offset. It will alter the section's attributes to ensure - that the location the align directive is at, has its - align lower bits equal to offset. -

If the constraint cannot be met (for example because the section - is fixed at an incompatible address), and error is produced. Note that - align align is a shorthand for - align align, - 0.

-
-
-
-

-rgbasm(1), rgblink(1), - rgblink(5), rgbds(5), - rgbds(7), gbz80(7) -
-
-

-rgbasm was originally written by Carsten Sørensen - as part of the ASMotor package, and was later packaged in RGBDS by Justin - Lloyd. It is now maintained by a number of contributors at - https://github.com/rednex/rgbds. -
-
- - - - - -
December 5, 2019General
- - diff --git a/docs/rgbds.5.html b/docs/rgbds.5.html deleted file mode 100644 index 46b6d607..00000000 --- a/docs/rgbds.5.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - RGBDS(5) - - - - - - - - -
RGBDS(5)File Formats ManualRGBDS(5)
-
-
-

-rgbds — -object file format documentation -
-
-

-This is the description of the object files used by rgbasm(1) - and rgblink(1). Please note that the - specifications may change. This toolchain is in development and new - features may require adding more information to the current format, or - modifying some fields, which would break compatibility with older versions. -
-
-

-The following types are used: -

LONG is a 32‐bit integer stored in - little‐endian format. BYTE is an 8‐bit - integer. STRING is a 0‐terminated string of - BYTE.

-
-
-; Header
-
-BYTE    ID[4]            ; "RGB9"
-LONG    RevisionNumber   ; The format's revision number this file uses
-LONG    NumberOfSymbols  ; The number of symbols used in this file
-LONG    NumberOfSections ; The number of sections used in this file
-
-; Symbols
-
-REPT    NumberOfSymbols   ; Number of symbols defined in this object file.
-
-    STRING  Name          ; The name of this symbol. Local symbols are stored
-                          ; as "Scope.Symbol".
-
-    BYTE    Type          ; 0 = LOCAL symbol only used in this file.
-                          ; 1 = IMPORT this symbol from elsewhere
-                          ; 2 = EXPORT this symbol to other objects.
-                          ; Bit 7 is independent from the above value, and
-                          ; encodes whether the section is unionized
-
-    IF (Type & 0x7F) != 1 ; If symbol is defined in this object file.
-
-        STRING  FileName  ; File where the symbol is defined.
-
-        LONG    LineNum   ; Line number in the file where the symbol is defined.
-
-        LONG    SectionID ; The section number (of this object file) in which
-                          ; this symbol is defined. If it doesn't belong to any
-                          ; specific section (like a constant), this field has
-                          ; the value -1.
-
-        LONG    Value     ; The symbols value. It's the offset into that
-                          ; symbol's section.
-
-    ENDC
-
-ENDR
-
-; Sections
-
-REPT NumberOfSections
-    STRING  Name  ; Name of the section
-
-    LONG    Size  ; Size in bytes of this section
-
-    BYTE    Type  ; 0 = WRAM0
-                  ; 1 = VRAM
-                  ; 2 = ROMX
-                  ; 3 = ROM0
-                  ; 4 = HRAM
-                  ; 5 = WRAMX
-                  ; 6 = SRAM
-                  ; 7 = OAM
-
-    LONG    Org   ; Address to fix this section at. -1 if the linker should
-                  ; decide (floating address).
-
-    LONG    Bank  ; Bank to load this section into. -1 if the linker should
-                  ; decide (floating bank). This field is only valid for ROMX,
-                  ; VRAM, WRAMX and SRAM sections.
-
-    BYTE    Align ; Alignment of this section, as N bits. 0 when not specified.
-
-    LONG    Ofs   ; Offset relative to the alignment specified above.
-                  ; Must be below 1 << Align.
-
-    IF      (Type == ROMX) || (Type == ROM0) ; Sections that can contain data.
-
-        BYTE    Data[Size]      ; Raw data of the section.
-
-        LONG    NumberOfPatches ; Number of patches to apply.
-
-        REPT    NumberOfPatches
-
-            STRING  SourceFile   ; Name of the source file (for printing error
-                                 ; messages).
-
-            LONG    Offset       ; Offset into the section where patch should
-                                 ; be applied (in bytes).
-
-            LONG    PCSectionID  ; Index within the file of the section in which
-                                 ; PC is located.
-                                 ; This is usually the same section that the
-                                 ; patch should be applied into, except e.g.
-                                 ; with LOAD blocks.
-
-            LONG    PCOffset     ; PC's offset into the above section.
-                                 ; Used because the section may be floating, so
-                                 ; PC's value is not known to RGBASM.
-
-            BYTE    Type         ; 0 = BYTE patch.
-                                 ; 1 = little endian WORD patch.
-                                 ; 2 = little endian LONG patch.
-                                 ; 3 = JR offset value BYTE patch.
-
-            LONG    RPNSize      ; Size of the buffer with the RPN.
-                                 ; expression.
-
-            BYTE    RPN[RPNSize] ; RPN expression. Definition below.
-
-        ENDR
-
-    ENDC
-
-ENDR
-
-; Assertions
-
-LONG  NumberOfAssertions
-
-REPT  NumberOfAssertions
-
-  STRING  SourceFile   ; Name of the source file (for printing the failure).
-
-  LONG    Offset       ; Offset into the section where the assertion is located.
-
-  LONG    SectionID    ; Index within the file of the section in which PC is
-                       ; located, or -1 if defined outside a section.
-
-  LONG    PCOffset     ; PC's offset into the above section.
-                       ; Used because the section may be floating, so PC's value
-                       ; is not known to RGBASM.
-
-  BYTE    Type         ; 0 = Prints the message but allows linking to continue
-                       ; 1 = Prints the message and evaluates other assertions,
-                       ;     but linking fails afterwards
-                       ; 2 = Prints the message and immediately fails linking
-
-  LONG    RPNSize      ; Size of the RPN expression's buffer.
-
-  BYTE    RPN[RPNSize] ; RPN expression, same as patches. Assert fails if == 0.
-
-  STRING  Message      ; A message displayed when the assert fails. If set to
-                       ; the empty string, a generic message is printed instead.
-
-ENDR
-
-
-
-

-Expressions in the object file are stored as RPN. This is an expression of the - form “2 5 +”. This will first push the value “2” - to the stack, then “5”. The “+” operator pops two - arguments from the stack, adds them, and then pushes the result on the stack, - effectively replacing the two top arguments with their sum. In the RGB format, - RPN expressions are stored as BYTEs with some bytes - being special prefixes for integers and symbols. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ValueMeaning
| -
, - a LONG Symbol ID follows.
, - a null-terminated string follows.
. - Checks if the value is in HRAM, ANDs it with 0xFF.
. - Checks if the value is a RST vector, ORs it with 0xC7.
LONG integer follows.
LONG symbol ID follows.
-
-
-
-

-rgbasm(1), rgblink(1), - rgbds(7), gbz80(7) -
-
-

-rgbds was originally written by Carsten Sørensen - as part of the ASMotor package, and was later packaged in RGBDS by Justin - Lloyd. It is now maintained by a number of contributors at - https://github.com/rednex/rgbds. -
-
- - - - - -
January 26, 2018General
- - diff --git a/docs/rgbds.7.html b/docs/rgbds.7.html deleted file mode 100644 index 01872533..00000000 --- a/docs/rgbds.7.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - RGBDS(7) - - - - - - - - -
RGBDS(7)Miscellaneous Information ManualRGBDS(7)
-
-
-

-rgbds — -Rednex Game Boy Development System -
-
-

-To get a working ROM image from a single assembly source file: -
-
-$ rgbasm -o bar.o foo.asm
-$ rgblink -o baz.gb bar.o
-$ rgbfix -v -p 0 baz.gb
-
-
-
-
-

-rgbasm(1), rgbfix(1), - rgblink(1), rgbds(5), - gbz80(7) -
-
-

-
-
-
1997, Carsten Sørensen (AKA SurfSmurf) writes ASMotor as a - general-purpose assembler/linker system for DOS/Win32.
-
-
1999, Justin Lloyd (AKA Otaku no Zoku) adapts ASMotor to read and produce - GBZ80 assembly/machine code, and releases this version as RGBDS.
-
-
2009, Vegard Nossum adapts the code to be more UNIX-like and releases this - version as rgbds-linux on GitHub.
-
-
2010, Anthony J. Bentley forks that repository. The fork becomes the - reference implementation of rgbds.
-
-
2017, Bentley's repository is moved to a neutral name. It is now - maintained by a number of contributors at - https://github.com/rednex/rgbds.
-
-
2018, codebase relicensed under the MIT license.
-
-
-
- - - - - -
March 7, 2018General
- - diff --git a/docs/rgbds.css b/docs/rgbds.css deleted file mode 100644 index b1dadb93..00000000 --- a/docs/rgbds.css +++ /dev/null @@ -1,63 +0,0 @@ -/* Overrides to default mandoc styling for HTML renders of RGBDS man pages */ - -html { - /* Reduce contrast */ - background-color: #f8f8f8; - color: #222; - - /* Override `mandoc.css`'s sowe can put it on instead */ - max-width: none; -} - -body { - /* Center body horizontally (requires to span full width) */ - margin: 0 auto; - /* `mandoc.css`'s default, but it's applied to there */ - max-width: 65em; - - /* Improve readability */ - font-size: 16px; - line-height: 1.4; - text-align: justify; - - /* Prevent text from bumping sides on mobile devices */ - padding: 10px 20px 10px 10px; -} -@media print { - body { - /* Max width doesn't make sense for print */ - max-width: none; - /* Make font slightly smaller for printing */ - font-size: 14px; - } -} - -code, pre { - font-size: smaller; -} - -pre { - /* Avoid horizontal page scrolling on mobile */ - overflow: auto; -} - -/* Separate lines in tables */ -table.Bl-column { - border-collapse: collapse; -} -table.Bl-column tr:not(:first-child) > td, -table.Bl-column tr:not(:first-child) > th { - border-top: 1px solid #aaa; -} - -table.Bl-column th { - /* Apply `.Sy` style to table headers */ - font-style: normal; - font-weight: bold; -} - -table.Bl-column td, -table.Bl-column th { - /* Add horizontal spacing between columns */ - padding: 2px 7px 0; -} diff --git a/docs/rgbfix.1.html b/docs/rgbfix.1.html deleted file mode 100644 index 67cc4030..00000000 --- a/docs/rgbfix.1.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - - RGBFIX(1) - - - - - - - - -
RGBFIX(1)General Commands ManualRGBFIX(1)
-
-
-

-rgbfix — -Game Boy header utility and checksum fixer -
-
-

- - - - - -
rgbfix[-jsVv] [-C | - -c] [-f - fix_spec] [-i - game_id] [-k - licensee_str] [-l - licensee_id] [-m - mbc_type] [-n - rom_version] [-p - pad_value] [-r - ram_size] [-t - title_str] file
-
-
-

-The rgbfix program changes headers of Game Boy ROM - images. It also performs other correctness operations, such as padding. -

Note that options can be abbreviated as long as the abbreviation - is unambiguous: --verb is - --verbose, but - --ver is invalid because it - could also be --version. The - arguments are as follows:

-
-
, - --color-only
-
Set the Game Boy Color–only flag: 0x143 = - 0xC0. If both this and the -c flag are set, this - takes precedence.
-
, - --color-compatible
-
Set the Game Boy Color–compatible flag: - 0x143 = 0x80. If both this and the - -C flag are set, -C takes - precedence.
-
- fix_spec, - --fix-spec - fix_spec
-
Fix certain header values that the Game Boy checks for correctness. - Alternatively, intentionally trash these values by writing their binary - inverse instead. fix_spec is a string containing any - combination of the following characters: -

-
-
-
Fix the Nintendo logo - (0x1040x133).
-
-
Trash the Nintendo logo.
-
-
Fix the header checksum (0x14D).
-
-
Trash the header checksum.
-
-
Fix the global checksum - (0x14E0x14F).
-
-
Trash the global checksum.
-
-
-
- game_id, - --game-id - game_id
-
Set the game ID string - (0x13F0x142) to a - given string of exactly 4 characters. If both this and the title are set, - the game ID will overwrite the overlapping portion of the title.
-
, - --non-japanese
-
Set the non-Japanese region flag: 0x14A = 1.
-
- licensee_str, - --new-licensee - licensee_str
-
Set the new licensee string - (0x1440x145) to a - given string, truncated to at most two characters.
-
- licensee_id, - --old-licensee - licensee_id
-
Set the old licensee code, 0x14B, to a given value - from 0 to 0xFF. This value is deprecated and should be set to 0x33 in all - new software.
-
- mbc_type, - --mbc-type - mbc_type
-
Set the MBC type, 0x147, to a given value from 0 - to 0xFF.
-
- rom_version, - --rom-version - rom_version
-
Set the ROM version, 0x14C, to a given value from - 0 to 0xFF.
-
- pad_value, - --pad-value - pad_value
-
Pad the image to a valid size with a given pad value from 0 to 0xFF. - rgbfix will automatically pick a size from 32 KiB, - 64 KiB, 128 KiB, ..., 8192 KiB. The cartridge size byte - (0x148) will be changed to reflect this new - size.
-
- ram_size, - --ram-size - ram_size
-
Set the RAM size, 0x149, to a given value from 0 - to 0xFF.
-
, - --sgb-compatible
-
Set the SGB flag: 0x146 = 3. This flag will be - ignored by the SGB unless the old licensee code is 0x33!
-
- title, - --title - title
-
Set the title string - (0x1340x143) to a - given string, truncated to at most 16 characters. It is recommended to use - 15 characters instead, to avoid clashing with the CGB flag - (-c or -C). If both this - and the game ID are set, the game ID will overwrite the overlapping - portion of the title.
-
, - --version
-
Print the version of the program and exit.
-
, - --validate
-
Equivalent to -f lhg.
-
-
-
-

-Most values in the ROM header are only cosmetic. The bare minimum requirements - for a workable program are the header checksum, the Nintendo logo, and (if - needed) the CGB/SGB flags. It is a good idea to pad the image to a valid size - as well (“valid” meaning a power of 2, times 32 KiB). -

The following will make a plain, non-color Game Boy game without - checking for a valid size:

-

-
$ rgbfix -v foo.gb
-

The following will make a SGB-enabled, color-enabled game with a - title of “foobar”, and pad it to a valid size. (The Game Boy - itself does not use the title, but some emulators or ROM managers do.)

-

-
$ rgbfix -vcs -l 0x33 -p 255 -t foobar baz.gb
-

The following will duplicate the header (sans global checksum) of - the game “Survival Kids”:

-

-
$ rgbfix -cjsv -k A4 -l 0x33 -m 0x1B -p 0xFF -r 3 -t - SURVIVALKIDAVKE SurvivalKids.gbc
-
-
-

-Please report bugs on - GitHub. -
-
-

-rgbasm(1), rgblink(1), - rgbds(7) -
-
-

-rgbfix was originally released by Carsten - Sørensen as a standalone program called gbfix, and was later packaged - in RGBDS by Justin Lloyd. It is now maintained by a number of contributors at - https://github.com/rednex/rgbds. -
-
- - - - - -
December 5, 2019General
- - diff --git a/docs/rgbgfx.1.html b/docs/rgbgfx.1.html deleted file mode 100644 index 13d67c2e..00000000 --- a/docs/rgbgfx.1.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - - RGBGFX(1) - - - - - - - - -
RGBGFX(1)General Commands ManualRGBGFX(1)
-
-
-

-rgbgfx — -Game Boy graphics converter -
-
-

- - - - - -
rgbgfx[-CDhmuVv] [-f | - -F] [-a - attrmap | -A] - [-d depth] - [-o out_file] - [-p pal_file | - -P] [-t - tilemap | -T] - [-x tiles] - file
-
-
-

-The rgbgfx program converts PNG images into the Nintendo - Game Boy's planar tile format. -

The resulting colors and their palette indices are determined - differently depending on the input PNG file:

-
    -
  • If the file has an embedded palette, that palette's color and order are - used.
  • -
  • If not, and the image only contains shades of gray, rgbgfx maps them to - the indices appropriate for each shade. Any undetermined indices are set - to respective default shades of gray. For example: if the bit depth is 2 - and the image contains light gray and black, they become the second and - fourth colors, and the first and third colors get set to default white and - dark gray. If the image has multiple shades that map to the same index, - the palette is instead determined as if the image had color.
  • -
  • If the image has color (or the grayscale method failed), the colors are - sorted from lightest to darkest.
  • -
-

The input image may not contain more colors than the selected bit - depth allows. Transparent pixels are set to palette index 0.

-
-
-

-Note that options can be abbreviated as long as the abbreviation is unambiguous: - --verb is - - -verbose, but - --ver is invalid because it - could also be --version. The - arguments are as follows: -
-
- attrmap, - --attr-map - attrmap
-
Generate a file of tile mirroring attributes for OAM or (CGB-only) - background tiles. For each tile in the input file, a byte is written - representing the dimensions that the associated tile in the output file - should be mirrored. Useful in combination with -m - to keep track the mirror direction of mirrored duplicate tiles.
-
, - --output-attr-map
-
Same as -a, but the attrmap file output name is - made by taking the input filename, removing the file extension, and - appending .attrmap.
-
, - --color-curve
-
Use the color curve of the Game Boy Color when generating palettes.
-
, - --debug
-
Debug features are enabled.
-
- depth, - --depth - depth
-
The bit depth of the output image (either 1 or 2). By default, the bit - depth is 2 (two bits per pixel).
-
, - --fix
-
Fix the input PNG file to be a correctly indexed image.
-
, - --fix-and-save
-
Same as -f, but additionally, the supplied command - line parameters are saved within the PNG and will be loaded and - automatically used next time.
-
, - --horizontal
-
Lay out tiles horizontally rather than vertically.
-
, - --mirror-tiles
-
Truncate tiles by checking for tiles that are mirrored versions of others - and omitting these from the output file. Useful with tilemaps and attrmaps - together to keep track of the duplicated tiles and the dimension mirrored. - Tiles are checked for horizontal, vertical, and horizontal-vertical - mirroring. Implies -u.
-
- out_file, - --output - out_file
-
The name of the output file.
-
- pal_file, - --palette - pal_file
-
Output the image's palette in standard GBC palette format: bytes (8 bytes - for two bits per pixel, 4 bytes for one bit per pixel) containing the - RGB15 values in little-endian byte order. If the palette contains too few - colors, the remaining entries are set to black.
-
, - --output-palette
-
Same as -p, but the palette file output name is - made by taking the input PNG file's filename, removing the file extension, - and appending .pal.
-
- tilemap, - --tilemap - tilemap
-
Generate a file of tile indices. For each tile in the input file, a byte - is written representing the index of the associated tile in the output - file. Useful in combination with -u or - -m to keep track of duplicate tiles.
-
, - --output-tilemap
-
Same as -t, but the tilemap file output name is - made by taking the input filename, removing the file extension, and - appending .tilemap.
-
, - --unique-tiles
-
Truncate tiles by checking for tiles that are exact duplicates of others - and omitting these from the output file. Useful with tilemaps to keep - track of the duplicated tiles.
-
, - --version
-
Print the version of the program and exit.
-
, - --verbose
-
Verbose. Print errors when the command line parameters and the parameters - in the PNG file don't match.
-
- tiles, - --trim-end - tiles
-
Trim the end of the output file by this many tiles.
-
-
-
-

-The following will take a PNG file with a bit depth of 1, 2, or 8, and output - planar 2bpp data: -

-
$ rgbgfx -o out.2bpp in.png
-

The following creates a planar 2bpp file with only unique tiles, - and its tilemap out.tilemap:

-

-
$ rgbgfx -T -u -o out.2bpp in.png
-

The following creates a planar 2bpp file with only unique tiles - accounting for tile mirroring and its associated - tilemap out.tilemap and attrmap - out.attrmap:

-

-
$ rgbgfx -A -T -m -o out.2bpp in.png
-

The following will do nothing:

-

-
$ rgbgfx in.png
-
-
-

-Please report bugs on - GitHub. -
-
-

-rgbds(7), rgbasm(1), - rgblink(1), rgbfix(1), - gbz80(7) -
-
-

-rgbgfx was created by stag019 to - be included in RGBDS. It is now maintained by a number of contributors at - https://github.com/rednex/rgbds. -
-
- - - - - -
December 5, 2019General
- - diff --git a/docs/rgblink.1.html b/docs/rgblink.1.html deleted file mode 100644 index d2e1b8d5..00000000 --- a/docs/rgblink.1.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - RGBLINK(1) - - - - - - - - -
RGBLINK(1)General Commands ManualRGBLINK(1)
-
-
-

-rgblink — -Game Boy linker -
-
-

- - - - - -
rgblink[-dtVvwx] [-l - linker_script] [-m - map_file] [-n - sym_file] [-O - overlay_file] [-o - out_file] [-p - pad_value] [-s - symbol] file ...
-
-
-

-The rgblink program links RGB object files, typically - created by rgbasm(1), into a single Game Boy ROM file. The - format is documented in rgbds(5). -

ROM0 sections are placed in the first 16 KiB of the output ROM, - and ROMX sections are placed in any 16 KiB “bank” except the - first. If your ROM will only be 32 KiB, you can use the - -t option to change this.

-

Similarly, WRAM0 sections are placed in the first 4 KiB of WRAM - (“bank 0”), and WRAMX sections are placed in any bank of the - last 4 KiB. If your ROM doesn't use banked WRAM, you can use the - -w option to change this.

-

Also, if your ROM is designed for a monochrome Game Boy, you can - make sure that you don't use any incompatible section by using the - -d option, which implies -w - but also prohibits the use of banked VRAM.

-

Note that options can be abbreviated as long as the abbreviation - is unambiguous: --verb is - --verbose, but - --ver is invalid because it - could also be --version. The - arguments are as follows:

-
-
, - --dmg
-
Enable DMG mode. Prohibit the use of sections that doesn't exist on a DMG, - such as VRAM bank 1. This option automatically enables - -w.
-
- linker_script, - --linkerscript - linker_script
-
Specify a linker script file that tells the linker how sections must be - placed in the ROM. The attributes assigned in the linker script must be - consistent with any assigned in the code. See rgblink(5) - for more information about the linker script format.
-
- map_file, - --map - map_file
-
Write a map file to the given filename, listing how sections and symbols - were assigned.
-
- sym_file, - --sym - sym_file
-
Write a symbol file to the given filename, listing the address of all - exported symbols. Several external programs can use this information, for - example to help debugging ROMs.
-
- overlay_file, - --overlay - overlay_file
-
If specified, sections will be overlaid "on top" of the provided - ROM image. In that case, all sections must be fixed. This may be used to - patch an existing binary.
-
- out_file, - --output - out_file
-
Write the ROM image to the given file.
-
- pad_value, - --pad - pad_value
-
When inserting padding between sections, pad with this value. Has no - effect if -O is specified. The default is 0.
-
- symbol, - --smart - symbol
-
This option is ignored. It was supposed to perform smart linking but fell - into disrepair, and so has been removed. It will be reimplemented at some - point.
-
, - --tiny
-
Expand the ROM0 section size from 16 KiB to the full 32 KiB assigned to - ROM. ROMX sections that are fixed to a bank other than 1 become errors, - other ROMX sections are treated as ROM0. Useful for ROMs that fit in 32 - KiB.
-
, - --version
-
Print the version of the program and exit.
-
, - --verbose
-
Verbose: enable printing more information to standard error.
-
, - --wramx
-
Expand the WRAM0 section size from 4 KiB to the full 8 KiB assigned to - WRAM. WRAMX sections that are fixed to a bank other than 1 become errors, - other WRAMX sections are treated as WRAM0.
-
, - --nopad
-
Disables padding the end of the final file. This option automatically - enables -t. You can use this when not not making a - ROM. When making a ROM, be careful that not using this is not a - replacement for rgbfix(1)'s -p - option!
-
-
-
-

-All you need for a basic ROM is an object file, which can be made into a ROM - image like so: -

-
$ rgblink -o bar.gb foo.o
-

The resulting bar.gb will not have correct - checksums (unless you put them in the assembly source). You should use - rgbfix(1) to fix these so that the program will actually - run in a Game Boy:

-

-
$ rgbfix -v bar.gb
-

Here is a more complete example:

-

-
$ rgblink -o bin/game.gb -n - bin/game.sym -p 0xFF obj/title.o obj/engine.o
-
-
-

-Please report bugs on - GitHub. -
-
-

-rgbasm(1), rgblink(5), - rgbfix(1), rgbds(5), - rgbds(7) -
-
-

-rgblink was originally written by Carsten - Sørensen as part of the ASMotor package, and was later packaged in - RGBDS by Justin Lloyd. It is now maintained by a number of contributors at - https://github.com/rednex/rgbds. -
-
- - - - - -
November 26, 2019General
- - diff --git a/docs/rgblink.5.html b/docs/rgblink.5.html deleted file mode 100644 index 90aa4756..00000000 --- a/docs/rgblink.5.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - RGBLINK(5) - - - - - - - - -
RGBLINK(5)File Formats ManualRGBLINK(5)
-
-
-

-rgblink — -linker script file format -
-
-

-The linker script is an external file that allows the user to specify the order - of sections at link time and in a centralized manner. -

A linker script consists on a series of banks followed by a list - of sections and, optionally, commands. They can be lowercase or uppercase, - it is ignored. Any line can contain a comment starting with - ‘;’ that ends at the end of the - line:

-
-
-ROMX $F ; This is a comment
-  "Functions to read array"
-  ALIGN 8
-  "Array aligned to 256 bytes"
-
-WRAMX 2
-  "Some variables"
-
-
-

Numbers can be in decimal or hexadecimal format (the prefix is - ‘$’). It is an error if any section - name or command is found before setting a bank.

-

Files can be included by using the INCLUDE - keyword, followed by a string with the path of the file that has to be - included.

-

The possible bank types are: ROM0, - ROMX, VRAM, - SRAM, WRAM0, - WRAMX, OAM and - HRAM. Unless there is a single bank, which can occur - with types ROMX, VRAM, - SRAM and WRAMX, it is needed - to specify a bank number after the type.

-

When a new bank statement is found, sections found after it will - be placed right from the beginning of that bank. If the linker script - switches to a different bank and then comes back to a previous one, it will - continue from the last address that was used.

-

The only two commands are ORG and - ALIGN:

-
    -
  • - sets the address in which new sections will be placed. It can not be lower - than the current address.
  • -
  • - will increase the address until it is aligned to the specified boundary - (it tries to set to 0 the number of bits specified after the command: - ‘ALIGN 8’ will align to $100).
  • -
-

Note: The bank, alignment, address and type of - sections can be specified both in the source code and in the linker script. - For a section to be able to be placed with the linker script, the bank, - address and alignment must be left unassigned in the source code or be - compatible with what is specified in the linker script. For example, - ‘ALIGN[8]’ in the source code is - compatible with ‘ORG $F00’ in the - linker script.

-
-
-

-rgbasm(1), rgblink(1), - rgbfix(1), rgbds(5), - rgbds(7) -
-
-

-rgblink was originally written by Carsten - Sørensen as part of the ASMotor package, and was later packaged in - RGBDS by Justin Lloyd. It is now maintained by a number of contributors at - https://github.com/rednex/rgbds. -
-
- - - - - -
November 26, 2019General
- -