mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Reorganize math-related HRAM union (ffb3)
This commit is contained in:
parent
919ed1d4f5
commit
b2adcd6d6f
@ -259,7 +259,7 @@ GetTreeScore:
|
||||
ld b, 2
|
||||
call Divide
|
||||
|
||||
ldh a, [hQuotient + 3]
|
||||
ldh a, [hRemainder]
|
||||
ret
|
||||
|
||||
.OTIDScore:
|
||||
@ -271,5 +271,5 @@ GetTreeScore:
|
||||
ldh [hDivisor], a
|
||||
ld b, 2
|
||||
call Divide
|
||||
ldh a, [hQuotient + 3]
|
||||
ldh a, [hRemainder]
|
||||
ret
|
||||
|
@ -239,10 +239,10 @@ Function104a95:
|
||||
cp $6c
|
||||
jr nz, .loop2
|
||||
|
||||
ldh a, [hPrintNum9]
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
cp $2
|
||||
jr z, Function104b22
|
||||
ld hl, hPrintNum1
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d56
|
||||
jr nz, .ly_loop
|
||||
@ -321,7 +321,7 @@ Function104b22:
|
||||
jp Function104bd0
|
||||
|
||||
Function104b40:
|
||||
ld hl, hPrintNum1
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d56
|
||||
ret nz
|
||||
@ -331,14 +331,14 @@ Function104b49:
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp $6c
|
||||
ret nz
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer]
|
||||
cp $96
|
||||
jp nz, Function104d32
|
||||
ld a, $90
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNumBuffer], a
|
||||
call Function104d38
|
||||
ret nz
|
||||
ld hl, hPrintNum1
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d4e
|
||||
ret nz
|
||||
@ -360,8 +360,8 @@ Function104b49:
|
||||
|
||||
Function104b88:
|
||||
ld a, $96
|
||||
ldh [hPrintNum1], a
|
||||
ld hl, hPrintNum1
|
||||
ldh [hPrintNumBuffer], a
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d4e
|
||||
ret nz
|
||||
@ -371,7 +371,7 @@ Function104b88:
|
||||
ret nz
|
||||
call Function104d43
|
||||
ret nz
|
||||
ld hl, hPrintNum1
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d56
|
||||
ret nz
|
||||
@ -379,7 +379,7 @@ Function104b88:
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp $6c
|
||||
ret nz
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer]
|
||||
cp $90
|
||||
jp nz, Function104d32
|
||||
call Function104d38
|
||||
@ -415,7 +415,7 @@ Function104bd0:
|
||||
call MysteryGift_ClearTrainerData
|
||||
ld a, $26
|
||||
ld [wca02], a
|
||||
ldh a, [hPrintNum9]
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
cp $2
|
||||
jr z, .asm_104c10
|
||||
call Function104d43
|
||||
@ -453,7 +453,7 @@ Function104c2d:
|
||||
jp z, Function104d1c
|
||||
cp $6c
|
||||
jr nz, .asm_104c37
|
||||
ldh a, [hPrintNum9]
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
cp $2
|
||||
jr z, .asm_104c6c
|
||||
call Function104c8a
|
||||
@ -479,7 +479,7 @@ Function104c2d:
|
||||
jp Function104d1c
|
||||
|
||||
Function104c8a:
|
||||
ld hl, hPrintNum1
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d56
|
||||
ret nz
|
||||
@ -487,14 +487,14 @@ Function104c8a:
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp $6c
|
||||
ret nz
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer]
|
||||
cp $3c
|
||||
jp nz, Function104d32
|
||||
swap a
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNumBuffer], a
|
||||
call Function104d38
|
||||
ret nz
|
||||
ld hl, hPrintNum1
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d4e
|
||||
ret nz
|
||||
@ -516,8 +516,8 @@ Function104c8a:
|
||||
|
||||
Function104cd2:
|
||||
ld a, $3c
|
||||
ldh [hPrintNum1], a
|
||||
ld hl, hPrintNum1
|
||||
ldh [hPrintNumBuffer], a
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d4e
|
||||
ret nz
|
||||
@ -527,7 +527,7 @@ Function104cd2:
|
||||
ret nz
|
||||
call Function104d43
|
||||
ret nz
|
||||
ld hl, hPrintNum1
|
||||
ld hl, hPrintNumBuffer
|
||||
ld b, $1
|
||||
call Function104d56
|
||||
ret nz
|
||||
@ -535,7 +535,7 @@ Function104cd2:
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp $6c
|
||||
ret nz
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer]
|
||||
swap a
|
||||
cp $3c
|
||||
jp nz, Function104d32
|
||||
@ -641,7 +641,7 @@ Function104d96:
|
||||
ld a, $c0
|
||||
call Function104e8c
|
||||
ld a, $1
|
||||
ldh [hPrintNum9], a
|
||||
ldh [hPrintNumBuffer + 8], a
|
||||
ret
|
||||
|
||||
Function104da0:
|
||||
@ -701,7 +701,7 @@ Function104ddd:
|
||||
ld d, $0
|
||||
ld e, d
|
||||
ld a, $1
|
||||
ldh [hPrintNum9], a
|
||||
ldh [hPrintNumBuffer + 8], a
|
||||
.loop
|
||||
call MysteryGift_ReadJoypad
|
||||
ld b, $2
|
||||
@ -760,7 +760,7 @@ Function104e3a:
|
||||
jr nz, .loop
|
||||
Function104e46:
|
||||
ld a, $2
|
||||
ldh [hPrintNum9], a
|
||||
ldh [hPrintNumBuffer + 8], a
|
||||
ld c, LOW(rRP)
|
||||
ld d, $0
|
||||
ld e, d
|
||||
@ -798,14 +798,14 @@ Function104e8c:
|
||||
|
||||
Function104e93:
|
||||
xor a
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
push hl
|
||||
push bc
|
||||
ld c, LOW(rRP)
|
||||
ld d, $3d
|
||||
call Function104dd1
|
||||
ld hl, hPrintNum2
|
||||
ld hl, hPrintNumBuffer + 1
|
||||
ld a, $5a
|
||||
ld [hli], a
|
||||
ld [hl], b
|
||||
@ -815,21 +815,21 @@ Function104e93:
|
||||
pop bc
|
||||
pop hl
|
||||
call Function104ed6
|
||||
ldh a, [hPrintNum5]
|
||||
ldh [hPrintNum2], a
|
||||
ldh a, [hPrintNum6]
|
||||
ldh [hPrintNum3], a
|
||||
ldh a, [hPrintNumBuffer + 4]
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
ldh a, [hPrintNumBuffer + 5]
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
push hl
|
||||
ld hl, hPrintNum2
|
||||
ld hl, hPrintNumBuffer + 1
|
||||
ld b, $2
|
||||
call Function104ed6
|
||||
ld hl, hMGStatusFlags
|
||||
ld b, $1
|
||||
call Function104faf
|
||||
ldh a, [hPrintNum2]
|
||||
ldh [hPrintNum5], a
|
||||
ldh a, [hPrintNum3]
|
||||
ldh [hPrintNum6], a
|
||||
ldh a, [hPrintNumBuffer + 1]
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ldh a, [hPrintNumBuffer + 2]
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
pop hl
|
||||
ret
|
||||
|
||||
@ -850,15 +850,15 @@ Function104ed6:
|
||||
inc b
|
||||
jr z, .asm_104f2e
|
||||
ld a, $8
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
ldh a, [hPrintNum5]
|
||||
ldh a, [hPrintNumBuffer + 4]
|
||||
add e
|
||||
ldh [hPrintNum5], a
|
||||
ldh a, [hPrintNum6]
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ldh a, [hPrintNumBuffer + 5]
|
||||
adc 0
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
.asm_104f02
|
||||
xor a
|
||||
ldh [rIF], a
|
||||
@ -883,10 +883,10 @@ Function104ed6:
|
||||
ldh [rIF], a
|
||||
halt
|
||||
.asm_104f25
|
||||
ldh a, [hPrintNum4]
|
||||
ldh a, [hPrintNumBuffer + 3]
|
||||
dec a
|
||||
jr z, .asm_104eee
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
jr .asm_104f02
|
||||
.asm_104f2e
|
||||
ld a, $fe
|
||||
@ -920,35 +920,35 @@ Function104f50:
|
||||
|
||||
Function104f57:
|
||||
xor a
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
push bc
|
||||
push hl
|
||||
ld hl, hPrintNum2
|
||||
ld hl, hPrintNumBuffer + 1
|
||||
ld b, $2
|
||||
call Function104faf
|
||||
ldh a, [hPrintNum3]
|
||||
ldh [hPrintNum8], a
|
||||
ldh a, [hPrintNumBuffer + 2]
|
||||
ldh [hPrintNumBuffer + 7], a
|
||||
ld b, a
|
||||
pop hl
|
||||
pop af
|
||||
cp b
|
||||
jp c, Function104f50
|
||||
ldh a, [hPrintNum2]
|
||||
ldh a, [hPrintNumBuffer + 1]
|
||||
cp $5a
|
||||
jp nz, Function104f50
|
||||
call Function104faf
|
||||
ldh a, [hPrintNum5]
|
||||
ldh a, [hPrintNumBuffer + 4]
|
||||
ld d, a
|
||||
ldh a, [hPrintNum6]
|
||||
ldh a, [hPrintNumBuffer + 5]
|
||||
ld e, a
|
||||
push hl
|
||||
push de
|
||||
ld hl, hPrintNum2
|
||||
ld hl, hPrintNumBuffer + 1
|
||||
ld b, $2
|
||||
call Function104faf
|
||||
pop de
|
||||
ld hl, hPrintNum2
|
||||
ld hl, hPrintNumBuffer + 1
|
||||
ld a, [hli]
|
||||
xor d
|
||||
ld b, a
|
||||
@ -965,9 +965,9 @@ Function104f57:
|
||||
pop de
|
||||
pop hl
|
||||
ld a, d
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ld a, e
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
ret
|
||||
|
||||
Function104faf:
|
||||
@ -991,7 +991,7 @@ Function104faf:
|
||||
inc b
|
||||
jr z, .asm_10501a
|
||||
ld a, $8
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
.asm_104fd9
|
||||
ld d, $0
|
||||
.asm_104fdb
|
||||
@ -1020,9 +1020,9 @@ Function104faf:
|
||||
.asm_104ffd
|
||||
res 0, e
|
||||
.asm_104fff
|
||||
ldh a, [hPrintNum4]
|
||||
ldh a, [hPrintNumBuffer + 3]
|
||||
dec a
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
jr z, .asm_10500b
|
||||
ld a, e
|
||||
rlca
|
||||
@ -1031,12 +1031,12 @@ Function104faf:
|
||||
.asm_10500b
|
||||
ld a, e
|
||||
ld [hli], a
|
||||
ldh a, [hPrintNum5]
|
||||
ldh a, [hPrintNumBuffer + 4]
|
||||
add e
|
||||
ldh [hPrintNum5], a
|
||||
ldh a, [hPrintNum6]
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ldh a, [hPrintNumBuffer + 5]
|
||||
adc 0
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
jr .asm_104fd2
|
||||
.asm_10501a
|
||||
call Function104d74
|
||||
|
@ -23,9 +23,9 @@ _PrintNum::
|
||||
|
||||
.main
|
||||
xor a
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNum2], a
|
||||
ldh [hPrintNum3], a
|
||||
ldh [hPrintNumBuffer + 0], a
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
ld a, b
|
||||
and $f
|
||||
cp 1
|
||||
@ -35,26 +35,26 @@ _PrintNum::
|
||||
; maximum 3 bytes
|
||||
.long
|
||||
ld a, [de]
|
||||
ldh [hPrintNum2], a
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ldh [hPrintNum3], a
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
jr .start
|
||||
|
||||
.word
|
||||
ld a, [de]
|
||||
ldh [hPrintNum3], a
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
jr .start
|
||||
|
||||
.byte
|
||||
ld a, [de]
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
|
||||
.start
|
||||
push de
|
||||
@ -81,51 +81,51 @@ _PrintNum::
|
||||
|
||||
.seven
|
||||
ld a, HIGH(1000000 >> 8)
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ld a, HIGH(1000000) ; mid
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
ld a, LOW(1000000)
|
||||
ldh [hPrintNum7], a
|
||||
ldh [hPrintNumBuffer + 6], a
|
||||
call .PrintDigit
|
||||
call .AdvancePointer
|
||||
|
||||
.six
|
||||
ld a, HIGH(100000 >> 8)
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ld a, HIGH(100000) ; mid
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
ld a, LOW(100000)
|
||||
ldh [hPrintNum7], a
|
||||
ldh [hPrintNumBuffer + 6], a
|
||||
call .PrintDigit
|
||||
call .AdvancePointer
|
||||
|
||||
.five
|
||||
xor a ; HIGH(10000 >> 8)
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ld a, HIGH(10000) ; mid
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
ld a, LOW(10000)
|
||||
ldh [hPrintNum7], a
|
||||
ldh [hPrintNumBuffer + 6], a
|
||||
call .PrintDigit
|
||||
call .AdvancePointer
|
||||
|
||||
.four
|
||||
xor a ; HIGH(1000 >> 8)
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
ld a, HIGH(1000) ; mid
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
ld a, LOW(1000)
|
||||
ldh [hPrintNum7], a
|
||||
ldh [hPrintNumBuffer + 6], a
|
||||
call .PrintDigit
|
||||
call .AdvancePointer
|
||||
|
||||
.three
|
||||
xor a ; HIGH(100 >> 8)
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
xor a ; HIGH(100) ; mid
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
ld a, LOW(100)
|
||||
ldh [hPrintNum7], a
|
||||
ldh [hPrintNumBuffer + 6], a
|
||||
call .PrintDigit
|
||||
call .AdvancePointer
|
||||
|
||||
@ -133,11 +133,11 @@ _PrintNum::
|
||||
dec e
|
||||
jr nz, .two_skip
|
||||
ld a, "0"
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNumBuffer + 0], a
|
||||
.two_skip
|
||||
|
||||
ld c, 0
|
||||
ldh a, [hPrintNum4]
|
||||
ldh a, [hPrintNumBuffer + 3]
|
||||
.mod_10
|
||||
cp 10
|
||||
jr c, .modded_10
|
||||
@ -147,7 +147,7 @@ _PrintNum::
|
||||
.modded_10
|
||||
|
||||
ld b, a
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer + 0]
|
||||
or c
|
||||
jr nz, .money
|
||||
call .PrintLeadingZero
|
||||
@ -160,7 +160,7 @@ _PrintNum::
|
||||
add c
|
||||
ld [hl], a
|
||||
pop af
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNumBuffer + 0], a
|
||||
inc e
|
||||
dec e
|
||||
jr nz, .money_leading_zero
|
||||
@ -180,7 +180,7 @@ _PrintNum::
|
||||
|
||||
.PrintYen:
|
||||
push af
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer + 0]
|
||||
and a
|
||||
jr nz, .stop
|
||||
bit 5, d
|
||||
@ -197,68 +197,68 @@ _PrintNum::
|
||||
dec e
|
||||
jr nz, .ok
|
||||
ld a, "0"
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNumBuffer + 0], a
|
||||
.ok
|
||||
ld c, 0
|
||||
.loop
|
||||
ldh a, [hPrintNum5]
|
||||
ldh a, [hPrintNumBuffer + 4]
|
||||
ld b, a
|
||||
ldh a, [hPrintNum2]
|
||||
ldh [hPrintNum8], a
|
||||
ldh a, [hPrintNumBuffer + 1]
|
||||
ldh [hPrintNumBuffer + 7], a
|
||||
cp b
|
||||
jr c, .skip1
|
||||
sub b
|
||||
ldh [hPrintNum2], a
|
||||
ldh a, [hPrintNum6]
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
ldh a, [hPrintNumBuffer + 5]
|
||||
ld b, a
|
||||
ldh a, [hPrintNum3]
|
||||
ldh [hPrintNum9], a
|
||||
ldh a, [hPrintNumBuffer + 2]
|
||||
ldh [hPrintNumBuffer + 8], a
|
||||
cp b
|
||||
jr nc, .skip2
|
||||
ldh a, [hPrintNum2]
|
||||
ldh a, [hPrintNumBuffer + 1]
|
||||
or 0
|
||||
jr z, .skip3
|
||||
dec a
|
||||
ldh [hPrintNum2], a
|
||||
ldh a, [hPrintNum3]
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
ldh a, [hPrintNumBuffer + 2]
|
||||
.skip2
|
||||
sub b
|
||||
ldh [hPrintNum3], a
|
||||
ldh a, [hPrintNum7]
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
ldh a, [hPrintNumBuffer + 6]
|
||||
ld b, a
|
||||
ldh a, [hPrintNum4]
|
||||
ldh [hPrintNum10], a
|
||||
ldh a, [hPrintNumBuffer + 3]
|
||||
ldh [hPrintNumBuffer + 9], a
|
||||
cp b
|
||||
jr nc, .skip4
|
||||
ldh a, [hPrintNum3]
|
||||
ldh a, [hPrintNumBuffer + 2]
|
||||
and a
|
||||
jr nz, .skip5
|
||||
ldh a, [hPrintNum2]
|
||||
ldh a, [hPrintNumBuffer + 1]
|
||||
and a
|
||||
jr z, .skip6
|
||||
dec a
|
||||
ldh [hPrintNum2], a
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
xor a
|
||||
.skip5
|
||||
dec a
|
||||
ldh [hPrintNum3], a
|
||||
ldh a, [hPrintNum4]
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
ldh a, [hPrintNumBuffer + 3]
|
||||
.skip4
|
||||
sub b
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
inc c
|
||||
jr .loop
|
||||
.skip6
|
||||
ldh a, [hPrintNum9]
|
||||
ldh [hPrintNum3], a
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
.skip3
|
||||
ldh a, [hPrintNum8]
|
||||
ldh [hPrintNum2], a
|
||||
ldh a, [hPrintNumBuffer + 7]
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
.skip1
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer + 0]
|
||||
or c
|
||||
jr z, .PrintLeadingZero
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer + 0]
|
||||
and a
|
||||
jr nz, .done
|
||||
bit 5, d
|
||||
@ -270,7 +270,7 @@ _PrintNum::
|
||||
ld a, "0"
|
||||
add c
|
||||
ld [hl], a
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNumBuffer + 0], a
|
||||
inc e
|
||||
dec e
|
||||
ret nz
|
||||
@ -292,7 +292,7 @@ _PrintNum::
|
||||
jr nz, .inc
|
||||
bit 6, d ; left alignment or right alignment?
|
||||
jr z, .inc
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer + 0]
|
||||
and a
|
||||
ret z
|
||||
.inc
|
||||
|
42
hram.asm
42
hram.asm
@ -62,45 +62,41 @@ ENDU ; ffb1
|
||||
hEnemyMonSpeed:: dw ; ffb1
|
||||
|
||||
UNION ; ffb3
|
||||
; miscellaneous
|
||||
ds 2
|
||||
hPartyMon1Speed:: dw ; ffb5
|
||||
ds 5
|
||||
hMGStatusFlags:: db ; ffbc
|
||||
|
||||
NEXTU ; ffb3
|
||||
hDividend:: ds 4 ; ffb3
|
||||
hDivisor:: db ; ffb7
|
||||
|
||||
NEXTU ; ffb3
|
||||
ds 1
|
||||
hQuotient:: ds 3 ; ffb4
|
||||
hRemainder:: db ; ffb7
|
||||
|
||||
NEXTU ; ffb3
|
||||
; inputs to Multiply
|
||||
ds 1
|
||||
hMultiplicand:: ds 3 ; ffb4
|
||||
hMultiplier:: db ; ffb7
|
||||
|
||||
NEXTU ; ffb3
|
||||
; result of Multiply
|
||||
hProduct:: ds 4 ; ffb3
|
||||
|
||||
NEXTU ; ffb3
|
||||
; inputs to Divide
|
||||
hDividend:: ds 4 ; ffb3
|
||||
hDivisor:: db ; ffb7
|
||||
|
||||
NEXTU ; ffb3
|
||||
; results of Divide
|
||||
ds 1
|
||||
hQuotient:: ds 3 ; ffb4
|
||||
hRemainder:: db ; ffb7
|
||||
|
||||
NEXTU ; ffb3
|
||||
; math-related scratch space
|
||||
ds 5
|
||||
hMathBuffer:: ds 5 ; ffb8
|
||||
|
||||
NEXTU ; ffb3
|
||||
hPrintNum1:: db ; ffb3
|
||||
hPrintNum2:: db ; ffb4
|
||||
hPrintNum3:: db ; ffb5
|
||||
hPrintNum4:: db ; ffb6
|
||||
hPrintNum5:: db ; ffb7
|
||||
hPrintNum6:: db ; ffb8
|
||||
hPrintNum7:: db ; ffb9
|
||||
hPrintNum8:: db ; ffba
|
||||
hPrintNum9:: db ; ffbb
|
||||
hPrintNum10:: db ; ffbc
|
||||
|
||||
NEXTU ; ffb3
|
||||
ds 9
|
||||
hMGStatusFlags:: db ; ffbc
|
||||
; PrintNum scratch space
|
||||
hPrintNumBuffer:: ds 10 ; ffb3
|
||||
ENDU ; ffbd
|
||||
|
||||
hUsedSpriteIndex:: db ; ffbd
|
||||
|
@ -586,9 +586,9 @@ _MobilePrintNum::
|
||||
; hl: where to print the converted string
|
||||
push bc
|
||||
xor a
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNum2], a
|
||||
ldh [hPrintNum3], a
|
||||
ldh [hPrintNumBuffer + 0], a
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
ld a, b
|
||||
and $f
|
||||
cp $1
|
||||
@ -599,29 +599,29 @@ _MobilePrintNum::
|
||||
jr z, .three_bytes
|
||||
; four bytes
|
||||
ld a, [de]
|
||||
ldh [hPrintNum1], a
|
||||
ldh [hPrintNumBuffer + 0], a
|
||||
inc de
|
||||
|
||||
.three_bytes
|
||||
ld a, [de]
|
||||
ldh [hPrintNum2], a
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
inc de
|
||||
|
||||
.two_bytes
|
||||
ld a, [de]
|
||||
ldh [hPrintNum3], a
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
inc de
|
||||
|
||||
.one_byte
|
||||
ld a, [de]
|
||||
ldh [hPrintNum4], a
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
inc de
|
||||
|
||||
push de
|
||||
xor a
|
||||
ldh [hPrintNum9], a
|
||||
ldh [hPrintNumBuffer + 8], a
|
||||
ld a, b
|
||||
ldh [hPrintNum10], a
|
||||
ldh [hPrintNumBuffer + 9], a
|
||||
ld a, c
|
||||
cp 2
|
||||
jr z, .two_digits
|
||||
@ -668,7 +668,7 @@ endr
|
||||
|
||||
.two_digits
|
||||
ld c, 0
|
||||
ldh a, [hPrintNum4]
|
||||
ldh a, [hPrintNumBuffer + 3]
|
||||
.mod_ten_loop
|
||||
cp 10
|
||||
jr c, .simple_divide_done
|
||||
@ -678,9 +678,9 @@ endr
|
||||
|
||||
.simple_divide_done
|
||||
ld b, a
|
||||
ldh a, [hPrintNum9]
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
or c
|
||||
ldh [hPrintNum9], a
|
||||
ldh [hPrintNumBuffer + 8], a
|
||||
jr nz, .create_digit
|
||||
call .LoadMinusTenIfNegative
|
||||
jr .done
|
||||
@ -714,53 +714,53 @@ endr
|
||||
ld a, [de]
|
||||
dec de
|
||||
ld b, a
|
||||
ldh a, [hPrintNum4]
|
||||
ldh a, [hPrintNumBuffer + 3]
|
||||
sub b
|
||||
ldh [hPrintNum8], a
|
||||
ldh [hPrintNumBuffer + 7], a
|
||||
ld a, [de]
|
||||
dec de
|
||||
ld b, a
|
||||
ldh a, [hPrintNum3]
|
||||
ldh a, [hPrintNumBuffer + 2]
|
||||
sbc b
|
||||
ldh [hPrintNum7], a
|
||||
ldh [hPrintNumBuffer + 6], a
|
||||
ld a, [de]
|
||||
dec de
|
||||
ld b, a
|
||||
ldh a, [hPrintNum2]
|
||||
ldh a, [hPrintNumBuffer + 1]
|
||||
sbc b
|
||||
ldh [hPrintNum6], a
|
||||
ldh [hPrintNumBuffer + 5], a
|
||||
ld a, [de]
|
||||
inc de
|
||||
inc de
|
||||
inc de
|
||||
ld b, a
|
||||
ldh a, [hPrintNum1]
|
||||
ldh a, [hPrintNumBuffer + 0]
|
||||
sbc b
|
||||
ldh [hPrintNum5], a
|
||||
ldh [hPrintNumBuffer + 4], a
|
||||
jr c, .asm_1062eb
|
||||
ldh a, [hPrintNum5]
|
||||
ldh [hPrintNum1], a
|
||||
ldh a, [hPrintNum6]
|
||||
ldh [hPrintNum2], a
|
||||
ldh a, [hPrintNum7]
|
||||
ldh [hPrintNum3], a
|
||||
ldh a, [hPrintNum8]
|
||||
ldh [hPrintNum4], a
|
||||
ldh a, [hPrintNumBuffer + 4]
|
||||
ldh [hPrintNumBuffer + 0], a
|
||||
ldh a, [hPrintNumBuffer + 5]
|
||||
ldh [hPrintNumBuffer + 1], a
|
||||
ldh a, [hPrintNumBuffer + 6]
|
||||
ldh [hPrintNumBuffer + 2], a
|
||||
ldh a, [hPrintNumBuffer + 7]
|
||||
ldh [hPrintNumBuffer + 3], a
|
||||
inc c
|
||||
jr .asm_1062b4
|
||||
|
||||
.asm_1062eb
|
||||
ldh a, [hPrintNum9]
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
or c
|
||||
jr z, .LoadMinusTenIfNegative
|
||||
ld a, -10
|
||||
add c
|
||||
ld [hl], a
|
||||
ldh [hPrintNum9], a
|
||||
ldh [hPrintNumBuffer + 8], a
|
||||
ret
|
||||
|
||||
.LoadMinusTenIfNegative:
|
||||
ldh a, [hPrintNum10]
|
||||
ldh a, [hPrintNumBuffer + 9]
|
||||
bit 7, a
|
||||
ret z
|
||||
|
||||
@ -768,12 +768,12 @@ endr
|
||||
ret
|
||||
|
||||
.Function1062ff:
|
||||
ldh a, [hPrintNum10]
|
||||
ldh a, [hPrintNumBuffer + 9]
|
||||
bit 7, a
|
||||
jr nz, .asm_10630d
|
||||
bit 6, a
|
||||
jr z, .asm_10630d
|
||||
ldh a, [hPrintNum9]
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
and a
|
||||
ret z
|
||||
|
||||
|
@ -5148,7 +5148,7 @@ Function11a80c:
|
||||
ld bc, hQuotient
|
||||
ld hl, Unknown_11a8ba
|
||||
call Function11a88c
|
||||
ld bc, hPrintNum3
|
||||
ld bc, hPrintNumBuffer + 2
|
||||
ld hl, Unknown_11a8da
|
||||
call Function11a88c
|
||||
xor a
|
||||
@ -5156,11 +5156,11 @@ Function11a80c:
|
||||
ldh a, [hDivisor]
|
||||
and $f
|
||||
ld e, a
|
||||
ldh a, [hPrintNum7]
|
||||
ldh a, [hPrintNumBuffer + 6]
|
||||
and $f
|
||||
call Function11a884
|
||||
ld e, a
|
||||
ldh a, [hPrintNum9]
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
and $f
|
||||
call Function11a884
|
||||
ld [wcd62], a
|
||||
@ -5172,12 +5172,12 @@ Function11a80c:
|
||||
swap a
|
||||
call Function11a884
|
||||
ld e, a
|
||||
ldh a, [hPrintNum7]
|
||||
ldh a, [hPrintNumBuffer + 6]
|
||||
and $f0
|
||||
swap a
|
||||
call Function11a884
|
||||
ld e, a
|
||||
ldh a, [hPrintNum9]
|
||||
ldh a, [hPrintNumBuffer + 8]
|
||||
and $f0
|
||||
swap a
|
||||
call Function11a884
|
||||
@ -5189,11 +5189,11 @@ Function11a80c:
|
||||
and $f
|
||||
call Function11a884
|
||||
ld e, a
|
||||
ldh a, [hPrintNum8]
|
||||
ldh a, [hPrintNumBuffer + 7]
|
||||
and $f
|
||||
call Function11a884
|
||||
ld e, a
|
||||
ldh a, [hPrintNum10]
|
||||
ldh a, [hPrintNumBuffer + 9]
|
||||
and $f
|
||||
call Function11a884
|
||||
ld [wcd64], a
|
||||
|
Loading…
Reference in New Issue
Block a user