mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-19 20:32:02 +00:00
refactoring
This commit is contained in:
parent
80972ebe88
commit
aabebeaa55
@ -12,9 +12,6 @@ counter = $ff
|
|||||||
|
|
||||||
!source "src/fx/macros.a"
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
+INIT_MASKS sourcemasks1, copymasks1
|
|
||||||
+INIT_MASKS sourcemasks4, copymasks4
|
|
||||||
|
|
||||||
lda #(40+12)
|
lda #(40+12)
|
||||||
sta counter
|
sta counter
|
||||||
|
|
||||||
@ -33,12 +30,12 @@ RowLoop
|
|||||||
bcs @skip1
|
bcs @skip1
|
||||||
|
|
||||||
; do top half of arrow
|
; do top half of arrow
|
||||||
+SWITCH_TO_MASKS sourcemasks1, copymasks1
|
+SWITCH_TO_MASKS copymasks1
|
||||||
lda row
|
lda row
|
||||||
jsr HGRBlockCopyWithMask
|
jsr HGRBlockCopyWithMask
|
||||||
|
|
||||||
; do bottom half of arrow (opposing row, same col)
|
; do bottom half of arrow (opposing row, same col)
|
||||||
+SWITCH_TO_MASKS sourcemasks4, copymasks4
|
+SWITCH_TO_MASKS copymasks4
|
||||||
lda #23
|
lda #23
|
||||||
sec
|
sec
|
||||||
sbc row
|
sbc row
|
||||||
@ -69,10 +66,6 @@ RowLoop
|
|||||||
+LBNE ColLoop
|
+LBNE ColLoop
|
||||||
@exit rts
|
@exit rts
|
||||||
|
|
||||||
sourcemasks1
|
|
||||||
!byte 0,0,0,0,0,0,0,0 ; SMC
|
|
||||||
sourcemasks4
|
|
||||||
!byte 0,0,0,0,0,0,0,0 ; SMC
|
|
||||||
copymasks1
|
copymasks1
|
||||||
!byte %11111111
|
!byte %11111111
|
||||||
!byte %11111110
|
!byte %11111110
|
||||||
|
@ -16,8 +16,6 @@ hgr1hi = $80C0
|
|||||||
!source "src/fx/macros.a"
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||||
+INIT_MASKS sourcemasks1, copymasks1
|
|
||||||
+INIT_MASKS sourcemasks4, copymasks4
|
|
||||||
|
|
||||||
lda #(40+12+1)
|
lda #(40+12+1)
|
||||||
sta counter
|
sta counter
|
||||||
@ -51,15 +49,13 @@ RowLoop
|
|||||||
+IS_Y_OFFSCREEN
|
+IS_Y_OFFSCREEN
|
||||||
bcs TopSkip1
|
bcs TopSkip1
|
||||||
|
|
||||||
ldx #7
|
|
||||||
- lda ($26),y
|
|
||||||
and sourcemasks1,x
|
|
||||||
sta $00
|
|
||||||
lda #$FF
|
|
||||||
and copymasks1,x
|
|
||||||
ora $00
|
|
||||||
sta ($26),y
|
|
||||||
clc
|
clc
|
||||||
|
ldx #7
|
||||||
|
- lda #$FF
|
||||||
|
eor ($26),y
|
||||||
|
and copymasks1,x
|
||||||
|
eor ($26),y
|
||||||
|
sta ($26),y
|
||||||
+HGR_INC_WITHIN_BLOCK
|
+HGR_INC_WITHIN_BLOCK
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl -
|
||||||
@ -69,15 +65,13 @@ TopSkip1
|
|||||||
+IS_Y_OFFSCREEN
|
+IS_Y_OFFSCREEN
|
||||||
bcs TopSkip2
|
bcs TopSkip2
|
||||||
|
|
||||||
|
clc
|
||||||
ldx #7
|
ldx #7
|
||||||
- lda #$FF
|
- lda #$FF
|
||||||
and sourcemasks1,x
|
eor ($3c),y
|
||||||
sta $00
|
and copymasks3,x
|
||||||
lda ($3c),y
|
eor ($3c),y
|
||||||
and copymasks1,x
|
|
||||||
ora $00
|
|
||||||
sta ($26),y
|
sta ($26),y
|
||||||
clc
|
|
||||||
+HGR_INC_WITHIN_BLOCK
|
+HGR_INC_WITHIN_BLOCK
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl -
|
||||||
@ -110,15 +104,13 @@ BottomHalf
|
|||||||
+IS_Y_OFFSCREEN
|
+IS_Y_OFFSCREEN
|
||||||
bcs BottomSkip1
|
bcs BottomSkip1
|
||||||
|
|
||||||
ldx #7
|
|
||||||
- lda ($26),y
|
|
||||||
and sourcemasks4,x
|
|
||||||
sta $00
|
|
||||||
lda #$FF
|
|
||||||
and copymasks4,x
|
|
||||||
ora $00
|
|
||||||
sta ($26),y
|
|
||||||
clc
|
clc
|
||||||
|
ldx #7
|
||||||
|
- lda #$FF
|
||||||
|
eor ($26),y
|
||||||
|
and copymasks4,x
|
||||||
|
eor ($26),y
|
||||||
|
sta ($26),y
|
||||||
+HGR_INC_WITHIN_BLOCK
|
+HGR_INC_WITHIN_BLOCK
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl -
|
||||||
@ -129,15 +121,13 @@ BottomSkip1
|
|||||||
+IS_Y_OFFSCREEN
|
+IS_Y_OFFSCREEN
|
||||||
bcs BottomSkip2
|
bcs BottomSkip2
|
||||||
|
|
||||||
|
clc
|
||||||
ldx #7
|
ldx #7
|
||||||
- lda #$FF
|
- lda #$FF
|
||||||
and sourcemasks4,x
|
eor ($3c),y
|
||||||
sta $00
|
and copymasks2,x
|
||||||
lda ($3c),y
|
eor ($3c),y
|
||||||
and copymasks4,x
|
|
||||||
ora $00
|
|
||||||
sta ($26),y
|
sta ($26),y
|
||||||
clc
|
|
||||||
+HGR_INC_WITHIN_BLOCK
|
+HGR_INC_WITHIN_BLOCK
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl -
|
||||||
@ -165,10 +155,6 @@ NextRow
|
|||||||
+LBNE ColLoop
|
+LBNE ColLoop
|
||||||
@exit rts
|
@exit rts
|
||||||
|
|
||||||
sourcemasks1
|
|
||||||
!byte 0,0,0,0,0,0,0,0 ; SMC
|
|
||||||
sourcemasks4
|
|
||||||
!byte 0,0,0,0,0,0,0,0 ; SMC
|
|
||||||
copymasks1
|
copymasks1
|
||||||
!byte %11111111
|
!byte %11111111
|
||||||
!byte %11111110
|
!byte %11111110
|
||||||
@ -178,6 +164,24 @@ copymasks1
|
|||||||
!byte %11100000
|
!byte %11100000
|
||||||
!byte %11000000
|
!byte %11000000
|
||||||
!byte %10000000
|
!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
|
copymasks4
|
||||||
!byte %10000000
|
!byte %10000000
|
||||||
!byte %11000000
|
!byte %11000000
|
||||||
|
@ -98,19 +98,11 @@ HGRStaggerToWhite
|
|||||||
bne @loop
|
bne @loop
|
||||||
rts
|
rts
|
||||||
|
|
||||||
SetSourceMask
|
|
||||||
; NOOP- to be removed
|
|
||||||
rts
|
|
||||||
|
|
||||||
SetCopyMask
|
SetCopyMask
|
||||||
; in: A/Y points to 8-byte array of bit masks used by HGRBlockCopyWithMask
|
; in: A/Y points to 8-byte array of bit masks used by HGRBlockCopyWithMask
|
||||||
+STAY CopyMaskAddr
|
+STAY CopyMaskAddr
|
||||||
rts
|
rts
|
||||||
|
|
||||||
BuildSourceMaskFromCopyMask
|
|
||||||
; NOOP- to be removed
|
|
||||||
rts
|
|
||||||
|
|
||||||
HGRBlockCopyWithMask
|
HGRBlockCopyWithMask
|
||||||
; in: A = HGR row / 8 (0x00..0x17)
|
; in: A = HGR row / 8 (0x00..0x17)
|
||||||
; Y = HGR column (0x00..0x27)
|
; Y = HGR column (0x00..0x27)
|
||||||
@ -126,7 +118,7 @@ HGRBlockCopyWithMasksLoop
|
|||||||
eor ($3c),y
|
eor ($3c),y
|
||||||
CopyMaskAddr=*+1
|
CopyMaskAddr=*+1
|
||||||
and $FDFD,x ; call SetCopyMask to set
|
and $FDFD,x ; call SetCopyMask to set
|
||||||
eor ($3c),y
|
eor ($26),y
|
||||||
sta ($26),y
|
sta ($26),y
|
||||||
clc
|
clc
|
||||||
+HGR_INC_WITHIN_BLOCK
|
+HGR_INC_WITHIN_BLOCK
|
||||||
|
@ -11,7 +11,7 @@ counter = $ff
|
|||||||
|
|
||||||
!source "src/fx/macros.a"
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
+INIT_MASKS sourcemasks, copymasks
|
+SWITCH_TO_MASKS copymasks
|
||||||
|
|
||||||
lda #64 ; 40 + 24
|
lda #64 ; 40 + 24
|
||||||
sta counter
|
sta counter
|
||||||
@ -47,8 +47,6 @@ counter = $ff
|
|||||||
bne @colloop
|
bne @colloop
|
||||||
@exit rts
|
@exit rts
|
||||||
|
|
||||||
sourcemasks
|
|
||||||
!byte 0,0,0,0,0,0,0,0 ; SMC
|
|
||||||
copymasks
|
copymasks
|
||||||
!byte %11111111
|
!byte %11111111
|
||||||
!byte %11111110
|
!byte %11111110
|
||||||
|
@ -11,7 +11,7 @@ counter = $ff
|
|||||||
|
|
||||||
!source "src/fx/macros.a"
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
+INIT_MASKS sourcemasks, copymasks
|
+SWITCH_TO_MASKS copymasks
|
||||||
|
|
||||||
lda #64 ; 40 + 24
|
lda #64 ; 40 + 24
|
||||||
sta counter
|
sta counter
|
||||||
@ -48,8 +48,6 @@ counter = $ff
|
|||||||
bne @colloop
|
bne @colloop
|
||||||
@exit rts
|
@exit rts
|
||||||
|
|
||||||
sourcemasks
|
|
||||||
!byte 0,0,0,0,0,0,0,0 ; SMC
|
|
||||||
copymasks
|
copymasks
|
||||||
!byte %11111111
|
!byte %11111111
|
||||||
!byte %10111111
|
!byte %10111111
|
||||||
|
@ -11,7 +11,7 @@ counter = $ff
|
|||||||
|
|
||||||
!source "src/fx/macros.a"
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
+INIT_MASKS sourcemasks, copymasks
|
+SWITCH_TO_MASKS copymasks
|
||||||
|
|
||||||
lda #64 ; 40 + 24
|
lda #64 ; 40 + 24
|
||||||
sta counter
|
sta counter
|
||||||
@ -50,8 +50,6 @@ counter = $ff
|
|||||||
bcc @colloop
|
bcc @colloop
|
||||||
@exit rts
|
@exit rts
|
||||||
|
|
||||||
sourcemasks
|
|
||||||
!byte 0,0,0,0,0,0,0,0 ; SMC
|
|
||||||
copymasks
|
copymasks
|
||||||
!byte %10000000
|
!byte %10000000
|
||||||
!byte %10000001
|
!byte %10000001
|
||||||
|
@ -11,7 +11,7 @@ counter = $ff
|
|||||||
|
|
||||||
!source "src/fx/macros.a"
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
+INIT_MASKS sourcemasks, copymasks
|
+SWITCH_TO_MASKS copymasks
|
||||||
|
|
||||||
lda #64 ; 40 + 24
|
lda #64 ; 40 + 24
|
||||||
sta counter
|
sta counter
|
||||||
@ -49,8 +49,6 @@ counter = $ff
|
|||||||
bne @colloop
|
bne @colloop
|
||||||
@exit rts
|
@exit rts
|
||||||
|
|
||||||
sourcemasks
|
|
||||||
!byte 0,0,0,0,0,0,0,0 ; SMC
|
|
||||||
copymasks
|
copymasks
|
||||||
!byte %10000000
|
!byte %10000000
|
||||||
!byte %11000000
|
!byte %11000000
|
||||||
|
@ -12,11 +12,6 @@ counter = $ff
|
|||||||
|
|
||||||
!source "src/fx/macros.a"
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
+INIT_MASKS sourcemasks1, copymasks1
|
|
||||||
+INIT_MASKS sourcemasks2, copymasks2
|
|
||||||
+INIT_MASKS sourcemasks3, copymasks3
|
|
||||||
+INIT_MASKS sourcemasks4, copymasks4
|
|
||||||
|
|
||||||
lda #32
|
lda #32
|
||||||
sta counter
|
sta counter
|
||||||
|
|
||||||
@ -36,11 +31,11 @@ counter = $ff
|
|||||||
+ cpy #40
|
+ cpy #40
|
||||||
bcs -
|
bcs -
|
||||||
; do corner 1
|
; do corner 1
|
||||||
+SWITCH_TO_MASKS sourcemasks1, copymasks1
|
+SWITCH_TO_MASKS copymasks1
|
||||||
lda row
|
lda row
|
||||||
jsr HGRBlockCopyWithMask
|
jsr HGRBlockCopyWithMask
|
||||||
; do corner 2 (same row, opposing col)
|
; do corner 2 (same row, opposing col)
|
||||||
+SWITCH_TO_MASKS sourcemasks2, copymasks2
|
+SWITCH_TO_MASKS copymasks2
|
||||||
lda #39
|
lda #39
|
||||||
sec
|
sec
|
||||||
sbc y
|
sbc y
|
||||||
@ -48,7 +43,7 @@ counter = $ff
|
|||||||
lda row
|
lda row
|
||||||
jsr HGRBlockCopyWithMask
|
jsr HGRBlockCopyWithMask
|
||||||
; do corner 3 (opposing row, opposing col)
|
; do corner 3 (opposing row, opposing col)
|
||||||
+SWITCH_TO_MASKS sourcemasks3, copymasks3
|
+SWITCH_TO_MASKS copymasks3
|
||||||
lda #39
|
lda #39
|
||||||
sec
|
sec
|
||||||
sbc y
|
sbc y
|
||||||
@ -58,7 +53,7 @@ counter = $ff
|
|||||||
sbc row
|
sbc row
|
||||||
jsr HGRBlockCopyWithMask
|
jsr HGRBlockCopyWithMask
|
||||||
; do corner 4 (opposing row, same col)
|
; do corner 4 (opposing row, same col)
|
||||||
+SWITCH_TO_MASKS sourcemasks4, copymasks4
|
+SWITCH_TO_MASKS copymasks4
|
||||||
ldy y
|
ldy y
|
||||||
lda #23
|
lda #23
|
||||||
sec
|
sec
|
||||||
@ -111,14 +106,6 @@ counter = $ff
|
|||||||
jmp @colloop
|
jmp @colloop
|
||||||
@exit rts
|
@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
|
|
||||||
copymasks1
|
copymasks1
|
||||||
!byte %11111111
|
!byte %11111111
|
||||||
!byte %11111110
|
!byte %11111110
|
||||||
|
@ -159,25 +159,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
!macro COPY_BIT .src1, .dest1, .copymasks {
|
!macro COPY_BIT .src1, .dest1, .copymasks {
|
||||||
lda (.dest1),y
|
lda (.src1),y
|
||||||
eor (.src1),y ; merge source and destination bits
|
eor (.dest1),y ; merge source and destination bits
|
||||||
and .copymasks,x ; isolate the bits to replace, zero the rest
|
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
|
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||||||
sta (.dest1),y ; write the result
|
sta (.dest1),y ; write the result
|
||||||
}
|
}
|
||||||
|
|
||||||
!macro SWITCH_TO_MASKS .source, .copy {
|
!macro SWITCH_TO_MASKS .copy {
|
||||||
sty $00
|
lda #<.copy
|
||||||
+LDADDR .source
|
sta CopyMaskAddr
|
||||||
jsr SetSourceMask
|
lda #>.copy
|
||||||
+LDADDR .copy
|
sta CopyMaskAddr+1
|
||||||
jsr SetCopyMask
|
|
||||||
ldy $00
|
|
||||||
}
|
|
||||||
|
|
||||||
!macro INIT_MASKS .source, .copy {
|
|
||||||
+SWITCH_TO_MASKS .source, .copy
|
|
||||||
jsr BuildSourceMaskFromCopyMask
|
|
||||||
}
|
}
|
||||||
|
|
||||||
; must set N flag based on Y immediately before using this macro
|
; must set N flag based on Y immediately before using this macro
|
||||||
|
Loading…
Reference in New Issue
Block a user