factor out BuildHGRTables, standardize some table locations across FX

This commit is contained in:
4am 2024-05-26 00:40:54 -04:00
parent 0301a7ff48
commit 1c15f9daa1
75 changed files with 307 additions and 280 deletions

View File

@ -127,6 +127,7 @@ ResetVector ; 6 bytes, copied to $100
!source "src/glue.decompress.a"
!source "src/textrank.a"
!source "src/okvs.a"
!source "src/prodos.path.a"
; add new files above here
!source "src/hw.vbl.a"
@ -154,9 +155,42 @@ gGlobalPrefsStore
SwitchToBank2
+READ_RAM2_WRITE_RAM2
rts
!source "src/prodos.path.a" ; paths end up on the same page
; BuildHGRTables (label is on constants.a)
!if (RELBASE != $2000) and (* != BuildHGRTables) {
!serious "BuildHGRTables=",*,", fix constants.a"
}
; out: A clobbered
; X=$C0
; Z=1
; Y preserved
ldx #0
- txa
and #$F8
bpl +
ora #5
+ asl
bpl +
ora #5
+ asl
asl
sta $0201, x
txa
and #7
rol
asl $0201, x
rol
ora #$20
sta $0301, x
inx
cpx #$C0
bne -
rts
; WaitForKeyWithTimeout (label is in constants.a)
!if (RELBASE != $2000) and (* != WaitForKeyWithTimeout) {
!serious "WaitForKeyWithTimeout=",*,", fix constants.a"
}
; in: A = timeout length (like standard $FCA8 wait routine)
; out: A clobbered
; X/Y preserved
@ -172,29 +206,54 @@ SwitchToBank2
@exit rts
; iLoadFXDATA (label is in constants.a)
!if (RELBASE != $2000) and (* != iLoadFXDATA) {
!serious "iLoadFXDATA=",*,", fix constants.a"
}
jmp LoadFXDATA ; no direct calling - target can move
; iLoadXSingle (label is in constants.a)
!if (RELBASE != $2000) and (* != iLoadXSingle) {
!serious "iLoadXSingle=",*,", fix constants.a"
}
jmp LoadXSingle ; no direct calling - target can move
; iAddToPath (label is in constants.a)
!if (RELBASE != $2000) and (* != iAddToPath) {
!serious "iAddToPath=",*,", fix constants.a"
}
jmp AddToPath ; no direct calling - target can move
; iLoadFileDirect (label is in constants.a)
!if (RELBASE != $2000) and (* != iLoadFileDirect) {
!serious "iLoadFileDirect=",*,", fix constants.a"
}
jmp LoadFileDirect ; no direct calling - target can move
; WaitForVBL (label is in constants.a)
!if (RELBASE != $2000) and (* != WaitForVBL) {
!serious "WaitForVBL=",*,", fix constants.a"
}
jmp WaitForVBL_iie ; SMC to RTS on a II+
; UnwaitForVBL (label is in constants.a)
!if (RELBASE != $2000) and (* != UnwaitForVBL) {
!serious "UnwaitForVBL=",*,", fix constants.a"
}
rts ; SMC to JMP on a IIc
!word iUnwaitForVBL
; MockingboardStuff (label is in constants.a)
!if (RELBASE != $2000) and (* != MockingboardStuff) {
!serious "MockingboardStuff=",*,", fix constants.a"
}
; slot number where Mockingboard was detected and type of board
; #$00 if no Mockingboard detected
!byte $FD ; MockingboardStuff ($FFF8)
; MachineStatus (label is in constants.a so prelaunchers can use it)
!if (RELBASE != $2000) and (* != MachineStatus) {
!serious "MachineStatus=",*,", fix constants.a"
}
; 7 6 5 4 3 2 1 0
; | | | | | | | +- bit 0 reserved
; | | | | | | +--- bit 1 reserved
@ -206,6 +265,9 @@ SwitchToBank2
; +--------------- bit 7 = 1 if joystick
; Use the bit masks defined in constants.a
!byte $FD ; MachineStatus ($FFF9)
!if (RELBASE != $2000) and (* != $FFFA) {
!serious "Expected LC vectors to start at $FFFA, found ",*
}
!word Reenter ; NMI vector ($FFFA-B)
!word Reenter ; reset vector ($FFFC-D)
!word Ignore ; IRQ vector ($FFFE-F)

View File

@ -170,6 +170,7 @@ gSearchIndex = $6000
gSearchCache = $A000
; LC RAM 1 & 2
BuildHGRTables = $FFAF
WaitForKeyWithTimeout = $FFD5
iLoadFXDATA = $FFE6
iLoadXSingle = $FFE9

View File

@ -11,6 +11,7 @@
+READ_RAM2_WRITE_RAM2
jsr EnableAccelerator
+LOAD_FILE_KEEP_DIR stellar_7, stellar_7_dir_e-stellar_7_dir_b
+READ_ROM_NO_WRITE
lda #$60
sta $863

View File

@ -5,14 +5,13 @@
!to "build/FX.INDEXED/DHGR.TWOPASS.LR",plain
*=$6000
hgrlo = $0200 ; [$C0 bytes, main memory only]
hgr1hi = $0300 ; [$C0 bytes, main memory only]
hgrlo = $0201 ; [$C0 bytes, main memory only]
hgr1hi = $0301 ; [$C0 bytes, main memory only]
!source "src/fx/macros.a"
+COPY_TO_0 start, end
;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
jmp loop
start

View File

@ -80,10 +80,10 @@ rowcount = $04 ; [byte] used by drawing routines
tmpy = $05 ; [byte] used by drawing routines
box = $0E ; [byte] counter in main loop
BoxStages = $10 ; [$30 bytes] current stage for each box
auxsrc_hgrhi = $BC00 ; [$C0 bytes] HGR base addresses (hi) starting at $9000
hgrhi = $BD00 ; [$C0 bytes] HGR base addresses (hi) starting at $2000
hgrlo = $BE00 ; [$C0 bytes] HGR base addresses (lo) starting at $2000
BoxesX = $BDC0 ; [$30 bytes] starting row for each box
auxsrc_hgrhi = $BD01 ; [$C0 bytes] HGR base addresses (hi) starting at $9000
hgrlo = $0201 ; [$C0 bytes] HGR base addresses (lo) starting at $2000
hgrhi = $0301 ; [$C0 bytes] HGR base addresses (hi) starting at $2000
BoxesX = $BE90 ; [$30 bytes] starting row for each box
BoxesY = $BEC0 ; [$30 bytes] starting byte offset for each box
; High bytes of drawing routines for each stage (actual routines will be page-aligned).
@ -167,6 +167,122 @@ k_bitcopy = 30 ; must be last token
!source "src/fx/macros.a"
jmp GenerateBoxes
; All template p-code must be on the same page
;!align 255,0
; Template for 'stage 0' routine (copy00), which copies the innermost
; part of the box (labeled '0' in diagram above).
STAGE0
!byte k_set_first_row
!byte k_iny2
!byte k_recalc
!byte k_bitcopy, k_left_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_left_mask_main
!byte k_switch_to_main
!byte k_inx_and_recalc
!byte k_bitcopy, k_left_mask_aux
!byte k_switch_to_aux
!byte k_bitcopy, k_left_mask_aux
!byte k_rts ; also serves as an end-of-template marker
; Template for 'stage 1' routine (copy01), which copies the pixels
; around the innermost box (labeled '1' in diagram above).
STAGE1
!byte k_set_first_row
!byte k_iny2
!byte k_recalc
!byte k_byte_copy
!byte k_switch_to_aux_and_byte_copy
!byte k_switch_to_main
!byte k_inx_and_recalc
!byte k_byte_copy
!byte k_switch_to_aux_and_byte_copy
!byte k_switch_to_main
!byte k_inx_and_recalc
!byte k_byte_copy
!byte k_switch_to_aux_and_byte_copy
!byte k_switch_to_main
!byte k_inx_and_recalc
!byte k_byte_copy
!byte k_switch_to_aux_and_byte_copy
!byte k_rts ; also serves as an end-of-template marker
; Template for stages 2-8 (copy02..copy08)
MIDDLE_STAGE
!byte k_set_row_count
!byte k_set_first_row
!byte k_iny
!byte k_save_y
!byte k_middle_jsr, k_current_page
;-
!byte k_inx_and_recalc
!byte k_bitcopy, k_left_mask_main
!byte k_iny2
!byte k_bitcopy, k_right_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_right_mask_aux
!byte k_restore_y
!byte k_bitcopy, k_left_mask_aux
!byte k_switch_to_main
!byte k_middle_branch
;+
!byte k_inx_and_recalc
!byte k_bitcopy, k_edge_left_mask_main
!byte k_iny
!byte k_byte_copy_and_iny
!byte k_bitcopy, k_edge_right_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_edge_right_mask_aux
!byte k_dey
!byte k_byte_copy
!byte k_dey
!byte k_bitcopy, k_edge_left_mask_aux
!byte k_rts ; also serves as an end-of-template marker
; Template for stages 9-15 (copy09..copy0F)
OUTER_STAGE
!byte k_set_row_count
!byte k_set_first_row
!byte k_save_y
!byte k_outer_jsr, k_current_page
;-
!byte k_inx_and_recalc
!byte k_bitcopy, k_left_mask_main
!byte k_iny2
!byte k_iny2
!byte k_bitcopy, k_right_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_right_mask_aux
!byte k_restore_y
!byte k_bitcopy, k_left_mask_aux
!byte k_switch_to_main
!byte k_outer_branch
;+
!byte k_inx_and_recalc
!byte k_bitcopy, k_edge_left_mask_main
!byte k_iny
!byte k_byte_copy_and_iny
!byte k_byte_copy_and_iny
!byte k_byte_copy_and_iny
!byte k_bitcopy, k_edge_right_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_edge_right_mask_aux
!byte k_dey
!byte k_byte_copy
!byte k_dey
!byte k_byte_copy
!byte k_dey
!byte k_byte_copy
!byte k_dey
!byte k_bitcopy, k_edge_left_mask_aux
!byte k_rts ; also serves as an end-of-template marker
!if >* != >STAGE0 {
!error "Templates are not all on same page"
}
GenerateBoxes
; generate |BoxesX| and |BoxesY| arrays
ldx #48
ldy #$A0
@ -206,7 +322,7 @@ k_bitcopy = 30 ; must be last token
bne -
; X=0 here
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgrhi
jsr BuildHGRTables
; X=$C0 here
- lda hgrhi-1, x
@ -638,116 +754,4 @@ BuildStage1And0
lda #<STAGE0
jmp BuildDrawingRoutineFrom
; All template p-code must be on the same page
;!align 255,0
; Template for 'stage 0' routine (copy00), which copies the innermost
; part of the box (labeled '0' in diagram above).
STAGE0
!byte k_set_first_row
!byte k_iny2
!byte k_recalc
!byte k_bitcopy, k_left_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_left_mask_main
!byte k_switch_to_main
!byte k_inx_and_recalc
!byte k_bitcopy, k_left_mask_aux
!byte k_switch_to_aux
!byte k_bitcopy, k_left_mask_aux
!byte k_rts ; also serves as an end-of-template marker
; Template for 'stage 1' routine (copy01), which copies the pixels
; around the innermost box (labeled '1' in diagram above).
STAGE1
!byte k_set_first_row
!byte k_iny2
!byte k_recalc
!byte k_byte_copy
!byte k_switch_to_aux_and_byte_copy
!byte k_switch_to_main
!byte k_inx_and_recalc
!byte k_byte_copy
!byte k_switch_to_aux_and_byte_copy
!byte k_switch_to_main
!byte k_inx_and_recalc
!byte k_byte_copy
!byte k_switch_to_aux_and_byte_copy
!byte k_switch_to_main
!byte k_inx_and_recalc
!byte k_byte_copy
!byte k_switch_to_aux_and_byte_copy
!byte k_rts ; also serves as an end-of-template marker
; Template for stages 2-8 (copy02..copy08)
MIDDLE_STAGE
!byte k_set_row_count
!byte k_set_first_row
!byte k_iny
!byte k_save_y
!byte k_middle_jsr, k_current_page
;-
!byte k_inx_and_recalc
!byte k_bitcopy, k_left_mask_main
!byte k_iny2
!byte k_bitcopy, k_right_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_right_mask_aux
!byte k_restore_y
!byte k_bitcopy, k_left_mask_aux
!byte k_switch_to_main
!byte k_middle_branch
;+
!byte k_inx_and_recalc
!byte k_bitcopy, k_edge_left_mask_main
!byte k_iny
!byte k_byte_copy_and_iny
!byte k_bitcopy, k_edge_right_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_edge_right_mask_aux
!byte k_dey
!byte k_byte_copy
!byte k_dey
!byte k_bitcopy, k_edge_left_mask_aux
!byte k_rts ; also serves as an end-of-template marker
; Template for stages 9-15 (copy09..copy0F)
OUTER_STAGE
!byte k_set_row_count
!byte k_set_first_row
!byte k_save_y
!byte k_outer_jsr, k_current_page
;-
!byte k_inx_and_recalc
!byte k_bitcopy, k_left_mask_main
!byte k_iny2
!byte k_iny2
!byte k_bitcopy, k_right_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_right_mask_aux
!byte k_restore_y
!byte k_bitcopy, k_left_mask_aux
!byte k_switch_to_main
!byte k_outer_branch
;+
!byte k_inx_and_recalc
!byte k_bitcopy, k_edge_left_mask_main
!byte k_iny
!byte k_byte_copy_and_iny
!byte k_byte_copy_and_iny
!byte k_byte_copy_and_iny
!byte k_bitcopy, k_edge_right_mask_main
!byte k_switch_to_aux
!byte k_bitcopy, k_edge_right_mask_aux
!byte k_dey
!byte k_byte_copy
!byte k_dey
!byte k_byte_copy
!byte k_dey
!byte k_byte_copy
!byte k_dey
!byte k_bitcopy, k_edge_left_mask_aux
!byte k_rts ; also serves as an end-of-template marker
!if >* != >STAGE0 {
!error "Templates are not all on same page"
}
BoxInitialStages

View File

@ -5,14 +5,14 @@
!to "build/FX.INDEXED/DHGR.BAR.DISSLV",plain
*=$6000
hgrlo = $0200 ; [$C0 bytes, main memory only]
hgr1hi = $0300 ; [$C0 bytes, main memory only]
hgrlo = $0201 ; [$C0 bytes, main memory only]
hgr1hi = $0301 ; [$C0 bytes, main memory only]
!source "src/fx/macros.a"
+COPY_TO_0 start, end
;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
jmp loop
start

View File

@ -5,15 +5,15 @@
!to "build/FX.INDEXED/DHGR.DIAGONAL",plain
*=$6000
hgrlo = $0200 ; [$C0 bytes, main memory only]
hgr1hi = $0300 ; [$C0 bytes, main memory only]
copymasks= $02C0 ; [$08 bytes, different values in main and auxmem]
hgrlo = $0201 ; [$C0 bytes, main memory only]
hgr1hi = $0301 ; [$C0 bytes, main memory only]
copymasks= $02C1 ; [$08 bytes, different values in main and auxmem]
!source "src/fx/macros.a"
+COPY_TO_0 start, end
;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
ldy #8 ; copy copymask arrays into place in main and auxmem
- lda copymasks_main-1, y

View File

@ -26,7 +26,7 @@ input = $FE ; word
Start
+BUILD_DITHER_MASKS_DHGR dithermasks
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4

View File

@ -17,7 +17,7 @@ input = $FE ; word
+BUILD_DITHER_MASKS_DHGR dithermasks
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4

View File

@ -5,9 +5,9 @@
!to "build/FX.INDEXED/DHGR.FLICK",plain
*=$6000
hgrlo = $200 ; [$C0 bytes, main memory only]
startrows_by_column = $2C0 ; [$28 bytes, main memory only]
hgr1hi = $300 ; [$C0 bytes, main memory only]
hgrlo = $201 ; [$C0 bytes, main memory only]
startrows_by_column = $2C1 ; [$28 bytes, main memory only]
hgr1hi = $301 ; [$C0 bytes, main memory only]
!source "src/fx/macros.a"
@ -18,9 +18,7 @@ hgr1hi = $300 ; [$C0 bytes, main memory only]
sta startrows_by_column-1, x
dex
bne -
;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
jmp loop
start

View File

@ -51,7 +51,7 @@
!macro FX_PRECOMPUTED_1BIT_DHGR .coords {
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_0 start, end
@ -143,7 +143,7 @@ end
!macro FX_PRECOMPUTED_1BIT_DHGR_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS_DHGR dithermasks
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS_DHGR mirror_cols

View File

@ -53,7 +53,7 @@
!macro FX_PRECOMPUTED_2BIT_DHGR .coords {
+BUILD_SPARSE_BITMASKS_2BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_0 start, end
jmp InputLoop
@ -128,7 +128,7 @@ end
!macro FX_PRECOMPUTED_2BIT_DHGR_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS_DHGR dithermasks
+BUILD_SPARSE_BITMASKS_2BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_MIRROR_COLS_DHGR mirror_cols
; phase 1 - in reverse, with additional masking (dithering)

View File

@ -12,8 +12,7 @@ copymasks= $02C1 ; [$07 bytes, different values in main and
!source "src/fx/macros.a"
+COPY_TO_0 start, end
;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
ldy #7 ; copy copymask arrays into place in main and auxmem
- lda copymasks_main-1, y

View File

@ -23,7 +23,7 @@ input = $FE ; word
Start
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4

View File

@ -14,7 +14,7 @@ reverse_input = $FC ; word
input = $FE ; word
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4

View File

@ -22,7 +22,7 @@ input = $FE ; word
Start
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS_DHGR mirror_cols
+COPY_TO_AUXMEM $60, 4

View File

@ -9,14 +9,13 @@
; mainmem alternate #$11/#$44
; auxmem alternate #$08/#$22
hgrlo = $0200 ; [$C0 bytes, main memory only]
hgr1hi = $0300 ; [$C0 bytes, main memory only]
hgrlo = $0201 ; [$C0 bytes, main memory only]
hgr1hi = $0301 ; [$C0 bytes, main memory only]
!source "src/fx/macros.a"
+COPY_TO_0 start, end
;X=0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
jsr BuildHGRTables
jmp loop
start

View File

@ -76,8 +76,8 @@
src = $00 ; [word][must be at $00] used by drawing routines
dst = $02 ; [word] used by drawing routines
rowcount = $04 ; [byte] used by drawing routines
hgrhi = $200 ; [$C0 bytes] HGR base addresses
hgrlo = $300 ; [$C0 bytes] HGR base addresses
hgrlo = $201 ; [$C0 bytes] HGR base addresses
hgrhi = $301 ; [$C0 bytes] HGR base addresses
BoxesX = $90 ; [$30 bytes] starting row for each box
BoxesY = $C0 ; [$30 bytes] starting byte offset for each box
@ -164,8 +164,7 @@ k_right_mask = 17
inx
bne -
; X=0 here
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgrhi
jsr BuildHGRTables
; Generate |BoxesX| and |BoxesY| arrays
; BoxesX (starting row for each box)

View File

@ -10,13 +10,13 @@ row = $fd
col = $fe
counter = $ff
hgrlo = $8000
hgr1hi = $80C0
hgrlo = $0201
hgr1hi = $0301
!source "src/fx/macros.a"
!source "src/constants.a"
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
lda #(40+12+1)
sta counter

View File

@ -5,8 +5,8 @@
!to "build/FX.INDEXED/CIRCLE.STRIPES",plain
*=$6000
hgrhi = $BE01 ; [$C0 bytes] HGR base addresses
hgrlo = $BD01 ; [$C0 bytes] HGR base addresses
hgrlo = $0201 ; [$C0 bytes] HGR base addresses
hgrhi = $0301 ; [$C0 bytes] HGR base addresses
src = $F0
dst = $F2
@ -18,7 +18,7 @@ mask2 = $F7
!source "src/fx/macros.a"
!source "src/constants.a"
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgrhi
jsr BuildHGRTables
lda #$00
sta row1

View File

@ -5,8 +5,8 @@
!to "build/FX.INDEXED/DIAG.STRIPES",plain
*=$6000
hgrhi = $BE01 ; [$C0 bytes] HGR base addresses
hgrlo = $BD01 ; [$C0 bytes] HGR base addresses
hgrlo = $0201 ; [$C0 bytes] HGR base addresses
hgrhi = $0301 ; [$C0 bytes] HGR base addresses
src = $F0
dst = $F2
@ -18,7 +18,7 @@ mask2 = $F7
!source "src/fx/macros.a"
!source "src/constants.a"
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgrhi
jsr BuildHGRTables
lda #$00
sta row1

View File

@ -5,8 +5,8 @@
!to "build/FX.INDEXED/DIAMOND.STRIPES",plain
*=$6000
hgrhi = $BE01 ; [$C0 bytes] HGR base addresses
hgrlo = $BD01 ; [$C0 bytes] HGR base addresses
hgrlo = $0201 ; [$C0 bytes] HGR base addresses
hgrhi = $0301 ; [$C0 bytes] HGR base addresses
src = $F0
dst = $F2
@ -18,7 +18,7 @@ mask2 = $F7
!source "src/fx/macros.a"
!source "src/constants.a"
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgrhi
jsr BuildHGRTables
lda #$00
sta row1

View File

@ -25,7 +25,7 @@ input = $FE ; word
Start
+BUILD_DITHER_MASKS dithermasks
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_1BIT

View File

@ -17,7 +17,7 @@ input = $FE ; word
+BUILD_DITHER_MASKS dithermasks
+BUILD_MIRROR_COLS mirror_cols
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_SPARSE_BITMASKS_1BIT

View File

@ -6,14 +6,14 @@
*=$6000
rowcount = $FF ; [byte]
hgrlo = $200 ; [$C0 bytes]
startrows_by_column = $2C0 ; [$28 bytes]
hgrhi = $300 ; [$C0 bytes]
rowcounts_by_column = $3C0 ; [$28 bytes]
hgrlo = $201 ; [$C0 bytes]
startrows_by_column = $2C1 ; [$28 bytes]
hgrhi = $301 ; [$C0 bytes]
rowcounts_by_column = $3C1 ; [$28 bytes]
!source "src/fx/macros.a"
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgrhi
jsr BuildHGRTables
ldy #$27
- lda #$00

View File

@ -1,17 +1,17 @@
;license:MIT
;(c) 2019-2022 by 4am
;
copymasks = $0200 ; $100 bytes but sparse, index is 0..6 but in high 3 bits, so $00, $20, $40, $60, $80, $A0, $C0
mirror_copymasks = $0201
hgrlo = $0300 ; $C0 bytes
hgrlomirror = $BD40 ; $C0 bytes
mirror_cols = $BE00 ; $28 bytes
hgr1hi = $BE40 ; $C0 bytes
hgr1himirror = $BF40 ; $C0 bytes
dithermasks = $8500 ; $58 bytes
hgrlo = $0201 ; $C0 bytes
hgr1hi = $0301 ; $C0 bytes
mirror_cols = $02C1 ; $28 bytes
dithermasks = $BBAA ; $58 bytes
evenrow_masks = dithermasks
oddrow_masks = dithermasks+2
no_masks = dithermasks+44
hgrlomirror = $BC01 ; $C0 bytes
hgr1himirror = $BD01 ; $C0 bytes
copymasks = $BE00 ; $100 bytes but sparse, index is 0..6 but in high 3 bits, so $00, $20, $40, $60, $80, $A0, $C0
mirror_copymasks = copymasks+1
Coordinates1Bit= $8600 ; $3481 bytes ($3480 on disk + 1 byte EOF marker)
EndCoordinates1Bit=Coordinates1Bit+$3480
@ -190,7 +190,7 @@ aslmod cmp #$1A
}
!macro FX_PRECOMPUTED_1BIT .coords {
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_1BIT
@ -262,7 +262,7 @@ end
!macro FX_PRECOMPUTED_1BIT_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS dithermasks
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_1BIT

View File

@ -1,17 +1,15 @@
;license:MIT
;(c) 2019-2022 by 4am
;
copymasks = $0200 ; $100 bytes but sparse, index is 0..4 but in high 3 bits, so $00, $20, $40, $60, $80
mirror_copymasks = $0201
hgrlo = $0301 ; $C0 bytes
hgrlomirror = $BD40 ; $C0 bytes
mirror_cols = $BE00 ; $28 bytes
hgr1hi = $BE40 ; $C0 bytes
hgr1himirror = $BF40 ; $C0 bytes
dithermasks = $8000 ; $58 bytes
hgrlo = $0201 ; $C0 bytes
mirror_cols = $02C1 ; $28 bytes
hgr1hi = $0301 ; $C0 bytes
dithermasks = $BDAA ; $58 bytes
evenrow_masks = dithermasks
oddrow_masks = dithermasks+2
no_masks = dithermasks+44
copymasks = $BE00 ; $100 bytes but sparse, index is 0..4 but in high 3 bits, so $00, $20, $40, $60, $80
mirror_copymasks = copymasks+1
Coordinates2Bit= $8100 ; $3C01 bytes ($3C00 on disk + 1 byte as EOF)
EndCoordinates2Bit = Coordinates2Bit + $3C00
@ -251,7 +249,7 @@ zerotbl !byte $f0, $f2, $ca, $d2, $d8, $e0, $e2, $e6, $ea, $ee
}
!macro FX_PRECOMPUTED_2BIT .coords {
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks
+COPY_TO_0 start, end
@ -304,7 +302,7 @@ end
!macro FX_PRECOMPUTED_2BIT_DITHER .coords, .endcoords {
+BUILD_DITHER_MASKS dithermasks
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks

View File

@ -2,10 +2,10 @@
;(c) 2019-2022 by 4am
;
copymasks = $0200 ; $100 bytes but sparse, index is 0..7 but in high 3 bits, so $00, $20, $40...
tmplo = $0300 ; $C0 bytes
extra_cols = $02F8 ; $08 bytes
tmphi = $BF40 ; $C0 bytes
tmplo = $0201 ; $C0 bytes
tmphi = $0301 ; $C0 bytes
copymasks = $BB01 ; $100 bytes but sparse, index is 0..7 but in high 3 bits, so $00, $20, $40...
extra_cols = $BBF8 ; $08 bytes
hgrlo3a = $BC00 ; $80 bytes
hgrlo3b = $BC80 ; $80 bytes
hgrlo3c = $BD00 ; $80 bytes
@ -66,7 +66,7 @@ EndCoordinates3Bit = Coordinates3Bit + $5000
}
!macro BUILD_3BIT_HGR_LOOKUP_TABLES {
+BUILD_HGR_LOOKUP_TABLES tmplo, tmphi
jsr BuildHGRTables
ldx #$BF
ldy #$3F
- lda tmplo, x

View File

@ -22,7 +22,7 @@ input = $FE ; word
sta Coordinates1Bit-2
Start
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_MIRROR_COLS mirror_cols
+BUILD_SPARSE_BITMASKS_1BIT

View File

@ -14,7 +14,7 @@ reverse_input = $FC ; word
input = $FE ; word
+BUILD_MIRROR_COLS mirror_cols
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_SPARSE_BITMASKS_1BIT

View File

@ -22,7 +22,7 @@ input = $FE ; word
Start
+BUILD_MIRROR_COLS mirror_cols
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
+BUILD_SPARSE_BITMASKS_1BIT
+LDADDR Coordinates1Bit

View File

@ -10,8 +10,8 @@ row = $fd
col = $fe
counter = $ff
hgrlo = $0200 ; [$C0 bytes]
hgr1hi = $0300 ; [$C0 bytes]
hgrlo = $0201 ; [$C0 bytes]
hgr1hi = $0301 ; [$C0 bytes]
!source "src/fx/macros.a"
@ -24,7 +24,7 @@ hgr1hi = $0300 ; [$C0 bytes]
sta $3d
}
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
jsr BuildHGRTables
lda #(40+24+7-1) ; columns + rows + blocks per row - 1
sta counter

View File

@ -4,41 +4,6 @@
!ifndef _FX_MACROS_HGR_ {
; .hgrlo, .hgr1hi will each be filled with $C0 bytes
; based on routine by John Brooks
; posted on comp.sys.apple2 on 2018-07-11
; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ
!macro BUILD_HGR_LOOKUP_TABLES .hgrlo, .hgr1hi {
; preserves Y
ldx #0
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 .hgrlo, .hgr1hi
}
; use this macro instead if you know X is already 0 on entry, to save 2 bytes
!macro BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 .hgrlo, .hgr1hi {
; preserves Y
- txa
and #$F8
bpl +
ora #5
+ asl
bpl +
ora #5
+ asl
asl
sta .hgrlo,x
txa
and #7
rol
asl .hgrlo,x
rol
ora #$20
sta .hgr1hi,x
inx
cpx #$C0
bne -
}
; .hgrlomirror, .hgr1himirror will each be filled with $C0 bytes
!macro BUILD_HGR_MIRROR_LOOKUP_TABLES .hgrlomirror, .hgr1himirror {
ldx #$C0

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15940340
!be24 15934478
!le16 5130

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15885020
!be24 15879158
!le16 5732

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15816787
!be24 15810925
!le16 4194

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15831501
!be24 15825639
!le16 4652

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15850216
!be24 15844354
!le16 5621

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15871257
!be24 15865395
!le16 6199

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15945470
!be24 15939608
!le16 410

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15946224
!be24 15940362
!le16 449

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15946673
!be24 15940811
!le16 303

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 12713005
!be24 12707143
!le16 1652

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15893392
!be24 15887530
!le16 1640

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15945956
!be24 15940094
!le16 67

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15940281
!be24 15934419
!le16 59

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15938701
!be24 15932839
!le16 1426

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15923467
!be24 15917605
!le16 557

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15890752
!be24 15884890
!le16 2640

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15895390
!be24 15889528
!le16 451

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15895841
!be24 15889979
!le16 7564

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15945880
!be24 15940018
!le16 76

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15940127
!be24 15934265
!le16 154

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15946023
!be24 15940161
!le16 201

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15924024
!be24 15918162
!le16 4334

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15928358
!be24 15922496
!le16 1733

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15930091
!be24 15924229
!le16 1181

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15931272
!be24 15925410
!le16 3394

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15934666
!be24 15928804
!le16 3429

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15938095
!be24 15932233
!le16 479

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15938574
!be24 15932712
!le16 127

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15946976
!be24 15941114
!le16 2370

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15908810
!be24 15902948
!le16 5083

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15913893
!be24 15908031
!le16 2485

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15877456
!be24 15871594
!le16 7564

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15807204
!be24 15801342
!le16 9583

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15820981
!be24 15815119
!le16 10520

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15836153
!be24 15830291
!le16 14063

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15855837
!be24 15849975
!le16 15420

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15895032
!be24 15889170
!le16 358

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15903405
!be24 15897543
!le16 5405

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15916378
!be24 15910516
!le16 7089

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 15802856
!be24 15796994
!le16 4348

View File

@ -358,6 +358,7 @@
+READ_ROM_NO_WRITE
}
; ROM must be banked in!
!macro USES_TEXT_PAGE_2 { ; If we know we are going into a game one-time
lda ROM_MACHINEID ; only we can just blindly turn on TEXT2COPY, as
cmp #$06 ; Alternate Display Mode turns off on reset or reboot.
@ -370,6 +371,7 @@
+
}
; ROM must be banked in!
!macro TEST_TEXT_PAGE_2 { ; On a ROM3 IIgs we can test if Alternate Display Mode
lda ROM_MACHINEID ; is already on. ROM0 and ROM1 versions of ADM use
cmp #$06 ; interrupts and can cause hangs, so safer to just

View File

@ -8,7 +8,7 @@
!source "src/macros.a"
lda #$60
sta $336
sta $33C
jsr $300
+USES_TEXT_PAGE_2
+ENABLE_ACCEL