Skip to content

Commit 13729e1

Browse files
committed
Use ? to silence macros
1 parent 2e4dece commit 13729e1

File tree

6 files changed

+65
-51
lines changed

6 files changed

+65
-51
lines changed

src/macros/asserts.asm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; Macros to verify assumptions about the data or code
22

3-
MACRO table_width
3+
MACRO? table_width
44
DEF CURRENT_TABLE_WIDTH = \1
55
IF _NARG == 2
66
REDEF CURRENT_TABLE_START EQUS "\2"
@@ -10,24 +10,24 @@ MACRO table_width
1010
ENDC
1111
ENDM
1212

13-
MACRO assert_table_length
13+
MACRO? assert_table_length
1414
DEF x = \1
1515
ASSERT x * CURRENT_TABLE_WIDTH == @ - {CURRENT_TABLE_START}, \
1616
"{CURRENT_TABLE_START}: expected {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes"
1717
ENDM
1818

19-
MACRO deck_list_start
19+
MACRO? deck_list_start
2020
DEF x = 0
2121
ENDM
2222

2323
; \1 = card ID
2424
; \2 = quantity
25-
MACRO card_item
25+
MACRO? card_item
2626
DEF x += \2
2727
db \2, \1
2828
ENDM
2929

30-
MACRO deck_list_end
30+
MACRO? deck_list_end
3131
db 0 ; end of list
3232
ASSERT x == DECK_SIZE, "expected {d:DECK_SIZE} cards, got {d:x}"
3333
ENDM

src/macros/code.asm

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MACRO lb ; r, hi, lo
1+
MACRO? lb ; r, hi, lo
22
ld \1, (\2) << 8 + ((\3) & $ff)
33
ENDM
44

5-
MACRO ldtx
5+
MACRO? ldtx
66
IF _NARG == 2
77
ld \1, \2_
88
ELSE
99
ld \1, \2_ \3
1010
ENDC
1111
ENDM
1212

13-
MACRO bank1call
13+
MACRO? bank1call
1414
rst $18
1515
dw \1
1616
ENDM
1717

18-
MACRO farcall
18+
MACRO? farcall
1919
rst $28
2020
IF _NARG == 1
2121
db BANK(\1)
@@ -27,49 +27,51 @@ MACRO farcall
2727
ENDM
2828

2929
; runs SetEventValue with the next byte as the event, c as the new value
30-
MACRO set_event_value
30+
MACRO? set_event_value
3131
call SetStackEventValue
3232
db \1
3333
ENDM
3434

3535
; runs ZeroOutEventValue with the next byte as the event
3636
; functionally identical to set_event_zero but intended for single-bit events
37-
MACRO set_event_false
37+
MACRO? set_event_false
3838
call SetStackEventFalse
3939
db \1
4040
ENDM
4141

4242
; runs ZeroOutEventValue with the next byte as the event
4343
; functionally identical to set_event_false but intended for multi-bit events
44-
MACRO set_event_zero
44+
MACRO? set_event_zero
4545
call SetStackEventZero
4646
db \1
4747
ENDM
4848

4949
; runs MaxOutEventValue with the next byte as the event
50-
MACRO max_event_value
50+
MACRO? max_event_value
5151
call MaxStackEventValue
5252
db \1
5353
ENDM
5454

5555
; runs GetEventValue with the next byte as the event. returns value in a
56-
MACRO get_event_value
56+
MACRO? get_event_value
5757
call GetStackEventValue
5858
db \1
5959
ENDM
6060

6161
; the rst $38 handler is a single ret instruction
6262
; probably used for testing purposes during development
63-
DEF debug_nop EQUS "rst $38"
63+
MACRO? debug_nop
64+
rst $38
65+
ENDM
6466

6567
; Returns to the pointer in bc instead of where the stack was.
66-
MACRO retbc
68+
MACRO? retbc
6769
push bc
6870
ret
6971
ENDM
7072

7173
; loads into a register the GameBoy (DMG) palette given
7274
; by the arguments as SHADE_* constants
73-
MACRO ldgbpal
75+
MACRO? ldgbpal
7476
ld \1, (\2 << 0) | (\3 << 2) | (\4 << 4) | (\5 << 6)
7577
ENDM

src/macros/constants.asm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
MACRO const_def
1+
MACRO? const_def
22
IF _NARG > 0
33
DEF const_value = \1
44
ELSE
55
DEF const_value = 0
66
ENDC
77
ENDM
88

9-
MACRO const
9+
MACRO? const
1010
DEF \1 EQU const_value
1111
DEF const_value += 1
1212
ENDM
1313

14-
MACRO const_skip
14+
MACRO? const_skip
1515
if _NARG > 0
1616
DEF const_value += \1
1717
else
1818
DEF const_value += 1
1919
endc
2020
ENDM
2121

22-
MACRO event_def
22+
MACRO? event_def
2323
db \1
2424
db \2
2525
ENDM

src/macros/data.asm

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
1-
MACRO dn
2-
REPT _NARG / 2
3-
db ((\1) << 4) | (\2)
4-
SHIFT 2
5-
ENDR
1+
MACRO? dn
2+
REPT _NARG / 2
3+
db ((\1) << 4) | (\2)
4+
SHIFT 2
5+
ENDR
66
ENDM
77

8-
MACRO dbw
8+
MACRO? dbw
99
db \1
1010
dw \2
1111
ENDM
1212

13-
MACRO dwb
13+
MACRO? dwb
1414
dw \1
1515
db \2
1616
ENDM
1717

18-
MACRO dx
18+
MACRO? dx
1919
DEF x = 8 * ((\1) - 1)
20-
REPT \1
20+
REPT? \1
2121
db ((\2) >> x) & $ff
2222
DEF x -= 8
2323
ENDR
2424
ENDM
2525

26-
MACRO dt ; three-byte (big-endian)
26+
MACRO? dt ; three-byte (big-endian)
2727
dx 3, \1
2828
ENDM
2929

30-
MACRO dd ; four-byte (big-endian)
30+
MACRO? dd ; four-byte (big-endian)
3131
dx 4, \1
3232
ENDM
3333

34-
MACRO bigdw ; big-endian word
34+
MACRO? bigdw ; big-endian word
3535
dx 2, \1
3636
ENDM
3737

38-
MACRO sgb
38+
MACRO? sgb
3939
db (\1) << 3 + (\2) ; sgb_command * 8 + length
4040
ENDM
4141

42-
MACRO rgb
42+
MACRO? rgb
4343
dw ((\3) << 10 | (\2) << 5 | (\1))
4444
ENDM
4545

4646
; poketcg specific macros below
4747

48-
MACRO textpointer
48+
MACRO? textpointer
4949
dw (((\1) + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) & $ffff
5050
db (((\1) + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) >> 16
5151
const \1_
5252
EXPORT \1_
5353
ENDM
5454

55-
MACRO energy
55+
MACRO? energy
5656
DEF en = 0
5757
IF _NARG > 1
58-
REPT _NARG / 2
58+
REPT? _NARG / 2
5959
DEF x = 4 - 8 * ((\1) % 2)
6060
DEF en += \2 << (((\1) * 4) + x)
6161
SHIFT 2
6262
ENDR
63-
REPT NUM_TYPES / 2
63+
REPT? NUM_TYPES / 2
6464
db LOW(en)
6565
DEF en >>= 8
6666
ENDR
@@ -69,38 +69,38 @@ MACRO energy
6969
ENDC
7070
ENDM
7171

72-
MACRO gfx
72+
MACRO? gfx
7373
dw ($4000 * (BANK(\1) - BANK(CardGraphics)) + ((\1) - $4000)) / 8
7474
ENDM
7575

76-
MACRO frame_table
76+
MACRO? frame_table
7777
db BANK(\1) - BANK(AnimData1) ; maybe use better reference for Bank20?
7878
dw \1
7979
ENDM
8080

81-
MACRO frame_data
81+
MACRO? frame_data
8282
db \1 ; frame index
8383
db \2 ; anim count
8484
db \3 ; x translation
8585
db \4 ; y translation
8686
ENDM
8787

88-
MACRO tx
88+
MACRO? tx
8989
dw \1_
9090
ENDM
9191

92-
MACRO textitem
92+
MACRO? textitem
9393
db \1, \2
9494
tx \3
9595
ENDM
9696

9797
; cursor x / cursor y / attribute / idx-up / idx-down / idx-right / idx-left
9898
; idx-[direction] means the index to get when the input is in the direction.
9999
; its attribute is used for drawing a flipped cursor.
100-
MACRO cursor_transition
100+
MACRO? cursor_transition
101101
db \1, \2, \3, \4, \5, \6, \7
102102
ENDM
103103

104-
MACRO gbpal
104+
MACRO? gbpal
105105
db (\1 << 0) | (\2 << 2) | (\3 << 4) | (\4 << 6)
106106
ENDM

src/macros/scripts.asm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
DEF start_script EQUS "rst $20"
1+
MACRO start_script
2+
rst $20
3+
ENDM
24

35
MACRO run_command
46
db \1_index

src/macros/text.asm

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
DEF text EQUS "db TX_HALFWIDTH, "
2-
DEF line EQUS "db TX_LINE, "
3-
DEF done EQUS "db TX_END"
1+
MACRO text
2+
db TX_HALFWIDTH, \#
3+
ENDM
4+
5+
MACRO line
6+
db TX_LINE, \#
7+
ENDM
48

5-
DEF half2full EQUS "db TX_HALF2FULL"
9+
MACRO done
10+
db TX_END
11+
ENDM
12+
13+
MACRO half2full
14+
db TX_HALF2FULL
15+
ENDM
616

717
MACRO get_charset
818
PUSHC katakana

0 commit comments

Comments
 (0)