split hgr.common routines into separate macros and make effects declare which ones they use

This commit is contained in:
4am 2020-11-13 21:24:30 -05:00
parent c455158253
commit 3189ef9176
36 changed files with 80 additions and 19 deletions

View File

@ -7,6 +7,8 @@ coord = $FE
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_HALF_BLOCK_COPY_ROUTINES
+HGR_WHITE_ROUTINES
!source "src/fx/fx.dhgr.common.a"
Start

View File

@ -59,3 +59,4 @@ row = $FF
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -88,3 +88,5 @@ copymasks4
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_BLOCK_COPY_ROUTINES
+HGR_COPY_MASK_ROUTINES

View File

@ -195,3 +195,4 @@ copymasks4
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_BLOCK_COPY_ROUTINES

View File

@ -40,3 +40,4 @@ row2 = $ff
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -38,3 +38,4 @@ coord = $FE
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_BLOCK_COPY_ROUTINES

View File

@ -63,3 +63,5 @@ coord = $FE
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_WHITE_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -80,3 +80,4 @@ Coordinates
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_BLOCK_COPY_ROUTINES

View File

@ -3,6 +3,7 @@
;
!source "src/fx/macros.a"
!macro HGR_CALC_ROUTINES {
HGRCalc
; in: A = HGR row (0x00..0xBF)
; out: A/X clobbered
@ -14,7 +15,9 @@ HGRCalc
; http://www.txbobsc.com/aal/1986/aal8612.html#a9
+HGR_CALC
rts
}
!macro HGR_BLOCK_COPY_ROUTINES {
HGRBlockCopy
; in: A = HGR row / 8 (0x00..0x17)
; Y = HGR column (0x00..0x27)
@ -34,26 +37,9 @@ HGRBlockCopyNoRecalc
dex
bne @loop
rts
}
HGRBlockToWhite
; in: A = HGR row / 8 (0x00..0x17)
; Y = HGR column (0x00..0x27)
; out: Y preserved
; X = #$00
; Z set
; C clear
; all other flags and registers clobbered
+HGR_ROW_CALC
clc
ldx #$08
@loop
lda #$7F
sta ($26),y
+HGR_INC_WITHIN_BLOCK
dex
bne @loop
rts
!macro HGR_HALF_BLOCK_COPY_ROUTINES {
HGRHalfBlockCopy
; in: A = HGR row / 4 (0x00..0x2F)
; Y = HGR column (0x00..0x27)
@ -75,6 +61,27 @@ HGRStaggerCopy
dex
bne @loop
rts
}
!macro HGR_WHITE_ROUTINES {
HGRBlockToWhite
; in: A = HGR row / 8 (0x00..0x17)
; Y = HGR column (0x00..0x27)
; out: Y preserved
; X = #$00
; Z set
; C clear
; all other flags and registers clobbered
+HGR_ROW_CALC
clc
ldx #$08
@loop
lda #$7F
sta ($26),y
+HGR_INC_WITHIN_BLOCK
dex
bne @loop
rts
HGRHalfBlockToWhite
; in: A = HGR row / 4 (0x00..0x2F)
@ -97,7 +104,9 @@ HGRStaggerToWhite
dex
bne @loop
rts
}
!macro HGR_COPY_MASK_ROUTINES {
SetCopyMask
; in: A/Y points to 8-byte array of bit masks used by HGRBlockCopyWithMask
+ST16 CopyMaskAddr
@ -125,3 +134,4 @@ CopyMaskAddr=*+1
dex
bpl HGRBlockCopyWithMasksLoop
rts
}

View File

@ -54,3 +54,5 @@
!byte $80
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_WHITE_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -60,3 +60,5 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_COPY_MASK_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -61,3 +61,5 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_COPY_MASK_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -62,3 +62,5 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_COPY_MASK_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -62,3 +62,5 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_COPY_MASK_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -146,3 +146,5 @@ copymasks4
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_COPY_MASK_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -91,3 +91,4 @@
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_HALF_BLOCK_COPY_ROUTINES

View File

@ -73,3 +73,5 @@
!byte $80
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_WHITE_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -38,3 +38,4 @@ coord = $FE
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_HALF_BLOCK_COPY_ROUTINES

View File

@ -63,3 +63,5 @@ coord = $FE
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_WHITE_ROUTINES
+HGR_HALF_BLOCK_COPY_ROUTINES

View File

@ -41,3 +41,4 @@ row = $FF
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -40,3 +40,4 @@ row2 = $ff
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -112,3 +112,4 @@ copymasks
!byte $FF,$BF,$9F,$8F,$87,$83,$81
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -95,3 +95,4 @@ copymasks2
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -73,3 +73,5 @@
!byte $80
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_WHITE_ROUTINES
+HGR_BLOCK_COPY_ROUTINES

View File

@ -63,3 +63,4 @@ copymasks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -98,3 +98,4 @@ CopyLine
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -149,3 +149,4 @@ masks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -157,3 +157,4 @@ masks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -160,3 +160,4 @@ masks
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES

View File

@ -78,3 +78,4 @@
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_BLOCK_COPY_ROUTINES

View File

@ -124,3 +124,5 @@ row2 = $FF
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_CALC_ROUTINES
+HGR_WHITE_ROUTINES

View File

@ -41,3 +41,4 @@ col2 = $ff
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_HALF_BLOCK_COPY_ROUTINES

View File

@ -70,3 +70,5 @@ col2 = $ff
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_WHITE_ROUTINES
+HGR_HALF_BLOCK_COPY_ROUTINES

View File

@ -37,3 +37,4 @@ row2 = $ff
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_HALF_BLOCK_COPY_ROUTINES

View File

@ -69,3 +69,5 @@ row2 = $ff
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_WHITE_ROUTINES
+HGR_HALF_BLOCK_COPY_ROUTINES

View File

@ -112,3 +112,5 @@ Coordinates
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"
+HGR_COPY_MASK_ROUTINES
+HGR_BLOCK_COPY_ROUTINES