shithub: pokecrystal

ref: 991d207d86c936757e70d2e6a1f6ee6b0e0f5891
dir: /home/print_level.asm/

View raw version
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, Print8BitNumLeftAlign

; 3-digit numbers overwrite the :L.
	dec hl
	inc c
	jr Print8BitNumLeftAlign

PrintLevel_Force3Digits::
; Print :L and all 3 digits
	ld [hl], "<LV>"
	inc hl
	ld c, 3

Print8BitNumLeftAlign::
	ld [wDeciramBuffer], a
	ld de, wDeciramBuffer
	ld b, PRINTNUM_LEFTALIGN | 1
	jp PrintNum