wip changing time units

it does this weird thing where sometimes it's reading out wrong digits
and then switches to expected unit of sec/px

work in progress no clue what's going on
This commit is contained in:
Brooke Vibber 2025-01-04 18:46:51 -08:00
parent 7e5ca79d9a
commit eaa00a055a

View file

@ -141,7 +141,7 @@ str_self:
.byte "MANDEL-6502"
str_self_end:
str_speed:
.byte " ms/px"
.byte " sec/px"
str_speed_end:
str_run:
.byte " RUN"
@ -195,9 +195,9 @@ aspect_x: ; fixed3.13 5/4
aspect_y: ; fixed3.13 3/4
.word 3 << (13 - 2)
ms_per_frame: ; float48 16.66666667
.byte 64 ; exponent/sign
.byte $16 ; BCD digits
sec_per_frame: ; float48 0.016666667
.byte 63 ; exponent/sign
.byte $01 ; BCD digits
.byte $66
.byte $66
.byte $66
@ -208,7 +208,7 @@ total_pixels: ; float48
.byte 0
.endrepeat
total_ms: ; float48
total_sec: ; float48
.repeat 6
.byte 0
.endrepeat
@ -1574,10 +1574,10 @@ main_loop:
sta count_frames
sta count_pixels
; total_ms = 0.0; total_pixels = 0.0
; total_sec = 0.0; total_pixels = 0.0
jsr ZFR0
ldx #.lobyte(total_ms)
ldy #.hibyte(total_ms)
ldx #.lobyte(total_sec)
ldy #.hibyte(total_sec)
jsr FST0R
ldx #.lobyte(total_pixels)
ldy #.hibyte(total_pixels)
@ -1697,21 +1697,21 @@ update_status:
sta count_frames
jsr IFP
; FR0 *= ms_per_frame
ldx #.lobyte(ms_per_frame)
ldy #.hibyte(ms_per_frame)
; FR0 *= sec_per_frame
ldx #.lobyte(sec_per_frame)
ldy #.hibyte(sec_per_frame)
jsr FLD1R
jsr FMUL
; FR0 += total_ms
ldx #.lobyte(total_ms)
ldy #.hibyte(total_ms)
; FR0 += total_sec
ldx #.lobyte(total_sec)
ldy #.hibyte(total_sec)
jsr FLD1R
jsr FADD
; total_ms = FR0
ldx #.lobyte(total_ms)
ldy #.hibyte(total_ms)
; total_sec = FR0
ldx #.lobyte(total_sec)
ldy #.hibyte(total_sec)
jsr FST0R
; FR0 /= total_pixels