From 9926ec28e73a0fb546f37c025a7364ca62cbc93f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 5 Mar 2023 13:48:39 -0800 Subject: [PATCH] clean up speed display now uses ms/px msg --- mandel.s | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/mandel.s b/mandel.s index 467245d..1f94b6a 100644 --- a/mandel.s +++ b/mandel.s @@ -94,7 +94,7 @@ str_self: .byte "MANDEL-6502" str_self_end: str_speed: - .byte "ms/px" + .byte " ms/px" str_speed_end: str_run: .byte " RUN" @@ -740,6 +740,25 @@ shift_done: rts .endproc +.macro draw_text_indirect col, len, strptr + ; clobbers A, X + .local loop + .local done + ldx #0 +loop: + cpx #len + beq done + txa + tay + lda (strptr),y + tay + lda char_map,y + sta textbuffer + col,x + inx + jmp loop +done: +.endmacro + .macro draw_text col, len, cstr ; clobbers A, X .local loop @@ -940,33 +959,9 @@ update_status: ; convert to ASCII in INBUFF jsr FASC - ; find the last byte - ldy #0 -number_loop: - lda (INBUFF),y - bmi lastchar - - tax - lda char_map,x - sta textbuffer + speed_start,y - - iny - bpl number_loop -lastchar: - ; Y is last char - ; trim that high bit - and #$7f - tax - lda char_map,x - sta textbuffer + speed_start,y - - ; Fill out any remaining spaces - lda #0 -space_loop: - iny - sta textbuffer + speed_start,y - cpy #(20) - bmi space_loop + ; print the first 6 digits + draw_text_indirect speed_start, 6, INBUFF + draw_text speed_start + 6, str_speed_len, str_speed skip_status: