-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.bat
257 lines (208 loc) · 6.23 KB
/
build.bat
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
@ECHO OFF
CLS & TITLE Building Nucomer...
CD %~dp0
SET LUA="bin\lua\lua53.exe"
SET LUA_ARTICLE=%LUA% "scripts\article.lua"
SET ACME=bin\acme\acme.exe -I "src"
SET C1541="bin\vice\c1541.exe"
SET EXOMIZER="bin\exomizer\exomizer.exe"
REM # assemble BSOD64 debugger
REM ============================================================================
REM # the same BSOD64 binary is used across all issues,
REM # so no need to do this as part of the per-issue build
ECHO:
ECHO BSOD64
ECHO ----------------------------------------
PUSHD src\bsod64
REM # assemble BSOD64 into its own folder as its a sub-project
REM #
..\..\%ACME% -v1 ^
--format cbm ^
--report "..\..\build\bsod.txt" ^
-o "build\bsod64.prg" ^
"bsod64.acme"
IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
TITLE Building Nucomer...
POPD
ECHO:
REM # loop through all issues...
REM ============================================================================
REM # begin with issue number zero
SET /A ISSUE=0
:next_issue
REM ----------------------------------------------------------------------------
REM # pad issue number to two digits;
REM # this is used in filenames & paths
SET "ISSUE_ID=00%ISSUE%"
REM # take the rightmost two digits
SET "ISSUE_ID=%ISSUE_ID:~-2%"
REM # combine this into a folder name
SET "ISSUE_DIR=issue#%ISSUE_ID%"
REM # and into a path, where the issues are stored
SET "ISSUE_PATH=issues\%ISSUE_DIR%\"
REM # does such an issue exist?
IF NOT EXIST "%ISSUE_PATH%" GOTO :end
:do_issue
REM ============================================================================
REM # build an individual issue
REM #
ECHO Issue #%ISSUE_ID%
ECHO ========================================
REM # clear the build folder
DEL /F /Q build\*.* >NUL
REM # process articles in the issue
%LUA% "scripts\issue.lua" %ISSUE%
IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
REM # Process SID songs
REM ============================================================================
REM # walk through the list of songs:
REM # (begin indexing from zero)
SET /A SID=0
FOR /F "eol=* delims=* tokens=*" %%A IN (build\i%ISSUE_ID%_sids.lst) DO (
IF NOT [%%~A] == [] CALL :process_sid "%%~A"
)
ECHO ========================================
GOTO :assemble_outfit
:process_sid
REM ----------------------------------------------------------------------------
REM # generate output file name
SET "SID_ID=00%SID%"
SET "SID_ID=%SID_ID:~-2%"
SET "SID_NAME=%~n1"
REM # announce
SET "SID_TITLE= "
SET "SID_TITLE=%~n1%SID_TITLE%"
SET "SID_TITLE=%SID_TITLE:~0,36%"
<NUL (SET /P "$=%SID_TITLE%")
REM # assemble the relocated SID, sans-header
%ACME% -- "build\%SID_NAME%.acme"
REM # compress the SID program...
%EXOMIZER% raw -q ^
-o "build\%SID_NAME%.exo" ^
-- "build\%SID_NAME%.prg"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
ECHO [OK]
REM # next SID...
SET /A SID=SID+1
goto:eof
:assemble_outfit
REM # assemble the outfit
REM ============================================================================
<NUL (SET /P "$=Assemble Outfit... ")
REM # assemble fonts
REM ----------------------------------------------------------------------------
%ACME% -- "src\fonts\admiral64.acme"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
REM # assemble the ASCII maps
REM ----------------------------------------------------------------------------
%ACME% -- "src\fonts\scr_nucomer.acme"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
%ACME% -- "src\fonts\scr_reverse.acme"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
%ACME% -- "src\fonts\scr_logo.acme"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
REM # assemble the disk bootstrap
REM ----------------------------------------------------------------------------
%ACME% ^
--format cbm ^
--report "build\boot.txt" ^
--outfile "build\boot.prg" ^
"src\prg_boot.acme"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
REM # assemble the intro
REM ----------------------------------------------------------------------------
%ACME% ^
--format cbm ^
--report "build\intro.txt" ^
--outfile "build\intro.prg" ^
"src\prg_intro.acme"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
REM # compress the intro
REM ----------------------------------------------------------------------------
%EXOMIZER% sfx 0x0400 -t64 -n -q ^
-o "build\intro-exo.prg" ^
-- "build\intro.prg"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
REM # assemble the main outfit
REM ----------------------------------------------------------------------------
%ACME% ^
--format cbm ^
--report "build\nucomer.txt" ^
--outfile "build\nucomer.prg" ^
"src\prg_nucomer.acme"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
REM # assemble articles
REM ----------------------------------------------------------------------------
REM # walk through the list of articles and assemble each
FOR /F "eol=* delims=* tokens=*" %%A IN (build\issue.lst) DO (
REM # assemble the article into its binary
%ACME% "%%A"
REM # ok?
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
)
ECHO [OK]
REM # pack the outfit into a single file
REM ----------------------------------------------------------------------------
<NUL (SET /P "$=Pack Outfit... ")
REM # make a copy of the first SID song to include with the outfit
REM # program so that it doesn't need to be loaded separately
REM # (note that in this environment, we don't know the exact file-name)
COPY /Y ^
"build\i%ISSUE_ID%_s00_*.prg" /B ^
"build\i%ISSUE_ID%_s00_menu.prg" /B >NUL
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
%EXOMIZER% sfx 0x8000 -t64 -n -q ^
-o "build\nucomer-exo.prg" ^
-- "build\i%ISSUE_ID%_s00_menu.prg" ^
"build\nucomer.prg" ^
"build\admiral64.prg" ^
"src\bsod64\build\bsod64.prg"
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
ECHO [OK]
REM # package disks
REM ============================================================================
<NUL (SET /P "$=Create D64... ")
%C1541% < "build\c1541.txt" 1>NUL
IF ERRORLEVEL 1 (
ECHO FAIL
EXIT /B %ERRORLEVEL%
)
ECHO [OK]
:end
ECHO: