not sure what's wrong have to hceck over

This commit is contained in:
Brooke Vibber 2023-01-22 12:02:15 -08:00
parent 1bef004ccd
commit 57975b7158

View file

@ -254,10 +254,10 @@ color_map:
; 5 cycles either way
.if bitnum < 8
lda arg1 ; 3 cyc
and #(1 << bitnum) ; 2 cyc
and #(1 << (bitnum)) ; 2 cyc
.else
lda arg1 + 1 ; 3 cyc
and #(1 << (bitnum - 8)) ; 2 cyc
and #(1 << ((bitnum) - 8)) ; 2 cyc
.endif
bne one ; 2 cyc
@ -434,43 +434,48 @@ loop:
rts
keep_going:
.macro quick_exit arg
.local keep_going
lda arg + 1
cmp #(4 << 4)
bmi keep_going
rts
keep_going:
.endmacro
; 4.12: (-8 .. +7.9)
; zx = zx_2 - zy_2 + cx
sub16 zx, zx_2 + 2, zy_2 + 2
sub16 zx, zx_2, zy_2
add16 zx, zx, cx
quick_exit zx
; zy = zx_zy + zx_zy + cy
add16 zy, zx_zy + 2, zx_zy + 2
add16 zy, zx_zy, zx_zy
add16 zy, zy, cy
; 8.24: (-128 .. +127.9)
; zx_2 = zx * zx
imul16 zx_2, zx, zx
imul16_round zx_2, zx, zx, 4
quick_exit dist
; zy_2 = zy * zy
imul16 zy_2, zy, zy
imul16_round zy_2, zy, zy, 4
quick_exit dist
; zx_zy = zx * zy
imul16 zx_zy, zx, zy
imul16_round zx_zy, zx, zy, 4
quick_exit dist
; dist = zx_2 + zy_2
add32 dist, zx_2, zy_2
; if dist >= 4 break, else continue iterating
lda dist + 3
cmp #4
bmi still_in
rts
still_in:
shift_round_16 zx_2, 4
shift_round_16 zy_2, 4
shift_round_16 zx_zy, 4
add16 dist, zx_2, zy_2
quick_exit dist
; if may be in the lake, look for looping output with a small buffer
; as an optimization vs running to max iters
jmp loop
peace_out:
rts
.endproc
.macro zoom_factor dest, src, zoom, aspect
@ -607,9 +612,13 @@ done:
sta ox + 1
sta oy
sta oy + 1
; zoom = 2x
lda #1
sta zoom
; Disable display DMA
lda #0
sta DMACTL
; zero the range from framebuffer_top to framebuffer_end