Skip to content

Commit 5dd1de5

Browse files
committed
Reorganize test code, add libX16Test submodule
1 parent 43e576c commit 5dd1de5

File tree

12 files changed

+86
-31
lines changed

12 files changed

+86
-31
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "libX16"]
22
path = libX16
33
url = https://github.com/CJLove/libX16
4+
[submodule "libX16Test"]
5+
path = libX16Test
6+
url = https://github.com/CJLove/libX16Test

Issues.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
# Rough plans
55
- Longer term: consider incorporating tilesets and concepts from LodeRunner Mad Monks Revenge
6-
- Figure out sound
76
- Support for jumping to specific level
87
- Add game editor? This would require kernal SAVE support from banked RAM
98

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This in-progress port is based on other open source LodeRunner ports: [LodeRunner TotalRecall](https://github.com/SimonHung/LodeRunner_TotalRecall) and [LodeRunner for Roku](https://github.com/lvcabral/Lode-Runner-Roku).
44

5-
This port is (so far :) ) being written in C using the [CC65](https://cc65.github.io/) toolchain. Also using the [libX16](https://github.com/CJLove/libX16) library for various utility functions.
5+
This port is (so far :smile:) being written in C using the [CC65](https://cc65.github.io/) toolchain. Also using the [libX16](https://github.com/CJLove/libX16) library for various utility functions and using the [libX16Test](https://github.com/CJLove/libX16Test) library for unit tests.
66

77
![](runner.gif)
88

@@ -23,6 +23,14 @@ make all
2323
```
2424

2525
## Test programs
26+
Test programs can be built from the test directory:
27+
```bash
28+
cd libX16Test/src
29+
make
30+
cd ../../test
31+
make all
32+
```
33+
2634
* `test_levels.prg` - browse levels in any supported world. Use the `+` and `-` keys to browse the next and previous levels. Use `1` - `5` to change worlds (Classic, Championship, Professional, Fanbook, Revenge). Use `c` to "complete" any given level (changing hidden ladder tiles to regular ladder tiles)
2735

2836
* `test_runner.prg` - tests the runner's animations and basic movements on level 1. Use the `j` and `k` for left/right, `i` and `m` for up/down. Debug information about the current surrounding tiles and the runner's current position are displayed to the right.

libX16Test

Submodule libX16Test added at c024d23

src/Makefile

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.PHONY: all clean
22

3-
LIBRARIES := ../libX16/lib
3+
LIBRARIES := -L ../libX16/lib
44

5-
INCLUDE := ../libX16/include
5+
INCLUDES := -I ../libX16/include
66

77
SRC = \
88
loader.c screen.c levels.c runner.c key.c guard.c splash.c sound.c
@@ -13,27 +13,7 @@ OBJ = $(SRC:%.c=%.o)
1313
# cl65 -t cx16 -I $(INCLUDE) -Oi $<
1414

1515
lode_runner: mainloop.c $(SRC)
16-
cl65 -t cx16 --listing test.txt -I $(INCLUDE) -L $(LIBRARIES) -Oi -o lode_runner.prg mainloop.c $(SRC) libX16.lib cx16.lib
17-
18-
test_keys: test_keys.c $(SRC)
19-
cl65 -t cx16 -I $(INCLUDE) -L $(LIBRARIES) -Oi -o test_keys.prg test_keys.c $(SRC) libX16.lib cx16.lib
20-
21-
22-
test_levels: test_levels.c $(SRC)
23-
cl65 -t cx16 -I $(INCLUDE) -L $(LIBRARIES) -Oi -o test_levels.prg test_levels.c $(SRC) libX16.lib cx16.lib
24-
25-
test_runner: test_runner.c $(SRC)
26-
cl65 -t cx16 -I $(INCLUDE) -L $(LIBRARIES) -Oi -o test_runner.prg test_runner.c $(SRC) libX16.lib cx16.lib
27-
28-
test_tiles: test_tiles.c $(SRC)
29-
cl65 -t cx16 -I $(INCLUDE) -L $(LIBRARIES) -Oi -o test_tiles.prg test_tiles.c $(SRC) libX16.lib cx16.lib
30-
31-
test_splash: test_splash.c $(SRC)
32-
cl65 -t cx16 -I $(INCLUDE) -L $(LIBRARIES) -Oi -o test_splash.prg test_splash.c $(SRC) libX16.lib cx16.lib
33-
34-
35-
test_sprites: test_sprites.c $(SRC)
36-
cl65 -t cx16 -I $(INCLUDE) -L $(LIBRARIES) -Oi -o test_sprites.prg test_sprites.c $(SRC) libX16.lib cx16.lib
16+
cl65 -t cx16 --listing test.txt $(INCLUDES) $(LIBRARIES) -Oi -o lode_runner.prg mainloop.c $(SRC) libX16.lib cx16.lib
3717

3818
PALETTE.BIN: ../assets/palette.txt
3919
../scripts/ascii2bin.py --input ../assets/palette.txt --output PALETTE.BIN --addr 1000

test/Makefile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.PHONY: all clean
2+
3+
LIBRARIES := -L ../libX16/lib
4+
5+
INCLUDES := -I ../libX16/include -I ../src
6+
7+
SRC = \
8+
../src/loader.c ../src/screen.c ../src/levels.c ../src/runner.c ../src/key.c ../src/guard.c ../src/splash.c ../src/sound.c
9+
10+
test_keys: test_keys.c $(SRC)
11+
cl65 -t cx16 $(INCLUDES) $(LIBRARIES) -Oi -o test_keys.prg test_keys.c $(SRC) libX16.lib cx16.lib
12+
13+
test_levels: test_levels.c $(SRC)
14+
cl65 -t cx16 $(INCLUDES) $(LIBRARIES) -Oi -o test_levels.prg test_levels.c $(SRC) libX16.lib cx16.lib
15+
16+
test_runner: test_runner.c $(SRC)
17+
cl65 -t cx16 $(INCLUDES) $(LIBRARIES) -Oi -o test_runner.prg test_runner.c $(SRC) libX16.lib cx16.lib
18+
19+
test_tiles: test_tiles.c $(SRC)
20+
cl65 -t cx16 $(INCLUDES) $(LIBRARIES) -Oi -o test_tiles.prg test_tiles.c $(SRC) libX16.lib cx16.lib
21+
22+
test_splash: test_splash.c $(SRC)
23+
cl65 -t cx16 $(INCLUDES) $(LIBRARIES) -Oi -o test_splash.prg test_splash.c $(SRC) libX16.lib cx16.lib
24+
25+
test_sprites: test_sprites.c $(SRC)
26+
cl65 -t cx16 $(INCLUDES) $(LIBRARIES) -Oi -o test_sprites.prg test_sprites.c $(SRC) libX16.lib cx16.lib
27+
28+
PALETTE.BIN: ../assets/palette.txt
29+
../scripts/ascii2bin.py --input ../assets/palette.txt --output PALETTE.BIN --addr 1000
30+
31+
SPLASH.BIN: ../assets/splash.txt
32+
../scripts/ascii2bin.py --input ../assets/splash.txt --output SPLASH.BIN --addr a000
33+
34+
TILES.BIN: ../assets/tiles.txt
35+
../scripts/graphic.py --input ../assets/tiles.txt --output TILES.BIN --x 8 --y 8 --bpp 2 --addr 0000
36+
37+
CLASSIC.BIN: ../assets/classic.json ../scripts/levels.py
38+
../scripts/levels.py --input ../assets/classic.json --output CLASSIC.BIN
39+
40+
CHAMP.BIN: ../assets/championship.json ../scripts/levels.py
41+
../scripts/levels.py --input ../assets/championship.json --output CHAMP.BIN
42+
43+
PRO.BIN: ../assets/professional.json ../scripts/levels.py
44+
../scripts/levels.py --input ../assets/professional.json --output PRO.BIN
45+
46+
FANBOOK.BIN: ../assets/fanbook.json ../scripts/levels.py
47+
../scripts/levels.py --input ../assets/fanbook.json --output FANBOOK.BIN
48+
49+
REVENGE.BIN: ../assets/revenge.json ../scripts/levels.py
50+
../scripts/levels.py --input ../assets/revenge.json --output REVENGE.BIN
51+
52+
CUSTOM.BIN: ../assets/custom.json ../scripts/levels.py
53+
../scripts/levels.py --input ../assets/custom.json --output CUSTOM.BIN
54+
55+
56+
SPRITES.BIN: ../assets/sprites.txt ../scripts/graphic.py
57+
../scripts/graphic.py --input ../assets/sprites.txt --output SPRITES.BIN --x 8 --y 8 --bpp 4 --addr e000
58+
59+
clean:
60+
rm -f *.prg *.o
61+
62+
all: bins test_keys test_levels test_runner test_tiles test_splash test_sprites
63+
64+
bins: CLASSIC.BIN CHAMP.BIN PRO.BIN FANBOOK.BIN REVENGE.BIN SPRITES.BIN TILES.BIN PALETTE.BIN CUSTOM.BIN SPLASH.BIN
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)