WIP code for elapsed time

not finished, doesn't work right
This commit is contained in:
Brooke 2025-06-22 20:00:35 -07:00
commit 689363d083

View file

@ -162,12 +162,28 @@ str_padding:
str_padding_end:
.byte 0
str_space:
.byte " "
.byte 0
str_h:
.byte "h"
.byte 0
str_m:
.byte "m"
.byte 0
str_s:
.byte "s"
.byte 0
str_speed_len = str_speed_end - str_speed
str_run_len = str_run_end - str_run
str_done_len = str_done_end - str_done
str_padding_len = str_padding_end - str_padding
speed_start = 40 - str_done_len - str_speed_len - str_padding_len - 1
; "3h59m59s"
str_elapsed_spacer = 8
speed_start = 40 - str_done_len - str_speed_len - str_padding_len - str_elapsed_spacer - 1
col_x = 1
str_x:
@ -1953,6 +1969,55 @@ update_status:
; convert to ASCII in INBUFF and print
jsr FASC
jsr draw_string
; elapsed time
; FR0 = total_sec
ldx #.lobyte(total_sec)
ldy #.hibyte(total_sec)
jsr FLD0R
; FR0 -> integer -> temp
jsr FPI
lda FR0
sta temp
lda FR0 + 1
sta temp + 1
.macro countdown divisor, string
.scope
; count the hours
ldx #0
countdown_loop:
lda temp + 1
cmp #.hibyte(divisor)
bmi countdown_done
lda temp
cmp #.lobyte(divisor)
bmi countdown_done
sec
lda temp
sbc #.lobyte(divisor)
sta temp
lda temp + 1
sbc #.hibyte(divisor)
sta temp + 1
inx
jmp countdown_loop
countdown_done:
stx FR0
ldx #0
stx FR0 + 1
jsr IFP
jsr FASC
jsr draw_string
draw_string_const string
.endscope
.endmacro
draw_string_const str_space
countdown 3600, str_h
countdown 60, str_m
countdown 1, str_s
skipped:
; sx += fill_level[fill_masks] + 1