repository organization fix
This commit is contained in:
parent
de38d95b74
commit
70b2b7ad47
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
bin/
|
||||||
|
build/
|
||||||
*.prg
|
*.prg
|
||||||
*.out
|
*.out
|
||||||
symbols.txt
|
symbols.txt
|
||||||
|
24
Makefile
24
Makefile
@ -1,8 +1,20 @@
|
|||||||
64:
|
.POSIX:
|
||||||
dasm main.asm -DSYSTEM=64 -DDEBUG=0 -osnake.prg
|
|
||||||
|
|
||||||
debug:
|
ASM=$(wildcard src/*.asm)
|
||||||
dasm main.asm -DSYSTEM=64 -DDEBUG=1 -ssymbols.txt -osnake.prg
|
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
31
README.md
Normal 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
|
||||||
|
|
@ -9,34 +9,35 @@
|
|||||||
; Commodore16 specific code
|
; Commodore16 specific code
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
; Uninitialized zeropage segment
|
; Uninitialized zeropage segment
|
||||||
|
; ----------------------------------------------------------------------
|
||||||
SEG.U zeropageSegment
|
SEG.U zeropageSegment
|
||||||
org $02
|
org $02
|
||||||
INCLUDE "zeropage.asm"
|
INCLUDE "zeropage.asm"
|
||||||
|
|
||||||
; Initialized segments
|
#if DEBUG = 1
|
||||||
SEG basicSegment
|
; Locations $90-$FF in zeropage are used by kernal
|
||||||
org $801
|
ECHO "End of zeropage variables. Space left: ",($90 - .)
|
||||||
INCLUDE "basic.asm"
|
#endif
|
||||||
|
|
||||||
|
; Initialized segments
|
||||||
|
; ----------------------------------------------------------------------
|
||||||
SEG dataSegment
|
SEG dataSegment
|
||||||
org $900
|
org $801
|
||||||
|
INCLUDE "basic.asm" ; BASIC must stay at this address
|
||||||
INCLUDE "data.asm"
|
INCLUDE "data.asm"
|
||||||
INCLUDE "const.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)
|
; SID tune (previously properly cleaned, see HVSC)
|
||||||
; ----------------------------------------------------------------------
|
; ----------------------------------------------------------------------
|
||||||
SEG sidSegment
|
SEG sidSegment
|
||||||
org $1000
|
org $1000
|
||||||
sidtune:
|
sidtune:
|
||||||
INCBIN "amour.sid"
|
INCBIN "../res/amour.sid"
|
||||||
#if DEBUG = 1
|
#if DEBUG = 1
|
||||||
ECHO "End of SIDtune. Space left: ",($2000 - .)
|
ECHO "End of SIDtune. Space left: ",($2000 - .)
|
||||||
#endif
|
#endif
|
||||||
@ -47,7 +48,7 @@ sidtune:
|
|||||||
org $2000
|
org $2000
|
||||||
; This binary data that defines the font is exactly 2kB long ($800)
|
; This binary data that defines the font is exactly 2kB long ($800)
|
||||||
tggsFont:
|
tggsFont:
|
||||||
INCBIN "tggs.font"
|
INCLUDE "tggs.asm"
|
||||||
|
|
||||||
; Include program
|
; Include program
|
||||||
; ----------------------------------------------------------------------
|
; ----------------------------------------------------------------------
|
||||||
@ -66,9 +67,21 @@ tggsFont:
|
|||||||
INCLUDE "subroutines.asm"
|
INCLUDE "subroutines.asm"
|
||||||
|
|
||||||
#if DEBUG = 1
|
#if DEBUG = 1
|
||||||
ECHO "Program ends at: ",.
|
ECHO "End of program at: ",.,"Space left:",($ce00 - .)
|
||||||
#endif
|
#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
|
; coded during december 2017
|
||||||
; by giomba -- giomba at glgprograms.it
|
; by giomba -- giomba at glgprograms.it
|
@ -25,21 +25,6 @@ multicolorInit:
|
|||||||
cpx #$0
|
cpx #$0
|
||||||
bne .tggsCopy
|
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:
|
; Tell VIC-II to use:
|
||||||
; - screen text memory at $400 = $400 * 1
|
; - screen text memory at $400 = $400 * 1
|
||||||
; - characters ROM at $2000 = $400 * 8
|
; - characters ROM at $2000 = $400 * 8
|
||||||
@ -74,20 +59,3 @@ multicolorOff:
|
|||||||
and #$ef
|
and #$ef
|
||||||
sta $d016
|
sta $d016
|
||||||
rts
|
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
2560
src/tggs.asm
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
; Zero page utilities
|
; Zero page utility pointers
|
||||||
; ----------------------------------------------------------------------
|
; ----------------------------------------------------------------------
|
||||||
; Where is the snake head in video memory? Do math to calculate address
|
; Where is the snake head in video memory? Do math to calculate address
|
||||||
; using pointer at tileMem,tileMem+1
|
; using pointer at tileMem,tileMem+1
|
||||||
@ -9,12 +9,9 @@ printStatusString DS 2
|
|||||||
|
|
||||||
; Pointer to intro string
|
; Pointer to intro string
|
||||||
printIntroString DS 2
|
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
|
introScreenStart DS 2
|
||||||
|
|
||||||
#if DEBUG = 1
|
; Note: Locations $90-$FF in zeropage are used by kernal
|
||||||
; Locations $90-$FF in zeropage are used by kernal
|
|
||||||
ECHO "End of zeropage variables. Space left: ",($90 - .)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
29
util/explodefont.cpp
Normal file
29
util/explodefont.cpp
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user