move total_ms, total_pixels out of zero page

this frees up 12 bytes of zero page space and costs no measurable
time as these variables are not in the hot path and there was only
a tiny bit different.
This commit is contained in:
Brooke Vibber 2025-01-04 14:25:25 -08:00
parent d2bf77dc26
commit 7e5ca79d9a

View file

@ -33,8 +33,7 @@ chroma_ticks = $bd ; u8
count_frames = $be ; u8 count_frames = $be ; u8
count_pixels = $bf ; u8 count_pixels = $bf ; u8
total_pixels = $c0 ; float48 ; free space c0-cb
total_ms = $c6 ; float48
temp = $cc ; u16 temp = $cc ; u16
temp2 = $ce ; u16 temp2 = $ce ; u16
@ -63,6 +62,7 @@ FADD = $DA66 ; ADDITION (FR0 += FR1)
FSUB = $DA60 ; SUBTRACTION (FR0 -= FR1) FSUB = $DA60 ; SUBTRACTION (FR0 -= FR1)
FMUL = $DADB ; MULTIPLICATION (FR0 *= FR1) FMUL = $DADB ; MULTIPLICATION (FR0 *= FR1)
FDIV = $DB28 ; DIVISION (FR0 /= FR1) FDIV = $DB28 ; DIVISION (FR0 /= FR1)
ZFR0 = $DA44 ; clear FR0
ZF1 = $DA46 ; CLEAR ZERO PAGE FLOATING POINT NUMBER (XX) ZF1 = $DA46 ; CLEAR ZERO PAGE FLOATING POINT NUMBER (XX)
FLD0R = $DD89 ; LOAD FR0 WITH FLOATING POINT NUMBER (YYXX) FLD0R = $DD89 ; LOAD FR0 WITH FLOATING POINT NUMBER (YYXX)
FLD1R = $DD98 ; LOAD FR1 WITH FLOATING POINT NUMBER (YYXX) FLD1R = $DD98 ; LOAD FR1 WITH FLOATING POINT NUMBER (YYXX)
@ -203,6 +203,16 @@ ms_per_frame: ; float48 16.66666667
.byte $66 .byte $66
.byte $67 .byte $67
total_pixels: ; float48
.repeat 6
.byte 0
.endrepeat
total_ms: ; float48
.repeat 6
.byte 0
.endrepeat
display_list_start: display_list_start:
; 24 lines overscan ; 24 lines overscan
.repeat 3 .repeat 3
@ -1565,10 +1575,13 @@ main_loop:
sta count_pixels sta count_pixels
; total_ms = 0.0; total_pixels = 0.0 ; total_ms = 0.0; total_pixels = 0.0
ldx #total_ms jsr ZFR0
jsr ZF1 ldx #.lobyte(total_ms)
ldx #total_pixels ldy #.hibyte(total_ms)
jsr ZF1 jsr FST0R
ldx #.lobyte(total_pixels)
ldy #.hibyte(total_pixels)
jsr FST0R
jsr clear_screen jsr clear_screen
jsr status_bar jsr status_bar
@ -1691,19 +1704,19 @@ update_status:
jsr FMUL jsr FMUL
; FR0 += total_ms ; FR0 += total_ms
ldx #total_ms ldx #.lobyte(total_ms)
ldy #0 ldy #.hibyte(total_ms)
jsr FLD1R jsr FLD1R
jsr FADD jsr FADD
; total_ms = FR0 ; total_ms = FR0
ldx #total_ms ldx #.lobyte(total_ms)
ldy #0 ldy #.hibyte(total_ms)
jsr FST0R jsr FST0R
; FR0 /= total_pixels ; FR0 /= total_pixels
ldx #total_pixels ldx #.lobyte(total_pixels)
ldy #0 ldy #.hibyte(total_pixels)
jsr FLD1R jsr FLD1R
jsr FDIV jsr FDIV