giomba
299eee1257
Now program takes less space in RAM. All variables, costants and Lists are moved before the SID song, in a previously unused space (BASIC RAM). SID song edit has been changed: - same song but slightly different - takes up a bit less than 4k - more catchy :-) - perfectly fits in $1000-$2000 and allows... ...the new custom charset to be put at $2000! - Taken TGGS font and properly customized with tiles Now actual program starts at $2800. Also added some useful code for assembler to output debug infos when assembling with -DDEBUG=1 In the meanwhile discovered tremendous subtle bug due to uninitialized structure (listX and listY). Fixed. Memory map now is: +-------------------------------+ 0000 | things in zero page | | and low RAM | +-------------------------------+ 0800 | BASIC autostart | | then data (variables, | | costants and strings) | <-- this can be done better using segments. Reminder for the future. | | +-------------------------------+ 0E00 | listX | +-------------------------------+ 0F00 | listY | +-------------------------------+ 1000 | SID song | | | | | +-------------------------------+ 2000 | TGGS Custom font charset | | | +-------------------------------+ 2800 | ACTUAL CODE | | | <-- plus some garbage data, see above (segments TODO) . . . .
94 lines
1.8 KiB
NASM
94 lines
1.8 KiB
NASM
processor 6502
|
|
|
|
multicolor SUBROUTINE
|
|
|
|
; Prepare data struct for MultiColor mode
|
|
; ----------------------------------------------------------------------
|
|
multicolorInit:
|
|
; Make font higher half the inverse of lower one
|
|
; TODO: merge these edits with actual font binary
|
|
ldx #$00
|
|
.tggsCopy
|
|
dex
|
|
lda tggsFont,x
|
|
eor #$ff
|
|
sta $2400,x
|
|
lda tggsFont + $100,x
|
|
eor #$ff
|
|
sta $2500,x
|
|
lda tggsFont + $200,x
|
|
eor #$ff
|
|
sta $2600,x
|
|
lda tggsFont + $300,x
|
|
eor #$ff
|
|
sta $2700,x
|
|
cpx #$0
|
|
bne .tggsCopy
|
|
|
|
; Alter character definitions in RAM (using previous defined table)
|
|
; TODO: merge these edits with actual font binary
|
|
ldx #$8
|
|
.editLoop:
|
|
dex
|
|
lda .multicolorSnakeTile,x
|
|
sta tggsFont + SNAKE_TILE * 8,x
|
|
lda .multicolorFoodTile,x
|
|
sta tggsFont + FOOD_TILE * 8,x
|
|
; lda .multicolorOtherTile,x
|
|
; sta tggsFont + SOME_TILE * 8,x
|
|
; ...
|
|
cpx #$0
|
|
bne .editLoop
|
|
|
|
; Tell VIC-II to use:
|
|
; - screen text memory at $400 = $400 * 1
|
|
; - characters ROM at $2000 = $400 * 8
|
|
lda #$18
|
|
sta $d018
|
|
|
|
rts
|
|
|
|
; Activate multicolor mode
|
|
; ----------------------------------------------------------------------
|
|
multicolorOn:
|
|
; Set colors
|
|
lda #9
|
|
sta $d021 ; 00 is brown
|
|
lda #2
|
|
sta $d022 ; 01 is red
|
|
lda #13
|
|
sta $d023 ; 10 is green
|
|
; and of course
|
|
; 11 is the colour specified in color RAM
|
|
|
|
lda $d016
|
|
ora #$10
|
|
sta $d016
|
|
|
|
rts
|
|
|
|
; Deactivate multicolor mode
|
|
; ----------------------------------------------------------------------
|
|
multicolorOff:
|
|
lda $d016
|
|
and #$ef
|
|
sta $d016
|
|
rts
|
|
|
|
; Costants
|
|
; ----------------------------------------------------------------------
|
|
.multicolorCommodoreTile:
|
|
BYTE #$00,#$30,#$cc,#$ca,#$c0,#$c5,#$cc,#$30
|
|
.multicolorSnakeTile:
|
|
BYTE #$00,#$28,#$ab,#$ab,#$ab,#$ab,#$28,#$00
|
|
.multicolorFoodTile:
|
|
BYTE #%00010101
|
|
BYTE #%10010101
|
|
BYTE #%10010101
|
|
BYTE #%10010101
|
|
BYTE #%10101000
|
|
BYTE #%00100000
|
|
BYTE #%00100000
|
|
BYTE #%10000000
|
|
|