Add home/print_level.asm

This commit is contained in:
libjet
2020-02-19 23:35:57 +00:00
parent d1bc3af431
commit c2e849aaa2
2 changed files with 29 additions and 21 deletions

View File

@@ -262,27 +262,7 @@ INCLUDE "home/stone_queue.asm"
INCLUDE "home/trainers.asm"
INCLUDE "home/mon_stats.asm"
INCLUDE "home/cry.asm"
PrintLevel:: ; 3a50
ld a, [wTempMonLevel]
ld [hl], $6e
inc hl
ld c, $2
cp MAX_LEVEL
jr c, Print8BitNumRightAlign
dec hl
inc c
jr Print8BitNumRightAlign
PrintLevel_Force3Digits::
ld [hl], $6e
inc hl
ld c, $3
Print8BitNumRightAlign::
ld [wd151], a
ld de, wd151
ld b, PRINTNUM_RIGHTALIGN | 1
jp PrintNum
INCLUDE "home/print_level.asm"
Function3a70::
ld hl, wd149

28
home/print_level.asm Executable file
View File

@@ -0,0 +1,28 @@
PrintLevel::
; Print wTempMonLevel at hl
ld a, [wTempMonLevel]
ld [hl], "<LV>"
inc hl
; How many digits?
ld c, 2
cp 100 ; This is distinct from MAX_LEVEL.
jr c, Print8BitNumRightAlign
; 3-digit numbers overwrite the :L.
dec hl
inc c
jr Print8BitNumRightAlign
PrintLevel_Force3Digits::
; Print :L and all 3 digits
ld [hl], "<LV>"
inc hl
ld c, 3
Print8BitNumRightAlign::
ld [wDeciramBuffer], a
ld de, wDeciramBuffer
ld b, PRINTNUM_RIGHTALIGN | 1
jp PrintNum