mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-10 20:51:45 +00:00
247 lines
5.1 KiB
Plaintext
247 lines
5.1 KiB
Plaintext
|
;license:MIT
|
||
|
;(c) 2019 by 4am
|
||
|
;
|
||
|
!cpu 6502
|
||
|
!to "build/FX/SOFT.L",plain
|
||
|
*=$6000
|
||
|
|
||
|
y = $fc
|
||
|
row = $fd
|
||
|
col = $fe
|
||
|
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
|
||
|
|
||
|
lda #39
|
||
|
sta col
|
||
|
ColLoop
|
||
|
lda #23
|
||
|
sta row
|
||
|
RowLoop
|
||
|
; [speedopt] calculate HGR base addresses once per row
|
||
|
lda row
|
||
|
asl
|
||
|
asl
|
||
|
asl
|
||
|
+HGR_CALC
|
||
|
|
||
|
ldy col
|
||
|
+IS_Y_OFFSCREEN
|
||
|
bcs @block2
|
||
|
|
||
|
; [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
|
||
|
+HGR_INC_WITHIN_BLOCK
|
||
|
dex
|
||
|
bpl -
|
||
|
|
||
|
; [speedopt] reset HGR base addresses instead of recalculating them from scratch
|
||
|
+RESET_HGR_CALC
|
||
|
@block2
|
||
|
iny
|
||
|
+IS_Y_OFFSCREEN
|
||
|
bcs @block3
|
||
|
|
||
|
ldx #7
|
||
|
- lda ($26),y
|
||
|
and sourcemasks2,x
|
||
|
sta $00
|
||
|
lda ($3c),y
|
||
|
and copymasks2,x
|
||
|
ora $00
|
||
|
sta ($26),y
|
||
|
clc
|
||
|
+HGR_INC_WITHIN_BLOCK
|
||
|
dex
|
||
|
bpl -
|
||
|
|
||
|
+RESET_HGR_CALC
|
||
|
@block3
|
||
|
iny
|
||
|
+IS_Y_OFFSCREEN
|
||
|
bcs @block4
|
||
|
|
||
|
ldx #7
|
||
|
- lda ($26),y
|
||
|
and sourcemasks3,x
|
||
|
sta $00
|
||
|
lda ($3c),y
|
||
|
and copymasks3,x
|
||
|
ora $00
|
||
|
sta ($26),y
|
||
|
clc
|
||
|
+HGR_INC_WITHIN_BLOCK
|
||
|
dex
|
||
|
bpl -
|
||
|
|
||
|
+RESET_HGR_CALC
|
||
|
@block4
|
||
|
iny
|
||
|
+IS_Y_OFFSCREEN
|
||
|
bcs @block5
|
||
|
|
||
|
ldx #7
|
||
|
- lda ($26),y
|
||
|
and sourcemasks4,x
|
||
|
sta $00
|
||
|
lda ($3c),y
|
||
|
and copymasks4,x
|
||
|
ora $00
|
||
|
sta ($26),y
|
||
|
clc
|
||
|
+HGR_INC_WITHIN_BLOCK
|
||
|
dex
|
||
|
bpl -
|
||
|
|
||
|
+RESET_HGR_CALC
|
||
|
@block5
|
||
|
iny
|
||
|
+IS_Y_OFFSCREEN
|
||
|
bcs @block6
|
||
|
|
||
|
ldx #7
|
||
|
- lda ($26),y
|
||
|
and sourcemasks5,x
|
||
|
sta $00
|
||
|
lda ($3c),y
|
||
|
and copymasks5,x
|
||
|
ora $00
|
||
|
sta ($26),y
|
||
|
clc
|
||
|
+HGR_INC_WITHIN_BLOCK
|
||
|
dex
|
||
|
bpl -
|
||
|
|
||
|
+RESET_HGR_CALC
|
||
|
@block6
|
||
|
iny
|
||
|
+IS_Y_OFFSCREEN
|
||
|
bcs @block7
|
||
|
|
||
|
ldx #7
|
||
|
- lda ($26),y
|
||
|
and sourcemasks6,x
|
||
|
sta $00
|
||
|
lda ($3c),y
|
||
|
and copymasks6,x
|
||
|
ora $00
|
||
|
sta ($26),y
|
||
|
clc
|
||
|
+HGR_INC_WITHIN_BLOCK
|
||
|
dex
|
||
|
bpl -
|
||
|
|
||
|
+RESET_HGR_CALC
|
||
|
@block7
|
||
|
iny
|
||
|
+IS_Y_OFFSCREEN
|
||
|
bcs @nextrow
|
||
|
|
||
|
; [speedopt] HGRBlockCopy but inlined
|
||
|
ldx #7
|
||
|
- lda ($3c),y
|
||
|
sta ($26),y
|
||
|
clc
|
||
|
+HGR_INC_WITHIN_BLOCK
|
||
|
dex
|
||
|
bpl -
|
||
|
|
||
|
; don't need RESET_HGR_CALC here because we're done with this row
|
||
|
@nextrow
|
||
|
dec row
|
||
|
+LBPL RowLoop
|
||
|
lda $c000
|
||
|
bmi @exit
|
||
|
dec col
|
||
|
dec counter
|
||
|
+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
|
||
|
!byte %10000000
|
||
|
!byte %10001000
|
||
|
!byte %10001000
|
||
|
!byte %10000000
|
||
|
!byte %10000000
|
||
|
!byte %10000000
|
||
|
copymasks2
|
||
|
!byte %10000000
|
||
|
!byte %10000000
|
||
|
!byte %10010100
|
||
|
!byte %10001000
|
||
|
!byte %10001000
|
||
|
!byte %10010100
|
||
|
!byte %10000000
|
||
|
!byte %10000000
|
||
|
copymasks3
|
||
|
!byte %10000000
|
||
|
!byte %10000000
|
||
|
!byte %10011100
|
||
|
!byte %10011100
|
||
|
!byte %10011100
|
||
|
!byte %10011100
|
||
|
!byte %10000000
|
||
|
!byte %10000000
|
||
|
copymasks4
|
||
|
!byte %10000000
|
||
|
!byte %10101010
|
||
|
!byte %10011100
|
||
|
!byte %10111110
|
||
|
!byte %10011100
|
||
|
!byte %10011100
|
||
|
!byte %10101010
|
||
|
!byte %10000000
|
||
|
copymasks5
|
||
|
!byte %10000000
|
||
|
!byte %10111110
|
||
|
!byte %10111110
|
||
|
!byte %10111110
|
||
|
!byte %10111110
|
||
|
!byte %10111110
|
||
|
!byte %10111110
|
||
|
!byte %10000000
|
||
|
copymasks6
|
||
|
!byte %11010101
|
||
|
!byte %10111110
|
||
|
!byte %11111111
|
||
|
!byte %10111110
|
||
|
!byte %11111111
|
||
|
!byte %10111110
|
||
|
!byte %10111110
|
||
|
!byte %11010101
|
||
|
|
||
|
!source "src/wait.a"
|
||
|
!source "src/fx/fx.hgr.common.a"
|