now writes pixels sorta

This commit is contained in:
Brooke Vibber 2023-01-22 09:09:12 -08:00
parent a8872b4e66
commit efac8f4f62

View file

@ -18,6 +18,12 @@ zoom = $a1 ; u8: zoom shift level
temp = $a2 ; u16 temp = $a2 ; u16
temp2 = $a4 ; u16 temp2 = $a4 ; u16
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
FRE = $da FRE = $da
@ -108,8 +114,8 @@ bit_masks:
.byte 3 << 6 .byte 3 << 6
display_list_start: display_list_start:
; 48 lines overscan ; 24 lines overscan
.repeat 5 .repeat 3
.byte $70 ; 8 blank lines .byte $70 ; 8 blank lines
.endrep .endrep
@ -185,8 +191,8 @@ color_map:
.macro shl bytes, arg .macro shl bytes, arg
asl arg asl arg
.repeat bytes-1 .repeat bytes-1, i
rol arg rol arg + 1 + i
.endrepeat .endrepeat
.endmacro .endmacro
@ -525,12 +531,6 @@ enough:
; iter holds the target to use ; iter holds the target to use
; @todo implement ; @todo implement
pixel_ptr = $b0
pixel_color = $b2
pixel_mask = $b3
pixel_shift = $b4
pixel_offset = $b5
; iter -> color ; iter -> color
ldx iter ldx iter
lda color_map,x lda color_map,x
@ -563,7 +563,7 @@ point:
; temp * 40 ; temp * 40
; = temp * 32 + temp * 8 ; = temp * 32 + temp * 8
; = (temp << 5) + (temp << 3) ; = (temp << 5) + (temp << 3)
extend_8_16 temp, sy copy16 temp, sy
shl16 temp shl16 temp
shl16 temp shl16 temp
shl16 temp shl16 temp
@ -588,6 +588,9 @@ point:
shift_loop: shift_loop:
beq shift_done beq shift_done
asl pixel_color asl pixel_color
asl pixel_color
sec
rol pixel_mask
sec sec
rol pixel_mask rol pixel_mask
dex dex
@ -602,11 +605,10 @@ shift_done:
tay tay
; read, mask, or, write ; read, mask, or, write
lda (temp),y lda (pixel_ptr),y
and pixel_mask and pixel_mask
ora pixel_color ora pixel_color
lda #255 sta (pixel_ptr),y
sta (temp),y
rts rts
.endproc .endproc
@ -703,13 +705,12 @@ loop_sx:
zoom_factor cx, sx, zoom, aspect_x zoom_factor cx, sx, zoom, aspect_x
zoom_factor cy, sy, zoom, aspect_y zoom_factor cy, sy, zoom, aspect_y
;jsr mandelbrot ;jsr mandelbrot
lda #1 lda #2
sta iter sta iter
jsr pset jsr pset
lda sx
clc clc
lda sx
adc #1 adc #1
sta sx sta sx
lda sx + 1 lda sx + 1
@ -723,8 +724,8 @@ loop_sx:
loop_sx_done: loop_sx_done:
lda sy
clc clc
lda sy
adc #1 adc #1
sta sy sta sy
lda sy + 1 lda sy + 1