-
Notifications
You must be signed in to change notification settings - Fork 2
/
ass.bat
85 lines (74 loc) · 2.29 KB
/
ass.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
:: Script to assemble a file in ca65 assembler cource into an executable
:: Automatically adds a BASIC execution stub, unless there is already code for a stub
:: in the program or a different target address is given
@echo off
set TARGET=c64
set LIBNAME=LAMAlib.lib
set ASMDEF=
set VERBOSE=
if "%1"=="" (
echo Usage: %0 [-128^|20] asmfile [startaddr]
echo Calls the cl65 assembler and linker and creates an executable .PRG for C64, unless -128 or -20 are specified, then result is for C128 or VIC20
exit /b
)
:check_options
if "%1"=="-v" (
set VERBOSE=1
shift
goto check_options
)
if "%1"=="-d" (
set ASMDEF=--asm-define %2
shift
shift
goto check_options
)
if "%~1"=="-128" goto do128
if /i "%~1" neq "-c128" goto not128
:do128
set TARGET=c128
set LIBNAME=LAMAlib128.lib
shift
goto check_options
:not128
if "%~1"=="-64" goto do64
if /i "%~1" neq "-c64" goto not64
:do64
set TARGET=c64
shift
goto check_options
:not64
if "%~1"=="-20" goto do20
if /i "%~1"=="-vic20" goto do20
if /i "%~1" neq "-vc20" goto not20
:do20
set TARGET=vic20
set LIBNAME=LAMAlib20.lib
shift
goto check_options
:not20
if "%2"=="" (
echo assembling %1 for target %TARGET%...
>nul findstr /c:"makesys" %1 && (
@echo on
if "%VERBOSE%"=="1" (
echo cl65 -t %TARGET% %ASMDEF% "%1" -lib %LIBNAME% -C %TARGET%-basicfriendly-asm.cfg -Ln "labels.txt" -o "%~n1.prg"
)
cl65 -t %TARGET% %ASMDEF% "%1" -lib %LIBNAME% -C %TARGET%-basicfriendly-asm.cfg -Ln "labels.txt" -o "%~n1.prg"
) || (
@echo on
if "%VERBOSE%"=="1" (
echo cl65 -t %TARGET% %ASMDEF% "%1" -lib %LIBNAME% -C %TARGET%-basicfriendly-asm.cfg -Ln "labels.txt" -u __EXEHDR__ -o "%~n1.prg"
)
cl65 -t %TARGET% %ASMDEF% "%1" -lib %LIBNAME% -C %TARGET%-basicfriendly-asm.cfg -Ln "labels.txt" -u __EXEHDR__ -o "%~n1.prg"
)
) else (
echo assembling %1 to start address %2 for target %TARGET%...
@echo on
if "%VERBOSE%"=="1" (
echo cl65 -t %TARGET% %ASMDEF% "%1" -lib %LIBNAME% -C %TARGET%-basicfriendly-asm.cfg -Ln "labels.txt" --start-addr %2 -o "%~n1.prg"
)
cl65 -t %TARGET% %ASMDEF% "%1" -lib %LIBNAME% -C %TARGET%-basicfriendly-asm.cfg -Ln "labels.txt" --start-addr %2 -o "%~n1.prg"
)
@echo done.
@exit /B %ERRORLEVEL%