Add build batch files and some documentation about the build process

So yeah, that'll be our build environment - just plain batch files calling the
Borland command-line assembler, linker, and eventually C compiler. These are
the exact tools that ZUN used as well. There certainly are other assemblers,
compilers and linkers that could compile this code into 16-bit DOS
executables; Open Watcom is the only free one I know, and the master.lib
manual also mentions C compilers by Microsoft and Symantec. However, I favor
having one clear build path for a single toolchain that will, with the correct
command-line switches for each game, create builds that are bit-perfect to
ZUN's original ones over the possibility of cross-platform builds and the
maintenance nightmare they add.
So, Borland-only it is.

(Also, no Makefile, due to our messy build setup. I think I still prefer this
solution though, as we can have these really nice error messages that double
as build instructions without any dependencies on installed software.)
This commit is contained in:
nmlgc 2015-02-15 23:32:32 +01:00
parent 5268241a06
commit ff94dce594
4 changed files with 105 additions and 3 deletions

2
build.bat Normal file
View File

@ -0,0 +1,2 @@
@call BUILD32B.BAT
@call BUILD16B.BAT

47
build16b.bat Normal file
View File

@ -0,0 +1,47 @@
@echo off
echo Running the second, 16-bit part of the ReC98 build process.
echo If this fails or shows other weird behavior, run BUILD16B separately in DOSBox.
REM (Yes, we don't use %0%, as it actually has to be %0 on DOS. Just spelling
REM out the name saves us that trouble.)
set ReC98_LINK=tlink
%ReC98_LINK% 1>NUL 2>NUL
if errorlevel 9009 goto no_tlink
if errorlevel 216 goto 64_bit
%ReC98_LINK% /t bin\th01\zunsoft.obj
%ReC98_LINK% bin\th01\op.obj
%ReC98_LINK% bin\th01\reiiden.obj
%ReC98_LINK% bin\th01\fuuin.obj
%ReC98_LINK% /t bin\th02\zuninit.obj
%ReC98_LINK% /t bin\th02\zun_res.obj
%ReC98_LINK% bin\th02\op.obj
%ReC98_LINK% bin\th02\main.obj
%ReC98_LINK% bin\th02\maine.obj
%ReC98_LINK% /t /3 bin\th03\zunsp.obj
%ReC98_LINK% /t bin\th03\res_yume.obj
%ReC98_LINK% bin\th03\op.obj
%ReC98_LINK% bin\th03\main.obj
%ReC98_LINK% bin\th03\mainl.obj
%ReC98_LINK% /t bin\th04\res_huma.obj
%ReC98_LINK% bin\th04\op.obj
%ReC98_LINK% bin\th04\main.obj
%ReC98_LINK% bin\th04\maine.obj
%ReC98_LINK% /t bin\th05\res_kso.obj
%ReC98_LINK% bin\th05\op.obj
%ReC98_LINK% bin\th05\main.obj
%ReC98_LINK% bin\th05\maine.obj
echo Done. Find the executables in the bin\ subdirectory.
goto eof
:64_bit
echo You're running a 64-bit OS. Run BUILD16B.BAT separately in DOSBox instead.
goto eof
:no_tlink
echo Could not find TLINK.
echo Please make sure that the BIN directory of Turbo C++ 4.0J is in your PATH.
goto eof
:eof

45
build32b.bat Normal file
View File

@ -0,0 +1,45 @@
@echo off
echo Running the first, 32-bit part of the ReC98 build process.
set ReC98_ASM=tasm32 /m /kh32768 /t /ilibs\BorlandC\ /ilibs\master.lib\
for /L %%i in (1,1,5) do mkdir bin\th0%%i 2>NUL
%ReC98_ASM% 1>NUL 2>NUL
if errorlevel 9009 goto no_tasm32
%ReC98_ASM% th01_zunsoft.asm bin\th01\zunsoft.obj
%ReC98_ASM% th01_op.asm bin\th01\op.obj
%ReC98_ASM% th01_reiiden.asm bin\th01\reiiden.obj
%ReC98_ASM% th01_fuuin.asm bin\th01\fuuin.obj
%ReC98_ASM% th02_zuninit.asm bin\th02\zuninit.obj
%ReC98_ASM% th02_zun_res.asm bin\th02\zun_res.obj
%ReC98_ASM% th02_op.asm bin\th02\op.obj
%ReC98_ASM% th02_main.asm bin\th02\main.obj
%ReC98_ASM% th02_maine.asm bin\th02\maine.obj
%ReC98_ASM% th03_zunsp.asm bin\th03\zunsp.obj
%ReC98_ASM% th03_res_yume.asm bin\th03\res_yume.obj
%ReC98_ASM% th03_op.asm bin\th03\op.obj
%ReC98_ASM% th03_main.asm bin\th03\main.obj
%ReC98_ASM% th03_mainl.asm bin\th03\mainl.obj
%ReC98_ASM% th04_res_huma.asm bin\th04\res_huma.obj
%ReC98_ASM% th04_op.asm bin\th04\op.obj
%ReC98_ASM% th04_main.asm bin\th04\main.obj
%ReC98_ASM% th04_maine.asm bin\th04\maine.obj
%ReC98_ASM% th05_res_kso.asm bin\th05\res_kso.obj
%ReC98_ASM% th05_op.asm bin\th05\op.obj
%ReC98_ASM% th05_main.asm bin\th05\main.obj
%ReC98_ASM% th05_maine.asm bin\th05\maine.obj
goto eof
:no_tasm32
echo Could not find TASM32.
echo Please make sure that the BIN directory of Turbo Assembler 5.0 is in your PATH.
goto eof
:eof
echo --------------------------------------------------------------------------------

View File

@ -82,8 +82,16 @@ Do whatever else is necessary to easily modify the game elements people like to
Since this will most likely result in graphics mods that exceed the specifications of PC-98 hardware, there will also be an optional filter to reduce the rendered output to the original resolution of 640x400 and a 16-color palette, for the sake of keeping the original spirit.
## Building
Currently, this code is only known to build with Borland's *Turbo Assembler* (TASM) and *Turbo Linker* (TLINK), Version 5.0 or later. Due to the large size of the initial assembly dumps, the 32-bit version of TASM (`tasm32`) is necessary to assemble them. However, TLINK32 does *not* support 16-bit DOS targets, so the 16-bit version of TLINK is needed for linking.
You will need:
To sum up: Compile the .asm files with ```tasm32 /kh32768 /m /zn``` (on 32-bit/Windows), and link the resulting .obj files with ```tlink``` (on 16-bit/DOS).
* Borland Turbo C++ 4.0J
* Borland Turbo Assembler (TASM), version 5.0 or later, in a 32-bit version (`TASM32.EXE`)
* [DOSBox](http://dosbox.com) if you're running a 64-bit version of Windows, or a non-Windows operating system
Please let us know if there are any other build systems we can use instead!
The Borland tools are the only ones that will, with the correct command-line switches for each game, deterministically compile this source code to executables that are bit-perfect to ZUN's original ones. Hence, they are the only supported build tools during all of the reconstruction phase.
To build, simply run `build.bat` and follow the instructions.
Since I, unfortunately, decided earlier in development to freely use long file names that don't need to conform to the 8.3 convention, the first part of the building process (`build32b.bat`) must be run in Windows (or Wine). This will be fixed as development goes along.
The final executables will be put into `bin\th0?`, using the same names as the originals.