forked from neiderm/arcade
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
executable file
·145 lines (114 loc) · 3.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Top-level Makefile.
#
# Running "make" builds the code, generates ROM files and runs mame ($MAMED).
#
# All binary file generation is done by srec_cat, which has lots of tricks...
# including the generation and placment of the proper checksum in each chip image!
#
# Select configuration, these are the two I use:
#
ARCH := $(shell uname -s)
ifeq ($(ARCH), Linux)
# MAME 0.79, *nix ... srec_cat, asxxxx, xmame binaries in /usr/local/bin
MAMED= xmamed.x11
MAMED= xmame.x11
MAMEOPTS= -debug -skip_gameinfo -rompath .
MAMEOPTS= -skip_gameinfo -rompath .
# MAMEOPTS+= -window -nomaximize
GAMENAME= galaga
else
# MAME 0.136, Windows
MAMED= /cygdrive/c/home/myjunk/mame0136/mamed.exe
MAMEOPTS= -debug -skip_gameinfo -rompath .
MAMEOPTS+= -window -nomaximize
GAMENAME= galagao
endif
OBJC= srec_cat
RM= rm -f
##############
# ROM Info
ROM0IHX= ga0.ihx
ROM1IHX= ga1.ihx
ROM2IHX= ga2.ihx
ROM0SIZE= 16384
ROM1SIZE= 4096
ROM2SIZE= 4096
OFDIR= ./$(GAMENAME)
ifeq ($(GAMENAME), galaga)
# These are for xmame(0.36), xmame(0.79)
R1_1= $(OFDIR)/04m_g01.bin
R1_2= $(OFDIR)/04k_g02.bin
R1_3= $(OFDIR)/04j_g03.bin
R1_4= $(OFDIR)/04h_g04.bin
R2_1= $(OFDIR)/04e_g05.bin
R3_1= $(OFDIR)/04d_g06.bin
else
# These are for xmame(0.136)
R1_1= $(OFDIR)/gg1-1.3p
R1_2= $(OFDIR)/gg1-2.3m
R1_3= $(OFDIR)/gg1-3.2m
R1_4= $(OFDIR)/gg1-4.2l
R2_1= $(OFDIR)/gg1-5.3f
R3_1= $(OFDIR)/gg1-7.2c
endif
ROMS= $(R1_1) $(R1_2) $(R1_3) $(R1_4) $(R2_1) $(R3_1)
all: test
SREC_ARGS= -intel -fill 0xff 0x0
SREC_CKSUM_LENEG= -checksum-neg-l-e
SREC_CKSUM_BTNOT= -checksum-bitnot-l-e
# note: negative sign on offsets is intentional.
# $< when you have only a single dependency
# $@ is the name of the target.
#
# TODO: mkdir $(OFDIR) target
#
$(R1_1): $(ROM0IHX)
$(OBJC) $< $(SREC_ARGS) $(ROM0SIZE) -crop 0x0000 0x0FFF -offset -0x0000 $(SREC_CKSUM_LENEG) 0x0FFF 1 1 -o $@ -Binary
$(R1_2): $(ROM0IHX)
$(OBJC) $< $(SREC_ARGS) $(ROM0SIZE) -crop 0x1000 0x1FFF -offset -0x1000 $(SREC_CKSUM_LENEG) 0x0FFF 1 1 -o $@ -Binary
$(R1_3): $(ROM0IHX)
$(OBJC) $< $(SREC_ARGS) $(ROM0SIZE) -crop 0x2000 0x2FFF -offset -0x2000 $(SREC_CKSUM_LENEG) 0x0FFF 1 1 -o $@ -Binary
$(R1_4): $(ROM0IHX)
$(OBJC) $< $(SREC_ARGS) $(ROM0SIZE) -crop 0x3000 0x3FFF -offset -0x3000 $(SREC_CKSUM_LENEG) 0x0FFF 1 1 -o $@ -Binary
$(R2_1): $(ROM1IHX)
$(OBJC) $< $(SREC_ARGS) $(ROM1SIZE) -crop 0x0000 0x0FFF -offset -0x0000 $(SREC_CKSUM_BTNOT) 0x0FFF 1 1 -o $@ -Binary
$(R3_1): $(ROM2IHX)
$(OBJC) $< $(SREC_ARGS) $(ROM2SIZE) -crop 0x0000 0x0FFF -offset -0x0000 $(SREC_CKSUM_BTNOT) 0x0FFF 1 1 -o $@ -Binary
# Using .BANK directive to separate code space of cpus, which causes
# type 04 "Extended Linear Address" record to be emitted in sub and sub2.
# srec_cat does not agree with aslink as to the format of this record, so I
# discard it. (TODO: try fake base e.g. BASE=0x010000 etc.)
# http://srecord.sourceforge.net/man/man5/srec_intel.html
# Main CPU hex file does not contain type 04 so just do a straight cp
$(ROM0IHX):
cd rom0 ; make
cp rom0/ga0.i86 $@
$(ROM1IHX):
cd rom0 ; make
cat rom0/ga0_sub.i86 | sed /:00000004FC/d > $@
$(ROM2IHX):
cd rom0 ; make
cat rom0/ga0_sub2.i86 | sed /:00000004FC/d > $@
mkrom: $(ROMS)
##############
# test
#
test: mkrom
$(MAMED) $(MAMEOPTS) \
$(GAMENAME)
##############
# ident
#
ident: mkrom
@-echo "Running mame -ident..."
$(MAMED) -rompath . -romident $(GAMENAME) | sed -n /NO\ MATCH/p
##############
# clean
#
cleanroms:
$(RM) $(ROMS)
clean: cleanroms
$(RM) -f *\.ihx
cd rom0 ; make clean
distclean: clean
cd rom0 ; make distclean