Skip to content

Commit fc3a5e4

Browse files
authored
Merge pull request #2 from johnoneil/master
Updated examples and additional housekeeping
2 parents d6d3480 + e2dfabe commit fc3a5e4

31 files changed

Lines changed: 4290 additions & 373 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.o
22
*.nes
3+
example*.s

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "cc65"]
2+
path = cc65
3+
url = https://github.com/cc65/cc65.git

Makefile

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,63 @@
1-
.PHONY: clean all
2-
3-
.PRECIOUS: *.o
4-
5-
all: example1.nes example2.nes example3.nes example4.nes example5.nes
6-
7-
clean:
8-
@rm -fv example1.s example2.s example3.s example4.s example5.s
9-
@rm -fv example1.o example2.o example3.o example4.o example5.o
10-
@rm -fv example1.nes example2.nes example3.nes example4.nes example5.nes
11-
@rm -fv crt0.o
12-
13-
crt0.o: crt0.s
14-
ca65 crt0.s
15-
16-
%.o: %.c
17-
cc65 -Oi $< --add-source
18-
ca65 $*.s
19-
rm $*.s
20-
21-
%.nes: %.o crt0.o
22-
ld65 -C nes.cfg -o $@ crt0.o $< nes.lib
1+
2+
#CC65_DIR := cc65-nes-2.13.3-1
3+
CC65_DIR := cc65
4+
5+
CC := $(CC65_DIR)/bin/cc65
6+
CA := $(CC65_DIR)/bin/ca65
7+
LD := $(CC65_DIR)/bin/ld65
8+
9+
TARGET_PLATFORM := nes
10+
11+
TARGETS := example1.nes
12+
TARGETS += example2.nes
13+
TARGETS += example3.nes
14+
TARGETS += example4.nes
15+
TARGETS += example5.nes
16+
TARGETS += example6.nes
17+
TARGETS += example7.nes
18+
TARGETS += example8.nes
19+
TARGETS += example9.nes
20+
TARGETS += example10.nes
21+
TARGETS += example11.nes
22+
23+
EMULATOR ?= higan
24+
25+
EXAMPLES := $(TARGETS:..nes=)
26+
OBJECTS := $(TARGETS:.nes=.o)
27+
ASSEMBLY_SOURCES := $(TARGETS:.nes=.s)
28+
C_SOURCES := $(TARGETS:.nes=.c)
29+
30+
.PHONY: all
31+
32+
# Disable builtin rules (for .c, .o) by providing an empty .SUFFIXES rule
33+
# Yes. GNU make is a rat's nest
34+
.SUFFIXES:
35+
36+
# Make sure intermediate files are *NOT* deleted
37+
# Yes. GNU make is a rat's nest
38+
.PRECIOUS: %.s %.o
39+
40+
all: $(CC) $(TARGETS)
41+
42+
# submodule build
43+
$(CC):
44+
cd $(CC65_DIR) && $(MAKE)
45+
46+
%: %.nes
47+
$(EMULATOR) $<
48+
49+
clean:
50+
@rm -fv $(TARGETS)
51+
@rm -fv $(OBJECTS)
52+
@rm -fv $(ASSEMBLY_SOURCES)
53+
@rm -fv crt0.o
54+
55+
%.s: %.c
56+
$(CC) -Oi $< --target $(TARGET_PLATFORM) -I$(CC65_DIR)/include/ --add-source
57+
58+
%.o: %.s
59+
$(CA) $<
60+
61+
%.nes: %.o crt0.o
62+
$(LD) -C nrom_128_horz.cfg -o $@ $^ $(TARGET_PLATFORM).lib
63+

bgsplit_nam.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const unsigned char bgsplit_nam[267]={
2+
0x01,0x00,0x01,0xa3,0x40,0x01,0x06,0x00,0x40,0x01,0x06,0x00,0x40,0x01,0x06,0x00,
3+
0x01,0x08,0x40,0x01,0x06,0x00,0x40,0x01,0x02,0x00,0x40,0x01,0x02,0x00,0x40,0x01,
4+
0x02,0x00,0x40,0x01,0x02,0x00,0x01,0x0a,0x40,0x01,0x02,0x00,0x01,0x02,0x40,0x01,
5+
0x02,0x00,0x40,0x01,0x02,0x00,0x40,0x01,0x02,0x00,0x40,0x01,0x02,0x00,0x01,0x0a,
6+
0x40,0x01,0x02,0x00,0x01,0x02,0x40,0x01,0x02,0x00,0x40,0x01,0x02,0x00,0x40,0x01,
7+
0x06,0x00,0x01,0x0a,0x40,0x01,0x02,0x00,0x01,0x02,0x40,0x01,0x06,0x00,0x40,0x01,
8+
0x06,0x00,0x01,0x0a,0x40,0x01,0x02,0x00,0x01,0x02,0x40,0x01,0x06,0x00,0x40,0x01,
9+
0x02,0x00,0x01,0x68,0x42,0x01,0x1f,0x00,0x01,0x62,0x40,0x00,0x01,0x06,0x40,0x00,
10+
0x01,0x02,0x40,0x00,0x01,0x12,0x40,0x00,0x01,0x06,0x40,0x00,0x01,0x02,0x40,0x00,
11+
0x01,0x12,0x40,0x01,0x02,0x00,0x40,0x01,0x02,0x00,0x40,0x40,0x00,0x00,0x40,0x40,
12+
0x00,0x00,0x40,0x01,0x02,0x00,0x40,0x01,0x04,0x00,0x01,0x06,0x40,0x00,0x40,0x00,
13+
0x40,0x00,0x40,0x00,0x40,0x00,0x01,0x02,0x40,0x00,0x01,0x02,0x40,0x00,0x40,0x00,
14+
0x40,0x00,0x40,0x00,0x40,0x00,0x01,0x06,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,
15+
0x40,0x00,0x01,0x02,0x40,0x00,0x01,0x02,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,
16+
0x40,0x00,0x01,0x06,0x40,0x01,0x02,0x00,0x40,0x01,0x02,0x00,0x40,0x01,0x02,0x00,
17+
0x40,0x01,0x02,0x00,0x40,0x01,0x02,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x01,0xdb,
18+
0x50,0x01,0x07,0xaa,0x01,0x17,0x0a,0x01,0x07,0x01,0x00
19+
};

cc65

Submodule cc65 added at 4a22487

0 commit comments

Comments
 (0)