-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
106 lines (80 loc) · 3.22 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
River-Raid.scl: River-Raid.trd
trd2scl River-Raid.trd River-Raid.scl
# The compressed screen is created by Laser Compact v5.2
# and cannot be generated at the build time
# see https://spectrumcomputing.co.uk/?cat=96&id=21446
River-Raid.trd: boot.$$B hob/screenz.$$C data.$$C
# Create a temporary file first in order to make sure the target file
# gets created only after the entire job has succeeded
$(eval TMPFILE=$(shell mktemp))
createtrd $(TMPFILE)
hobeta2trd boot.\$$B $(TMPFILE)
hobeta2trd hob/screenz.\$$C $(TMPFILE)
hobeta2trd data.\$$C $(TMPFILE)
# Write the correct length to the first file (offset 13)
# The length is 1 (boot) + 7 (loading screen) + 66 (data) = 74
# Got to use the the octal notation since it's the only format of binary data POSIX printf understands
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html#tag_20_94_13
printf '\112' | dd of=$(TMPFILE) bs=1 seek=13 conv=notrunc status=none
# Remove two other files (fill 2×16 bytes starting offset 16 with zeroes)
dd if=/dev/zero of=$(TMPFILE) bs=1 seek=16 count=32 conv=notrunc status=none
# Rename the temporary file to target name
mv $(TMPFILE) River-Raid.trd
boot.$$B: boot.000
0tohob boot.000
boot.000: boot.tap
tapto0 -f boot.tap
boot.tap: boot.bas
bas2tap -sboot -a10 boot.bas boot.tap
boot.bas: src/boot.bas loader.bin
# Replace the __LOADER__ placeholder with the machine codes with bytes represented as {XX}
sed "s/__LOADER__/$(shell hexdump -e '1/1 "{%02x}"' loader.bin)/" src/boot.bas > boot.bas
loader.bin: src/loader.asm
pasmo --bin src/loader.asm loader.bin
data.$$C: data.000
0tohob data.000
data.000: data.bin
rm -f data.000
binto0 data.bin 3
data.bin: src/depacker.asm buffer.zx7 LERN.patched.zx7 Prog.patched.zx7
pasmo --bin src/depacker.asm data.bin
controls.bin: src/controls.asm
pasmo --bin src/controls.asm controls.bin
buffer.zx7: buffer.cod
zx7 buffer.cod buffer.zx7
buffer.cod: buffer.000
0tobin buffer.000
LERN.patched.zx7: LERN.patched.cod
zx7 LERN.patched.cod LERN.patched.zx7
LERN.patched.cod: LERN.cod
sed "s/FASTER......2/FASTER......Q/; s/SLOWER......W/SLOWER......A/g" LERN.cod > LERN.patched.cod
LERN.cod: LERN.000
0tobin LERN.000
Prog.patched.bas: Prog.bas controls.bin
cp Prog.bas Prog.patched.bas
# The output offset is the relative offset of the start memory address being patched to the start address of the file:
# 0x607A (see src/controls.asm) - 0x5CCB (where PROG points) = 0x3AF (or 943 decimal)
dd if=controls.bin of=Prog.patched.bas obs=1 seek=943 conv=notrunc
Prog.patched.zx7: Prog.patched.bas
zx7 Prog.patched.bas Prog.patched.zx7
Prog.bas: Prog.000
0tobin Prog.000
buffer.000 LERN.000 Prog.000: River\ Raid\ (1984)(Activision)[a].tap
tapto0 -f "River Raid (1984)(Activision)[a].tap"
River\ Raid\ (1984)(Activision)[a].tap: River\ Raid\ (1984)(Activision)[a].tzx
tzx2tap "River Raid (1984)(Activision)[a].tzx"
River\ Raid\ (1984)(Activision)[a].tzx:
# The disctribution of the image is denied on WoS (http://www.worldofspectrum.org/infoseekid.cgi?id=0004154),
wget https://zxaaa.net/DENIED/River%20Raid%20%281984%29%28Activision%29.tzx -O "River Raid (1984)(Activision)[a].tzx"
clean:
rm -f \
*.000 \
*.\$$B \
*.\$$C \
*.bas \
*.bin \
*.cod \
*.tap \
*.trd \
*.tzx \
*.zx7