I'm trying to make it work with all memory configurations. It reads the screen page and saves it to zero page for indirect index addressing. I know it's still using a hard-coded color address, but I haven't worked that out yet.
It has a basic program in the beginning that I'm sure is recognizable. It runs the machine language starting at $100D.
The problem is, depending on the memory configuration, the program loads at different addresses, and doesn't run correctly unless basic memory starts at $1001
Is there any way to compensate for this?
Code: Select all
SCREEN_START = $1E00
COLOR_START = $9600
CHARACTER_ROM = $8000
CHARACTER_RAM = $1C00
SCREEN_PAGE = $288
SCREEN_ADDRESS = $FD
COLOR_ADDRESS = $FB
.org $1001
; BASIC program to boot the machine language code
.byte $0B, $10, $0a, $00, $9e, $34, $31, $30, $39, $00, $00, $00
; store the screen address in zero page, for indirect-indexed addressing
LDA #$00
STA SCREEN_ADDRESS
LDA SCREEN_PAGE
STA SCREEN_ADDRESS + 1
; lower the top of basic programming
LDA #$1C
STA $34
STA $38
;copy 512 bytes from 32768 $8000 to 7168 $1C00
ldx #$00
copyChracters:
LDA CHARACTER_ROM, X
STA CHARACTER_RAM, X
LDA CHARACTER_ROM + 256, X
STA CHARACTER_RAM + 256, X
INX
BNE copyChracters ; incrementing past FF will set it back to zero
LDX #$07
makeSmiley:
LDA smiley, X
STA CHARACTER_RAM, X
DEX
BPL makeSmiley
switchToRamSet;
LDA #$FF
STA $9005
LDY #$3F
writeCharacters:
TYA
STA (SCREEN_ADDRESS), Y
LDA #$00
STA COLOR_START, Y
DEY
BPL writeCharacters
done:
RTS
smiley:
.byte %00111100
.byte %01000010
.byte %10100101
.byte %10000001
.byte %10100101
.byte %10011001
.byte %01000010
.byte %00111100