diff --git a/mandel.s b/mandel.s index 4a4c7f4..6c9c42e 100644 --- a/mandel.s +++ b/mandel.s @@ -48,13 +48,35 @@ SDLSTH = $231 strings: str_self: - .asciiz "MANDEL-6502" + .byte "MANDEL-6502" +str_self_end: str_speed: - .asciiz "ms/px" -str_running: - .asciiz "RUN " + .byte "ms/px" +str_speed_end: +str_run: + .byte "RUN " +str_run_end: str_done: - .asciiz "DONE" + .byte "DONE" +str_done_end: + +str_self_len = str_self_end - str_self +str_speed_len = str_speed_end - str_speed +str_run_len = str_run_end - str_run +str_done_len = str_done_end - str_done + +char_map: + ; Map ATASCII string values to framebuffer font entries + ; Sighhhhh + .repeat 32, i + .byte i + 64 + .endrepeat + .repeat 64, i + .byte i + .endrepeat + .repeat 32, i + .byte 96 + i + .endrepeat aspect: ; aspect ratio! @@ -477,14 +499,16 @@ enough: rts .endproc -.macro draw_text col, cstr +.macro draw_text col, len, cstr ; clobbers A, X .local loop .local done ldx #0 loop: - lda cstr,x + cpx #len beq done + ldy cstr,x + lda char_map,y sta textbuffer + col,x inx jmp loop @@ -531,8 +555,8 @@ zero_byte_loop: cmp #.hibyte(framebuffer_end) bne zero_page_loop - draw_text 0, str_self - draw_text 36, str_running + draw_text 0, str_self_len, str_self + draw_text 40 - str_run_len, str_run_len, str_run ; Re-enable display DMA lda #$22 @@ -589,7 +613,7 @@ loop_sx_done: loop_sy_done: - draw_text 36, str_done + draw_text 40 - str_done_len, str_done_len, str_done loop: ; finished