Skip to content

Commit

Permalink
Rename dt and dd to bigdt and bigdd
Browse files Browse the repository at this point in the history
This makes their big-endianness obvious and matches `dw`
  • Loading branch information
Rangi42 committed Oct 17, 2024
1 parent 80d17e1 commit fe8254c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 33 deletions.
5 changes: 2 additions & 3 deletions data/items/mom_phone.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
MACRO momitem
; money to trigger, cost, kind, item
dt \1
dt \2
bigdt \1, \2
db \3, \4
ENDM

Expand All @@ -26,4 +25,4 @@ MomItems_2:
momitem 100000, 22800, MOM_DOLL, DECO_BIG_SNORLAX_DOLL
.End

dt 0 ; unused
bigdt 0 ; unused
29 changes: 9 additions & 20 deletions engine/events/mom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -554,26 +554,15 @@ Mom_WithdrawDepositMenuJoypad:
ret

.DigitQuantities:
dt 100000
dt 10000
dt 1000
dt 100
dt 10
dt 1

dt 100000
dt 10000
dt 1000
dt 100
dt 10
dt 1

dt 900000
dt 90000
dt 9000
dt 900
dt 90
dt 9
for x, 5, -1, -1
bigdt 10**x
endr
for x, 5, -1, -1
bigdt 10**x
endr
for x, 5, -1, -1
bigdt 9 * 10**x
endr

MomLeavingText1:
text_far _MomLeavingText1
Expand Down
2 changes: 1 addition & 1 deletion engine/events/money.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GiveMoney::
ret

MaxMoney:
dt MAX_MONEY
bigdt MAX_MONEY

TakeMoney::
ld a, 3
Expand Down
21 changes: 15 additions & 6 deletions macros/data.asm
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,25 @@ MACRO dc ; "crumbs"
endr
ENDM

MACRO dt ; three-byte (big-endian)
db LOW((\1) >> 16), HIGH(\1), LOW(\1)
MACRO bigdw ; big-endian word
rept _NARG
db HIGH(\1), LOW(\1)
shift
endr
ENDM

MACRO dd ; four-byte (big-endian)
db HIGH((\1) >> 16), LOW((\1) >> 16), HIGH(\1), LOW(\1)
MACRO bigdt ; big-endian "tribyte"
rept _NARG
db LOW((\1) >> 16), HIGH(\1), LOW(\1)
shift
endr
ENDM

MACRO bigdw ; big-endian word
db HIGH(\1), LOW(\1)
MACRO bigdd ; big-endian "double word"
rept _NARG
db HIGH((\1) >> 16), LOW((\1) >> 16), HIGH(\1), LOW(\1)
shift
endr
ENDM

MACRO dba ; dbw bank, address
Expand Down
8 changes: 8 additions & 0 deletions macros/legacy.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ ENDM

; macros/data.asm

MACRO dt
bigdt \1
ENDM

MACRO dd
bigdd \1
ENDM

MACRO dbbw
db \1, \2
dw \3
Expand Down
6 changes: 3 additions & 3 deletions macros/scripts/events.asm
Original file line number Diff line number Diff line change
Expand Up @@ -229,21 +229,21 @@ ENDM
MACRO givemoney
db givemoney_command
db \1 ; account
dt \2 ; money
bigdt \2 ; money
ENDM

const takemoney_command ; $23
MACRO takemoney
db takemoney_command
db \1 ; account
dt \2 ; money
bigdt \2 ; money
ENDM

const checkmoney_command ; $24
MACRO checkmoney
db checkmoney_command
db \1 ; account
dt \2 ; money
bigdt \2 ; money
ENDM

const givecoins_command ; $25
Expand Down

0 comments on commit fe8254c

Please sign in to comment.