64K compatibility and some notes

This commit is contained in:
4am 2021-12-01 00:39:05 -05:00
parent d826236cc7
commit 9fa12ea6e8

View File

@ -10,6 +10,7 @@ fracv = $F9 ; byte
incv = $FA ; byte
src = $FC ; word
dst = $FE ; word
palettes = $BD00 ; $200 bytes
!source "src/fx/macros.a"
@ -31,14 +32,26 @@ dst = $FE ; word
;Y=0
- lda $9D00, y ; copy SCB
sta $9D00, y
iny
bne -
sta $C004
- lda $9E00, y ; Back up palettes to alternate location in main memory.
sta palettes, y ; The CPU in a 64K Apple ][+/][e w/VidHD ignores STA $C004/5
lda $9F00, y ; but VidHD respects them, so we can't clear the palettes
sta palettes+$100, y ; in auxmem until we copy them in mainmem. Whee.
iny
bne -
sta $C005
lda #0
sta $9E00, y ; clear palettes
- sta $9E00, y ; now clear the palettes
sta $9F00, y
iny
bne -
sta $C004
lda #$9E
lda #>palettes
sta src+1
ldx #$0F ; palette counter ($0F -> $00, not used as index)
rb_palette_loop
@ -51,7 +64,7 @@ rb_color_loop
sta dst
lda src+1
sec
sbc #$3E
sbc #>(palettes-$6000)
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
@ -83,7 +96,7 @@ rb_step_loop
+ dex
bpl rb_palette_loop
lda #$9E
lda #>palettes
sta src+1
ldx #$0F ; palette counter ($0F -> $00, not used as index)
g_palette_loop
@ -96,7 +109,7 @@ g_color_loop
sta dst
lda src+1
sec
sbc #$3E
sbc #>(palettes-$6000)
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