From c2e849aaa2ee59da43984c3d02acf0d60b011ddd Mon Sep 17 00:00:00 2001 From: libjet Date: Wed, 19 Feb 2020 23:35:57 +0000 Subject: Add home/print_level.asm --- home.asm | 22 +--------------------- home/print_level.asm | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 21 deletions(-) create mode 100755 home/print_level.asm diff --git a/home.asm b/home.asm index 283a0e5d..fa5c96cf 100644 --- a/home.asm +++ b/home.asm @@ -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 diff --git a/home/print_level.asm b/home/print_level.asm new file mode 100755 index 00000000..dbe14f74 --- /dev/null +++ b/home/print_level.asm @@ -0,0 +1,28 @@ +PrintLevel:: +; Print wTempMonLevel at hl + + ld a, [wTempMonLevel] + ld [hl], "" + 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], "" + inc hl + ld c, 3 + +Print8BitNumRightAlign:: + ld [wDeciramBuffer], a + ld de, wDeciramBuffer + ld b, PRINTNUM_RIGHTALIGN | 1 + jp PrintNum \ No newline at end of file -- cgit v1.2.3