2020-10-06 22:09:33 +00:00
|
|
|
PrintFiveDigitNumber: ; unreferenced
|
2020-10-05 20:15:57 +00:00
|
|
|
; Debug function?
|
2020-10-06 00:10:01 +00:00
|
|
|
; Input: bc = value, de = destination
|
2017-12-16 02:22:26 +00:00
|
|
|
ld a, b
|
|
|
|
ld b, c
|
|
|
|
ld c, a
|
2020-10-06 00:10:01 +00:00
|
|
|
push bc ; de points to this on the stack for PrintNum
|
2017-12-16 02:22:26 +00:00
|
|
|
push de
|
2020-06-17 14:39:17 +00:00
|
|
|
ld hl, sp+2
|
2017-12-16 02:22:26 +00:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 2, 5
|
|
|
|
call PrintNum
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PrintHoursMins:
|
2017-12-16 02:22:26 +00:00
|
|
|
; Hours in b, minutes in c
|
|
|
|
ld a, b
|
|
|
|
cp 12
|
|
|
|
push af
|
|
|
|
jr c, .AM
|
|
|
|
jr z, .PM
|
|
|
|
sub 12
|
|
|
|
jr .PM
|
|
|
|
.AM:
|
|
|
|
or a
|
|
|
|
jr nz, .PM
|
|
|
|
ld a, 12
|
|
|
|
.PM:
|
|
|
|
ld b, a
|
|
|
|
; Crazy stuff happening with the stack
|
|
|
|
push bc
|
2020-06-17 14:39:17 +00:00
|
|
|
ld hl, sp+1
|
2017-12-16 02:22:26 +00:00
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ld [hl], " "
|
|
|
|
lb bc, 1, 2
|
|
|
|
call PrintNum
|
|
|
|
ld [hl], ":"
|
|
|
|
inc hl
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2020-06-17 14:39:17 +00:00
|
|
|
ld hl, sp+0
|
2017-12-16 02:22:26 +00:00
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
call PrintNum
|
|
|
|
pop bc
|
|
|
|
ld de, String_AM
|
|
|
|
pop af
|
|
|
|
jr c, .place_am_pm
|
|
|
|
ld de, String_PM
|
|
|
|
.place_am_pm
|
|
|
|
inc hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
String_AM: db "AM@"
|
|
|
|
String_PM: db "PM@"
|