WIP frame counter for speed readout

not yet doing any of the calc/output or calls :D
This commit is contained in:
Brooke Vibber 2023-01-29 18:50:04 -08:00
parent ca5db83e8f
commit 702f7b3598

View file

@ -13,16 +13,20 @@ zy_2 = $92 ; fixed4.12: z_y^2
zx_zy = $94 ; fixed4.12: z_x * z_y zx_zy = $94 ; fixed4.12: z_x * z_y
dist = $96 ; fixed4.12: z_x^2 + z_y^2 dist = $96 ; fixed4.12: z_x^2 + z_y^2
iter = $a0 ; u8: iteration count frames = $a0 ; u16
zoom = $a1 ; u8: zoom shift level frames_total = $a2 ; float48; total frames
temp = $a2 ; u16 pixels = $a8 ; u16
temp2 = $a4 ; u16 pixels_total = $aa ; float48; total pixels
iter = $b0 ; u8: iteration count
zoom = $b1 ; u8: zoom shift level
temp = $b2 ; u16
pixel_ptr = $b4 ; u16
pixel_color = $b6 ; u8
pixel_mask = $b7 ; u8
pixel_shift = $b8 ; u8
pixel_offset = $b9 ; u8
pixel_ptr = $b0 ; u16
pixel_color = $b2 ; u8
pixel_mask = $b3 ; u8
pixel_shift = $b4 ; u8
pixel_offset = $b5 ; u8
; FP registers in zero page ; FP registers in zero page
FR0 = $d4 FR0 = $d4
@ -51,6 +55,10 @@ DLISTH = $D403
SDLSTL = $230 SDLSTL = $230
SDLSTH = $231 SDLSTH = $231
; interrupt stuff
XITVBV = $E462
SETVBV = $E45C
.data .data
strings: strings:
@ -216,6 +224,10 @@ color_map:
copy 4, dest, arg copy 4, dest, arg
.endmacro .endmacro
.macro copyfloat dest, arg
copy 6, dest, arg
.endmacro
; 2 + 8 * byte cycles ; 2 + 8 * byte cycles
.macro neg bytes, arg .macro neg bytes, arg
sec ; 2 cyc sec ; 2 cyc
@ -613,6 +625,24 @@ loop:
done: done:
.endmacro .endmacro
.proc vsync_handler
inc frames
bne no_carry
inc frames + 1
no_carry:
jmp XITVBV
.endproc
.proc update_speed
; convert frames (u16) to fp
; add to frames_total
; convert pixels (u16) to fp
; add to pixels_total
; (frames_total * 16.66666667) / pixels_total
; convert to ATASCII
; draw text
.endproc
.proc start .proc start
; ox = 0; oy = 0; zoom = 0 ; ox = 0; oy = 0; zoom = 0
@ -675,6 +705,12 @@ copy_byte_loop:
lda #$22 lda #$22
sta DMACTL sta DMACTL
; install the vblank handler
lda #7 ; deferred
ldx #.hibyte(vblank_handler)
ldy #.lobyte(vblank_handler)
jsr SETVBV
main_loop: main_loop:
; sy = -92 .. 91 ; sy = -92 .. 91
lda #(256-half_height) lda #(256-half_height)