From 702f7b35985cdadf43714018cf050447d4b96028 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 29 Jan 2023 18:50:04 -0800 Subject: [PATCH] WIP frame counter for speed readout not yet doing any of the calc/output or calls :D --- mandel.s | 54 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/mandel.s b/mandel.s index ff402ad..06d59e7 100644 --- a/mandel.s +++ b/mandel.s @@ -13,16 +13,20 @@ zy_2 = $92 ; fixed4.12: z_y^2 zx_zy = $94 ; fixed4.12: z_x * z_y dist = $96 ; fixed4.12: z_x^2 + z_y^2 -iter = $a0 ; u8: iteration count -zoom = $a1 ; u8: zoom shift level -temp = $a2 ; u16 -temp2 = $a4 ; u16 +frames = $a0 ; u16 +frames_total = $a2 ; float48; total frames +pixels = $a8 ; 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 FR0 = $d4 @@ -51,6 +55,10 @@ DLISTH = $D403 SDLSTL = $230 SDLSTH = $231 +; interrupt stuff +XITVBV = $E462 +SETVBV = $E45C + .data strings: @@ -216,6 +224,10 @@ color_map: copy 4, dest, arg .endmacro +.macro copyfloat dest, arg + copy 6, dest, arg +.endmacro + ; 2 + 8 * byte cycles .macro neg bytes, arg sec ; 2 cyc @@ -613,6 +625,24 @@ loop: done: .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 ; ox = 0; oy = 0; zoom = 0 @@ -675,6 +705,12 @@ copy_byte_loop: lda #$22 sta DMACTL + ; install the vblank handler + lda #7 ; deferred + ldx #.hibyte(vblank_handler) + ldy #.lobyte(vblank_handler) + jsr SETVBV + main_loop: ; sy = -92 .. 91 lda #(256-half_height)