Browse Source

updated sid tune

new sid tune is bigger than 4k, so charset had to be moved
now (part of) first half of the charset actually is used by the sid
and ignored by the VIC; chars had to be redefined
newintro
giomba 1 year ago
parent
commit
c8199e7144
  1. 11
      README.md
  2. 1280
      src/font.asm
  3. 10
      src/initdata.asm
  4. 8
      src/levels.asm
  5. 7
      src/main.asm
  6. 10
      src/program.asm
  7. 22
      src/subroutines.asm
  8. 6
      util/rlevel.cpp

11
README.md

@ -68,9 +68,10 @@ Address | PRG | Description
#### Custom charset
Index | Description
----------------|-------------
```$00 - $1F``` | A-Z (space first)
```$20 - $3F``` | A-Z, reversed (space first)
```$40 - $4F``` | hex digits
```$50 - $5F``` | hex digits, reversed
```$60 - ``` | game tiles
```$00 - $7F``` | unused (space for SID)
```$80 - $9F``` | A-Z (space first)
```$A0 - $BF``` | A-Z, reversed (space first)
```$C0 - $CF``` | hex digits
```$D0 - $DF``` | hex digits, reversed
```$E0 - ``` | game tiles

1280
src/font.asm

File diff suppressed because it is too large

10
src/initdata.asm

@ -38,10 +38,10 @@ SCREEN_H = 24
; Tiles
; -----
EMPTY_TILE = $60
SNAKE_TILE = $61
FOOD_TILE = $62
WALL_TILE = $63
EMPTY_TILE = $e0
SNAKE_TILE = $e1
FOOD_TILE = $e2
WALL_TILE = $e3
; Tiles colors
; Note: these colors will be picked by the level select routine
@ -101,4 +101,4 @@ levelsList:
#if VERBOSE = 1
ECHO "initdata.asm @ ",LASTINIT,"len:",(. - LASTINIT)
#endif
#endif

8
src/levels.asm

@ -60,7 +60,7 @@ statusLevelLoad SUBROUTINE
; Upper bar -- fill with spaces, color yellow
ldx #39
.loop:
lda #$0
lda #$80
sta $400,x
lda #7
sta $d800,x
@ -139,9 +139,9 @@ writeLevelElement:
lda levelT
sta (levelVideoPointer),y
; tiles colors can be found in an array
; position in array = tile value - $60
; position in array = tile value - $e0
sec
sbc #$60
sbc #$e0
tax
lda tilesColors,x
sta (levelColorPointer),y
@ -168,4 +168,4 @@ writeLevelEnd:
#if VERBOSE = 1
ECHO "levels.asm @ ",LASTINIT,"len:",(. - LASTINIT)
#endif
#endif

7
src/main.asm

@ -25,15 +25,16 @@
SEG sidSegment
org $1000
sidtune:
INCBIN "../res.bin/amour.sid"
INCBIN "../res.bin/amour2.sid"
#if VERBOSE = 1
ECHO "End of SIDtune at ",.,"Space left:",($2000 - .)
ECHO "top $2000: End of SIDtune at ",.,"Space left:",($2000 - .)
ECHO "top $2400: End of SIDtune at ",.,"Space left:",($2400 - .)
#endif
; Font Data
; ----------------------------------------------------------------------
SEG fontSegment
org $2000
org $2400
; This binary data that defines the font is exactly 2kB long ($800)
INCLUDE "font.asm"

10
src/program.asm

@ -166,10 +166,10 @@ checkEndStatus:
; Play music
jsr sidtune + 3
jsr sidtune + 3
jsr sidtune + 3
jsr sidtune + 3
jsr sidtune + 3
; jsr sidtune + 3
; jsr sidtune + 3
; jsr sidtune + 3
; jsr sidtune + 3
; Increase random value
inc random
@ -192,4 +192,4 @@ checkEndStatus:
#if VERBOSE = 1
ECHO "program.asm @ ",LASTINIT,"len:",(. - LASTINIT)
#endif
#endif

22
src/subroutines.asm

@ -9,7 +9,7 @@ LASTINIT SET .
clearScreen SUBROUTINE
ldx #$ff
.loop:
lda #$00
lda #$80
sta $400,x
sta $500,x
sta $600,x
@ -81,12 +81,12 @@ printByte SUBROUTINE
lsr
lsr
lsr
ora #$40 ; add 64 (see font)
ora #$c0 ; add 192 (see font)
sta $400,y ; print msb char
txa ; Take least significant nibble (use previous copy)
and #$0f
ora #$40 ; add 64 (see font)
ora #$c0 ; add 192 (see font)
sta $401,y ; print lsb char
rts
@ -104,22 +104,22 @@ printString SUBROUTINE
beq .end ; if zero, then end (string must be null-terminated)
cmp #$20 ; is space?
bne .checkP1
lda #$0
lda #$80
jmp .print
.checkP1:
cmp #$28 ; is char '(' ?
bne .checkP2
lda #$1b
lda #$9b
jmp .print
.checkP2:
cmp #$29 ; is char ')' ?
bne .checkP3
lda #$1c
lda #$9c
jmp .print
.checkP3
cmp #$2e ; is char '.' ?
bne .checkNumber
lda #$1d
lda #$9d
jmp .print
.checkNumber: ; is char a number?
cmp #$2f
@ -129,14 +129,14 @@ printString SUBROUTINE
sec
sbc #$30
clc
adc #$40
adc #$c0
jmp .print
.nextCheck:
.isLetter:
; defaults to an uppercase letter of ASCII set
sec
sbc #$40
clc
adc #$40
.print:
sta (dstScreenPointer),y ; put screen code to screen
iny ; next char in string
@ -167,4 +167,4 @@ nextPointer:
#if VERBOSE = 1
ECHO "subroutines.asm @ ",LASTINIT,"len:",(. - LASTINIT)
#endif
#endif

6
util/rlevel.cpp

@ -7,11 +7,11 @@ void flush(char last, int count) {
char tile, color;
switch(last) {
case 'x':
tile = (char)0x63; break;
tile = (char)0xe3; break;
case 'f':
tile = (char)0x62; break;
tile = (char)0xe2; break;
default:
tile = (char)0x60; break;
tile = (char)0xe0; break;
}
cout << tile << (char)count;
}

Loading…
Cancel
Save