Build Scripts

About

Build scripts run a variety of external programs to assemble and link your program for a particular platform. When you create a new project, one or more default build scripts are created and saved in your project folder. You can then tailor them to your personal needs, or create whole new ones if the need arises.

Build scripts are attached to your project, and need to go into the Build project folder for them to appear on the build menu bar. They are, at heart, simple Windows batch scripts with the .CMD extension.

Environment variables

When you run a build script, Latenite passes information to it in the form of environment variables. These variables exist for as long as the script is running. You can access them by surrounding the name of the variable in percent (%) signs.

The environment variables are as follows:

SOURCE_PATHThe full path to the source file to build.C:\Directory\File.ext
SOURCE_FILEThe filename of the source file to build.File.ext
SOURCE_DIRThe directory of the source file to build.C:\Directory
SOURCE_FILE_EXTThe extension of the source file to build.ext
SOURCE_FILE_NOEXTThe filename of the source file to build without the extension.File
BUILD_PATHThe full path to the build script.C:\Directory\SuperPC.cmd
BUILD_FILEThe filename of the build script.SuperPC.cmd
BUILD_DIRThe directory of the build script.C:\Directory
BUILD_FILE_EXTThe extension of the build script.cmd
BUILD_FILE_NOEXTThe filename of the build script without the extension.SuperPC
COMPILE_DIRThe default directory in which Latenite stores the assemblers/linkers.C:\Latenite\Compile
ERROR_LOGExpected location of the error log when the build process is complete.C:\Latenite\Compile\Errors.xml
PROJECT_PATHThe full path to the project.C:\Directory\Super.lnp
PROJECT_FILEThe filename of the project.Super.lnp
PROJECT_DIRThe directory of the project.C:\Directory
PROJECT_NAMEThe name of the project.Super Doom 2
PROJECT_BINARYThe short name of the project.SPRDOOM2

For example, one common task would be to add the Latenite compile directory to the system's PATH variable so that you can call the various assemblers/linkers packaged with Latenite without having to swap directories a lot. The build script would have to contain a line like this:

SET PATH=%PATH%;"%COMPILE_DIR%"

Knowledge of how to create Windows/DOS batch scripts is a must!

The Bundled Tools

Latenite is pretty useless on its own - it's just a Z80 editor. The default projects and build scripts all require that there are a set of assemblers and linkers available to them. Please note that WLA-DX and TASM were not written by Ben Ryves. All the other tools are.

WLA-DX (wla-z80.exe and wlalink.exe)

These are (a small!) part of Ville Helin's excellent WLA-DX assemblers, suitable for the Z80. You can get more information and download the latest version (source) from the WLA-DX homepage.

TASM Assembler (TASM.exe and TASM80.tab)

This is a shareware copy of Thomas N. Anderson's (Squak Valley Software) TASM, the most commonly used assembler for TI's Z80 series of calculator. As it is shareware, if you intend on using it beyond an evaluation period please consider registering it through the homepage.

TASM Error Converter (TASMERR.exe)

This Latenite-specific tool converts TASM's output to an XML error log. By piping the output of TASM to the input of TASMERR you can then easily redirect the output straight to the log file like this:

TASM <args> | TASMERR > "%ERROR_LOG%"

(Where args refers to TASM's command-line arguments). Passing the optional command-line switch /o only outputs the errors and messages, not the XML header (potentially useful if you need to join multiple error logs togther, such as one from the assembler and one from the linker).

8XP Linker (8XPLink.exe)

This is a simple (but quite powerful) 8XP/83P linker. It wraps a number of COM binaries into a single 8XP/83P file. The command-line syntax is this:

8XPLINK (Binary file[,Variable name[,Variable type=6]]) <Output file> [/x [/o]] [/3]

You can specify any number of binaries to link. Each binary you wish to link needs to be added in (parentheses). For example:

8XPLINK (IN.BIN) OUT.8XPLink IN.BIN to OUT.8XP as IN.
8XPLINK (IN1.BIN) (IN2.BIN) OUT.8XGLink IN1.BIN and IN2.BIN to OUT.8XG as IN1 and IN2.
8XPLINK (IN1.BIN,PROG1) (IN2.BIN,PROG2) OUT.8XGLink IN1.BIN and IN2.BIN to OUT.8XG as PROG1 and PROG2.
8XPLINK (IN1.BIN,PROG1,5) (IN2.BIN) OUT.8XGLink IN1.BIN and IN2.BIN to OUT.8XG as PROG1 (unlocked program) and IN2.

This could be useful to, for example, link your program and an AppVar together.

Setting the switch /x makes the linker output an XML error log (using /o makes 8XP Linker only output the errors and messages, not the XML header). Setting the switch /3 outputs a TI-83 variable rather than a TI-83 Plus variable.

XML Error Log Tool (ErrLog.exe)

This very basic program is designed to help creating XML error logs. Syntax is very basic:

ERRLOG START|END

Passing in START echoes the start of an XML error log to the console. END echoes the end. It could be used like this:

ERRLOG START > "%ERROR_LOG%"
8XPLINK (IN1.BIN) OUT.8XG /x /o >> "%ERROR_LOG%"
ERRLOG END >> "%ERROR_LOG%"