Ah that's better

used the appropriate instruction for comparison
This commit is contained in:
Brooke Vibber 2025-06-22 23:10:43 -07:00
commit 5cf64970c8

View file

@ -398,6 +398,11 @@ viewport_oy:
.dword ($fffe0000 & $3fffffff) << 2 .dword ($fffe0000 & $3fffffff) << 2
.dword $ff000000 .dword $ff000000
elapsed_work:
.dword 0
elapsed_digit:
.byte 0
; 2 + 9 * byte cycles ; 2 + 9 * byte cycles
.macro add bytes, dest, arg1, arg2 .macro add bytes, dest, arg1, arg2
clc ; 2 cyc clc ; 2 cyc
@ -1979,12 +1984,12 @@ update_status:
ldx #.lobyte(total_sec) ldx #.lobyte(total_sec)
ldy #.hibyte(total_sec) ldy #.hibyte(total_sec)
jsr FLD0R jsr FLD0R
; FR0 -> integer -> temp ; FR0 -> integer -> elapsed_work
jsr FPI jsr FPI
lda FR0 lda FR0
sta temp sta elapsed_work
lda FR0 + 1 lda FR0 + 1
sta temp + 1 sta elapsed_work + 1
;jsr IFP ;jsr IFP
;jsr FASC ;jsr FASC
@ -1995,28 +2000,28 @@ update_status:
; count the hours ; count the hours
ldx #0 ldx #0
countdown_loop: countdown_loop:
lda temp + 1 lda elapsed_work + 1
cmp #.hibyte(divisor) cmp #.hibyte(divisor)
bmi countdown_done bcc countdown_done
lda temp lda elapsed_work
cmp #.lobyte(divisor) cmp #.lobyte(divisor)
bmi countdown_done bcc countdown_done
sec sec
lda temp lda elapsed_work
sbc #.lobyte(divisor) sbc #.lobyte(divisor)
sta temp sta elapsed_work
lda temp + 1 lda elapsed_work + 1
sbc #.hibyte(divisor) sbc #.hibyte(divisor)
sta temp + 1 sta elapsed_work + 1
inx inx
jmp countdown_loop jmp countdown_loop
countdown_done: countdown_done:
lda digits,x lda digits,x
eor #$80 eor #$80
sta temp2 sta elapsed_digit
lda #.lobyte(temp2) lda #.lobyte(elapsed_digit)
sta INBUFF sta INBUFF
lda #.hibyte(temp2) lda #.hibyte(elapsed_digit)
sta INBUFF + 1 sta INBUFF + 1
jsr draw_string jsr draw_string
.endscope .endscope