mirror of
https://github.com/a2-4am/4cade.git
synced 2024-09-29 09:55:29 +00:00
add some SHR transition effects (not yet hooked up)
This commit is contained in:
parent
876ad2de1d
commit
7b7360237d
@ -22,6 +22,27 @@
|
|||||||
bne -
|
bne -
|
||||||
}
|
}
|
||||||
|
|
||||||
|
!macro BUILD_SHR_REVERSE_LOOKUP_TABLES .lo, .hi {
|
||||||
|
ldx #$C8
|
||||||
|
lda #$00
|
||||||
|
ldy #$20
|
||||||
|
- sta .lo-1, x
|
||||||
|
!if .hi < $100 {
|
||||||
|
sty .hi-1, x
|
||||||
|
} else {
|
||||||
|
pha
|
||||||
|
tya
|
||||||
|
sta .hi-1, x
|
||||||
|
pla
|
||||||
|
}
|
||||||
|
clc
|
||||||
|
adc #$A0
|
||||||
|
bcc +
|
||||||
|
iny
|
||||||
|
+ dex
|
||||||
|
bne -
|
||||||
|
}
|
||||||
|
|
||||||
!macro COPY_SCB_AND_PALETTES {
|
!macro COPY_SCB_AND_PALETTES {
|
||||||
sta $C005
|
sta $C005
|
||||||
ldy #0
|
ldy #0
|
||||||
|
@ -46,3 +46,8 @@ dst sta $0000, y ; SMC
|
|||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
; if zero page code gets too large, move shrhi to $201
|
||||||
|
!if end-start > $38 {
|
||||||
|
!error "code is too large: ends at ", end-start
|
||||||
|
}
|
||||||
|
@ -42,3 +42,8 @@ dst sta $0000, y ; SMC
|
|||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
; if zero page code gets too large, move shrhi to $201
|
||||||
|
!if end-start > $38 {
|
||||||
|
!error "code is too large: ends at ", end-start
|
||||||
|
}
|
||||||
|
@ -46,3 +46,8 @@ dst sta $0000, y ; SMC
|
|||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
; if zero page code gets too large, move shrhi to $201
|
||||||
|
!if end-start > $38 {
|
||||||
|
!error "code is too large: ends at ", end-start
|
||||||
|
}
|
||||||
|
173
src/fx/wip/fx.shr.palette.fadein.a
Normal file
173
src/fx/wip/fx.shr.palette.fadein.a
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
;license:MIT
|
||||||
|
;(c) 2021 by 4am
|
||||||
|
|
||||||
|
!cpu 6502
|
||||||
|
!to "build/FX/SHR.FIZZLE",plain
|
||||||
|
*=$A000
|
||||||
|
|
||||||
|
color = $F8 ; byte
|
||||||
|
fracv = $F9 ; byte
|
||||||
|
incv = $FA ; byte
|
||||||
|
src = $FC ; word
|
||||||
|
dst = $FE ; word
|
||||||
|
|
||||||
|
!source "src/fx/macros.a"
|
||||||
|
|
||||||
|
sta $C005
|
||||||
|
ldy #0 ; copy pixel data
|
||||||
|
sty src
|
||||||
|
sty dst
|
||||||
|
lda #$20
|
||||||
|
sta src+1
|
||||||
|
ldx #$7D
|
||||||
|
- lda (src), y
|
||||||
|
sta (src), y
|
||||||
|
iny
|
||||||
|
bne -
|
||||||
|
inc src+1
|
||||||
|
dex
|
||||||
|
bne -
|
||||||
|
|
||||||
|
;Y=0
|
||||||
|
- lda $9D00, y ; copy SCB
|
||||||
|
sta $9D00, y
|
||||||
|
lda #0
|
||||||
|
sta $9E00, y ; clear palettes
|
||||||
|
sta $9F00, y
|
||||||
|
iny
|
||||||
|
bne -
|
||||||
|
|
||||||
|
;Y=0
|
||||||
|
sta $C004
|
||||||
|
lda #$60 ; clear $2000 bytes at $6000/main
|
||||||
|
sta src+1 ; for use as incremental palettes
|
||||||
|
ldx #$20
|
||||||
|
tya
|
||||||
|
- sta (src), y
|
||||||
|
iny
|
||||||
|
bne -
|
||||||
|
inc src+1
|
||||||
|
dex
|
||||||
|
bne -
|
||||||
|
|
||||||
|
; lda #$00
|
||||||
|
; sta src
|
||||||
|
lda #$9E
|
||||||
|
sta src+1
|
||||||
|
ldx #$0F ; palette counter ($0F -> $00, not used as index)
|
||||||
|
rb_palette_loop
|
||||||
|
ldy #$00 ; byte offset of color # within palette (00.1F)
|
||||||
|
rb_color_loop
|
||||||
|
lda #$00
|
||||||
|
sta fracv
|
||||||
|
sta color
|
||||||
|
lda src
|
||||||
|
sta dst
|
||||||
|
lda src+1
|
||||||
|
sec
|
||||||
|
sbc #$3E
|
||||||
|
sta dst+1
|
||||||
|
lda (src), y ; get final Red or Blue value for this color in this palette
|
||||||
|
asl ; Red or Blue value is bits 0-3, shift them into bits 4-7
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
sta incv
|
||||||
|
- lda fracv
|
||||||
|
clc
|
||||||
|
adc incv
|
||||||
|
sta fracv
|
||||||
|
bcc +
|
||||||
|
inc color
|
||||||
|
+ lda color
|
||||||
|
sta (dst), y
|
||||||
|
inc dst+1
|
||||||
|
inc dst+1
|
||||||
|
bpl -
|
||||||
|
iny
|
||||||
|
cpy #$20
|
||||||
|
bcc rb_color_loop
|
||||||
|
lda src
|
||||||
|
clc
|
||||||
|
adc #$20
|
||||||
|
sta src
|
||||||
|
bcc +
|
||||||
|
inc src+1
|
||||||
|
+ dex
|
||||||
|
bpl rb_palette_loop
|
||||||
|
|
||||||
|
; lda #$00
|
||||||
|
; sta src
|
||||||
|
lda #$9E
|
||||||
|
sta src+1
|
||||||
|
ldx #$0F ; palette #
|
||||||
|
g_palette_loop
|
||||||
|
ldy #$00 ; byte offset of color # within palette (00.1F)
|
||||||
|
g_color_loop
|
||||||
|
lda #$00
|
||||||
|
sta fracv
|
||||||
|
sta color
|
||||||
|
lda src
|
||||||
|
sta dst
|
||||||
|
lda src+1
|
||||||
|
sec
|
||||||
|
sbc #$3E
|
||||||
|
sta dst+1
|
||||||
|
lda (src), y ; get final Green value for this color in this palette
|
||||||
|
and #$F0 ; Green value is bits 4-7, mask out other bits
|
||||||
|
sta incv
|
||||||
|
- lda fracv
|
||||||
|
clc
|
||||||
|
adc incv
|
||||||
|
sta fracv
|
||||||
|
lda color
|
||||||
|
bcc +
|
||||||
|
clc
|
||||||
|
adc #$10
|
||||||
|
sta color
|
||||||
|
+ ora (dst), y ; keep existing Blue value in bits 0-3
|
||||||
|
sta (dst), y
|
||||||
|
inc dst+1
|
||||||
|
inc dst+1
|
||||||
|
bpl -
|
||||||
|
iny
|
||||||
|
iny ; high nibble of second color byte is always 0 so skip it
|
||||||
|
cpy #$20
|
||||||
|
bcc g_color_loop
|
||||||
|
lda src
|
||||||
|
clc
|
||||||
|
adc #$20
|
||||||
|
sta src
|
||||||
|
bcc +
|
||||||
|
inc src+1
|
||||||
|
+ dex
|
||||||
|
bpl g_palette_loop
|
||||||
|
|
||||||
|
ldx #$62
|
||||||
|
stx copy1+2
|
||||||
|
inx
|
||||||
|
stx copy2+2
|
||||||
|
ldx #$0E
|
||||||
|
ldy #$00
|
||||||
|
copyloop jsr WaitForVBL
|
||||||
|
sta $C005
|
||||||
|
copy1 lda $6200, y ; SMC
|
||||||
|
sta $9E00, y
|
||||||
|
copy2 lda $6300, y ; SMC
|
||||||
|
sta $9F00, y
|
||||||
|
iny
|
||||||
|
bne copy1
|
||||||
|
sta $C004
|
||||||
|
inc copy1+2
|
||||||
|
inc copy1+2
|
||||||
|
inc copy2+2
|
||||||
|
inc copy2+2
|
||||||
|
lda #$40
|
||||||
|
jsr WaitForKeyWithTimeout
|
||||||
|
bmi exit
|
||||||
|
dex
|
||||||
|
bpl copyloop
|
||||||
|
exit sta $C004
|
||||||
|
jmp UnwaitForVBL
|
||||||
|
|
||||||
|
!source "src/wait.a"
|
59
src/fx/wip/fx.shr.thin.ud.a
Normal file
59
src/fx/wip/fx.shr.thin.ud.a
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
;license:MIT
|
||||||
|
;(c) 2021 by 4am
|
||||||
|
|
||||||
|
!cpu 6502
|
||||||
|
!to "build/FX/SHR.FIZZLE",plain
|
||||||
|
*=$A000
|
||||||
|
|
||||||
|
!source "src/fx/fx.shr.common.a"
|
||||||
|
|
||||||
|
shrlo = $301 ; $C8 bytes
|
||||||
|
shrhi = $38 ; $C8 bytes
|
||||||
|
reverseshrlo = $BD01 ; $C8 bytes
|
||||||
|
reverseshrhi = $BE01 ; $C8 bytes
|
||||||
|
|
||||||
|
ldx #(end-start-1) ; copy loop to zero page
|
||||||
|
- lda start, x
|
||||||
|
sta $00, x
|
||||||
|
dex
|
||||||
|
bpl -
|
||||||
|
|
||||||
|
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
|
||||||
|
+BUILD_SHR_REVERSE_LOOKUP_TABLES reverseshrlo, reverseshrhi
|
||||||
|
+COPY_SCB_AND_PALETTES
|
||||||
|
|
||||||
|
ldx #$C8
|
||||||
|
jmp loop
|
||||||
|
|
||||||
|
start
|
||||||
|
!pseudopc 0 {
|
||||||
|
loop lda shrlo-1, x
|
||||||
|
sta <dst+1
|
||||||
|
lda shrhi-1, x
|
||||||
|
sta <dst+2
|
||||||
|
lda reverseshrlo-1, x
|
||||||
|
sta <rdst+1
|
||||||
|
lda reverseshrhi-1, x
|
||||||
|
sta <rdst+2
|
||||||
|
ldy #$00
|
||||||
|
loop2 lda (<dst+1), y
|
||||||
|
dst sta $0000, y ; SMC
|
||||||
|
iny
|
||||||
|
lda (<rdst+1), y
|
||||||
|
rdst sta $0000, y ; SMC
|
||||||
|
iny
|
||||||
|
cpy #$A0
|
||||||
|
bcc loop2
|
||||||
|
lda $C000
|
||||||
|
bmi exit
|
||||||
|
dex
|
||||||
|
bne loop
|
||||||
|
exit sta $C004
|
||||||
|
rts
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
; if zero page code gets too large, move shrhi to $201
|
||||||
|
!if end-start > $38 {
|
||||||
|
!error "code is too large: ends at ", end-start
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user