add radial wipes, refactor other wipes

This commit is contained in:
4am 2019-10-24 15:41:08 -04:00
parent 54c4e2746c
commit 40cb26263f
24 changed files with 7086 additions and 5912 deletions

View File

@ -3,7 +3,6 @@
import math
def f(x,r=36.3):
x = float(x)
try:
return math.sqrt(r*r*(1.0-(x*x/(r*r*0.6))))
except:

View File

@ -0,0 +1,44 @@
#!/usr/bin/env python3
import math
radius_x = 280//2
radius_y = 192//2
def f(x,r=36.3):
try:
return math.sqrt(r*r*(1.0-(x*x/(r*r*0.6))))
except:
return -1
coords = []
for i in range(30000, 0, -1):
a = float(i)/1000.0
b = f(a)
for x in range(140, 0, -1):
y = round(float(x)*b/a)
if x < 1 or x > radius_x or y < 1 or y > radius_y:
continue
for m in range(1, y+1):
if m % 2 != 0:
continue
coords.append((radius_x - x,radius_y - m))
d = {}
unique_coords = []
for c in coords:
if not d.get(c):
unique_coords.append(c)
d[c] = 1
unique_vals = []
for x, y in unique_coords:
aval = "$" + hex(y)[2:].rjust(2, "0").upper()
bval = "%" + \
bin(x%7)[2:].rjust(3, "0") + \
bin(x//7)[2:].rjust(5, "0")
unique_vals.append((aval, bval))
with open("../../../src/fx/fx.hgr.radial.data.a", "w") as f:
for aval, bval in unique_vals:
f.write(" !byte %s,%s\n" % (aval, bval))

View File

@ -1 +1 @@
# # slideshow of favorite title screens # FALCONS GORGON BCS.QUEST JOUST DUNG.BEETLES MONTEZUMA ALCAZAR SABOTAGE DINO.EGGS [eof]
# # slideshow of favorite title screens # FALCONS GORGON BCS.QUEST JOUST DUNG.BEETLES MONTEZUMA ALCAZAR SABOTAGE DINO.EGGS SPDWAY.CLASSIC [eof]

View File

@ -1 +1 @@
# # slideshow of favorite title screens # CRAZY.MAZEY CAPTN.GOODNIGHT PAPERBOY LOST.TOMB SWASHBUCKLER [eof]
# # slideshow of favorite title screens # CRAZY.MAZEY CAPTN.GOODNIGHT PAPERBOY LOST.TOMB SWASHBUCKLER BLACK.MAGIC WOLFEN84 SHORT.CIRCUIT THE.BILESTOAD SITUATION.CRTCL [eof]

View File

@ -6,7 +6,6 @@
*=$6000
tmp=$fd
sourcemask=$fe
copymask=$ff
;init RNG
@ -60,20 +59,16 @@ copymask=$ff
sta $27
eor #$60
sta $3d
lda copymask
eor #%11111111
sta sourcemask
;copy pixel from other page to this page
ldy #0
lda ($26),y
and sourcemask
sta tmp
lda ($3c),y
and copymask
ora tmp
sta ($26),y
eor ($3c),y ; merge source and destination bits
and copymask ; isolate the bits to replace, zero the rest
eor ($26),y ; unmerge source and destination bits, leaves "to keep" destination bits intact
sta ($26),y ; write the result
;wait while checking for keypress

View File

@ -5,8 +5,6 @@
!to "build/FX/CENTER.BY.PIXEL",plain
*=$6000
sourcemask1 = $f0
sourcemask2 = $f1
copymask1 = $f2
copymask2 = $f3
skipcounter = $f7
@ -41,12 +39,8 @@ MaskLoop
ldx maskindex
lda copymasks1,x
sta copymask1
eor #%11111111
sta sourcemask1
lda copymasks2,x
sta copymask2
eor #%11111111
sta sourcemask2
lda #23
sta row
@ -57,20 +51,16 @@ RowLoop
BlockLoop
ldy col1
lda ($26),y
and sourcemask1
sta tmp
lda ($3c),y
eor ($3c),y
and copymask1
ora tmp
eor ($26),y
sta ($26),y
ldy col2
lda ($26),y
and sourcemask2
sta tmp
lda ($3c),y
eor ($3c),y
and copymask2
ora tmp
eor ($26),y
sta ($26),y
clc

View File

@ -5,23 +5,20 @@
!to "build/FX/CHECKER.FIZZLE",plain
*=$6000
sourcemask_even = $f0
copymask_even = $f1
sourcemask_odd = $f2
copymask_odd = $f3
copymask_even = $f0
copymask_odd = $f1
counter = $f2
!source "src/fx/macros.a"
;init masks
lda #%01111111
sta sourcemask_even
lda #%10000000
sta copymask_even
lda #%00000000
sta sourcemask_odd
lda #%11111111
sta copymask_odd
lda #2
sta counter
@outerloop
;init RNG
@ -77,20 +74,16 @@ copymask_odd = $f3
eor $00
bne @odd
lda ($26),y
and sourcemask_even
sta $00
lda ($3c),y
eor ($3c),y
and copymask_even
ora $00
eor ($26),y
sta ($26),y
jmp @next
@odd
lda ($26),y
and sourcemask_odd
sta $00
lda ($3c),y
eor ($3c),y
and copymask_odd
ora $00
eor ($26),y
sta ($26),y
@next
@ -105,13 +98,9 @@ copymask_odd = $f3
cmp #1
bne @loop
lda sourcemask_even
beq @exit
lda #0
sta sourcemask_even
sta sourcemask_odd
lda #$FF
sta copymask_even
sta copymask_odd
dec counter
+LBNE @outerloop
@exit rts

View File

@ -23,12 +23,8 @@ col2 = $ff
ldx maskindex
lda copymasks1,x
sta @copymask1
eor #%11111111
sta @sourcemask1
lda copymasks2,x
sta @copymask2
eor #%11111111
sta @sourcemask2
lda #23
sta row
@ -43,24 +39,18 @@ col2 = $ff
@blockloop
ldy col1
lda ($26),y
@sourcemask1=*+1
and #0 ; SMC
sta tmp
lda ($3c),y
eor ($3c),y
@copymask1=*+1
and #0 ; SMC
ora tmp
eor ($26),y
sta ($26),y
ldy col2
lda ($26),y
@sourcemask2=*+1
and #0 ; SMC
sta tmp
lda ($3c),y
eor ($3c),y
@copymask2=*+1
and #0 ; SMC
ora tmp
eor ($26),y
sta ($26),y
lda $27

View File

@ -5,23 +5,20 @@
!to "build/FX/PALETTE.FIZZLE",plain
*=$6000
sourcemask_even = $f0
copymask_even = $f1
sourcemask_odd = $f2
copymask_odd = $f3
copymask_even = $f0
copymask_odd = $f1
counter = $f2
!source "src/fx/macros.a"
;init masks
lda #%00101010
sta sourcemask_even
lda #%11010101
sta copymask_even
lda #%01010101
sta sourcemask_odd
lda #%10101010
sta copymask_odd
lda #2
sta counter
@outerloop
;init RNG
@ -71,20 +68,16 @@ copymask_odd = $f3
ror
bcs @odd
lda ($26),y
and sourcemask_even
sta $00
lda ($3c),y
eor ($3c),y
and copymask_even
ora $00
eor ($26),y
sta ($26),y
jmp @next
@odd
lda ($26),y
and sourcemask_odd
sta $00
lda ($3c),y
eor ($3c),y
and copymask_odd
ora $00
eor ($26),y
sta ($26),y
@next
@ -99,13 +92,9 @@ copymask_odd = $f3
cmp #1
bne @loop
lda sourcemask_even
beq @exit
lda #0
sta sourcemask_even
sta sourcemask_odd
lda #$FF
sta copymask_even
sta copymask_odd
dec counter
+LBNE @outerloop
@exit rts

View File

@ -9,6 +9,7 @@ src1 = $F0 ; word
dest1 = $F2 ; word
src2 = $F4 ; word
dest2 = $F6 ; word
reverse_input = $FC ; word
input = $FE ; word
copymasks = $0200 ; $100 bytes but sparse, index is 0..6 but in high 3 bits, so $00, $20, $40, $60, $80, $A0, $C0
@ -21,28 +22,18 @@ hgr1himirror = $BF40 ; $C0 bytes
!source "src/fx/macros.a"
!macro COPY_BIT .src1, .dest1, .copymasks {
lda (.dest1),y
eor (.src1),y ; merge source and destination bits
and .copymasks,x ; isolate the bits to replace, zero the rest
eor (.dest1),y ; unmerge source and destination bits, leaves "to keep" destination bits intact
sta (.dest1),y ; write the result
}
!macro FX_PRECOMPUTED_1BIT .coords {
; build lookup tables for base address of HGR rows
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
!macro BUILD_MIRROR_COLS .mirror_cols {
; build lookup table to get $27-y for y in $00..$27
ldx #$27
ldy #$00
- tya
sta mirror_cols,x
sta .mirror_cols,x
iny
dex
bpl -
}
!macro BUILD_SPARSE_BITMASKS .copymasks, .mirror_copymasks {
; build sparse lookup tables for bitmasks
lda #%10000001
sta copymasks
@ -71,25 +62,15 @@ hgr1himirror = $BF40 ; $C0 bytes
lda #%11000000
sta copymasks+$C0
sta mirror_copymasks
}
; set up pointer to input data
lda #<.coords
sta input
lda #>.coords
sta input+1
InputLoop
ldy #0
lda (input),y ; first value: HGR row (only 0..95 will be in input array)
bmi Exit1 ; if > 127 then we're done
tax
!macro ROW_X_TO_BASE_ADDRESSES {
lda hgrlo,x
sta dest1
sta src1
lda hgr1hi,x
sta dest1+1
Exit1 = * + 1
eor #$60 ; ahem. doubles as RTS
eor #$60
sta src1+1
lda hgrlo+1,x
sta dest2
@ -98,7 +79,9 @@ Exit1 = * + 1
sta dest2+1
eor #$60
sta src2+1
}
!macro ROW_X_TO_MIRROR_ADDRESSES {
lda hgrlomirror,x
sta dest3
sta src3
@ -113,47 +96,85 @@ Exit1 = * + 1
sta dest4+1
eor #$60
sta src4+1
}
!macro HIGH_3_LOW_5 .input {
and #%11100000 ; second value: high 3 bits = index into tables to find bitmasks
tax
eor (.input),y ; second value: low 5 bits = byte offset within the row (implicitly "and #%00011111")
tay
}
!macro INC_INPUT_AND_LOOP .loop {
inc input
beq +
jmp .loop
+ bit $c000
bmi +
inc input+1
jmp .loop
+ rts
}
!macro DEC_INPUT_AND_LOOP .loop {
lda input
beq +
dec input
dec input
jmp .loop
+ dec input
dec input
dec input+1
bit $c000
bmi +
jmp .loop
+ rts
}
!macro FX_PRECOMPUTED_1BIT .coords {
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
+LDAY .coords
+STAY input
jmp InputLoop
Exit1Bit rts
InputLoop
ldy #0
lda (input),y ; first value: HGR row (only 0..95 will be in input array)
bmi Exit1Bit ; if > 127 then we're done
tax
+ROW_X_TO_BASE_ADDRESSES
+ROW_X_TO_MIRROR_ADDRESSES
inc input
lda (input),y
and #%11100000 ; second value: high 3 bits = index into tables to find bitmasks
tax
eor (input),y ; second value: low 5 bits = byte offset within the row (implicitly "and #%00011111")
tay
+HIGH_3_LOW_5 input
; main 1x2 block in top-left quadrant
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
lda mirror_cols,y
tay
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
+COPY_BIT src3, dest3, mirror_copymasks
+COPY_BIT src4, dest4, mirror_copymasks
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
lda mirror_cols,y
tay
+COPY_BIT src3, dest3, copymasks
+COPY_BIT src4, dest4, copymasks
inc input
beq +
jmp InputLoop
+ bit $c000
bmi Exit2
inc input+1
jmp InputLoop
Exit2 rts
+INC_INPUT_AND_LOOP InputLoop
rts
!if * and 1 {
!byte 0 ;align 2 but avoids the fake allocation bug if it was aligned already
!byte 0 ;align 2 but avoids the fake allocation bug if it was aligned already
}
}

View File

@ -29,11 +29,9 @@ RowLoop
ldx #7
ldy col
- lda ($26),y
and sourcemask_even
sta $00
lda ($3c),y
eor ($3c),y
and copymask_even
ora $00
eor ($26),y
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
@ -45,11 +43,9 @@ OddCol
ldx #7
ldy col
- lda ($26),y
and sourcemask_odd
sta $00
lda ($3c),y
eor ($3c),y
and copymask_odd
ora $00
eor ($26),y
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
@ -104,12 +100,8 @@ RowLoop2
+LBNE ColLoop2
Exit2 rts
sourcemask_even
!byte %00110011
copymask_even
!byte %11001100
sourcemask_odd
!byte %01001100
copymask_odd
!byte %10110011

View File

@ -29,11 +29,9 @@ RowLoop
ldx #7
ldy col
- lda ($26),y
and sourcemask_even
sta $00
lda ($3c),y
eor ($3c),y
and copymask_even
ora $00
eor ($26),y
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
@ -45,11 +43,9 @@ OddCol
ldx #7
ldy col
- lda ($26),y
and sourcemask_odd
sta $00
lda ($3c),y
eor ($3c),y
and copymask_odd
ora $00
eor ($26),y
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
@ -104,12 +100,8 @@ RowLoop2
+LBNE ColLoop2
Exit2 rts
sourcemask_even
!byte %00101010
copymask_even
!byte %11010101
sourcemask_odd
!byte %01010101
copymask_odd
!byte %10101010

View File

@ -20,8 +20,6 @@ col = $ff
ldx maskindex
lda copymasks,x
sta @copymask
eor #$FF
sta @sourcemask
lda #$17
sta row
@rowloop
@ -35,13 +33,10 @@ col = $ff
ldy col
@blockloop
lda ($26),y
@sourcemask=*+1
and #$FD ; SMC
sta tmp
lda ($3c),y
eor ($3c),y
@copymask=*+1
and #$FD ; SMC
ora tmp
eor ($26),y
sta ($26),y
lda $27
adc #4

View File

@ -1,16 +1,90 @@
;license:MIT
;(c) 2018 by 4am
;(c) 2019 by 4am
;
!cpu 6502
!to "build/FX/RADIAL",plain
*=$6000
!source "src/fx/fx.hgr.precomputed.a"
!source "src/fx/fx.hgr.precomputed.1bit.a"
+FX_PRECOMPUTED HGRHalfBlockCopy, Coordinates, $06
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
+LDADDR EndCoordinates-2
+STAY input
LoopBL ; bottom-left quadrant (opposite row, original column, reverse input order)
ldy #0
lda (input),y
bmi DoneBL
tax
+ROW_X_TO_MIRROR_ADDRESSES
iny
lda (input),y
+HIGH_3_LOW_5 input
+COPY_BIT src3, dest3, copymasks
+COPY_BIT src4, dest4, copymasks
+DEC_INPUT_AND_LOOP LoopBL
DoneBL
+LDADDR Coordinates
+STAY input
LoopTL ; top-left quadrant
ldy #0
lda (input),y
bmi DoneTL
tax
+ROW_X_TO_BASE_ADDRESSES
inc input
lda (input),y
+HIGH_3_LOW_5 input
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
+INC_INPUT_AND_LOOP LoopTL
DoneTL
+LDADDR EndCoordinates-2
+STAY input
LoopTR ; top-right quadrant (same row, opposite column, reverse input order)
ldy #0
lda (input),y
bmi DoneTR
tax
+ROW_X_TO_BASE_ADDRESSES
iny
lda (input),y
+HIGH_3_LOW_5 input
lda mirror_cols,y
tay
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
+DEC_INPUT_AND_LOOP LoopTR
DoneTR
+LDADDR Coordinates
+STAY input
LoopBR ; bottom-right quadrant (opposite row, opposite column, original input order)
ldy #0
lda (input),y
bmi DoneBR
tax
+ROW_X_TO_MIRROR_ADDRESSES
inc input
lda (input),y
+HIGH_3_LOW_5 input
lda mirror_cols,y
tay
+COPY_BIT src3, dest3, mirror_copymasks
+COPY_BIT src4, dest4, mirror_copymasks
+INC_INPUT_AND_LOOP LoopBR
DoneBR
rts
!if * and 1 {
!byte 0
}
Coordinates
!source "src/fx/fx.hgr.radial.data.a"
EndCoordinates
!byte $80

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,81 @@
;license:MIT
;(c) 2018 by 4am
;(c) 2019 by 4am
;
!cpu 6502
!to "build/FX/RADIAL3",plain
*=$6000
!source "src/fx/fx.hgr.precomputed.a"
!source "src/fx/fx.hgr.precomputed.1bit.a"
+FX_PRECOMPUTED HGRHalfBlockCopy, Coordinates, $06
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
+LDADDR Coordinates
+STAY input
+LDADDR EndCoordinates-2
+STAY reverse_input
jmp Loop
Exit rts
Loop ldy #0
lda (input),y
bmi Exit
tax
+ROW_X_TO_BASE_ADDRESSES
+ROW_X_TO_MIRROR_ADDRESSES
inc input
lda (input),y
+HIGH_3_LOW_5 input
rts
; top-left quadrant (original row, original column, original input order)
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
; bottom-right quadrant (opposite row, opposite column, original input order)
lda mirror_cols,y
tay
+COPY_BIT src3, dest3, mirror_copymasks
+COPY_BIT src4, dest4, mirror_copymasks
ldy #0
lda (reverse_input),y
tax
+ROW_X_TO_BASE_ADDRESSES
+ROW_X_TO_MIRROR_ADDRESSES
iny
lda (reverse_input),y
+HIGH_3_LOW_5 reverse_input
; bottom-left quadrant (opposite row, original column, reverse input order)
+COPY_BIT src3, dest3, copymasks
+COPY_BIT src4, dest4, copymasks
; top-right quadrant (same row, opposite column, reverse input order)
lda mirror_cols,y
tay
+COPY_BIT src1, dest1, mirror_copymasks
+COPY_BIT src2, dest2, mirror_copymasks
inc input
bne +
inc input+1
+ lda reverse_input
beq +
dec reverse_input
dec reverse_input
jmp Loop
+ dec reverse_input
dec reverse_input
dec reverse_input+1
bit $c000
bmi +
jmp Loop
+ rts
!if * and 1 {
!byte 0
}
Coordinates
!source "src/fx/fx.hgr.radial3.data.a"
!source "src/fx/fx.hgr.radial.data.a"
EndCoordinates
!byte $80

File diff suppressed because it is too large Load Diff

View File

@ -12,13 +12,6 @@ counter = $ff
!source "src/fx/macros.a"
+INIT_MASKS sourcemasks1, copymasks1
+INIT_MASKS sourcemasks2, copymasks2
+INIT_MASKS sourcemasks3, copymasks3
+INIT_MASKS sourcemasks4, copymasks4
+INIT_MASKS sourcemasks5, copymasks5
+INIT_MASKS sourcemasks6, copymasks6
lda #(40+24+7-1) ; columns + rows + blocks per row - 1
sta counter
@ -29,7 +22,6 @@ ColLoop
sta row
ldy col
sty y
jsr WaitForVBL
RowLoop
; [speedopt] calculate HGR base addresses once per row
lda row
@ -44,14 +36,9 @@ RowLoop
; [speedopt] HGRBlockCopyWithMask but hardcoded for this block's masks
ldx #7
- lda ($26),y
and sourcemasks1,x
sta $00
lda ($3c),y
and copymasks1,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks1
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -64,14 +51,9 @@ RowLoop
bcs @block3
ldx #7
- lda ($26),y
and sourcemasks2,x
sta $00
lda ($3c),y
and copymasks2,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks2
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -83,14 +65,9 @@ RowLoop
bcs @block4
ldx #7
- lda ($26),y
and sourcemasks3,x
sta $00
lda ($3c),y
and copymasks3,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks3
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -102,14 +79,9 @@ RowLoop
bcs @block5
ldx #7
- lda ($26),y
and sourcemasks4,x
sta $00
lda ($3c),y
and copymasks4,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks4
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -121,14 +93,9 @@ RowLoop
bcs @block6
ldx #7
- lda ($26),y
and sourcemasks5,x
sta $00
lda ($3c),y
and copymasks5,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks5
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -140,14 +107,9 @@ RowLoop
bcs @block7
ldx #7
- lda ($26),y
and sourcemasks6,x
sta $00
lda ($3c),y
and copymasks6,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks6
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -160,9 +122,9 @@ RowLoop
; [speedopt] HGRBlockCopy but inlined
ldx #7
clc
- lda ($3c),y
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -181,18 +143,6 @@ RowLoop
+LBNE ColLoop
@exit rts
sourcemasks1
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks2
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks3
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks4
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks5
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks6
!byte 0,0,0,0,0,0,0,0 ; SMC
copymasks1
!byte %10000000
!byte %10000000

View File

@ -12,13 +12,6 @@ counter = $ff
!source "src/fx/macros.a"
+INIT_MASKS sourcemasks1, copymasks1
+INIT_MASKS sourcemasks2, copymasks2
+INIT_MASKS sourcemasks3, copymasks3
+INIT_MASKS sourcemasks4, copymasks4
+INIT_MASKS sourcemasks5, copymasks5
+INIT_MASKS sourcemasks6, copymasks6
lda #(40+7-1) ; columns + blocks per row - 1
sta counter
@ -27,7 +20,6 @@ counter = $ff
ColLoop
lda #23
sta row
jsr WaitForVBL
RowLoop
; [speedopt] calculate HGR base addresses once per row
lda row
@ -42,14 +34,9 @@ RowLoop
; [speedopt] HGRBlockCopyWithMask but hardcoded for this block's masks
ldx #7
- lda ($26),y
and sourcemasks1,x
sta $00
lda ($3c),y
and copymasks1,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks1
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -62,14 +49,9 @@ RowLoop
bcs @block3
ldx #7
- lda ($26),y
and sourcemasks2,x
sta $00
lda ($3c),y
and copymasks2,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks2
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -81,14 +63,9 @@ RowLoop
bcs @block4
ldx #7
- lda ($26),y
and sourcemasks3,x
sta $00
lda ($3c),y
and copymasks3,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks3
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -100,14 +77,9 @@ RowLoop
bcs @block5
ldx #7
- lda ($26),y
and sourcemasks4,x
sta $00
lda ($3c),y
and copymasks4,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks4
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -119,14 +91,9 @@ RowLoop
bcs @block6
ldx #7
- lda ($26),y
and sourcemasks5,x
sta $00
lda ($3c),y
and copymasks5,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks5
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -138,14 +105,9 @@ RowLoop
bcs @block7
ldx #7
- lda ($26),y
and sourcemasks6,x
sta $00
lda ($3c),y
and copymasks6,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks6
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -158,9 +120,9 @@ RowLoop
; [speedopt] HGRBlockCopy but inlined
ldx #7
clc
- lda ($3c),y
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -176,18 +138,6 @@ RowLoop
+LBNE ColLoop
@exit rts
sourcemasks1
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks2
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks3
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks4
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks5
!byte 0,0,0,0,0,0,0,0 ; SMC
sourcemasks6
!byte 0,0,0,0,0,0,0,0 ; SMC
copymasks1
!byte %10000000
!byte %10000000

View File

@ -12,13 +12,6 @@ counter = $ff
!source "src/fx/macros.a"
+INIT_MASKS sourcemasks1, copymasks1
+INIT_MASKS sourcemasks2, copymasks2
+INIT_MASKS sourcemasks3, copymasks3
+INIT_MASKS sourcemasks4, copymasks4
+INIT_MASKS sourcemasks5, copymasks5
+INIT_MASKS sourcemasks6, copymasks6
lda #(40+7-1) ; columns + blocks per row - 1
sta counter
@ -27,7 +20,6 @@ counter = $ff
ColLoop
lda #23
sta row
jsr WaitForVBL
RowLoop
; [speedopt] calculate HGR base addresses once per row
lda row
@ -42,14 +34,9 @@ RowLoop
; [speedopt] HGRBlockCopyWithMask but hardcoded for this block's masks
ldx #7
- lda ($26),y
and sourcemasks1,x
sta $00
lda ($3c),y
and copymasks1,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks1
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -62,14 +49,9 @@ RowLoop
bcs @block3
ldx #7
- lda ($26),y
and sourcemasks2,x
sta $00
lda ($3c),y
and copymasks2,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks2
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -81,14 +63,9 @@ RowLoop
bcs @block4
ldx #7
- lda ($26),y
and sourcemasks3,x
sta $00
lda ($3c),y
and copymasks3,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks3
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -100,14 +77,9 @@ RowLoop
bcs @block5
ldx #7
- lda ($26),y
and sourcemasks4,x
sta $00
lda ($3c),y
and copymasks4,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks4
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -119,14 +91,9 @@ RowLoop
bcs @block6
ldx #7
- lda ($26),y
and sourcemasks5,x
sta $00
lda ($3c),y
and copymasks5,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks5
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -138,14 +105,9 @@ RowLoop
bcs @block7
ldx #7
- lda ($26),y
and sourcemasks6,x
sta $00
lda ($3c),y
and copymasks6,x
ora $00
sta ($26),y
clc
-
+COPY_BIT $3c, $26, copymasks6
+HGR_INC_WITHIN_BLOCK
dex
bpl -
@ -158,9 +120,9 @@ RowLoop
; [speedopt] HGRBlockCopy but inlined
ldx #7
clc
- lda ($3c),y
sta ($26),y
clc
+HGR_INC_WITHIN_BLOCK
dex
bpl -

View File

@ -9,6 +9,8 @@ tmp = $fb
maskindex = $fc
row = $fd
!source "src/fx/macros.a"
lda #$FA
sta row
@rowloop
@ -40,32 +42,22 @@ row = $fd
inc @basemaskaddr+1
+
ldx #7
clc
@blockloop
@basemaskaddr=*+1
lda $FDFD,x ; SMC
sta @copymask
eor #%11111111
sta @sourcemask
ldy #39
@colloop
lda ($26),y
@sourcemask=*+1
and #0 ; SMC
sta tmp
lda ($3c),y
eor ($3c),y
@copymask=*+1
and #0 ; SMC
ora tmp
eor ($26),y
sta ($26),y
dey
bpl @colloop
lda $27
adc #4
sta $27
eor #$60
sta $3d
+HGR_INC_WITHIN_BLOCK
dex
bpl @blockloop

View File

@ -9,6 +9,8 @@ tmp = $fb
maskindex = $fc
row = $fd
!source "src/fx/macros.a"
lda #$FA
sta row
@rowloop
@ -69,32 +71,22 @@ do
inc @basemaskaddr+1
+
ldx #7
clc
@blockloop
@basemaskaddr=*+1
lda $FDFD,x ; SMC
sta @copymask
eor #%11111111
sta @sourcemask
ldy #39
@colloop
lda ($26),y
@sourcemask=*+1
and #0 ; SMC
sta tmp
lda ($3c),y
eor ($3c),y
@copymask=*+1
and #0 ; SMC
ora tmp
eor ($26),y
sta ($26),y
dey
bpl @colloop
lda $27
adc #4
sta $27
eor #$60
sta $3d
+HGR_INC_WITHIN_BLOCK
dex
bpl @blockloop
rts

View File

@ -9,6 +9,8 @@ tmp = $fb
maskindex = $fc
row = $fd
!source "src/fx/macros.a"
lda #$FA
sta row
@rowloop
@ -71,32 +73,23 @@ do
inc @basemaskaddr+1
+
ldx #7
clc
@blockloop
@basemaskaddr=*+1
lda $FDFD,x ; SMC
sta @copymask
eor #%11111111
sta @sourcemask
ldy #39
@colloop
lda ($26),y
@sourcemask=*+1
and #0 ; SMC
sta tmp
lda ($3c),y
eor ($3c),y
@copymask=*+1
and #0 ; SMC
ora tmp
eor ($26),y
sta ($26),y
dey
bpl @colloop
lda $27
adc #4
sta $27
eor #$60
sta $3d
+HGR_INC_WITHIN_BLOCK
dex
bpl @blockloop
rts

View File

@ -158,6 +158,14 @@
sta $3d
}
!macro COPY_BIT .src1, .dest1, .copymasks {
lda (.dest1),y
eor (.src1),y ; merge source and destination bits
and .copymasks,x ; isolate the bits to replace, zero the rest
eor (.dest1),y ; unmerge source and destination bits, leaves "to keep" destination bits intact
sta (.dest1),y ; write the result
}
!macro SWITCH_TO_MASKS .source, .copy {
sty $00
+LDADDR .source