mirror of
https://github.com/a2-4am/4sports.git
synced 2025-04-09 18:38:23 +00:00
new DHGR dither transition effects
This commit is contained in:
parent
d356d4be23
commit
c9b3bdc83a
15
res/DFX.CONF
15
res/DFX.CONF
@ -29,62 +29,77 @@ DHGR.FIZZLE2BIT
|
||||
DHGR.RIPPLE
|
||||
DHGR.SOFT.DIAG
|
||||
DHGR.48BOXES
|
||||
DHGR.DITHIRIS
|
||||
DHGR.BUBBLES
|
||||
DHGR.RADIAL
|
||||
DHGR.SOFT.IRIS
|
||||
DHGR.WAVY.RIP
|
||||
DHGR.DITHBUBBLE
|
||||
DHGR.48.SNAKE
|
||||
DHGR.SNOWFL.IN
|
||||
DHGR.MAPLE
|
||||
DHGR.SLOW.STAR
|
||||
DHGR.DITHCORNER
|
||||
DHGR.48.SNAKEC
|
||||
DHGR.HEART.RIP
|
||||
DHGR.CORNER4
|
||||
DHGR.STAR.IN
|
||||
DHGR.DITHSLOWST
|
||||
DHGR.48.ARROW
|
||||
DHGR.REDLINES
|
||||
DHGR.BUTTERFLY
|
||||
DHGR.BLOOM.IN
|
||||
DHGR.DITHSNOWFL
|
||||
DHGR.48.SYNCC
|
||||
DHGR.RADIAL4
|
||||
DHGR.TWOPASS.LR
|
||||
DHGR.WAVY.IN
|
||||
DHGR.DITHHEART
|
||||
DHGR.CORNER4RIP
|
||||
DHGR.STAR
|
||||
DHGR.48.LDIAGON
|
||||
DHGR.MAPLE.IN
|
||||
DHGR.DITHBUTTER
|
||||
DHGR.BAR.DISSLV
|
||||
DHGR.BLOOM
|
||||
DHGR.SLOW.STARI
|
||||
DHGR.HEART
|
||||
DHGR.DITHMAPLE
|
||||
DHGR.48.2SNAKES
|
||||
DHGR.RADIAL3
|
||||
DHGR.STAR.RIP
|
||||
DHGR.BFLY.IN
|
||||
DHGR.DITHSOFTIR
|
||||
DHGR.DIAGONAL
|
||||
DHGR.SNOWFLAKE
|
||||
DHGR.48.DOWN
|
||||
DHGR.SOFTIRISIN
|
||||
DHGR.DITHSTAR
|
||||
DHGR.RADIAL2
|
||||
DHGR.IRIS
|
||||
DHGR.BUBBLES.IN
|
||||
DHGR.SLOWST.RIP
|
||||
DHGR.DITHWAVYIR
|
||||
DHGR.48.SPIRAL
|
||||
DHGR.RADIAL5
|
||||
DHGR.FIZZLE
|
||||
DHGR.48.PAGEC
|
||||
DHGR.DITHBLOOM
|
||||
DHGR.BFLY.RIP
|
||||
DHGR.IRIS.IN
|
||||
DHGR.SWIRL
|
||||
DHGR.48.SPIRALC
|
||||
DHGR.DITHRADIAL
|
||||
DHGR.MAPLE.RIP
|
||||
DHGR.R.BY.PIXEL
|
||||
DHGR.HEART.IN
|
||||
DHGR.SNOWFL.RIP
|
||||
DHGR.DITHRAD2
|
||||
DHGR.48.SIDES
|
||||
DHGR.CORNER4.IN
|
||||
DHGR.WAVY.IRIS
|
||||
DHGR.BLOOM.RIP
|
||||
DHGR.DITHRAD4
|
||||
DHGR.48.SYNC
|
||||
DHGR.FLICK
|
||||
[eof]
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
rts
|
||||
+READ_ROM_NO_WRITE
|
||||
|
||||
;init RNG
|
||||
|
@ -1,254 +0,0 @@
|
||||
!macro AUXMEM {
|
||||
sta $C055
|
||||
lda auxsrc_hgrhi, x
|
||||
sta src+1
|
||||
}
|
||||
|
||||
!macro MAINMEM {
|
||||
sta $C054
|
||||
}
|
||||
|
||||
!macro INX_AND_RECALC {
|
||||
inx
|
||||
lda hgrlo, x
|
||||
sta src
|
||||
sta dst
|
||||
lda hgrhi, x
|
||||
sta dst+1
|
||||
eor #$60
|
||||
sta src+1
|
||||
}
|
||||
|
||||
!macro BITCOPY .copy, .mask {
|
||||
!if .mask != %00000000 {
|
||||
!if .mask = %11111111 {
|
||||
!if .copy != 0 {
|
||||
lda (src), y
|
||||
} else {
|
||||
lda #$00
|
||||
}
|
||||
sta (dst), y
|
||||
} else {
|
||||
lda (dst), y
|
||||
!if .copy != 0 {
|
||||
eor (src), y
|
||||
} else {
|
||||
bit src
|
||||
}
|
||||
and #.mask
|
||||
eor (dst), y
|
||||
sta (dst), y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
!macro MIDDLE_STAGE_DHGR .copy, .rowcount, .firstrow, .edge_left_mask_main, .edge_right_mask_main, .left_mask_main, .right_mask_main, .edge_left_mask_aux, .edge_right_mask_aux, .left_mask_aux, .right_mask_aux {
|
||||
lda #(.rowcount-2) ;k_set_row_count
|
||||
sta rowcount
|
||||
txa ;k_set_first_row
|
||||
adc #(.firstrow-1)
|
||||
tax
|
||||
iny ;k_iny
|
||||
sty tmpy ;k_save_y
|
||||
jsr + ;k_middle_jsr, k_current_page
|
||||
-
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, .left_mask_main ;k_bitcopy, k_left_mask_main
|
||||
iny ;k_iny
|
||||
iny ;k_iny
|
||||
+BITCOPY .copy, .right_mask_main ;k_bitcopy, k_right_mask_main
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, .right_mask_aux ;k_bitcopy, k_right_mask_aux
|
||||
ldy tmpy ;k_restore_y
|
||||
+BITCOPY .copy, .left_mask_aux ;k_bitcopy, k_left_mask_aux
|
||||
+MAINMEM ;k_switch_to_main
|
||||
dec rowcount ;k_middle_branch
|
||||
bpl -
|
||||
+
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, .edge_left_mask_main ;k_bitcopy, k_edge_left_mask_main
|
||||
iny ;k_iny
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
iny ;k_iny
|
||||
+BITCOPY .copy, .edge_right_mask_main ;k_bitcopy, k_edge_right_mask_main
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, .edge_right_mask_aux ;k_bitcopy, k_edge_right_mask_aux
|
||||
dey ;k_dey
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
dey ;k_dey
|
||||
+BITCOPY .copy, .edge_left_mask_aux ;k_bitcopy, k_edge_left_mask_aux
|
||||
+MAINMEM ;k_switch_to_main
|
||||
rts
|
||||
}
|
||||
|
||||
!macro OUTER_STAGE_DHGR .copy, .rowcount, .firstrow, .edge_left_mask_main, .edge_right_mask_main, .left_mask_main, .right_mask_main, .edge_left_mask_aux, .edge_right_mask_aux, .left_mask_aux, .right_mask_aux {
|
||||
lda #(.rowcount-2) ;k_set_row_count
|
||||
sta rowcount
|
||||
txa ;k_set_first_row
|
||||
adc #(.firstrow-1)
|
||||
tax
|
||||
sty tmpy ;k_save_y
|
||||
jsr + ;k_outer_jsr
|
||||
-
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, .left_mask_main ;k_bitcopy, k_left_mask_main
|
||||
iny ;k_iny
|
||||
iny ;k_iny
|
||||
iny ;k_iny
|
||||
iny ;k_iny
|
||||
+BITCOPY .copy, .right_mask_main ;k_bitcopy, k_right_mask_main
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, .right_mask_aux ;k_bitcopy, k_right_mask_aux
|
||||
ldy tmpy ;k_restore_y
|
||||
+BITCOPY .copy, .left_mask_aux ;k_bitcopy, k_left_mask_aux
|
||||
+MAINMEM ;k_switch_to_main
|
||||
dec rowcount ;k_outer_branch
|
||||
bpl -
|
||||
+
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, .edge_left_mask_main ;k_bitcopy, k_edge_left_mask_main
|
||||
iny ;k_iny
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
iny ;k_iny
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
iny ;k_iny
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
iny ;k_iny
|
||||
+BITCOPY .copy, .edge_right_mask_main ;k_bitcopy, k_edge_right_mask_main
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, .edge_right_mask_aux ;k_bitcopy, k_edge_right_mask_aux
|
||||
dey ;k_dey
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
dey ;k_dey
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
dey ;k_dey
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
dey ;k_dey
|
||||
+BITCOPY .copy, .edge_left_mask_aux ;k_bitcopy, k_edge_left_mask_aux
|
||||
+MAINMEM ;k_switch_to_main
|
||||
rts
|
||||
}
|
||||
|
||||
!macro STAGE0 .copy {
|
||||
txa ;k_set_first_row
|
||||
adc #($0F-1)
|
||||
tax
|
||||
iny ;k_iny
|
||||
iny ;k_iny
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, %00011111 ;k_bitcopy, k_left_mask_main
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, %01111100 ;k_bitcopy, k_left_mask_aux
|
||||
+MAINMEM ;k_switch_to_main
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, %00011111 ;k_bitcopy, k_left_mask_main
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, %01111100 ;k_bitcopy, k_left_mask_aux
|
||||
+MAINMEM ;k_switch_to_main
|
||||
rts
|
||||
}
|
||||
|
||||
!macro STAGE1 .copy {
|
||||
txa ;k_set_first_row
|
||||
adc #($0E-1)
|
||||
tax
|
||||
iny ;k_iny
|
||||
iny ;k_iny
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
+MAINMEM ;k_switch_to_main
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
+MAINMEM ;k_switch_to_main
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
+MAINMEM ;k_switch_to_main
|
||||
+INX_AND_RECALC ;k_inx_and_recalc
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
+AUXMEM ;k_switch_to_aux
|
||||
+BITCOPY .copy, %11111111 ;k_bitcopy, k_full_mask
|
||||
+MAINMEM ;k_switch_to_main
|
||||
rts
|
||||
}
|
||||
|
||||
;clear00
|
||||
*=$7000
|
||||
+STAGE0 0
|
||||
;clear01
|
||||
*=$7100
|
||||
+STAGE1 0
|
||||
;clear02-0F
|
||||
*=$7200
|
||||
+MIDDLE_STAGE_DHGR 0, $05, $0D, %01100000, %00000000, %01100000, %00000000, %00000000, %00000011, %00000000, %00000011
|
||||
*=$7300
|
||||
+MIDDLE_STAGE_DHGR 0, $07, $0C, %01111000, %00000000, %00011000, %00000000, %00000000, %00001111, %00000000, %00001100
|
||||
*=$7400
|
||||
+MIDDLE_STAGE_DHGR 0, $09, $0B, %11111111, %00000000, %00000111, %00000000, %00000000, %11111111, %00000000, %01110000
|
||||
*=$7500
|
||||
+MIDDLE_STAGE_DHGR 0, $0B, $0A, %11111111, %00000001, %00000000, %00000001, %01000000, %11111111, %01000000, %00000000
|
||||
*=$7600
|
||||
+MIDDLE_STAGE_DHGR 0, $0D, $09, %11111111, %00000111, %00000000, %00000110, %01110000, %11111111, %00110000, %00000000
|
||||
*=$7700
|
||||
+MIDDLE_STAGE_DHGR 0, $0F, $08, %11111111, %00011111, %00000000, %00011000, %01111100, %11111111, %00001100, %00000000
|
||||
*=$7800
|
||||
+MIDDLE_STAGE_DHGR 0, $11, $07, %11111111, %11111111, %00000000, %01100000, %11111111, %11111111, %00000011, %00000000
|
||||
*=$7900
|
||||
+OUTER_STAGE_DHGR 0, $13, $06, %01100000, %00000000, %01100000, %00000000, %00000000, %00000011, %00000000, %00000011
|
||||
*=$7A00
|
||||
+OUTER_STAGE_DHGR 0, $15, $05, %01111000, %00000000, %00011000, %00000000, %00000000, %00001111, %00000000, %00001100
|
||||
*=$7B00
|
||||
+OUTER_STAGE_DHGR 0, $17, $04, %11111111, %00000000, %00000111, %00000000, %00000000, %11111111, %00000000, %01110000
|
||||
*=$7C00
|
||||
+OUTER_STAGE_DHGR 0, $19, $03, %11111111, %00000001, %00000000, %00000001, %01000000, %11111111, %01000000, %00000000
|
||||
*=$7D00
|
||||
+OUTER_STAGE_DHGR 0, $1B, $02, %11111111, %00000111, %00000000, %00000110, %01110000, %11111111, %00110000, %00000000
|
||||
*=$7E00
|
||||
+OUTER_STAGE_DHGR 0, $1D, $01, %11111111, %00011111, %00000000, %00011000, %01111100, %11111111, %00001100, %00000000
|
||||
*=$7F00
|
||||
+OUTER_STAGE_DHGR 0, $1F, $00, %11111111, %11111111, %00000000, %01100000, %11111111, %11111111, %00000011, %00000000
|
||||
|
||||
;copy02-08
|
||||
; cp rowc frow edgeleft edgeright left right edgeltaux edgertaux leftaux rightaux
|
||||
*=$A000
|
||||
+MIDDLE_STAGE_DHGR 1, $05, $0D, %01100000, %00000000, %01100000, %00000000, %00000000, %00000011, %00000000, %00000011
|
||||
*=$A100
|
||||
+MIDDLE_STAGE_DHGR 1, $07, $0C, %01111000, %00000000, %00011000, %00000000, %00000000, %00001111, %00000000, %00001100
|
||||
*=$A200
|
||||
+MIDDLE_STAGE_DHGR 1, $09, $0B, %11111111, %00000000, %00000111, %00000000, %00000000, %11111111, %00000000, %01110000
|
||||
*=$A300
|
||||
+MIDDLE_STAGE_DHGR 1, $0B, $0A, %11111111, %00000001, %00000000, %00000001, %01000000, %11111111, %01000000, %00000000
|
||||
*=$A400
|
||||
+MIDDLE_STAGE_DHGR 1, $0D, $09, %11111111, %00000111, %00000000, %00000110, %01110000, %11111111, %00110000, %00000000
|
||||
*=$A500
|
||||
+MIDDLE_STAGE_DHGR 1, $0F, $08, %11111111, %00011111, %00000000, %00011000, %01111100, %11111111, %00001100, %00000000
|
||||
*=$A600
|
||||
+MIDDLE_STAGE_DHGR 1, $11, $07, %11111111, %11111111, %00000000, %01100000, %11111111, %11111111, %00000011, %00000000
|
||||
;copy09-0F
|
||||
*=$A700
|
||||
+OUTER_STAGE_DHGR 1, $13, $06, %01100000, %00000000, %01100000, %00000000, %00000000, %00000011, %00000000, %00000011
|
||||
*=$A800
|
||||
+OUTER_STAGE_DHGR 1, $15, $05, %01111000, %00000000, %00011000, %00000000, %00000000, %00001111, %00000000, %00001100
|
||||
*=$A900
|
||||
+OUTER_STAGE_DHGR 1, $17, $04, %11111111, %00000000, %00000111, %00000000, %00000000, %11111111, %00000000, %01110000
|
||||
*=$AA00
|
||||
+OUTER_STAGE_DHGR 1, $19, $03, %11111111, %00000001, %00000000, %00000001, %01000000, %11111111, %01000000, %00000000
|
||||
*=$AB00
|
||||
+OUTER_STAGE_DHGR 1, $1B, $02, %11111111, %00000111, %00000000, %00000110, %01110000, %11111111, %00110000, %00000000
|
||||
*=$AC00
|
||||
+OUTER_STAGE_DHGR 1, $1D, $01, %11111111, %00011111, %00000000, %00011000, %01111100, %11111111, %00001100, %00000000
|
||||
*=$AD00
|
||||
+OUTER_STAGE_DHGR 1, $1F, $00, %11111111, %11111111, %00000000, %01100000, %11111111, %11111111, %00000011, %00000000
|
||||
|
||||
;copy00
|
||||
*=$AE00
|
||||
+STAGE0 1
|
||||
;copy01
|
||||
*=$AF00
|
||||
+STAGE1 1
|
||||
|
@ -1,21 +0,0 @@
|
||||
!macro COPY_TO_AUXMEM .startpage, .pagecount {
|
||||
ldx #.pagecount
|
||||
lda #.startpage
|
||||
sta $FF
|
||||
lda #$00
|
||||
sta $FE
|
||||
tay
|
||||
sta $c005
|
||||
- lda ($FE),y
|
||||
sta ($FE),y
|
||||
iny
|
||||
bne -
|
||||
inc $FF
|
||||
dex
|
||||
bne -
|
||||
sta $c004
|
||||
}
|
||||
|
||||
!macro COPY_SELF_TO_AUXMEM {
|
||||
+COPY_TO_AUXMEM $60, $60
|
||||
}
|
16
src/fx/fx.dhgr.dither.bubbles.a
Normal file
16
src/fx/fx.dhgr.dither.bubbles.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHBUBBLE",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_1BIT_DHGR_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 15
|
||||
!text "FX/BUBBLES.DATA"
|
16
src/fx/fx.dhgr.dither.butterfly.a
Normal file
16
src/fx/fx.dhgr.dither.butterfly.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHBUTTER",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.2bit.a"
|
||||
|
||||
+FX_INITONCE_2BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/BUTTERFLY.DATA"
|
16
src/fx/fx.dhgr.dither.corner4.a
Normal file
16
src/fx/fx.dhgr.dither.corner4.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHCORNER",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_1BIT_DHGR_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 15
|
||||
!text "FX/CORNER4.DATA"
|
16
src/fx/fx.dhgr.dither.heart.a
Normal file
16
src/fx/fx.dhgr.dither.heart.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHHEART",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.2bit.a"
|
||||
|
||||
+FX_INITONCE_2BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 13
|
||||
!text "FX/HEART.DATA"
|
16
src/fx/fx.dhgr.dither.iris.a
Normal file
16
src/fx/fx.dhgr.dither.iris.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHIRIS",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_1BIT_DHGR_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 12
|
||||
!text "FX/IRIS.DATA"
|
16
src/fx/fx.dhgr.dither.maple.a
Normal file
16
src/fx/fx.dhgr.dither.maple.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2020 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHMAPLE",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.2bit.a"
|
||||
|
||||
+FX_INITONCE_2BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 13
|
||||
!text "FX/MAPLE.DATA"
|
158
src/fx/fx.dhgr.dither.radial.a
Normal file
158
src/fx/fx.dhgr.dither.radial.a
Normal file
@ -0,0 +1,158 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHRADIAL",plain
|
||||
*=$6000
|
||||
|
||||
evenrow_ptr = $E4 ; word
|
||||
oddrow_ptr = $E6 ; word
|
||||
mirror_src1 = $E8 ; word
|
||||
mirror_dest1 = $EA ; word
|
||||
mirror_src2 = $EC ; word
|
||||
mirror_dest2 = $EE ; word
|
||||
src1 = $F0 ; word
|
||||
dest1 = $F2 ; word
|
||||
src2 = $F4 ; word
|
||||
dest2 = $F6 ; word
|
||||
input = $FE ; word
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
lda #$80
|
||||
sta Coordinates1Bit-2
|
||||
|
||||
Start
|
||||
+BUILD_DITHER_MASKS_DHGR dithermasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
+COPY_TO_AUXMEM $60, 4
|
||||
|
||||
+LDADDR evenrow_masks
|
||||
+ST16 evenrow_ptr
|
||||
+LDADDR oddrow_masks
|
||||
+ST16 oddrow_ptr
|
||||
jsr FullRadial
|
||||
bit KBD
|
||||
bpl +
|
||||
rts
|
||||
+ lda #<no_masks
|
||||
sta <evenrow_ptr
|
||||
sta <oddrow_ptr
|
||||
; /!\ execution falls through here
|
||||
FullRadial
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
+ST16 input
|
||||
LoopBL ; bottom-left quadrant (opposite row, original column, reverse input order)
|
||||
ldy #0
|
||||
lda (input),y
|
||||
bmi DoneBL
|
||||
tax
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
iny
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
clc
|
||||
- lda copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+DEC_INPUT_AND_LOOP LoopBL
|
||||
DoneBL
|
||||
|
||||
+LDADDR Coordinates1Bit
|
||||
+ST16 input
|
||||
LoopTL ; top-left quadrant
|
||||
ldy #0
|
||||
lda (input),y
|
||||
bmi DoneTL
|
||||
tax
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
inc input
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
clc
|
||||
- lda copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER src1, dest1, copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+INC_INPUT_AND_LOOP LoopTL
|
||||
DoneTL
|
||||
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
+ST16 input
|
||||
LoopTR ; top-right quadrant (same row, opposite column, reverse input order)
|
||||
ldy #0
|
||||
lda (input),y
|
||||
bmi DoneTR
|
||||
tax
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
iny
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
lda mirror_cols,y
|
||||
tay
|
||||
clc
|
||||
- lda mirror_copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+DEC_INPUT_AND_LOOP LoopTR
|
||||
DoneTR
|
||||
|
||||
+LDADDR Coordinates1Bit
|
||||
+ST16 input
|
||||
LoopBR ; bottom-right quadrant (opposite row, opposite column, original input order)
|
||||
ldy #0
|
||||
lda (input),y
|
||||
bmi DoneBR
|
||||
tax
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
inc input
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
lda mirror_cols,y
|
||||
tay
|
||||
clc
|
||||
- lda mirror_copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
+INC_INPUT_AND_LOOP LoopBR
|
||||
DoneBR
|
||||
rts
|
||||
|
||||
CoordinatesFile
|
||||
!byte 14
|
||||
!text "FX/RADIAL.DATA"
|
135
src/fx/fx.dhgr.dither.radial.common.a
Normal file
135
src/fx/fx.dhgr.dither.radial.common.a
Normal file
@ -0,0 +1,135 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
evenrow_ptr = $E4 ; word
|
||||
oddrow_ptr = $E6 ; word
|
||||
mirror_src1 = $E8 ; word
|
||||
mirror_dest1 = $EA ; word
|
||||
mirror_src2 = $EC ; word
|
||||
mirror_dest2 = $EE ; word
|
||||
src1 = $F0 ; word
|
||||
dest1 = $F2 ; word
|
||||
src2 = $F4 ; word
|
||||
dest2 = $F6 ; word
|
||||
reverse_input = $FC ; word
|
||||
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
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
+COPY_TO_AUXMEM $60, 4
|
||||
|
||||
+LDADDR evenrow_masks
|
||||
+ST16 evenrow_ptr
|
||||
+LDADDR oddrow_masks
|
||||
+ST16 oddrow_ptr
|
||||
jsr FullRadial
|
||||
bit KBD
|
||||
bmi Exit
|
||||
lda #<no_masks
|
||||
sta <evenrow_ptr
|
||||
sta <oddrow_ptr
|
||||
; /!\ execution falls through here
|
||||
FullRadial
|
||||
+LDADDR Coordinates
|
||||
+ST16 input
|
||||
+LDADDR EndCoordinates-2
|
||||
+ST16 reverse_input
|
||||
+HIDE_NEXT_BYTE
|
||||
Exit rts
|
||||
Loop ldy #0
|
||||
lda (input),y
|
||||
bmi Exit
|
||||
tax
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
inc input
|
||||
lda (input),y
|
||||
+HIGH_3_LOW_5 input
|
||||
|
||||
; top-left quadrant (original row, original column, original input order)
|
||||
clc
|
||||
- lda copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER src1, dest1, copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, copymasks, oddrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
|
||||
; bottom-right quadrant (opposite row, opposite column, original input order)
|
||||
lda mirror_cols,y
|
||||
tay
|
||||
clc
|
||||
- lda mirror_copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, mirror_copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, mirror_copymasks, evenrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
|
||||
ldy #0
|
||||
lda (reverse_input),y
|
||||
tax
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
iny
|
||||
lda (reverse_input),y
|
||||
+HIGH_3_LOW_5 reverse_input
|
||||
|
||||
; bottom-left quadrant (opposite row, original column, reverse input order)
|
||||
clc
|
||||
- lda copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER mirror_src1, mirror_dest1, copymasks, oddrow_ptr
|
||||
+COPY_BIT_DITHER mirror_src2, mirror_dest2, copymasks, evenrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
|
||||
; top-right quadrant (same row, opposite column, reverse input order)
|
||||
lda mirror_cols,y
|
||||
tay
|
||||
clc
|
||||
- lda mirror_copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
|
||||
inc input
|
||||
bne +
|
||||
inc input+1
|
||||
+ lda reverse_input
|
||||
php
|
||||
dec reverse_input
|
||||
dec reverse_input
|
||||
plp
|
||||
bne +
|
||||
dec reverse_input+1
|
||||
bit $c000
|
||||
bmi ++
|
||||
+ jmp Loop
|
||||
++ rts
|
20
src/fx/fx.dhgr.dither.radial2.a
Normal file
20
src/fx/fx.dhgr.dither.radial2.a
Normal file
@ -0,0 +1,20 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHRAD2",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
+FX_RIPPLE_1BIT aslmod
|
||||
|
||||
Start
|
||||
!source "src/fx/fx.dhgr.dither.radial.common.a"
|
||||
|
||||
CoordinatesFile
|
||||
!byte 14
|
||||
!text "FX/RADIAL.DATA"
|
||||
Coordinates=Coordinates1Bit
|
||||
EndCoordinates=EndCoordinates1Bit
|
20
src/fx/fx.dhgr.dither.radial4.a
Normal file
20
src/fx/fx.dhgr.dither.radial4.a
Normal file
@ -0,0 +1,20 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHRAD4",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
jsr EndCoordinates1Bit+1
|
||||
|
||||
Start
|
||||
!source "src/fx/fx.dhgr.dither.radial.common.a"
|
||||
|
||||
CoordinatesFile
|
||||
!byte 14
|
||||
!text "FX/RADIAL.DATA"
|
||||
Coordinates=Coordinates1Bit
|
||||
EndCoordinates=EndCoordinates1Bit
|
16
src/fx/fx.dhgr.dither.slow.star.a
Normal file
16
src/fx/fx.dhgr.dither.slow.star.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHSLOWST",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_1BIT_DHGR_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/SLOW.STAR.DATA"
|
16
src/fx/fx.dhgr.dither.snowflake.a
Normal file
16
src/fx/fx.dhgr.dither.snowflake.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2020 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHSNOWFL",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.1bit.a"
|
||||
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_1BIT_DHGR_DITHER Coordinates1Bit, EndCoordinates1Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/SNOWFLAKE.DATA"
|
16
src/fx/fx.dhgr.dither.soft.iris.a
Normal file
16
src/fx/fx.dhgr.dither.soft.iris.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2020 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHSOFTIR",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.2bit.a"
|
||||
|
||||
+FX_INITONCE_2BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/SOFT.IRIS.DATA"
|
16
src/fx/fx.dhgr.dither.star.a
Normal file
16
src/fx/fx.dhgr.dither.star.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2020 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHSTAR",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.2bit.a"
|
||||
|
||||
+FX_INITONCE_2BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 12
|
||||
!text "FX/STAR.DATA"
|
16
src/fx/fx.dhgr.dither.wavy.iris.a
Normal file
16
src/fx/fx.dhgr.dither.wavy.iris.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2020 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHWAVYIR",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.2bit.a"
|
||||
|
||||
+FX_INITONCE_2BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 17
|
||||
!text "FX/WAVY.IRIS.DATA"
|
16
src/fx/fx.dhgr.dither.wavy.iris.bloom.a
Normal file
16
src/fx/fx.dhgr.dither.wavy.iris.bloom.a
Normal file
@ -0,0 +1,16 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2020 by 4am/qkumba
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/DHGR.DITHBLOOM",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/fx.dhgr.precomputed.2bit.a"
|
||||
|
||||
+FX_INITONCE_2BIT CoordinatesFile, Start
|
||||
Start
|
||||
+FX_PRECOMPUTED_2BIT_DHGR_DITHER Coordinates2Bit, EndCoordinates2Bit
|
||||
|
||||
CoordinatesFile
|
||||
!byte 18
|
||||
!text "FX/W.IR.BLOOM.DATA"
|
@ -1,10 +1,10 @@
|
||||
;license:MIT
|
||||
;(c) 2020 by 4am
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
!source "src/fx/fx.hgr.precomputed.1bit.a"
|
||||
!source "src/fx/fx.dhgr.common.a"
|
||||
|
||||
!macro BUILD_SPARSE_BITMASKS_DHGR .copymasks, .mirror_copymasks {
|
||||
!source "src/fx/fx.hgr.precomputed.1bit.a"
|
||||
|
||||
!macro BUILD_SPARSE_BITMASKS_1BIT_DHGR .copymasks, .mirror_copymasks {
|
||||
; build sparse lookup tables for bitmasks
|
||||
ldx #$00
|
||||
txa
|
||||
@ -50,11 +50,10 @@
|
||||
}
|
||||
|
||||
!macro FX_PRECOMPUTED_1BIT_DHGR .coords {
|
||||
+BUILD_SPARSE_BITMASKS_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+COPY_SELF_TO_AUXMEM
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
+COPY_TO_0 start, end
|
||||
jmp InputLoop
|
||||
start
|
||||
@ -100,11 +99,11 @@ dest2=*+1
|
||||
+COPY_BIT_ZP mirror_src2, mirror_dest2, copymask
|
||||
|
||||
+
|
||||
lda mirror_copymasks, x
|
||||
lda mirror_copymasks, x ; exists at the same address in mainmem and auxmem but each is different
|
||||
beq +
|
||||
sta <mirror_copymask
|
||||
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
|
||||
lda mirror_cols, y
|
||||
lda mirror_cols, y ; duplicated in mainmem and auxmem
|
||||
tay
|
||||
mirror_src1=*+1
|
||||
lda $FDFD, y
|
||||
@ -139,7 +138,160 @@ y=*+1
|
||||
+INC_INPUT_AND_LOOP InputLoop
|
||||
}
|
||||
end
|
||||
!if * and 1 {
|
||||
!byte 0 ;align 2 but avoids the fake allocation bug if it was aligned already
|
||||
}
|
||||
|
||||
!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
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
|
||||
; phase 1 - in reverse, with additional masking
|
||||
+COPY_TO_0 start, end
|
||||
|
||||
; set up starting coordinate for reading coordinates in reverse order
|
||||
+LDADDR .endcoords-2
|
||||
sta <input
|
||||
sty <input+1
|
||||
|
||||
; set up EOF marker to stop reading coordinates in reverse order
|
||||
lda #$80
|
||||
sta .coords-2
|
||||
|
||||
; set up logic to advance to next coordinates in reverse order
|
||||
ldx #(next2_end-next2_start-1)
|
||||
- lda next2_start, x
|
||||
sta <next, x
|
||||
dex
|
||||
bpl -
|
||||
|
||||
jsr InputLoop
|
||||
|
||||
bit KBD
|
||||
bmi start
|
||||
|
||||
; phase 2 - in order, without additional masking
|
||||
+COPY_TO_0 start, end
|
||||
|
||||
; redirect additional masking pointers to an array that contains #$FFs (so no masking)
|
||||
lda #<no_masks
|
||||
sta <evenrow_ptr
|
||||
sta <oddrow_ptr
|
||||
|
||||
jmp InputLoop
|
||||
start
|
||||
!pseudopc 0 {
|
||||
Exit1Bit rts
|
||||
evenrow_ptr
|
||||
!word evenrow_masks
|
||||
oddrow_ptr
|
||||
!word oddrow_masks
|
||||
InputLoop
|
||||
ldy #0
|
||||
input=*+1
|
||||
ldx .coords ; first value: HGR row (only 0..95 will be in input array)
|
||||
bmi Exit1Bit ; if > 127 then we're done
|
||||
+ROW_X_TO_BASE_ADDRESSES
|
||||
+ROW_X_TO_MIRROR_ADDRESSES
|
||||
|
||||
iny
|
||||
lda (input), y
|
||||
+HIGH_3_LOW_5 input
|
||||
sty <y
|
||||
clc
|
||||
bankloop
|
||||
lda copymasks, x
|
||||
beq +
|
||||
sta <copymask
|
||||
|
||||
; main 1x2 block in top-left quadrant
|
||||
src1=*+1
|
||||
lda $FDFD, y
|
||||
eor (<dest1), y
|
||||
copymask=*+1
|
||||
and #$FD ; SMC
|
||||
and (<evenrow_ptr), y
|
||||
eor (<dest1), y
|
||||
dest1=*+1
|
||||
sta $FDFD, y
|
||||
src2=*+1
|
||||
lda $FDFD, y
|
||||
eor (<dest2), y
|
||||
and <copymask
|
||||
and (<oddrow_ptr), y
|
||||
eor (<dest2), y
|
||||
dest2=*+1
|
||||
sta $FDFD, y
|
||||
|
||||
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
|
||||
+COPY_BIT_ZP_DITHER mirror_src1, mirror_dest1, copymask, oddrow_ptr
|
||||
+COPY_BIT_ZP_DITHER mirror_src2, mirror_dest2, copymask, evenrow_ptr
|
||||
|
||||
+
|
||||
lda mirror_copymasks, x
|
||||
beq +
|
||||
sta <mirror_copymask
|
||||
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
|
||||
lda mirror_cols, y
|
||||
tay
|
||||
mirror_src1=*+1
|
||||
lda $FDFD, y
|
||||
eor (<mirror_dest1), y
|
||||
mirror_copymask=*+1
|
||||
and #$FD ; SMC
|
||||
and (<oddrow_ptr), y
|
||||
eor (<mirror_dest1), y
|
||||
mirror_dest1=*+1
|
||||
sta $FDFD, y
|
||||
mirror_src2=*+1
|
||||
lda $FDFD, y
|
||||
eor (<mirror_dest2), y
|
||||
and <mirror_copymask
|
||||
and (<evenrow_ptr), y
|
||||
eor (<mirror_dest2), y
|
||||
mirror_dest2=*+1
|
||||
sta $FDFD, y
|
||||
|
||||
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
|
||||
+COPY_BIT_ZP_DITHER src1, dest1, mirror_copymask, evenrow_ptr
|
||||
+COPY_BIT_ZP_DITHER src2, dest2, mirror_copymask, oddrow_ptr
|
||||
+
|
||||
bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
y=*+1
|
||||
ldy #$FD
|
||||
sec
|
||||
jmp bankloop
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
|
||||
next
|
||||
inc <input
|
||||
inc <input
|
||||
bne +
|
||||
bit KBD
|
||||
bmi ++
|
||||
inc <input+1
|
||||
+ jmp InputLoop
|
||||
++ rts
|
||||
}
|
||||
end
|
||||
|
||||
next2_start
|
||||
!pseudopc next {
|
||||
lda <input
|
||||
php
|
||||
dec <input
|
||||
dec <input
|
||||
plp
|
||||
bne +
|
||||
dec <input+1
|
||||
bit KBD
|
||||
bmi ++
|
||||
+ jmp InputLoop
|
||||
++ rts
|
||||
}
|
||||
next2_end
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
;(c) 2019-2020 by 4am
|
||||
;
|
||||
!source "src/fx/fx.hgr.precomputed.2bit.a"
|
||||
!source "src/fx/fx.dhgr.common.a"
|
||||
|
||||
!macro BUILD_SPARSE_BITMASKS_2BIT_DHGR .copymasks, .mirror_copymasks {
|
||||
; build sparse lookup tables for bitmasks
|
||||
@ -55,8 +54,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
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+COPY_SELF_TO_AUXMEM
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
+COPY_TO_0 start, end
|
||||
jmp InputLoop
|
||||
|
||||
@ -125,7 +123,138 @@ dest2=*+1
|
||||
+ rts
|
||||
}
|
||||
end
|
||||
!if * and 1 {
|
||||
!byte 0 ;align 2 but avoids the fake allocation bug if it was aligned already
|
||||
}
|
||||
|
||||
!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
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
|
||||
; phase 1 - in reverse, with additional masking (dithering)
|
||||
jsr copytozp
|
||||
|
||||
; set up starting coordinate for reading coordinates in reverse order
|
||||
+LDADDR .endcoords-2
|
||||
sta <input
|
||||
sty <input+1
|
||||
|
||||
; set up EOF marker to stop reading coordinates in reverse order
|
||||
lda #$00
|
||||
sta .coords-2
|
||||
|
||||
; set up logic to advance to next coordinates in reverse order
|
||||
ldx #(next2_end-next2_start-1)
|
||||
- lda next2_start, x
|
||||
sta <next, x
|
||||
dex
|
||||
bpl -
|
||||
|
||||
jsr InputLoop
|
||||
|
||||
bit KBD
|
||||
bmi start
|
||||
|
||||
; phase 2 - in order, without additional masking
|
||||
jsr copytozp
|
||||
|
||||
; redirect additional masking pointers to an array that contains #$FFs (so no dithering)
|
||||
lda #<no_masks
|
||||
sta <evenrow_ptr
|
||||
sta <oddrow_ptr
|
||||
|
||||
jmp InputLoop
|
||||
|
||||
copytozp
|
||||
+COPY_TO_0 start, end
|
||||
start
|
||||
!pseudopc 0 {
|
||||
Exit2Bit rts
|
||||
evenrow_ptr
|
||||
!word evenrow_masks
|
||||
oddrow_ptr
|
||||
!word oddrow_masks
|
||||
InputLoop
|
||||
ldy #0
|
||||
input=*+1
|
||||
ldx .coords ; first value: HGR row + 1
|
||||
beq Exit2Bit ; if 0 then we're done
|
||||
+ROW_X_TO_2BIT_BASE_ADDRESSES
|
||||
|
||||
iny
|
||||
lda (<input), y
|
||||
+HIGH_3_LOW_5 input
|
||||
|
||||
; main 2x2 block in left half
|
||||
clc
|
||||
- lda copymasks, x
|
||||
beq +
|
||||
src1=*+1
|
||||
lda $FDFD, y
|
||||
eor (<dest1), y
|
||||
and copymasks, x
|
||||
and (<evenrow_ptr), y
|
||||
eor (<dest1), y
|
||||
dest1=*+1
|
||||
sta $FDFD, y
|
||||
src2=*+1
|
||||
lda $FDFD, y
|
||||
eor (<dest2), y
|
||||
and copymasks, x
|
||||
and (<oddrow_ptr), y
|
||||
eor (<dest2), y
|
||||
dest2=*+1
|
||||
sta $FDFD, y
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
|
||||
; corresponding 2x2 block in right half (same row, opposite column)
|
||||
lda mirror_cols, y
|
||||
tay
|
||||
clc
|
||||
- lda mirror_copymasks, x
|
||||
beq +
|
||||
+COPY_BIT_DITHER src1, dest1, mirror_copymasks, evenrow_ptr
|
||||
+COPY_BIT_DITHER src2, dest2, mirror_copymasks, oddrow_ptr
|
||||
+ bcs +
|
||||
sta $C003
|
||||
sta $C005
|
||||
sec
|
||||
bcs -
|
||||
+ sta $C002
|
||||
sta $C004
|
||||
|
||||
next
|
||||
inc <input
|
||||
inc <input
|
||||
bne +
|
||||
bit KBD
|
||||
bmi ++
|
||||
inc <input+1
|
||||
+ jmp InputLoop
|
||||
++ rts
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
next2_start
|
||||
!pseudopc next {
|
||||
lda <input
|
||||
php
|
||||
dec <input
|
||||
dec <input
|
||||
plp
|
||||
bne +
|
||||
dec <input+1
|
||||
bit KBD
|
||||
bmi ++
|
||||
+ jmp InputLoop
|
||||
++ rts
|
||||
}
|
||||
next2_end
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ input = $FE ; word
|
||||
sta Coordinates1Bit-2
|
||||
|
||||
Start
|
||||
+BUILD_SPARSE_BITMASKS_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+COPY_SELF_TO_AUXMEM
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
+COPY_TO_AUXMEM $60, 4
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
+ST16 input
|
||||
LoopBL ; bottom-left quadrant (opposite row, original column, reverse input order)
|
||||
|
@ -1,3 +1,7 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
mirror_src1 = $E8 ; word
|
||||
mirror_dest1 = $EA ; word
|
||||
mirror_src2 = $EC ; word
|
||||
@ -9,11 +13,12 @@ dest2 = $F6 ; word
|
||||
reverse_input = $FC ; word
|
||||
input = $FE ; word
|
||||
|
||||
+BUILD_SPARSE_BITMASKS_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+COPY_SELF_TO_AUXMEM
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
+COPY_TO_AUXMEM $60, 4
|
||||
|
||||
+LDADDR Coordinates
|
||||
+ST16 input
|
||||
+LDADDR EndCoordinates-2
|
||||
|
@ -21,11 +21,12 @@ input = $FE ; word
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
|
||||
Start
|
||||
+BUILD_SPARSE_BITMASKS_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT_DHGR copymasks, mirror_copymasks
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+COPY_SELF_TO_AUXMEM
|
||||
+BUILD_MIRROR_COLS_DHGR mirror_cols
|
||||
+COPY_TO_AUXMEM $60, 4
|
||||
|
||||
+LDADDR Coordinates1Bit
|
||||
+ST16 input
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
|
@ -25,18 +25,10 @@ counter = $FF
|
||||
+SET_HGR_HI_WITH_OFFSET .offset
|
||||
}
|
||||
|
||||
!macro COPY_WITH_MASK .copymask {
|
||||
lda (src), y
|
||||
eor (dst), y ; merge source and destination bits
|
||||
and #.copymask ; isolate the bits to replace, zero the rest
|
||||
eor (dst), y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||||
sta (dst), y ; write the result
|
||||
}
|
||||
|
||||
; note: .copymask is an immediate value, not an indexed array or a memory address
|
||||
!macro COPY_WITH_OFFSET_AND_MASK .offset, .copymask {
|
||||
+RESET_HGR_HI_WITH_OFFSET .offset
|
||||
+COPY_WITH_MASK .copymask
|
||||
+COPY_BIT_IMMEDIATE .copymask
|
||||
}
|
||||
|
||||
!macro COPY_BYTE .offset {
|
||||
@ -46,7 +38,6 @@ counter = $FF
|
||||
}
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.dhgr.common.a"
|
||||
|
||||
exit=*+3
|
||||
+COPY_TO_AUXMEM $60, $07
|
||||
@ -79,7 +70,7 @@ RowLoop
|
||||
|
||||
+BRANCH_IF_Y_IS_OFFSCREEN @block2
|
||||
+SET_HGR_HI_WITH_OFFSET 3
|
||||
+COPY_WITH_MASK %10000001
|
||||
+COPY_BIT_IMMEDIATE %10000001
|
||||
+COPY_WITH_OFFSET_AND_MASK 4, %10000001
|
||||
@block2
|
||||
iny
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
row = $FF
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta @h1
|
||||
sta @h2
|
||||
@ -58,5 +60,4 @@ row = $FF
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -87,6 +87,5 @@ copymasks4
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
+HGR_COPY_MASK_ROUTINES
|
||||
|
@ -194,5 +194,4 @@ copymasks4
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -8,6 +8,8 @@
|
||||
row1 = $fe
|
||||
row2 = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta row1
|
||||
lda #$BF
|
||||
@ -39,5 +41,4 @@ row2 = $ff
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -34,5 +34,4 @@
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -57,6 +57,5 @@
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_WHITE_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -122,4 +122,3 @@ copymasks2
|
||||
!byte %11000000
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
|
@ -75,5 +75,4 @@ colors
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -1,137 +0,0 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
!macro HGR_CALC_ROUTINES {
|
||||
HGRCalc
|
||||
; in: A = HGR row (0x00..0xBF)
|
||||
; out: A/X clobbered
|
||||
; Y preserved
|
||||
; ($26) points to first byte of given HGR row on hi-res page 1
|
||||
; ($3C) points to same byte on hi-res page 2
|
||||
; based on 'Woz Recodes Hi-Res Address Calculations'
|
||||
; Apple Assembly Line vol. 7 issue 3 (December 1986)
|
||||
; 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)
|
||||
; out: Y preserved
|
||||
; X = #$00
|
||||
; Z set
|
||||
; C clear
|
||||
; all other flags and registers clobbered
|
||||
+HGR_ROW_CALC
|
||||
HGRBlockCopyNoRecalc
|
||||
clc
|
||||
ldx #$08
|
||||
@loop
|
||||
lda ($3c),y
|
||||
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)
|
||||
; out: Y preserved
|
||||
; X = #$00
|
||||
; Z set
|
||||
; C clear
|
||||
; all other flags and registers clobbered
|
||||
asl
|
||||
asl
|
||||
+HGR_CALC
|
||||
HGRStaggerCopy
|
||||
clc
|
||||
ldx #$04
|
||||
@loop
|
||||
lda ($3c),y
|
||||
sta ($26),y
|
||||
+HGR_INC_WITHIN_BLOCK
|
||||
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)
|
||||
; Y = HGR column (0x00..0x27)
|
||||
; out: Y preserved
|
||||
; X = #$00
|
||||
; Z set
|
||||
; C clear
|
||||
; all other flags and registers clobbered
|
||||
asl
|
||||
asl
|
||||
+HGR_CALC
|
||||
HGRStaggerToWhite
|
||||
clc
|
||||
ldx #$04
|
||||
@loop
|
||||
lda #$7F
|
||||
sta ($26),y
|
||||
+HGR_INC_WITHIN_BLOCK
|
||||
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
|
||||
rts
|
||||
|
||||
HGRBlockCopyWithMask
|
||||
; in: A = HGR row / 8 (0x00..0x17)
|
||||
; Y = HGR column (0x00..0x27)
|
||||
; must call SetCopyMask first
|
||||
; out: Y preserved
|
||||
; A/X clobbered
|
||||
; $00 clobbered
|
||||
+HGR_ROW_CALC
|
||||
HGRBlockCopyWithMaskNoRecalc
|
||||
ldx #7
|
||||
HGRBlockCopyWithMasksLoop
|
||||
lda ($26),y
|
||||
eor ($3c),y
|
||||
CopyMaskAddr=*+1
|
||||
and $FDFD,x ; call SetCopyMask to set
|
||||
eor ($26),y
|
||||
sta ($26),y
|
||||
clc
|
||||
+HGR_INC_WITHIN_BLOCK
|
||||
dex
|
||||
bpl HGRBlockCopyWithMasksLoop
|
||||
rts
|
||||
}
|
@ -124,7 +124,7 @@
|
||||
inc $FF
|
||||
+ rts
|
||||
|
||||
@table1
|
||||
@table1
|
||||
!byte $05, $AF, $05, $AF, $06, $90, $FA, $50, $FA, $50, $50, $5A, $F0, $5A, $F0, $0F
|
||||
!byte $A5, $0F, $A5, $05, $A5, $05, $AF, $05, $AF, $FA, $50, $FA, $50, $5A, $FA, $50
|
||||
!byte $5A, $F0, $5A, $A5, $0F, $A5, $05, $AF, $0F, $A5, $05, $AF, $05, $50, $FA, $50
|
||||
@ -142,7 +142,6 @@
|
||||
!byte $F0, $0F, $A5, $0F, $A5, $05, $05, $AF, $05, $AF, $06, $90, $FA, $50, $FA, $50
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_WHITE_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
Coordinates
|
||||
|
@ -59,6 +59,5 @@ copymasks
|
||||
!byte %10000000
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_COPY_MASK_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -60,6 +60,5 @@ copymasks
|
||||
!byte %10000000
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_COPY_MASK_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -61,6 +61,5 @@ copymasks
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_COPY_MASK_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -61,6 +61,5 @@ copymasks
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_COPY_MASK_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -145,6 +145,5 @@ copymasks4
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_COPY_MASK_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -10,6 +10,8 @@ row2 = $ff
|
||||
src = $3c
|
||||
dst = $26
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta row1
|
||||
lda #$BF
|
||||
@ -64,5 +66,4 @@ mask4 !byte %10011001
|
||||
!byte %11100110
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -22,12 +22,14 @@ input = $FE ; word
|
||||
+FX_INITONCE_1BIT CoordinatesFile, Start
|
||||
lda #$80
|
||||
sta Coordinates1Bit-2
|
||||
+BUILD_DITHER_MASKS dither_masks, evenrow_masks, oddrow_masks, no_masks
|
||||
|
||||
Start
|
||||
+BUILD_DITHER_MASKS dithermasks
|
||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
||||
Start
|
||||
+BUILD_SPARSE_BITMASKS_1BIT
|
||||
|
||||
+LDADDR evenrow_masks
|
||||
+ST16 evenrow_ptr
|
||||
+LDADDR oddrow_masks
|
||||
@ -110,8 +112,6 @@ LoopBR ; bottom-right quadrant (opposite row, oppo
|
||||
DoneBR
|
||||
rts
|
||||
|
||||
+DITHER_MASK_DATA
|
||||
|
||||
CoordinatesFile
|
||||
!byte 14
|
||||
!text "FX/RADIAL.DATA"
|
||||
|
@ -1,3 +1,7 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
evenrow_ptr = $E4 ; word
|
||||
oddrow_ptr = $E6 ; word
|
||||
mirror_src1 = $E8 ; word
|
||||
@ -11,11 +15,12 @@ dest2 = $F6 ; word
|
||||
reverse_input = $FC ; word
|
||||
input = $FE ; word
|
||||
|
||||
+BUILD_DITHER_MASKS dither_masks, evenrow_masks, oddrow_masks, no_masks
|
||||
+BUILD_DITHER_MASKS dithermasks
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT
|
||||
|
||||
+LDADDR evenrow_masks
|
||||
+ST16 evenrow_ptr
|
||||
+LDADDR oddrow_masks
|
||||
@ -87,5 +92,3 @@ Loop ldy #0
|
||||
bmi ++
|
||||
+ jmp Loop
|
||||
++ rts
|
||||
|
||||
+DITHER_MASK_DATA
|
||||
|
@ -5,6 +5,8 @@
|
||||
!to "build/FX.INDEXED/FOURSPIRAL",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$13
|
||||
sta $FB
|
||||
lda #$17
|
||||
@ -90,5 +92,4 @@
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_HALF_BLOCK_COPY_ROUTINES
|
||||
|
@ -5,6 +5,8 @@
|
||||
!to "build/FX.INDEXED/FOURSQUARE",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #23
|
||||
sta $FD
|
||||
lda #<Coordinates
|
||||
@ -157,7 +159,6 @@ stainc sta ($FE), y
|
||||
+ rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_WHITE_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
||||
|
@ -34,5 +34,4 @@
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_HALF_BLOCK_COPY_ROUTINES
|
||||
|
@ -57,6 +57,5 @@
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_WHITE_ROUTINES
|
||||
+HGR_HALF_BLOCK_COPY_ROUTINES
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
row = $FF
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta @h1
|
||||
lda #$27
|
||||
@ -40,5 +42,4 @@ row = $FF
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -8,6 +8,8 @@
|
||||
row1 = $fe
|
||||
row2 = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta row1
|
||||
lda #$5F
|
||||
@ -39,5 +41,4 @@ row2 = $ff
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -218,4 +218,3 @@ copymask_odd6
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
|
@ -9,6 +9,7 @@ maskindex = $fd
|
||||
row = $fe
|
||||
col = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/constants.a"
|
||||
|
||||
@jump
|
||||
@ -111,5 +112,4 @@ clearmasks
|
||||
copymasks
|
||||
!byte $FF,$BF,$9F,$8F,$87,$83,$81
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -10,6 +10,7 @@ row = $fd
|
||||
col1 = $fe
|
||||
col2 = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/constants.a"
|
||||
|
||||
lda #0
|
||||
@ -94,5 +95,4 @@ copymasks2
|
||||
!byte %11000000
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -5,6 +5,8 @@
|
||||
!to "build/FX.INDEXED/ONESQUARE",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
ldy #0
|
||||
sty $FA
|
||||
ldx #40
|
||||
@ -139,7 +141,6 @@
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_WHITE_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
||||
|
@ -8,123 +8,44 @@ hgrlomirror = $BD40 ; $C0 bytes
|
||||
mirror_cols = $BE00 ; $28 bytes
|
||||
hgr1hi = $BE40 ; $C0 bytes
|
||||
hgr1himirror = $BF40 ; $C0 bytes
|
||||
; the next 3 addresses should all be on the same page
|
||||
evenrow_masks = $8500 ; $28 bytes (for dithering)
|
||||
oddrow_masks = $8528 ; $28 bytes (for dithering)
|
||||
no_masks = $8550 ; $28 bytes (for dithering)
|
||||
dithermasks = $8500 ; $58 bytes
|
||||
evenrow_masks = dithermasks
|
||||
oddrow_masks = dithermasks+2
|
||||
no_masks = dithermasks+44
|
||||
Coordinates1Bit= $8600 ; $3481 bytes ($3480 on disk + 1 byte EOF marker)
|
||||
EndCoordinates1Bit=Coordinates1Bit+$3480
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
!macro BUILD_MIRROR_COLS .mirror_cols {
|
||||
; build lookup table to get $27-y for y in $00..$27
|
||||
ldx #$28
|
||||
ldy #$00
|
||||
- tya
|
||||
sta .mirror_cols-1, x
|
||||
iny
|
||||
dex
|
||||
bne -
|
||||
; X=0
|
||||
}
|
||||
|
||||
!macro BUILD_SPARSE_BITMASKS .copymasks, .mirror_copymasks {
|
||||
!macro BUILD_SPARSE_BITMASKS_1BIT {
|
||||
; build sparse lookup tables for bitmasks
|
||||
lda #%10000001
|
||||
sta .copymasks
|
||||
sta .mirror_copymasks+$C0
|
||||
sta copymasks
|
||||
sta mirror_copymasks+$C0
|
||||
|
||||
lda #%10000010
|
||||
sta .copymasks+$20
|
||||
sta .mirror_copymasks+$A0
|
||||
sta copymasks+$20
|
||||
sta mirror_copymasks+$A0
|
||||
|
||||
lda #%10000100
|
||||
sta .copymasks+$40
|
||||
sta .mirror_copymasks+$80
|
||||
sta copymasks+$40
|
||||
sta mirror_copymasks+$80
|
||||
|
||||
lda #%10001000
|
||||
sta .copymasks+$60
|
||||
sta .mirror_copymasks+$60
|
||||
sta copymasks+$60
|
||||
sta mirror_copymasks+$60
|
||||
|
||||
lda #%10010000
|
||||
sta .copymasks+$80
|
||||
sta .mirror_copymasks+$40
|
||||
sta copymasks+$80
|
||||
sta mirror_copymasks+$40
|
||||
|
||||
lda #%10100000
|
||||
sta .copymasks+$A0
|
||||
sta .mirror_copymasks+$20
|
||||
sta copymasks+$A0
|
||||
sta mirror_copymasks+$20
|
||||
|
||||
lda #%11000000
|
||||
sta .copymasks+$C0
|
||||
sta .mirror_copymasks
|
||||
}
|
||||
|
||||
!macro ROW_X_TO_BASE_ADDRESSES {
|
||||
lda hgrlo, x
|
||||
sta <dest1
|
||||
sta <src1
|
||||
lda hgr1hi, x
|
||||
sta <dest1+1
|
||||
eor #$60
|
||||
sta <src1+1
|
||||
lda hgrlo+1, x
|
||||
sta <dest2
|
||||
sta <src2
|
||||
lda hgr1hi+1, x
|
||||
sta <dest2+1
|
||||
eor #$60
|
||||
sta <src2+1
|
||||
}
|
||||
|
||||
!macro ROW_X_TO_MIRROR_ADDRESSES {
|
||||
lda hgrlomirror, x
|
||||
sta <mirror_dest1
|
||||
sta <mirror_src1
|
||||
lda hgr1himirror, x
|
||||
sta <mirror_dest1+1
|
||||
eor #$60
|
||||
sta <mirror_src1+1
|
||||
lda hgrlomirror+1, x
|
||||
sta <mirror_dest2
|
||||
sta <mirror_src2
|
||||
lda hgr1himirror+1, x
|
||||
sta <mirror_dest2+1
|
||||
eor #$60
|
||||
sta <mirror_src2+1
|
||||
}
|
||||
|
||||
!macro HIGH_3_LOW_5 .input {
|
||||
and #%11100000 ; second value: high 3 bits = index into tables to find bitmasks
|
||||
tax
|
||||
eor (<.input), y ; second value: low 5 bits = byte offset within the row (implicitly "and #%00011111")
|
||||
tay
|
||||
}
|
||||
|
||||
!macro INC_INPUT_AND_LOOP .loop {
|
||||
inc <input
|
||||
beq +
|
||||
jmp .loop
|
||||
+ bit KBD
|
||||
bmi +
|
||||
inc <input+1
|
||||
jmp .loop
|
||||
+ rts
|
||||
}
|
||||
|
||||
!macro DEC_INPUT_AND_LOOP .loop {
|
||||
lda input
|
||||
php
|
||||
dec input
|
||||
dec input
|
||||
plp
|
||||
bne +
|
||||
dec input+1
|
||||
bit KBD
|
||||
bpl .loop
|
||||
bmi ++
|
||||
+ jmp .loop
|
||||
++ rts
|
||||
sta copymasks+$C0
|
||||
sta mirror_copymasks
|
||||
}
|
||||
|
||||
!macro FX_INITONCE_1BIT .CoordinatesFile, .Start {
|
||||
@ -270,7 +191,7 @@ aslmod cmp #$1A
|
||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT
|
||||
+COPY_TO_0 start, end
|
||||
jmp InputLoop
|
||||
start
|
||||
@ -338,11 +259,11 @@ end
|
||||
}
|
||||
|
||||
!macro FX_PRECOMPUTED_1BIT_DITHER .coords, .endcoords {
|
||||
+BUILD_DITHER_MASKS dither_masks, evenrow_masks, oddrow_masks, no_masks
|
||||
+BUILD_DITHER_MASKS dithermasks
|
||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT
|
||||
|
||||
; phase 1 - in reverse, with additional masking
|
||||
+COPY_TO_0 start, end
|
||||
@ -471,6 +392,4 @@ next2_start
|
||||
++ rts
|
||||
}
|
||||
next2_end
|
||||
|
||||
+DITHER_MASK_DATA
|
||||
}
|
||||
|
@ -8,26 +8,15 @@ hgrlomirror = $BD40 ; $C0 bytes
|
||||
mirror_cols = $BE00 ; $28 bytes
|
||||
hgr1hi = $BE40 ; $C0 bytes
|
||||
hgr1himirror = $BF40 ; $C0 bytes
|
||||
; the next 3 addresses should all be on the same page
|
||||
evenrow_masks = $8000 ; $28 bytes (used for dithering)
|
||||
oddrow_masks = $8028 ; $28 bytes (used for dithering)
|
||||
no_masks = $8050 ; $28 bytes (used for dithering)
|
||||
dithermasks = $8000 ; $58 bytes
|
||||
evenrow_masks = dithermasks
|
||||
oddrow_masks = dithermasks+2
|
||||
no_masks = dithermasks+44
|
||||
Coordinates2Bit= $8100 ; $3C01 bytes ($3C00 on disk + 1 byte as EOF)
|
||||
EndCoordinates2Bit = Coordinates2Bit + $3C00
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
!macro BUILD_MIRROR_COLS .mirror_cols {
|
||||
; build lookup table to get $27-y for y in $00..$27
|
||||
ldx #$27
|
||||
ldy #$00
|
||||
- tya
|
||||
sta .mirror_cols, x
|
||||
iny
|
||||
dex
|
||||
bpl -
|
||||
}
|
||||
|
||||
!macro BUILD_SPARSE_BITMASKS_2BIT .copymasks, .mirror_copymasks {
|
||||
; build sparse lookup tables for bitmasks
|
||||
lda #%10000011
|
||||
@ -81,13 +70,6 @@ EndCoordinates2Bit = Coordinates2Bit + $3C00
|
||||
sta <src2+1
|
||||
}
|
||||
|
||||
!macro HIGH_3_LOW_5 .input {
|
||||
and #%11100000 ; second value: high 3 bits = index into tables to find bitmasks
|
||||
tax
|
||||
eor (.input), y ; second value: low 5 bits = byte offset within the row (implicitly "and #%00011111")
|
||||
tay
|
||||
}
|
||||
|
||||
!macro FX_INITONCE_2BIT .CoordinatesFile, .Start {
|
||||
InitOnce
|
||||
bit .Start
|
||||
@ -319,7 +301,7 @@ end
|
||||
}
|
||||
|
||||
!macro FX_PRECOMPUTED_2BIT_DITHER .coords, .endcoords {
|
||||
+BUILD_DITHER_MASKS dither_masks, evenrow_masks, oddrow_masks, no_masks
|
||||
+BUILD_DITHER_MASKS dithermasks
|
||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_SPARSE_BITMASKS_2BIT copymasks, mirror_copymasks
|
||||
@ -438,6 +420,4 @@ next2_start
|
||||
rts
|
||||
}
|
||||
next2_end
|
||||
|
||||
+DITHER_MASK_DATA
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ hgrhi3c = $BE80 ; $80 bytes
|
||||
dither1_lo = $6900 ; $80 bytes
|
||||
dither2_lo = $6980 ; $80 bytes
|
||||
dither3_lo = $6A00 ; $80 bytes
|
||||
; the next 3 addresses should all be on the same page
|
||||
evenrow_masks = $6A80 ; $28 bytes (for dithering)
|
||||
oddrow_masks = $6AA8 ; $28 bytes (for dithering)
|
||||
no_masks = $6AD0 ; $28 bytes (for dithering)
|
||||
dithermasks = $6A80 ; $58 bytes
|
||||
evenrow_masks = dithermasks
|
||||
oddrow_masks = dithermasks+2
|
||||
no_masks = dithermasks+44
|
||||
Coordinates3Bit= $6B00 ; pixel data is $5001 bytes ($5000 on disk + 1 byte as EOF marker)
|
||||
; and for optimization we only support loading external files page-aligned
|
||||
; and $BC00+ is used by the 3bit macros for data tables
|
||||
@ -296,7 +296,7 @@ end
|
||||
}
|
||||
|
||||
!macro FX_PRECOMPUTED_3BIT_DITHER .coords, .endcoords {
|
||||
+BUILD_DITHER_MASKS dither_masks, evenrow_masks, oddrow_masks, no_masks
|
||||
+BUILD_DITHER_MASKS dithermasks
|
||||
+BUILD_3BIT_HGR_LOOKUP_TABLES
|
||||
+BUILD_EXTRA_COLS
|
||||
+BUILD_SPARSE_BITMASKS_3BIT
|
||||
@ -440,6 +440,4 @@ next2_start
|
||||
++ rts
|
||||
}
|
||||
next2_end
|
||||
|
||||
+DITHER_MASK_DATA
|
||||
}
|
||||
|
@ -106,4 +106,3 @@ copymask_odd
|
||||
!byte %10110011
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
|
@ -106,4 +106,3 @@ copymask_odd
|
||||
!byte %10101010
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
|
@ -9,6 +9,7 @@ maskindex = $fd
|
||||
row = $fe
|
||||
col = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/constants.a"
|
||||
|
||||
lda #$00
|
||||
@ -62,5 +63,4 @@ copymasks
|
||||
!byte $FF,$BF,$9F,$8F,$87,$83,$81
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -25,7 +25,7 @@ Start
|
||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT
|
||||
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
+ST16 input
|
||||
|
@ -1,3 +1,7 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
mirror_src1 = $E8 ; word
|
||||
mirror_dest1 = $EA ; word
|
||||
mirror_src2 = $EC ; word
|
||||
@ -12,7 +16,8 @@ input = $FE ; word
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT
|
||||
|
||||
+LDADDR Coordinates
|
||||
+ST16 input
|
||||
+LDADDR EndCoordinates-2
|
||||
|
@ -24,7 +24,7 @@ Start
|
||||
+BUILD_MIRROR_COLS mirror_cols
|
||||
+BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi
|
||||
+BUILD_HGR_MIRROR_LOOKUP_TABLES hgrlomirror, hgr1himirror
|
||||
+BUILD_SPARSE_BITMASKS copymasks, mirror_copymasks
|
||||
+BUILD_SPARSE_BITMASKS_1BIT
|
||||
+LDADDR Coordinates1Bit
|
||||
+ST16 input
|
||||
+LDADDR EndCoordinates1Bit-2
|
||||
|
@ -8,6 +8,7 @@
|
||||
row1 = $fe
|
||||
row2 = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/constants.a"
|
||||
|
||||
lda #$00
|
||||
@ -97,5 +98,4 @@ CopyLine
|
||||
rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -195,4 +195,3 @@ copymasks6
|
||||
!byte %11010101
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
|
@ -195,4 +195,3 @@ copymasks6
|
||||
!byte %11010101
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
|
@ -148,5 +148,4 @@ masks
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -156,5 +156,4 @@ masks
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -159,5 +159,4 @@ masks
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
@ -5,6 +5,7 @@
|
||||
!to "build/FX.INDEXED/SPIRAL",plain
|
||||
*=$6000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/constants.a"
|
||||
|
||||
lda #$27
|
||||
@ -77,5 +78,4 @@
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -123,6 +123,5 @@ row2 = $FF
|
||||
@exit jmp UnwaitForVBL
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
+HGR_WHITE_ROUTINES
|
||||
|
@ -9,6 +9,8 @@ row = $fd
|
||||
col1 = $fe
|
||||
col2 = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta col1
|
||||
lda #$27
|
||||
@ -40,5 +42,4 @@ col2 = $ff
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_HALF_BLOCK_COPY_ROUTINES
|
||||
|
@ -9,6 +9,8 @@ row = $fd
|
||||
col1 = $fe
|
||||
col2 = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta col1
|
||||
lda #$27
|
||||
@ -69,6 +71,5 @@ col2 = $ff
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_WHITE_ROUTINES
|
||||
+HGR_HALF_BLOCK_COPY_ROUTINES
|
||||
|
@ -1,3 +1,7 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
!cpu 6502
|
||||
!to "build/FX.INDEXED/STAGGER.UD",plain
|
||||
*=$6000
|
||||
@ -5,6 +9,8 @@
|
||||
row1 = $fe
|
||||
row2 = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta row1
|
||||
lda #$2E
|
||||
@ -36,5 +42,4 @@ row2 = $ff
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_HALF_BLOCK_COPY_ROUTINES
|
||||
|
@ -8,6 +8,8 @@
|
||||
row1 = $fe
|
||||
row2 = $ff
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta row1
|
||||
lda #$2E
|
||||
@ -68,6 +70,5 @@ row2 = $ff
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_WHITE_ROUTINES
|
||||
+HGR_HALF_BLOCK_COPY_ROUTINES
|
||||
|
@ -10,6 +10,8 @@ row2 = $ff
|
||||
src = $3c
|
||||
dst = $26
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
|
||||
lda #$00
|
||||
sta row1
|
||||
lda #$BF
|
||||
@ -61,7 +63,6 @@ dst = $26
|
||||
@exit rts
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_CALC_ROUTINES
|
||||
|
||||
mask1 !byte %10110011
|
||||
|
@ -108,6 +108,5 @@ mask4
|
||||
!byte %11111111
|
||||
|
||||
!source "src/wait.a"
|
||||
!source "src/fx/fx.hgr.common.a"
|
||||
+HGR_COPY_MASK_ROUTINES
|
||||
+HGR_BLOCK_COPY_ROUTINES
|
||||
|
@ -9,7 +9,6 @@ shrlo = $301 ; $C8 bytes, indexed as shrlo-1,x
|
||||
shrhi = $38 ; $C8 bytes, indexed as shrhi-1,x
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
|
@ -85,7 +85,6 @@ BoxesX = $BE60 ; [$50 bytes][accessed via BoxesX-1][should
|
||||
BoxesY = $BEB0 ; [$50 bytes][accessed via BoxesY-1][should not cross page]
|
||||
|
||||
!source "src/fx/macros.a" ; no code in these
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
ldx #80
|
||||
lda #175
|
||||
|
@ -9,7 +9,6 @@ shrlo = $301 ; $C8 bytes, indexed as shrlo-1,x
|
||||
shrhi = $201 ; $C8 bytes, indexed as shrhi-1,x
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
|
@ -6,7 +6,6 @@
|
||||
*=$A000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
addrs=$7F ; [128 bytes]
|
||||
|
||||
|
@ -13,7 +13,6 @@ CoordinatesFileCopy = $BE42; $11 bytes
|
||||
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
|
||||
jmp stage2
|
||||
|
@ -13,7 +13,6 @@ CoordinatesFileCopy = $BE42; $11 bytes
|
||||
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
|
||||
jmp stage2
|
||||
|
@ -6,7 +6,6 @@
|
||||
*=$A000
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
shrlo = $301 ; $C8 bytes, indexed as shrlo-1,x
|
||||
shrhi = $37 ; $C8 bytes, indexed as shrhi-1,x
|
||||
|
@ -9,7 +9,6 @@ shrlo = $301 ; $C8 bytes, indexed as shrlo-1,x
|
||||
shrhi = $38 ; $C8 bytes, indexed as shrhi-1,x
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||
|
@ -14,7 +14,6 @@ CoordinatesFileCopy = $BE42; $11 bytes
|
||||
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
|
||||
jmp stage2
|
||||
|
@ -14,7 +14,6 @@ CoordinatesFileCopy = $BE42; $11 bytes
|
||||
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
|
||||
jmp stage2
|
||||
|
@ -13,7 +13,6 @@ CoordinatesFileCopy = $BE42; $11 bytes
|
||||
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
|
||||
jmp stage2
|
||||
|
@ -13,7 +13,6 @@ CoordinatesFileCopy = $BE42; $11 bytes
|
||||
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
|
||||
jmp stage2
|
||||
|
@ -13,7 +13,6 @@ CoordinatesFileCopy = $BE42; $11 bytes
|
||||
mirror_cols = $BE60 ; $A0 bytes but clobbers $27 previous bytes during construction
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+SHR_STAGE_1 shrlo, shrhi, mirror_rows, mirror_cols
|
||||
jmp stage2
|
||||
|
@ -11,7 +11,6 @@ reverseshrlo = $BD01 ; $C8 bytes
|
||||
reverseshrhi = $BE01 ; $C8 bytes
|
||||
|
||||
!source "src/fx/macros.a"
|
||||
!source "src/fx/fx.shr.common.a"
|
||||
|
||||
+COPY_TO_0 start, end
|
||||
+BUILD_SHR_REVERSE_LOOKUP_TABLES reverseshrlo, reverseshrhi
|
||||
|
227
src/fx/macros.a
227
src/fx/macros.a
@ -1,222 +1,15 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
!ifndef _FX_MACROS_ {
|
||||
!source "src/macros.a"
|
||||
|
||||
; .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
|
||||
ldy #0
|
||||
- tya
|
||||
and #$F8
|
||||
bpl +
|
||||
ora #5
|
||||
+ asl
|
||||
bpl +
|
||||
ora #5
|
||||
+ asl
|
||||
asl
|
||||
sta .hgrlomirror-1,x
|
||||
tya
|
||||
and #7
|
||||
rol
|
||||
asl .hgrlomirror-1,x
|
||||
rol
|
||||
ora #$20
|
||||
sta .hgr1himirror-1,x
|
||||
iny
|
||||
dex
|
||||
bne -
|
||||
}
|
||||
|
||||
!macro BUILD_DITHER_MASKS .dither_masks, .evenrow_masks, .oddrow_masks, .no_masks {
|
||||
ldy #$28
|
||||
-- ldx #$03
|
||||
- dey
|
||||
lda .dither_masks, x
|
||||
sta .evenrow_masks, y
|
||||
lda .dither_masks+2, x
|
||||
sta .oddrow_masks, y
|
||||
lda #$FF
|
||||
sta .no_masks, y
|
||||
dex
|
||||
bpl -
|
||||
tya
|
||||
bne --
|
||||
}
|
||||
|
||||
!macro HGR_CALC {
|
||||
; in: A = HGR row (0x00..0xBF)
|
||||
; out: A/X clobbered
|
||||
; Y preserved
|
||||
; ($26) points to first byte of given HGR row on hi-res page 1
|
||||
; ($3C) points to same byte on hi-res page 2
|
||||
; based on 'Woz Recodes Hi-Res Address Calculations'
|
||||
; Apple Assembly Line vol. 7 issue 3 (December 1986)
|
||||
; http://www.txbobsc.com/aal/1986/aal8612.html#a9
|
||||
asl
|
||||
tax
|
||||
and #$F0
|
||||
bpl @calc1
|
||||
ora #$05
|
||||
@calc1 bcc @calc2
|
||||
ora #$0A
|
||||
@calc2 asl
|
||||
asl
|
||||
sta $26
|
||||
txa
|
||||
and #$0E
|
||||
adc #$10
|
||||
asl $26
|
||||
rol
|
||||
sta $27
|
||||
eor #$60
|
||||
sta $3d
|
||||
lda $26
|
||||
sta $3c
|
||||
}
|
||||
|
||||
!macro HGR_ROW_CALC {
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
+HGR_CALC
|
||||
}
|
||||
|
||||
; /!\ C must be clear before using this macro
|
||||
!macro HGR_INC_WITHIN_BLOCK {
|
||||
lda $27
|
||||
adc #$04
|
||||
sta $27
|
||||
eor #$60
|
||||
sta $3d
|
||||
}
|
||||
|
||||
!macro RESET_HGR_CALC {
|
||||
lda $27
|
||||
sec
|
||||
sbc #$20
|
||||
sta $27
|
||||
eor #$60
|
||||
sta $3d
|
||||
}
|
||||
|
||||
!macro COPY_BIT .src1, .dest1, .copymasks {
|
||||
lda (.src1),y
|
||||
eor (.dest1),y ; merge source and destination bits
|
||||
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
|
||||
sta (.dest1),y ; write the result
|
||||
}
|
||||
|
||||
!macro COPY_BIT_DITHER .src1, .dest1, .copymasks, .dithermaskptr {
|
||||
lda (.src1),y
|
||||
eor (.dest1),y ; merge source and destination bits
|
||||
and .copymasks,x ; isolate the bits to replace, zero the rest
|
||||
and (.dithermaskptr),y
|
||||
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||||
sta (.dest1),y ; write the result
|
||||
}
|
||||
|
||||
!macro DITHER_MASK_DATA {
|
||||
dither_masks
|
||||
!byte %10110011
|
||||
!byte %11100110
|
||||
!byte %11001100
|
||||
!byte %10011001
|
||||
!byte %10110011
|
||||
!byte %11100110
|
||||
}
|
||||
|
||||
!macro COPY_BIT_ZP .src1, .dest1, .zpcopymask {
|
||||
lda (.src1),y
|
||||
eor (.dest1),y ; merge source and destination bits
|
||||
and <.zpcopymask ; isolate the bits to replace, zero the rest
|
||||
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||||
sta (.dest1),y ; write the result
|
||||
}
|
||||
|
||||
!macro SWITCH_TO_MASKS .copy {
|
||||
lda #<.copy
|
||||
sta CopyMaskAddr
|
||||
lda #>.copy
|
||||
sta CopyMaskAddr+1
|
||||
}
|
||||
|
||||
; must set N flag based on Y immediately before using these macros
|
||||
; e.g. LDY, INY, DEY, TYA
|
||||
!macro IS_Y_OFFSCREEN {
|
||||
bpl +
|
||||
sec
|
||||
bcs ++
|
||||
+ cpy #40
|
||||
++
|
||||
}
|
||||
!macro BRANCH_IF_Y_IS_OFFSCREEN .target {
|
||||
cpy #40
|
||||
bcs .target
|
||||
}
|
||||
!macro LONG_BRANCH_IF_Y_IS_OFFSCREEN .target {
|
||||
cpy #40
|
||||
bcc +
|
||||
jmp .target
|
||||
+
|
||||
}
|
||||
|
||||
!macro COPY_TO_0 .start, .end {
|
||||
; out: X=0
|
||||
; Z=1
|
||||
ldx #(.end-.start)
|
||||
- lda .start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
}
|
||||
|
||||
!macro OVERCOPY_TO_0 .start, .end {
|
||||
; over-copy region to $00
|
||||
; clobbers $FF
|
||||
; out: X=0
|
||||
; Y=last byte before start (e.g. 0 if the last instruction is JMP $0000)
|
||||
ldx #(.end-.start+1)
|
||||
- ldy .start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
}
|
||||
!source "src/fx/macros.hgr.a"
|
||||
!source "src/fx/macros.dhgr.a"
|
||||
!source "src/fx/macros.shr.a"
|
||||
!source "src/fx/macros.copybit.a"
|
||||
!source "src/fx/macros.dither.a"
|
||||
!source "src/fx/macros.misc.a"
|
||||
|
||||
_FX_MACROS_=*
|
||||
}
|
||||
|
50
src/fx/macros.copybit.a
Normal file
50
src/fx/macros.copybit.a
Normal file
@ -0,0 +1,50 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
!ifndef _FX_MACROS_COPYBIT_ {
|
||||
|
||||
!macro COPY_BIT .src1, .dest1, .copymasks {
|
||||
lda (.src1),y
|
||||
eor (.dest1),y ; merge source and destination bits
|
||||
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
|
||||
sta (.dest1),y ; write the result
|
||||
}
|
||||
|
||||
!macro COPY_BIT_DITHER .src1, .dest1, .copymasks, .dithermaskptr {
|
||||
lda (.src1),y
|
||||
eor (.dest1),y ; merge source and destination bits
|
||||
and .copymasks,x ; isolate the bits to replace, zero the rest
|
||||
and (.dithermaskptr),y ; apply dither mask (if any)
|
||||
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||||
sta (.dest1),y ; write the result
|
||||
}
|
||||
|
||||
!macro COPY_BIT_ZP .src1, .dest1, .zpcopymask {
|
||||
lda (.src1),y
|
||||
eor (.dest1),y ; merge source and destination bits
|
||||
and <.zpcopymask ; isolate the bits to replace, zero the rest
|
||||
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||||
sta (.dest1),y ; write the result
|
||||
}
|
||||
|
||||
!macro COPY_BIT_ZP_DITHER .src1, .dest1, .zpcopymask, .ditherptr {
|
||||
lda (.src1),y
|
||||
eor (.dest1),y ; merge source and destination bits
|
||||
and <.zpcopymask ; isolate the bits to replace, zero the rest
|
||||
and (.ditherptr), y ; apply dither mask (if any)
|
||||
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||||
sta (.dest1),y ; write the result
|
||||
}
|
||||
|
||||
!macro COPY_BIT_IMMEDIATE .copymask {
|
||||
lda (src), y
|
||||
eor (dst), y ; merge source and destination bits
|
||||
and #.copymask ; isolate the bits to replace, zero the rest
|
||||
eor (dst), y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||||
sta (dst), y ; write the result
|
||||
}
|
||||
|
||||
_FX_MACROS_COPYBIT_=*
|
||||
}
|
42
src/fx/macros.dhgr.a
Normal file
42
src/fx/macros.dhgr.a
Normal file
@ -0,0 +1,42 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
!ifndef _FX_MACROS_DHGR_ {
|
||||
|
||||
!macro COPY_TO_AUXMEM .startpage, .pagecount {
|
||||
ldx #.pagecount
|
||||
lda #.startpage
|
||||
sta $FF
|
||||
lda #$00
|
||||
sta $FE
|
||||
tay
|
||||
sta $C005
|
||||
- lda ($FE),y
|
||||
sta ($FE),y
|
||||
iny
|
||||
bne -
|
||||
inc $FF
|
||||
dex
|
||||
bne -
|
||||
sta $C004
|
||||
}
|
||||
|
||||
!macro BUILD_MIRROR_COLS_DHGR .mirror_cols {
|
||||
; build lookup table to get $27-y for y in $00..$27
|
||||
; duplicate in both mainmem and auxmem
|
||||
ldx #$28
|
||||
ldy #$00
|
||||
- tya
|
||||
sta .mirror_cols-1, x
|
||||
sta $C005
|
||||
sta .mirror_cols-1, x
|
||||
sta $C004
|
||||
iny
|
||||
dex
|
||||
bne -
|
||||
; X=0
|
||||
}
|
||||
|
||||
_FX_MACROS_DHGR_=*
|
||||
}
|
73
src/fx/macros.dither.a
Normal file
73
src/fx/macros.dither.a
Normal file
@ -0,0 +1,73 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
!ifndef _FX_MACROS_DITHER_ {
|
||||
|
||||
!macro BUILD_DITHER_MASKS .dithermasks {
|
||||
ldy #40
|
||||
- lda #%10110011
|
||||
sta .dithermasks, y
|
||||
lda #%11100110
|
||||
sta .dithermasks+1, y
|
||||
lda #%11001100
|
||||
sta .dithermasks+2, y
|
||||
lda #%10011001
|
||||
sta .dithermasks+3, y
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
bpl -
|
||||
ldy #39
|
||||
lda #$FF
|
||||
- sta .dithermasks+44, y
|
||||
dey
|
||||
bpl -
|
||||
}
|
||||
|
||||
!macro BUILD_DITHER_MASKS_DHGR .dithermasks {
|
||||
ldy #40
|
||||
- lda #%10011110
|
||||
sta .dithermasks, y
|
||||
lda #%11111000
|
||||
sta .dithermasks+1, y
|
||||
lda #%11100001
|
||||
sta .dithermasks+2, y
|
||||
lda #%10000111
|
||||
sta .dithermasks+3, y
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
bpl -
|
||||
ldy #39
|
||||
- lda #$FF
|
||||
sta .dithermasks+44, y
|
||||
dey
|
||||
bpl -
|
||||
sta $C005
|
||||
ldy #40
|
||||
- lda #%10001111
|
||||
sta .dithermasks, y
|
||||
lda #%10111100
|
||||
sta .dithermasks+1, y
|
||||
lda #%11110000
|
||||
sta .dithermasks+2, y
|
||||
lda #%11000011
|
||||
sta .dithermasks+3, y
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
bpl -
|
||||
ldy #39
|
||||
- lda #$FF
|
||||
sta .dithermasks+44, y
|
||||
dey
|
||||
bne -
|
||||
sta $C004
|
||||
}
|
||||
|
||||
_FX_MACROS_DITHER_=*
|
||||
}
|
312
src/fx/macros.hgr.a
Normal file
312
src/fx/macros.hgr.a
Normal file
@ -0,0 +1,312 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
!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
|
||||
ldy #0
|
||||
- tya
|
||||
and #$F8
|
||||
bpl +
|
||||
ora #5
|
||||
+ asl
|
||||
bpl +
|
||||
ora #5
|
||||
+ asl
|
||||
asl
|
||||
sta .hgrlomirror-1,x
|
||||
tya
|
||||
and #7
|
||||
rol
|
||||
asl .hgrlomirror-1,x
|
||||
rol
|
||||
ora #$20
|
||||
sta .hgr1himirror-1,x
|
||||
iny
|
||||
dex
|
||||
bne -
|
||||
}
|
||||
|
||||
!macro BUILD_MIRROR_COLS .mirror_cols {
|
||||
; in: none
|
||||
; out: .mirror_cols populated with lookup table to get $27-y for y in $00..$27
|
||||
; all registers and flags clobbered
|
||||
ldx #$27
|
||||
ldy #$00
|
||||
- tya
|
||||
sta .mirror_cols, x
|
||||
iny
|
||||
dex
|
||||
bpl -
|
||||
}
|
||||
|
||||
!macro HGR_CALC {
|
||||
; in: A = HGR row (0x00..0xBF)
|
||||
; out: A/X clobbered
|
||||
; Y preserved
|
||||
; ($26) points to first byte of given HGR row on hi-res page 1
|
||||
; ($3C) points to same byte on hi-res page 2
|
||||
; based on 'Woz Recodes Hi-Res Address Calculations'
|
||||
; Apple Assembly Line vol. 7 issue 3 (December 1986)
|
||||
; http://www.txbobsc.com/aal/1986/aal8612.html#a9
|
||||
asl
|
||||
tax
|
||||
and #$F0
|
||||
bpl @calc1
|
||||
ora #$05
|
||||
@calc1 bcc @calc2
|
||||
ora #$0A
|
||||
@calc2 asl
|
||||
asl
|
||||
sta $26
|
||||
txa
|
||||
and #$0E
|
||||
adc #$10
|
||||
asl $26
|
||||
rol
|
||||
sta $27
|
||||
eor #$60
|
||||
sta $3d
|
||||
lda $26
|
||||
sta $3c
|
||||
}
|
||||
|
||||
!macro HGR_ROW_CALC {
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
+HGR_CALC
|
||||
}
|
||||
|
||||
; /!\ C must be clear before using this macro
|
||||
!macro HGR_INC_WITHIN_BLOCK {
|
||||
lda $27
|
||||
adc #$04
|
||||
sta $27
|
||||
eor #$60
|
||||
sta $3d
|
||||
}
|
||||
|
||||
!macro RESET_HGR_CALC {
|
||||
lda $27
|
||||
sec
|
||||
sbc #$20
|
||||
sta $27
|
||||
eor #$60
|
||||
sta $3d
|
||||
}
|
||||
|
||||
!macro SWITCH_TO_MASKS .copy {
|
||||
lda #<.copy
|
||||
sta CopyMaskAddr
|
||||
lda #>.copy
|
||||
sta CopyMaskAddr+1
|
||||
}
|
||||
|
||||
!macro ROW_X_TO_BASE_ADDRESSES {
|
||||
lda hgrlo, x
|
||||
sta <dest1
|
||||
sta <src1
|
||||
lda hgr1hi, x
|
||||
sta <dest1+1
|
||||
eor #$60
|
||||
sta <src1+1
|
||||
lda hgrlo+1, x
|
||||
sta <dest2
|
||||
sta <src2
|
||||
lda hgr1hi+1, x
|
||||
sta <dest2+1
|
||||
eor #$60
|
||||
sta <src2+1
|
||||
}
|
||||
|
||||
!macro ROW_X_TO_MIRROR_ADDRESSES {
|
||||
lda hgrlomirror, x
|
||||
sta <mirror_dest1
|
||||
sta <mirror_src1
|
||||
lda hgr1himirror, x
|
||||
sta <mirror_dest1+1
|
||||
eor #$60
|
||||
sta <mirror_src1+1
|
||||
lda hgrlomirror+1, x
|
||||
sta <mirror_dest2
|
||||
sta <mirror_src2
|
||||
lda hgr1himirror+1, x
|
||||
sta <mirror_dest2+1
|
||||
eor #$60
|
||||
sta <mirror_src2+1
|
||||
}
|
||||
|
||||
!macro HGR_CALC_ROUTINES {
|
||||
HGRCalc
|
||||
; in: A = HGR row (0x00..0xBF)
|
||||
; out: A/X clobbered
|
||||
; Y preserved
|
||||
; ($26) points to first byte of given HGR row on hi-res page 1
|
||||
; ($3C) points to same byte on hi-res page 2
|
||||
; based on 'Woz Recodes Hi-Res Address Calculations'
|
||||
; Apple Assembly Line vol. 7 issue 3 (December 1986)
|
||||
; 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)
|
||||
; out: Y preserved
|
||||
; X = #$00
|
||||
; Z set
|
||||
; C clear
|
||||
; all other flags and registers clobbered
|
||||
+HGR_ROW_CALC
|
||||
HGRBlockCopyNoRecalc
|
||||
clc
|
||||
ldx #$08
|
||||
@loop
|
||||
lda ($3c),y
|
||||
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)
|
||||
; out: Y preserved
|
||||
; X = #$00
|
||||
; Z set
|
||||
; C clear
|
||||
; all other flags and registers clobbered
|
||||
asl
|
||||
asl
|
||||
+HGR_CALC
|
||||
HGRStaggerCopy
|
||||
clc
|
||||
ldx #$04
|
||||
@loop
|
||||
lda ($3c),y
|
||||
sta ($26),y
|
||||
+HGR_INC_WITHIN_BLOCK
|
||||
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)
|
||||
; Y = HGR column (0x00..0x27)
|
||||
; out: Y preserved
|
||||
; X = #$00
|
||||
; Z set
|
||||
; C clear
|
||||
; all other flags and registers clobbered
|
||||
asl
|
||||
asl
|
||||
+HGR_CALC
|
||||
HGRStaggerToWhite
|
||||
clc
|
||||
ldx #$04
|
||||
@loop
|
||||
lda #$7F
|
||||
sta ($26),y
|
||||
+HGR_INC_WITHIN_BLOCK
|
||||
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
|
||||
rts
|
||||
|
||||
HGRBlockCopyWithMask
|
||||
; in: A = HGR row / 8 (0x00..0x17)
|
||||
; Y = HGR column (0x00..0x27)
|
||||
; must call SetCopyMask first
|
||||
; out: Y preserved
|
||||
; A/X clobbered
|
||||
; $00 clobbered
|
||||
+HGR_ROW_CALC
|
||||
HGRBlockCopyWithMaskNoRecalc
|
||||
ldx #7
|
||||
HGRBlockCopyWithMasksLoop
|
||||
lda ($26),y
|
||||
eor ($3c),y
|
||||
CopyMaskAddr=*+1
|
||||
and $FDFD,x ; call SetCopyMask to set
|
||||
eor ($26),y
|
||||
sta ($26),y
|
||||
clc
|
||||
+HGR_INC_WITHIN_BLOCK
|
||||
dex
|
||||
bpl HGRBlockCopyWithMasksLoop
|
||||
rts
|
||||
}
|
||||
|
||||
_FX_MACROS_HGR_=*
|
||||
}
|
83
src/fx/macros.misc.a
Normal file
83
src/fx/macros.misc.a
Normal file
@ -0,0 +1,83 @@
|
||||
;license:MIT
|
||||
;(c) 2019-2022 by 4am
|
||||
;
|
||||
|
||||
!ifndef _FX_MACROS_MISC_ {
|
||||
|
||||
!macro HIGH_3_LOW_5 .input {
|
||||
and #%11100000 ; second value: high 3 bits = index into tables to find bitmasks
|
||||
tax
|
||||
eor (<.input), y ; second value: low 5 bits = byte offset within the row (implicitly "and #%00011111")
|
||||
tay
|
||||
}
|
||||
|
||||
; must set N flag based on Y immediately before using these macros
|
||||
; e.g. LDY, INY, DEY, TYA
|
||||
!macro IS_Y_OFFSCREEN {
|
||||
bpl +
|
||||
sec
|
||||
bcs ++
|
||||
+ cpy #40
|
||||
++
|
||||
}
|
||||
!macro BRANCH_IF_Y_IS_OFFSCREEN .target {
|
||||
cpy #40
|
||||
bcs .target
|
||||
}
|
||||
!macro LONG_BRANCH_IF_Y_IS_OFFSCREEN .target {
|
||||
cpy #40
|
||||
bcc +
|
||||
jmp .target
|
||||
+
|
||||
}
|
||||
|
||||
!macro COPY_TO_0 .start, .end {
|
||||
; out: X=0
|
||||
; Z=1
|
||||
ldx #(.end-.start)
|
||||
- lda .start-1, x
|
||||
sta $FF, x
|
||||
dex
|
||||
bne -
|
||||
}
|
||||
|
||||
!macro OVERCOPY_TO_0 .start, .end {
|
||||
; over-copy region to $00
|
||||
; clobbers $FF
|
||||
; out: X=0
|
||||
; Y=last byte before start (e.g. 0 if the last instruction is JMP $0000)
|
||||
ldx #(.end-.start+1)
|
||||
- ldy .start-2, x
|
||||
sty $FE, x
|
||||
dex
|
||||
bne -
|
||||
}
|
||||
|
||||
!macro INC_INPUT_AND_LOOP .loop {
|
||||
inc <input
|
||||
beq +
|
||||
jmp .loop
|
||||
+ bit KBD
|
||||
bmi +
|
||||
inc <input+1
|
||||
jmp .loop
|
||||
+ rts
|
||||
}
|
||||
|
||||
!macro DEC_INPUT_AND_LOOP .loop {
|
||||
lda input
|
||||
php
|
||||
dec input
|
||||
dec input
|
||||
plp
|
||||
bne +
|
||||
dec input+1
|
||||
bit KBD
|
||||
bpl .loop
|
||||
bmi ++
|
||||
+ jmp .loop
|
||||
++ rts
|
||||
}
|
||||
|
||||
_FX_MACROS_MISC_=*
|
||||
}
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 1455855
|
||||
!be24 1465314
|
||||
!le16 496
|
||||
|
@ -4,5 +4,5 @@
|
||||
; This file is automatically generated
|
||||
;
|
||||
!byte 0
|
||||
!be24 1444997
|
||||
!be24 1454137
|
||||
!le16 917
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user