VBL syncing on some wipes

This commit is contained in:
4am 2019-10-19 20:30:48 -04:00
parent ba30588e96
commit b39e9264d8
21 changed files with 193 additions and 55 deletions

View File

@ -1 +1 @@
RIPPLE STARWHITE SOFT.DIAGONAL STAGGERWHITE.UD RADIAL STAGGER.LR SOFT.UD BIT.FIZZLE MEETINTHEMIDDLE CRYSTAL DIAGONAL R.BY.PIXEL SUNRISE SOFT.L SUNSET CORNER.CIRCLE DIAGONAL2 RIPPLE2 RADIAL2 SPLIT.UD.INTRO HALF.FIZZLE RADIAL3 DIAGONAL3 BAR.DISSOLVE FOURSPIRAL SOFT.R IRIS CASCADE AND CHECKERBOARD LR.BY.PIXEL RADIAL4 STAGGERWHITE.LR SOFT.UD.OUT ONESQUARE FIZZLE STAR DIAMOND TWOPASS.LR HALF.MOSAIC RADIAL5 ARROW FOURSQUARE DIAGONAL4 STAGGER.UD INTERLOCK.LR SOFT.UD.IN BLOCK.MOSAIC INTERLOCK.UD BLOCK.FIZZLE SPIRAL ARROW.WHITE [eof] # # transition effects for HGR slideshows # # Each Mega-Attract Module that is an HGR slideshow (see attract.conf) # will use a single transition effect for the length of the module. # Transition effects are loaded in the order listed in this file. Each line # of this file is a filename (not including comments, like this one). The # name of the next transition effect is stored in the global prefs, so this # file should not contain duplicates. # # Transition effects are binary files loaded at $6000 and called with # hi-res page 1 showing and the next HGR graphic already loaded at $4000. # A transition effect has full use of main memory, including zero page and # text page if needed. LC RAM banks 1 and 2 are reserved for the launcher. # # Important: LC RAM bank 1 will be read/write on entry and must be read/write # on exit. If you need ROM routines, you are responsible for switching to ROM # then switching back to RAM bank 1 (read/write) before returning. #
RIPPLE STARWHITE SOFT.DIAGONAL STAGGERWHITE.UD RADIAL STAGGER.LR SOFT.UD CRYSTAL BIT.FIZZLE MEETINTHEMIDDLE DIAGONAL R.BY.PIXEL SUNRISE SOFT.L SUNSET CORNER.CIRCLE DIAGONAL2 RIPPLE2 RADIAL2 SPLIT.UD.INTRO HALF.FIZZLE RADIAL3 DIAGONAL3 BAR.DISSOLVE FOURSPIRAL SOFT.R IRIS CASCADE AND CHECKERBOARD LR.BY.PIXEL RADIAL4 STAGGERWHITE.LR SOFT.UD.OUT ONESQUARE FIZZLE STAR DIAMOND TWOPASS.LR HALF.MOSAIC RADIAL5 ARROW FOURSQUARE DIAGONAL4 STAGGER.UD INTERLOCK.LR SOFT.UD.IN BLOCK.MOSAIC INTERLOCK.UD BLOCK.FIZZLE SPIRAL ARROW.WHITE [eof] # # transition effects for HGR slideshows # # Each Mega-Attract Module that is an HGR slideshow (see attract.conf) # will use a single transition effect for the length of the module. # Transition effects are loaded in the order listed in this file. Each line # of this file is a filename (not including comments, like this one). The # name of the next transition effect is stored in the global prefs, so this # file should not contain duplicates. # # Transition effects are binary files loaded at $6000 and called with # hi-res page 1 showing and the next HGR graphic already loaded at $4000. # A transition effect can use $6000-$BFFF in main memory, zero page, and # text page if needed. $800-$1FFF is reserved for the slideshow data. # LC RAM banks 1 and 2 are reserved for the launcher. # # Important: LC RAM bank 1 will be read/write on entry and must be read/write # on exit. If you need ROM routines, you are responsible for switching to ROM # then switching back to RAM bank 1 (read/write) before returning. #

View File

@ -25,6 +25,7 @@ ColLoop
sta row
ldy col
sty y
jsr WaitForVBL
RowLoop
; check if this column is visible
ldy y
@ -93,3 +94,4 @@ copymasks4
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -10,8 +10,13 @@ row = $fd
col = $fe
counter = $ff
hgrlo = $8000
hgr1hi = $80C0
hgr2hi = $8180
!source "src/fx/macros.a"
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi, hgr2hi
+INIT_MASKS sourcemasks1, copymasks1
+INIT_MASKS sourcemasks4, copymasks4
@ -25,18 +30,27 @@ ColLoop
sta row
ldy col
sty y
jsr WaitForVBL
RowLoop
; do top half of arrow
lda row
asl
asl
asl
tax
lda hgrlo,x
sta $26
sta $3c
lda hgr1hi,x
sta $27
lda hgr2hi,x
sta $3d
; check if this column is visible
ldy y
+IS_Y_OFFSCREEN
+LBCS Skip1
; do top half of arrow (part 1 of 2)
lda row
asl
asl
asl
+HGR_CALC
bcs TopSkip1
ldx #7
- lda ($26),y
@ -50,42 +64,11 @@ RowLoop
+HGR_INC_WITHIN_BLOCK
dex
bpl -
; do bottom half of arrow (opposing row, same col)
lda #23
sec
sbc row
asl
asl
asl
+HGR_CALC
ldx #7
- lda ($26),y
and sourcemasks4,x
sta $00
lda #$FF
and copymasks4,x
ora $00
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
dex
bpl -
Skip1
; now check if *this* column is visible
+RESET_HGR_CALC
TopSkip1
iny
sty y
+IS_Y_OFFSCREEN
+LBCS Skip2
; do top half of arrow (part 2 of 2)
lda row
asl
asl
asl
+HGR_CALC
bcs TopSkip2
ldx #7
- lda #$FF
@ -99,7 +82,15 @@ Skip1
+HGR_INC_WITHIN_BLOCK
dex
bpl -
+RESET_HGR_CALC
TopSkip2
iny
+IS_Y_OFFSCREEN
bcs BottomHalf
lda row
jsr HGRBlockCopyNoRecalc
BottomHalf
; do bottom half of arrow (opposing row, same col)
lda #23
sec
@ -107,7 +98,37 @@ Skip1
asl
asl
asl
+HGR_CALC
tax
lda hgrlo,x
sta $26
sta $3c
lda hgr1hi,x
sta $27
lda hgr2hi,x
sta $3d
ldy y
+IS_Y_OFFSCREEN
bcs BottomSkip1
ldx #7
- lda ($26),y
and sourcemasks4,x
sta $00
lda #$FF
and copymasks4,x
ora $00
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
dex
bpl -
+RESET_HGR_CALC
BottomSkip1
iny
+IS_Y_OFFSCREEN
bcs BottomSkip2
ldx #7
- lda #$FF
@ -121,24 +142,21 @@ Skip1
+HGR_INC_WITHIN_BLOCK
dex
bpl -
Skip2
; now check if *this* column is visible
+RESET_HGR_CALC
BottomSkip2
iny
+IS_Y_OFFSCREEN
bcs NextRow
; do top half copy
lda row
jsr HGRBlockCopy
; do bottom half copy
lda #23
sec
sbc row
jsr HGRBlockCopy
jsr HGRBlockCopyNoRecalc
NextRow
ldy y
iny
sty y
dec row
+LBPL RowLoop
lda $c000
@ -173,3 +191,4 @@ copymasks4
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -7,7 +7,8 @@
ldx #191
--- lda #$40
--- jsr WaitForVBL
lda #$40
sta $e6
lsr
sta $29
@ -97,3 +98,5 @@ vposn txa
sta $27
done rts
!source "src/fx/hw.vbl.a"

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2018 by 4am
;(c) 2018-9 by 4am
;
!source "src/fx/macros.a"

View File

@ -22,6 +22,7 @@ counter = $ff
lda #23
sta row
ldy col
jsr WaitForVBL
@rowloop
tya
bmi +
@ -60,3 +61,4 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -22,6 +22,7 @@ counter = $ff
lda #23
sta row
ldy col
jsr WaitForVBL
@rowloop
tya
bmi +
@ -61,3 +62,4 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -22,6 +22,7 @@ counter = $ff
lda #0
sta row
ldy col
jsr WaitForVBL
@rowloop
tya
bmi +
@ -62,3 +63,4 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -27,6 +27,7 @@ counter = $ff
sta row
ldy col
sty y
jsr WaitForVBL
@rowloop
; check if this column is visible
ldy y
@ -157,3 +158,4 @@ copymasks4
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -18,6 +18,7 @@ col = $ff
@clearcolloop
lda #$06
sta maskindex
jsr WaitForVBL
@clearmaskloop
ldx maskindex
lda clearmasks,x
@ -63,6 +64,7 @@ col = $ff
@colloop
lda #$06
sta maskindex
jsr WaitForVBL
@maskloop
ldx maskindex
lda copymasks,x
@ -108,3 +110,4 @@ copymasks
!byte $FF,$BF,$9F,$8F,$87,$83,$81
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -18,6 +18,7 @@ col2 = $ff
@colloop
lda #6
sta maskindex
jsr WaitForVBL
@maskloop
ldx maskindex
lda copymasks1,x
@ -103,3 +104,4 @@ copymasks2
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -15,6 +15,7 @@ col = $ff
@colloop
lda #$06
sta maskindex
jsr WaitForVBL
@maskloop
ldx maskindex
lda copymasks,x
@ -66,3 +67,4 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -29,6 +29,7 @@ ColLoop
sta row
ldy col
sty y
jsr WaitForVBL
RowLoop
; [speedopt] calculate HGR base addresses once per row
lda row
@ -249,3 +250,4 @@ copymasks6
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -27,6 +27,7 @@ counter = $ff
ColLoop
lda #23
sta row
jsr WaitForVBL
RowLoop
; [speedopt] calculate HGR base addresses once per row
lda row
@ -244,3 +245,4 @@ copymasks6
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -27,6 +27,7 @@ counter = $ff
ColLoop
lda #23
sta row
jsr WaitForVBL
RowLoop
; [speedopt] calculate HGR base addresses once per row
lda row
@ -244,3 +245,4 @@ copymasks6
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -14,6 +14,7 @@ row = $fd
@rowloop
lda #6
sta maskindex
jsr WaitForVBL
@maskloop
lda row
bmi @skiprow
@ -156,3 +157,4 @@ masks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -14,6 +14,7 @@ row = $fd
@rowloop
lda #6
sta maskindex
jsr WaitForVBL
@maskloop
lda row
bmi @skiprow
@ -164,3 +165,4 @@ masks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -14,6 +14,7 @@ row = $fd
@rowloop
lda #6
sta maskindex
jsr WaitForVBL
@maskloop
lda row
bmi @skiprow
@ -166,3 +167,4 @@ masks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

View File

@ -39,6 +39,7 @@ row2 = $FF
sta row2
@outerloop
jsr WaitForVBL
lda row1
bmi @skiptopwhite
asl
@ -122,3 +123,4 @@ row2 = $FF
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
!source "src/fx/hw.vbl.a"

54
src/fx/hw.vbl.a Normal file
View File

@ -0,0 +1,54 @@
;license:MIT
;(c) 2019 by 4am
;
; Public functions:
; - WaitForVBL
;
!source "src/fx/macros.a"
WaitForVBL
bit $FDFD
pha
tya
pha
+READ_ROM_NO_WRITE
lda $FBB3
cmp #$06
bne @nop
lda $FBC0
beq @iic
+LDADDR WaitForVBL_iie
bne +
@iic
+LDADDR WaitForVBL_iic
bne +
@nop
+LDADDR WaitForVBL_nop
bne + ; always branches
+
+STAY WaitForVBL+1
lda #$4C ; JMP opcode
sta WaitForVBL
+READ_RAM1_WRITE_RAM1
pla
tay
pla
jmp WaitForVBL
WaitForVBL_nop ; II/II+ have no easy VBL
rts
WaitForVBL_iie ; IIe/IIgs have a relatively sane VBL
- bit $c019
bpl -
- bit $c019
bmi -
rts
WaitForVBL_iic ; IIc is special
; TODO
rts

View File

@ -1,6 +1,37 @@
!ifndef _HGRMACROS_ {
!source "src/macros.a"
; .lo, .page1hi, .page2hi will each be filled with $C0 bytes
; based on routine by John Brooks
; posted on comp.sys.apple2 on 2018-07-11
; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ
!macro BUILD_HGR_LOOKUP_TABLES .hgrlo, .hgr1hi, .hgr2hi {
ldx #0
- txa
and #$F8
bpl +
ora #5
+ asl
bpl +
ora #5
+ asl
asl
sta .hgrlo,x
txa
and #7
rol
asl .hgrlo,x
rol
clc
adc #$20
sta .hgr1hi,x
eor #$60
sta .hgr2hi,x
inx
cpx #$C0
bne -
}
!macro HGR_CALC {
asl
tax