forked from batari-Basic/batari-Basic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2600bas.native.bat
More file actions
executable file
·80 lines (62 loc) · 1.88 KB
/
2600bas.native.bat
File metadata and controls
executable file
·80 lines (62 loc) · 1.88 KB
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
@echo off
REM 2600basic compilation script (Native Windows executables)
setlocal
if X"%bB%"==X goto nobasic
echo Using bB=%bB%
REM --- Display tool versions ---
for /F "delims=" %%v in ('"%bB%\2600basic.exe" -v 2^>nul') do set BASVER=%%v
echo basic version: %BASVER%
for /F "delims=" %%v in ('"%bB%\dasm.exe" 2^>nul') do set DASMVER=%%v & goto dasmgotver
:dasmgotver
echo dasm version: %DASMVER%
REM --- Source file check ---
if "%~1"=="" (
echo ### ERROR: No source file specified.
exit /b 1
)
if /i "%~1"=="-v" (
REM Just version check
exit /b 0
)
set srcfile=%~nx1
set srcbase=%~n1
set srcdir=%~dp1
if "%srcdir:~-1%"=="\" set srcdir=%srcdir:~0,-1%
echo.
echo Starting build of %srcfile%
REM --- Preprocess and Compile ---
"%bB%\preprocess.exe" <"%~f1" | "%bB%\2600basic.exe" -i "%bB%" > bB.asm
if errorlevel 1 goto basicerror
REM --- Postprocess / Optimize ---
if /I "%2"=="-O" (
"%bB%\postprocess.exe" -i "%bB%" ^
| "%bB%\optimize.exe" > "%~1.asm"
) else (
"%bB%\postprocess.exe" -i "%bB%" > "%~1.asm"
)
REM --- Assemble final binary ---
"%bB%\dasm.exe" "%~1.asm" -I. -I"%bB%\includes" -f3 -p20 -l"%~1.lst" -s"%~1.sym" -o"%~1.bin" | "%bB%\bbfilter.exe"
REM --- Create an ACE file if the binary is DPC+ ---
"%bB%\relocateBB.exe" "%~nx1.bin"
REM --- Create a .elf file to flash PXE games to Chameleon Cart
if not defined PXE_VENDOR_UUID (
for /F "delims=" %%A IN ('powershell -command [guid]::NewGuid(^).ToString(^)') DO (
SET "PXE_VENDOR_UUID=%%A"
)
)
FOR /F "delims=" %%A IN ('powershell -command [guid]::NewGuid(^).ToString(^)') DO (
SET "GameGuid=%%A"
)
"%bB%\pxebin2ccelf.exe" "%~nx1.bin" "%bB%\includes\PXE_CC_pre.arm" "%bB%\includes\PXE_CC_post.arm" "%PXE_VENDOR_UUID%" "%GameGuid%"
goto end
:basicerror
echo.
echo ### ERROR: 2600basic compilation failed.
exit /b 1
:nobasic
echo.
echo ### ERROR: bB not defined.
exit /b 1
:end
endlocal
exit /b 0