gr: plasma: one more try at interference

This commit is contained in:
Vince Weaver 2023-10-29 18:45:07 -04:00
parent 0f121ce524
commit 5829435061

View File

@ -3,12 +3,8 @@
.include "hardware.inc" .include "hardware.inc"
; zero page ; zero page
YY = $69
COLOR_MASK=$F8
XPOS = $F9
YPOS = $FA
COLOR_MASK=$FA
DRAW_PAGE=$FB DRAW_PAGE=$FB
FRAME = $FC FRAME = $FC
SUM = $FD SUM = $FD
@ -25,6 +21,9 @@ oval:
bit FULLGR ; make it 40x48 bit FULLGR ; make it 40x48
bit PAGE1 bit PAGE1
lda #0
sta FRAME
lda #4 lda #4
sta DRAW_PAGE sta DRAW_PAGE
@ -36,7 +35,48 @@ draw_oval_loop:
create_yloop: create_yloop:
txa txa
jsr plot_setup ; jsr plot_setup
;================================
; plot_setup
;================================
plot_setup:
lsr ; shift bottom bit into carry ; 2
tay
bcc plot_even ; 2nt/3
plot_odd:
lda #$f0 ; 2
bcs plot_c_done ; 2nt/3
plot_even:
lda #$0f ; 2
plot_c_done:
sta mask_smc2+1 ;
eor #$FF ; 2
sta mask_invert_smc1+1 ;
lda gr_offsets_l,Y ; lookup low-res memory address ; 4
sta gbasl_smc1+1
sta gbasl_smc2+1
lda gr_offsets_h,Y ; 4
clc
adc DRAW_PAGE ; add in draw page offset ; 3
sta gbasl_smc1+2
sta gbasl_smc2+2
;==========================================
;===========================
; calculate for each XPOS (Y) on ROW (X)
ldy #39 ldy #39
@ -50,15 +90,27 @@ create_xloop:
jsr calcsine_div2 jsr calcsine_div2
txa ; YY txa ; YY
adc FRAME ; ADDED
jsr calcsine jsr calcsine
; X (YY) is in SAVEX ; X (YY) is in SAVEX
clc clc
; sty SAVEY ; XX
sty SAVEY ; XX
tya tya
; PATCH?
adc SAVEX ; XX + YY adc SAVEX ; XX + YY
adc FRAME ; ADDED
jsr calcsine_div2 jsr calcsine_div2
; jsr calcsine
; clc ; clc
; adc FRAME ; adc FRAME
@ -70,8 +122,8 @@ create_xloop:
sta color_smc+1 sta color_smc+1
tya ; tya
pha ; pha
;================================ ;================================
@ -94,9 +146,10 @@ gbasl_smc2:
;================================= ;=================================
pla ; pla
tay ; tay
ldy SAVEY
ldx SAVEX ldx SAVEX
dey dey
@ -121,14 +174,35 @@ done_flip:
sta DRAW_PAGE sta DRAW_PAGE
; X and Y both $FF ;===================================
;===================================
;===================================
; try patching
lda FRAME
and #$10
bne do_patch1
undo_patch1:
lda #$EA ; nop
bne done_patch1 ; bra
do_patch1:
lda #$4A ; lsr
done_patch1:
sta patch1
;===================================
jmp draw_oval_loop ; bra jmp draw_oval_loop ; bra
;=============================
;=============================
calcsine_div2: calcsine_div2:
lsr ; no LSR = zoomed out
lsr ; one LSR = zoomed in on oval
patch1:
nop ; two LSR = more zoomed in
calcsine: calcsine:
stx SAVEX stx SAVEX
@ -148,6 +222,8 @@ sinsub:
jmp sindone jmp sindone
sinadd: sinadd:
; ldx FRAME
lda SUM lda SUM
clc clc
adc sinetable,X adc sinetable,X
@ -184,43 +260,6 @@ sinetable:
;================================
; plot_setup
;================================
; sets up GBASL/GBASH and MASK
; Ycoord in A
; trashes Y/A
plot_setup:
lsr ; shift bottom bit into carry ; 2
tay
bcc plot_even ; 2nt/3
plot_odd:
lda #$f0 ; 2
bcs plot_c_done ; 2nt/3
plot_even:
lda #$0f ; 2
plot_c_done:
sta mask_smc2+1 ;
eor #$FF ; 2
sta mask_invert_smc1+1 ;
lda gr_offsets_l,Y ; lookup low-res memory address ; 4
sta gbasl_smc1+1
sta gbasl_smc2+1
lda gr_offsets_h,Y ; 4
clc
adc DRAW_PAGE ; add in draw page offset ; 3
sta gbasl_smc1+2
sta gbasl_smc2+2
rts
gr_offsets_l: gr_offsets_l: