-
Notifications
You must be signed in to change notification settings - Fork 0
/
!compilelink.bat
61 lines (50 loc) · 1.95 KB
/
!compilelink.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
@echo off
set rt11exe=C:\bin\rt11\rt11.exe
set pclink11=C:\bin\pclink11.exe
rem Define ESCchar to use in ANSI escape sequences
rem https://stackoverflow.com/questions/2048509/how-to-echo-with-different-colors-in-the-windows-command-line
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "ESCchar=%%E"
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "DATESTAMP=%YYYY%-%MM%-%DD%"
for /f %%i in ('git rev-list HEAD --count') do (set REVISION=%%i)
echo Rev.%REVISION% %DATESTAMP%
echo VERSTR: .ASCIZ "Rev.%REVISION% %DATESTAMP%" > VERSIO.MAC
@if exist DESOLA.LST del DESOLA.LST
@if exist DESOLA.OBJ del DESOLA.OBJ
%rt11exe% MACRO/LIST:DK: DESOLA.MAC
for /f "delims=" %%a in ('findstr /B "Errors detected" DESOLA.LST') do set "errdet=%%a"
if "%errdet%"=="Errors detected: 0" (
echo COMPILED SUCCESSFULLY
) ELSE (
findstr /RC:"^[ABDEILMNOPQRTUZ] " DESOLA.LST
echo ======= %errdet% =======
exit /b
)
@if exist DESOLA.MAP del DESOLA.MAP
@if exist DESOLA.SAV del DESOLA.SAV
@if exist DESOLA-11.MAP del DESOLA-11.MAP
@if exist DESOLA-11.SAV del DESOLA-11.SAV
%rt11exe% LINK DESOLA /MAP:DESOLA.MAP
@if exist DESOLA.MAP rename DESOLA.MAP DESOLA-11.MAP
@if exist DESOLA.SAV rename DESOLA.SAV DESOLA-11.SAV
%pclink11% DESOLA.OBJ /MAP > pclink11.log
fc.exe /b DESOLA-11.SAV DESOLA.SAV > fc.log
for /f "delims=" %%a in ('findstr /B "FC: " fc.log') do set "fcdiff=%%a"
if "%fcdiff%"=="FC: no differences encountered" (
echo SAV FILES ARE EQUAL
del fc.log
echo.
) ELSE (
echo %ESCchar%[91m======= SAV FILES ARE DIFFERENT, see fc.log =======%ESCchar%[0m
exit /b
)
for /f "delims=" %%a in ('findstr /B "Undefined globals" DESOLA.MAP') do set "undefg=%%a"
if "%undefg%"=="" (
type DESOLA.MAP
echo.
echo %ESCchar%[92mLINKED SUCCESSFULLY%ESCchar%[0m
) ELSE (
echo %ESCchar%[91m======= LINK FAILED =======%ESCchar%[0m
exit /b
)