summaryrefslogtreecommitdiff
path: root/src/macros/code.asm
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2018-02-10 14:11:36 +0100
committerxCrystal <rgr.crystal@gmail.com>2018-02-10 14:11:36 +0100
commitf541f5e03adadf0b9315cc642da9a5b377b52c12 (patch)
tree3aa0db9181a57a8dd5456955f7957a1950fe1400 /src/macros/code.asm
parent4d594f0e320b5eda3a6bc503392c88131358d3ce (diff)
Refractor/rearrange some macros
Diffstat (limited to 'src/macros/code.asm')
-rw-r--r--src/macros/code.asm60
1 files changed, 7 insertions, 53 deletions
diff --git a/src/macros/code.asm b/src/macros/code.asm
index 1721d75..47b698f 100644
--- a/src/macros/code.asm
+++ b/src/macros/code.asm
@@ -3,11 +3,11 @@ INCBIN "baserom.gbc", \1, \2 - \1
ENDM
const_def: MACRO
-IF _NARG > 0
+if _NARG > 0
const_value = \1
-ELSE
+else
const_value = 0
-ENDC
+endc
ENDM
const: MACRO
@@ -15,44 +15,14 @@ const: MACRO
const_value = const_value + 1
ENDM
-dn: MACRO
- db \1 << 4 | \2
-ENDM
-
-dbw: MACRO
- db \1
- dw \2
-ENDM
-
-dwb: MACRO
- dw \1
- db \2
-ENDM
-
-dx: MACRO
-x = 8 * ((\1) - 1)
- rept \1
- db ((\2) >> x) & $ff
-x = x + -8
- endr
- ENDM
-
-dt: MACRO ; three-byte (big-endian)
- dx 3, \1
- ENDM
-
-dd: MACRO ; four-byte (big-endian)
- dx 4, \1
- ENDM
-
-bigdw: MACRO ; big-endian word
- dx 2, \1
- ENDM
-
lb: MACRO ; r, hi, lo
ld \1, (\2) << 8 + ((\3) & $ff)
ENDM
+ldtx: MACRO
+ ld \1, \2_
+ENDM
+
bank1call: MACRO
rst $18
dw \1
@@ -78,25 +48,9 @@ emptybank: MACRO
endr
ENDM
-rgb: MACRO
- dw (\3 << 10 | \2 << 5 | \1)
-ENDM
-
textpointer: MACRO
dw ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) & $ffff
db ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) >> 16
const \1_
GLOBAL \1_
ENDM
-
-text_hl: MACRO
- ld hl, \1_
-ENDM
-
-text_de: MACRO
- ld de, \1_
-ENDM
-
-sgb: MACRO
- db \1 * 8 + \2 ; sgb_command * 8 + length
-ENDM