shithub: pokecrystal

Download patch

ref: b2adcd6d6ff91efc764a6ecc65147be7b9cda9e8
parent: 919ed1d4f586e5e64a0f565513937fb47e4f8fba
author: Rangi <[email protected]>
date: Sat Aug 25 17:49:26 EDT 2018

Reorganize math-related HRAM union (ffb3)

--- a/engine/events/treemons.asm
+++ b/engine/events/treemons.asm
@@ -259,7 +259,7 @@
 	ld b, 2
 	call Divide
 
-	ldh a, [hQuotient + 3]
+	ldh a, [hRemainder]
 	ret
 
 .OTIDScore:
@@ -271,5 +271,5 @@
 	ldh [hDivisor], a
 	ld b, 2
 	call Divide
-	ldh a, [hQuotient + 3]
+	ldh a, [hRemainder]
 	ret
--- a/engine/link/mystery_gift.asm
+++ b/engine/link/mystery_gift.asm
@@ -239,10 +239,10 @@
 	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 @@
 	jp Function104bd0
 
 Function104b40:
-	ld hl, hPrintNum1
+	ld hl, hPrintNumBuffer
 	ld b, $1
 	call Function104d56
 	ret nz
@@ -331,14 +331,14 @@
 	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 @@
 
 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 @@
 	ret nz
 	call Function104d43
 	ret nz
-	ld hl, hPrintNum1
+	ld hl, hPrintNumBuffer
 	ld b, $1
 	call Function104d56
 	ret nz
@@ -379,7 +379,7 @@
 	ldh a, [hMGStatusFlags]
 	cp $6c
 	ret nz
-	ldh a, [hPrintNum1]
+	ldh a, [hPrintNumBuffer]
 	cp $90
 	jp nz, Function104d32
 	call Function104d38
@@ -415,7 +415,7 @@
 	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 @@
 	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 @@
 	jp Function104d1c
 
 Function104c8a:
-	ld hl, hPrintNum1
+	ld hl, hPrintNumBuffer
 	ld b, $1
 	call Function104d56
 	ret nz
@@ -487,14 +487,14 @@
 	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 @@
 
 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 @@
 	ret nz
 	call Function104d43
 	ret nz
-	ld hl, hPrintNum1
+	ld hl, hPrintNumBuffer
 	ld b, $1
 	call Function104d56
 	ret nz
@@ -535,7 +535,7 @@
 	ldh a, [hMGStatusFlags]
 	cp $6c
 	ret nz
-	ldh a, [hPrintNum1]
+	ldh a, [hPrintNumBuffer]
 	swap a
 	cp $3c
 	jp nz, Function104d32
@@ -641,7 +641,7 @@
 	ld a, $c0
 	call Function104e8c
 	ld a, $1
-	ldh [hPrintNum9], a
+	ldh [hPrintNumBuffer + 8], a
 	ret
 
 Function104da0:
@@ -701,7 +701,7 @@
 	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 @@
 	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 @@
 
 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 @@
 	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 @@
 	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 @@
 	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 @@
 
 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 @@
 	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 @@
 	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 @@
 .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 @@
 .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
--- a/engine/math/print_num.asm
+++ b/engine/math/print_num.asm
@@ -23,9 +23,9 @@
 
 .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 @@
 ; 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 @@
 
 .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 @@
 	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 @@
 .modded_10
 
 	ld b, a
-	ldh a, [hPrintNum1]
+	ldh a, [hPrintNumBuffer + 0]
 	or c
 	jr nz, .money
 	call .PrintLeadingZero
@@ -160,7 +160,7 @@
 	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 @@
 
 .PrintYen:
 	push af
-	ldh a, [hPrintNum1]
+	ldh a, [hPrintNumBuffer + 0]
 	and a
 	jr nz, .stop
 	bit 5, d
@@ -197,68 +197,68 @@
 	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 @@
 	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 @@
 	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
--- a/hram.asm
+++ b/hram.asm
@@ -62,45 +62,41 @@
 hEnemyMonSpeed:: dw ; ffb1
 
 UNION ; ffb3
+; miscellaneous
 	ds 2
 hPartyMon1Speed:: dw ; ffb5
+	ds 5
+hMGStatusFlags:: db ; ffbc
 
 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
-	ds 1
-hMultiplicand:: ds 3 ; ffb4
-hMultiplier:: db ; ffb7
-
-NEXTU ; ffb3
-hProduct:: ds 4 ; ffb3
-
-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
--- a/mobile/mobile_41.asm
+++ b/mobile/mobile_41.asm
@@ -586,9 +586,9 @@
 ; 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 @@
 	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 @@
 
 .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 @@
 
 .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 @@
 	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 @@
 	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
 
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -5148,7 +5148,7 @@
 	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 @@
 	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 @@
 	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 @@
 	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