repository organization fix

This commit is contained in:
giomba 2020-04-01 21:11:08 +02:00
parent de38d95b74
commit 70b2b7ad47
22 changed files with 2675 additions and 62 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
bin/
build/
*.prg
*.out
symbols.txt

1
LICENSE Normal file
View File

@ -0,0 +1 @@
https://www.gnu.org/licenses/gpl-3.0.txt

View File

@ -1,8 +1,20 @@
64:
dasm main.asm -DSYSTEM=64 -DDEBUG=0 -osnake.prg
.POSIX:
debug:
dasm main.asm -DSYSTEM=64 -DDEBUG=1 -ssymbols.txt -osnake.prg
ASM=$(wildcard src/*.asm)
RES=$(wildcard res/*)
.PHONY: debug env clean
bin/snake.prg: $(ASM) $(RES) | env
dasm src/main.asm -Isrc/ -DSYSTEM=64 -DDEBUG=0 -obin/snake.prg
clean:
rm -rf {build,bin}
env:
mkdir -p {build,bin}
debug: $(ASM) $(RES) | env
g++ -o bin/explodefont util/explodefont.cpp
dasm src/main.asm -Isrc/ -DSYSTEM=64 -DDEBUG=1 -sbuild/symbols.txt -obin/snake.prg
16:
dasm main.asm -DSYSTEM=16 -osnake.prg

31
README.md Normal file
View File

@ -0,0 +1,31 @@
# snake6502
*snake6502* is a snake-like game clone for Commodore home computers, written for fun because «I always wanted to code something for a computer of my retrocomputers collection actually, this is the main reason I collect them: to write programs».
## Compile
You need the [dasm](https://dasm-assembler.github.io/) macro assembler, then:
```
$ make
```
You can also make it output useful extra info with:
```
$ make debug
```
## Memory map
Address | PRG | Description
----------------------|-------|------------
```$0000 - $0001``` | no | hardware
```$0002 - $00FF``` | no | zero page pointers
```$0100 - $07FF``` | no | *free ram*
```$0800 - $0FFF``` | yes | data segment + BASIC autostart
```$1000 - $1FFF``` | yes | SID tune
```$2000 - $27FF``` | yes | custom char
```$2800 - $xxxx``` | yes | program logic (only needed part used)
```$xxxx - $CDFF``` | no | *free ram*
```$CE00 - $CEFF``` | no | list X
```$CF00 - $CFFF``` | no | list Y
```$D000 - $DFFF``` | no | I/O
```$E000 - $FFFF``` | no | Kernal

View File

@ -7,7 +7,7 @@ ST_INTRO1 = 1
ST_PLAY = 2
ST_OUTRO = 3
ST_END = 4
ST_PAUSE = 255
ST_PAUSE = 255
; Screen features
SCREEN_W = 40

View File

@ -9,34 +9,35 @@
; Commodore16 specific code
#endif
; Uninitialized zeropage segment
; Uninitialized zeropage segment
; ----------------------------------------------------------------------
SEG.U zeropageSegment
org $02
INCLUDE "zeropage.asm"
; Initialized segments
SEG basicSegment
org $801
INCLUDE "basic.asm"
#if DEBUG = 1
; Locations $90-$FF in zeropage are used by kernal
ECHO "End of zeropage variables. Space left: ",($90 - .)
#endif
; Initialized segments
; ----------------------------------------------------------------------
SEG dataSegment
org $900
org $801
INCLUDE "basic.asm" ; BASIC must stay at this address
INCLUDE "data.asm"
INCLUDE "const.asm"
#if DEBUG = 1
ECHO "End of Data + Basic Segment. Space left: ",($1000 - .)
#endif
; List
; ----------------------------------------------------------------------
. = $e00
listX:
. = $f00
listY:
; SID tune (previously properly cleaned, see HVSC)
; ----------------------------------------------------------------------
SEG sidSegment
org $1000
sidtune:
INCBIN "amour.sid"
INCBIN "../res/amour.sid"
#if DEBUG = 1
ECHO "End of SIDtune. Space left: ",($2000 - .)
#endif
@ -47,7 +48,7 @@ sidtune:
org $2000
; This binary data that defines the font is exactly 2kB long ($800)
tggsFont:
INCBIN "tggs.font"
INCLUDE "tggs.asm"
; Include program
; ----------------------------------------------------------------------
@ -66,9 +67,21 @@ tggsFont:
INCLUDE "subroutines.asm"
#if DEBUG = 1
ECHO "Program ends at: ",.
ECHO "End of program at: ",.,"Space left:",($ce00 - .)
#endif
#if DEBUG = 1
; +2 because of PRG header
ECHO "PRG size:",([. - $801 + 2]d),"dec"
#endif
; Uninitialized list segment
; ----------------------------------------------------------------------
SEG.U listSegment
org $ce00
listX DS 256
listY DS 256
;
; coded during december 2017
; by giomba -- giomba at glgprograms.it

View File

@ -25,21 +25,6 @@ multicolorInit:
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
@ -74,20 +59,3 @@ multicolorOff:
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

2560
src/tggs.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
; Zero page utilities
; Zero page utility pointers
; ----------------------------------------------------------------------
; Where is the snake head in video memory? Do math to calculate address
; using pointer at tileMem,tileMem+1
@ -9,12 +9,9 @@ printStatusString DS 2
; Pointer to intro string
printIntroString DS 2
; Pointer to screen position where to print intro string ($fb-$fc)
; Pointer to screen position where to print intro string
introScreenStart DS 2
#if DEBUG = 1
; Locations $90-$FF in zeropage are used by kernal
ECHO "End of zeropage variables. Space left: ",($90 - .)
#endif
; Note: Locations $90-$FF in zeropage are used by kernal

29
util/explodefont.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <iostream>
using namespace std;
int main() {
int count = 0;
while (cin.good()) {
char c;
cin.get(c);
if (! cin.good()) break;
if (count % 8 == 0) {
cout << "; character " << count / 8 << endl;
}
cout << " BYTE #%";
for (int i = 7; i >= 0; --i) {
cout << ((c >> i) & 1);
}
cout << endl;
if (count % 8 == 7) {
cout << endl;
}
count++;
}
return 0;
}