mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-24 07:29:26 +00:00
refactoring with macros
This commit is contained in:
parent
68fd1c6dda
commit
3f89a241e6
@ -22,6 +22,16 @@ hgr1hi = $BE40 ; $C0 bytes
|
|||||||
|
|
||||||
!source "src/fx/macros.a"
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
|
!macro COPY_BIT .src1, .dest1, .sourcemasks, .copymasks {
|
||||||
|
lda (.dest1),y
|
||||||
|
and .sourcemasks,x
|
||||||
|
sta $00
|
||||||
|
lda (.src1),y
|
||||||
|
and .copymasks,x
|
||||||
|
ora $00
|
||||||
|
sta (.dest1),y
|
||||||
|
}
|
||||||
|
|
||||||
!macro FX_PRECOMPUTED_1BIT .coords {
|
!macro FX_PRECOMPUTED_1BIT .coords {
|
||||||
; build lookup tables for base address of HGR rows
|
; build lookup tables for base address of HGR rows
|
||||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||||
@ -150,83 +160,27 @@ InputLoop
|
|||||||
|
|
||||||
; main 1x2 block in top-left quadrant
|
; main 1x2 block in top-left quadrant
|
||||||
|
|
||||||
lda (dest1),y
|
+COPY_BIT src1, dest1, sourcemasks, copymasks
|
||||||
and sourcemasks,x
|
+COPY_BIT src2, dest2, sourcemasks, copymasks
|
||||||
sta $00
|
|
||||||
lda (src1),y
|
|
||||||
; lda #$FF
|
|
||||||
and copymasks,x
|
|
||||||
ora $00
|
|
||||||
sta (dest1),y
|
|
||||||
lda (dest2),y
|
|
||||||
and sourcemasks,x
|
|
||||||
sta $00
|
|
||||||
lda (src2),y
|
|
||||||
; lda #$FF
|
|
||||||
and copymasks,x
|
|
||||||
ora $00
|
|
||||||
sta (dest2),y
|
|
||||||
|
|
||||||
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
|
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
|
||||||
|
|
||||||
lda mirror_cols,y
|
lda mirror_cols,y
|
||||||
tay
|
tay
|
||||||
lda (dest1),y
|
+COPY_BIT src1, dest1, mirror_sourcemasks, mirror_copymasks
|
||||||
and mirror_sourcemasks,x
|
+COPY_BIT src2, dest2, mirror_sourcemasks, mirror_copymasks
|
||||||
sta $00
|
|
||||||
lda (src1),y
|
|
||||||
; lda #$FF
|
|
||||||
and mirror_copymasks,x
|
|
||||||
ora $00
|
|
||||||
sta (dest1),y
|
|
||||||
lda (dest2),y
|
|
||||||
and mirror_sourcemasks,x
|
|
||||||
sta $00
|
|
||||||
lda (src2),y
|
|
||||||
; lda #$FF
|
|
||||||
and mirror_copymasks,x
|
|
||||||
ora $00
|
|
||||||
sta (dest2),y
|
|
||||||
|
|
||||||
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
|
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
|
||||||
|
|
||||||
lda (dest3),y
|
+COPY_BIT src3, dest3, mirror_sourcemasks, mirror_copymasks
|
||||||
and mirror_sourcemasks,x
|
+COPY_BIT src4, dest4, mirror_sourcemasks, mirror_copymasks
|
||||||
sta $00
|
|
||||||
lda (src3),y
|
|
||||||
; lda #$FF
|
|
||||||
and mirror_copymasks,x
|
|
||||||
ora $00
|
|
||||||
sta (dest3),y
|
|
||||||
lda (dest4),y
|
|
||||||
and mirror_sourcemasks,x
|
|
||||||
sta $00
|
|
||||||
lda (src4),y
|
|
||||||
; lda #$FF
|
|
||||||
and mirror_copymasks,x
|
|
||||||
ora $00
|
|
||||||
sta (dest4),y
|
|
||||||
|
|
||||||
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
|
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
|
||||||
|
|
||||||
lda mirror_cols,y
|
lda mirror_cols,y
|
||||||
tay
|
tay
|
||||||
lda (dest3),y
|
+COPY_BIT src3, dest3, sourcemasks, copymasks
|
||||||
and sourcemasks,x
|
+COPY_BIT src4, dest4, sourcemasks, copymasks
|
||||||
sta $00
|
|
||||||
lda (src3),y
|
|
||||||
; lda #$FF
|
|
||||||
and copymasks,x
|
|
||||||
ora $00
|
|
||||||
sta (dest3),y
|
|
||||||
lda (dest4),y
|
|
||||||
and sourcemasks,x
|
|
||||||
sta $00
|
|
||||||
lda (src4),y
|
|
||||||
; lda #$FF
|
|
||||||
and copymasks,x
|
|
||||||
ora $00
|
|
||||||
sta (dest4),y
|
|
||||||
|
|
||||||
bit $c000
|
bit $c000
|
||||||
bmi Exit2
|
bmi Exit2
|
||||||
|
Loading…
Reference in New Issue
Block a user