wipes: get diamond wipe going

This commit is contained in:
Vince Weaver 2024-11-12 00:02:07 -05:00
parent 3480f7578e
commit 4af18a2b5c
9 changed files with 323 additions and 18 deletions

View File

@ -8,10 +8,11 @@ ZX02 = ~/research/6502_compression/zx02.git/build/zx02 -f
all: wipes.dsk
wipes.dsk: HELLO bubbles/WIPE_BUBBLES
wipes.dsk: HELLO bubbles/WIPE_BUBBLES diamond/WIPE_DIAMOND
cp $(EMPTY_DISK)/empty.dsk wipes.dsk
$(DOS33) -y wipes.dsk SAVE A HELLO
$(DOS33) -y wipes.dsk BSAVE -a 0x5700 bubbles/WIPE_BUBBLES
$(DOS33) -y wipes.dsk BSAVE -a 0x6000 diamond/WIPE_DIAMOND
###
@ -23,9 +24,13 @@ HELLO: hello.bas
bubbles/WIPE_BUBBLES:
cd bubbles && make
diamond/WIPE_DIAMOND:
cd diamond && make
###
clean:
rm -f *~ *.o *.lst *.zx02 HELLO
cd bubbles && make clean
cd diamond && make clean

View File

@ -34,5 +34,5 @@ fx.hgr.bubbles.data.o: fx.hgr.bubbles.data.s
###
clean:
rm -f *~ *.o *.lst *.zx02 HELLO WIPE_TEST
rm -f *~ *.o *.lst *.zx02 HELLO WIPE_BUBBLES

View File

@ -305,13 +305,13 @@ dhgr_copy01 = $8F
; LC RAM 1 & 2 addresses
; these are defined here because they are also called by other targets
; that are assembled separately, e.g. prelaunchers, demo launchers, and graphic effects
UnwaitForVBL = $FFEE
WaitForVBL = UnwaitForVBL-3
iLoadFileDirect = WaitForVBL-3 ; note: you really want LC RAM 2 banked in before calling this
iAddToPath = iLoadFileDirect-3
iLoadXSingle = iAddToPath-3
iLoadFXCODE = iLoadXSingle-3
iLoadFXDATA = iLoadFXCODE-3
;UnwaitForVBL = $FFEE
;WaitForVBL = UnwaitForVBL-3
;iLoadFileDirect = WaitForVBL-3 ; note: you really want LC RAM 2 banked in before calling this
;iAddToPath = iLoadFileDirect-3
;iLoadXSingle = iAddToPath-3
;iLoadFXCODE = iLoadXSingle-3
;iLoadFXDATA = iLoadFXCODE-3
;iBuildHGRTables = iLoadFXDATA-3
;iBuildHGRMirrorTables = iBuildHGRTables-3
;iBuildHGRMirrorCols = iBuildHGRMirrorTables-3

View File

@ -0,0 +1,35 @@
include ../../../../Makefile.inc
LINKER_SCRIPTS = ../../../../linker_scripts
all: WIPE_DIAMOND
###
WIPE_DIAMOND: wipe_diamond.o
ld65 -o WIPE_DIAMOND wipe_diamond.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
wipe_diamond.o: wipe_diamond.s \
../zp.inc ../hardware.inc ../wait_keypress.s ../zx02_optim.s \
../main_macros.s \
fx.hgr.diamond.s \
../fx.lib.s \
../macros.s
ca65 -o wipe_diamond.o wipe_diamond.s -l wipe_diamond.lst
###
diamond_data.zx02: fx.hgr.diamond.data
$(ZX02) fx.hgr.diamond.data diamond_data.zx02
fx.hgr.diamond.data: fx.hgr.diamond.data.o
ld65 -o fx.hgr.diamond.data fx.hgr.diamond.data.o -C $(LINKER_SCRIPTS)/apple2_8800.inc
fx.hgr.diamond.data.o: fx.hgr.diamond.data.s
ca65 -o fx.hgr.diamond.data.o fx.hgr.diamond.data.s -l fx.hgr.diamond.data.lst
###
clean:
rm -f *~ *.o *.lst *.zx02 HELLO WIPE_DIAMOND

View File

@ -0,0 +1,150 @@
;license:MIT
;(c) 2019 by 4am
;
;!cpu 6502
;!to "build/FX.INDEXED/DIAMOND",plain
;*=$6000
YY = $fc
row = $fd
col = $fe
counter = $ff
; !source "src/fx/macros.a"
; !source "src/constants.a"
do_wipe_diamond:
lda #32
sta counter
lda #39
sta col
colloop:
lda #23
sta row
ldy col
sty YY
; jsr WaitForVBL
jsr wait_vblank
rowloop:
; check if this column is visible
ldy YY
bpl dp
dm: jmp skip1
dp: cpy #40
bcs dm
; do corner 1
SWITCH_TO_MASKS copymasks1
lda row
jsr HGRBlockCopyWithMask
; do corner 2 (same row, opposing col)
SWITCH_TO_MASKS copymasks2
lda #39
sec
sbc YY
tay
lda row
jsr HGRBlockCopyWithMask
; do corner 3 (opposing row, opposing col)
SWITCH_TO_MASKS copymasks3
lda #39
sec
sbc YY
tay
lda #23
sec
sbc row
jsr HGRBlockCopyWithMask
; do corner 4 (opposing row, same col)
SWITCH_TO_MASKS copymasks4
ldy YY
lda #23
sec
sbc row
jsr HGRBlockCopyWithMask
; reset y for looping
ldy YY
skip1:
iny
sty YY
; now check if *this* column is visible
bpl dp2
dm2: jmp skip2
dp2: cpy #40
bcs dm2
; do corner 1
lda row
jsr HGRBlockCopy
; do corner 2
lda #39
sec
sbc YY
tay
lda #23
sec
sbc row
jsr HGRBlockCopy
; do corner 3
lda #39
sec
sbc YY
tay
lda row
jsr HGRBlockCopy
; do corner 4
ldy YY
lda #23
sec
sbc row
jsr HGRBlockCopy
skip2:
dec row
bmi dp3
jmp rowloop
dp3: lda $c000
bmi dexit
dec col
dec counter
beq dexit
jmp colloop
dexit: jmp unwait_for_vblank
copymasks1:
.byte %11111111
.byte %11111110
.byte %11111100
.byte %11111000
.byte %11110000
.byte %11100000
.byte %11000000
.byte %10000000
copymasks2:
.byte %11111111
.byte %10111111
.byte %10011111
.byte %10001111
.byte %10000111
.byte %10000011
.byte %10000001
.byte %10000000
copymasks3:
.byte %10000000
.byte %10000001
.byte %10000011
.byte %10000111
.byte %10001111
.byte %10011111
.byte %10111111
.byte %11111111
copymasks4:
.byte %10000000
.byte %11000000
.byte %11100000
.byte %11110000
.byte %11111000
.byte %11111100
.byte %11111110
.byte %11111111
HGR_COPY_MASK_ROUTINES
HGR_BLOCK_COPY_ROUTINES

View File

@ -0,0 +1,78 @@
; test 4-cade diamond wipe
.include "../zp.inc"
.include "../hardware.inc"
wipe_diamond:
jsr BuildHGRTables
jsr BuildHGRMirrorTables
jsr BuildHGRMirrorCols
jsr BuildHGRSparseBitmasks1Bit
bit SET_GR
bit HIRES
bit FULLGR
bit PAGE1
;=================================
; intro
;=================================
lda #<test_graphic
sta zx_src_l+1
lda #>test_graphic
sta zx_src_h+1
lda #$20
jsr zx02_full_decomp
; ldy #0
;fake_hgr2:
; lda #$0
; sta $4000,Y
; dey
; bne fake_hgr2
;
; inc fake_hgr2+2
; lda fake_hgr2+2
; cmp #$60
; bne fake_hgr2
jsr HGR2
bit PAGE1
jsr wait_until_keypress
;=================================
; test wipe...
;=================================
test_loop:
jsr do_wipe_diamond
jsr wait_until_keypress
jmp test_loop
.include "../wait_keypress.s"
.include "../fx.lib.s"
.include "../main_macros.s"
.include "../macros.hgr.s"
.include "fx.hgr.diamond.s"
test_graphic:
.incbin "../graphics/a2_dating.hgr.zx02"
.include "../zx02_optim.s"
.include "../vblank.s"

View File

@ -6,7 +6,7 @@
.ifndef _FX_MACROS_HGR_
;!macro HGR_CALC {
.macro HGR_CACLC
.macro HGR_CALC
; in: A = HGR row (0x00..0xBF)
; out: A/X clobbered
; Y preserved
@ -15,14 +15,18 @@
; based on 'Woz Recodes Hi-Res Address Calculations'
; Apple Assembly Line vol. 7 issue 3 (December 1986)
; http://www.txbobsc.com/aal/1986/aal8612.html#a9
.local calc1
.local calc2
asl
tax
and #$F0
bpl @calc1
bpl calc1
ora #$05
@calc1 bcc @calc2
calc1: bcc calc2
ora #$0A
@calc2 asl
calc2: asl
asl
sta $26
txa
@ -190,7 +194,7 @@ HGRBlockCopy:
; Z set
; C clear
; all other flags and registers clobbered
+HGR_ROW_CALC
HGR_ROW_CALC
HGRBlockCopyNoRecalc:
clc
ldx #$08
@ -279,7 +283,7 @@ HGRStaggerToWhite:
.macro HGR_COPY_MASK_ROUTINES
SetCopyMask:
; in: A/Y points to 8-byte array of bit masks used by HGRBlockCopyWithMask
+ST16 CopyMaskAddr
ST16 CopyMaskAddr
rts
HGRBlockCopyWithMask:
@ -289,7 +293,7 @@ HGRBlockCopyWithMask:
; out: Y preserved
; A/X clobbered
; $00 clobbered
+HGR_ROW_CALC
HGR_ROW_CALC
HGRBlockCopyWithMaskNoRecalc:
ldx #7
HGRBlockCopyWithMasksLoop:

View File

@ -95,8 +95,10 @@ end_pstring:
; store a 16-bit value from A (low) and Y (high)
;!macro ST16 .ptr {
; sta .ptr
; sty .ptr+1
.macro ST16 ptr
sta ptr
sty ptr+1
.endmacro
;}
; store a 16-bit value from X (low) and Y (high)

View File

@ -0,0 +1,31 @@
; wait for VBLANK
; FIXME: assuming iie here
; no way to do this on II/II+ short of vapor lock / floating bus
; IIe you can read $C019 (in VBLANK when top bit 0)
; IIc you can also read $C019 (also can setup interrupt)
; IIgs you can read $C019 but reverse of IIe (in VBLANK when top bit 1)
VBLANK = $C019 ;
; wait for vblank on IIe
; positive? during vblank
wait_vblank:
; lda APPLEII_MODEL
; cmp #'e'
; bne no_vblank
wait_vblank_iie:
lda VBLANK
bpl wait_vblank_iie ; wait for positive (in vblank)
wait_vblank_done_iie:
lda VBLANK ; wait for negative (vlank done)
bmi wait_vblank_done_iie
no_vblank:
rts
unwait_for_vblank:
rts