Skip to content

Commit

Permalink
Create windows and unix build scripts (#216)
Browse files Browse the repository at this point in the history
* Create simple windows and unix build scripts

* Get build version info from git

* Update readme

- Better explain the spasm situation.
- Replace build commands with references to the build scripts.

* Make build.bat more normie-friendly

* Handle spaces in version string

Not that there should be any.

* Indicate dirty build with "*"

* Use build script for Travis CI

No idea if this works. Travis CI seems to already be defunct.

* Quote variable paths

* Echo more of the build steps

* Forward extra build arguments to assembler

* Fall back to a hard-coded version definition

* Make it possible to override version from git

* Explicitly specify commit hash length
  • Loading branch information
runer112 authored Jul 30, 2024
1 parent d062c4b commit 498da0c
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 16 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ script:
- make NO_APPSIGN=1 -j2
- cp ./spasm ../spasm
- cd ..
- ./spasm -E -A launcher.asm TIBOYCE.8xp
- ./spasm -E -A tiboyce.asm TIBoyDat.8xv
- ./spasm -E -A skin.asm TIBoySkn.8xv
- ./build.sh
- cd tiboyce-romgen
- gcc -std=c99 -O2 -W -Wall -Wextra -Wno-pointer-sign -Wno-unused-parameter -o romgen romgen.c zip.c
- cd ../tiboyce-convertsav
Expand Down
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,11 @@ If you get a missing DLL error when running the command-line utility, you may ne

## Build Instructions

To build the emulator from source, first grab the latest release of [SPASM-ng](https://github.com/alberthdev/spasm-ng/releases).
To build the emulator:
1. Obtain [SPASM-ng](https://github.com/alberthdev/spasm-ng). Commit [5f0786d](https://github.com/alberthdev/spasm-ng/commit/5f0786d38f064835be674d4b7df42969967bb73c) is required to build TI-Boy CE successfully. As of July 22 2024, there is no official release containing this commit; see https://github.com/alberthdev/spasm-ng/issues/88.
2. Name the SPASM-ng executable "spasm" and place it in the repo root directory or somewhere in the executable search path.
3. From the repo root directory, run `build.bat` if on Windows or `build.sh` if on some other OS.

A build newer than SPASM-ng v0.5-beta.3 is required to build TI-Boy CE properly; currently, there is not a release corresponding to that so you must build it yourself.

For simplicity's sake, I'll call the name of the executable `spasm` below. Run the following to produce the emulator files:
```
spasm -E -A launcher.asm TIBOYCE.8xp
spasm -E -A tiboyce.asm TIBoyDat.8xv
spasm -E -A skin.asm TIBoySkn.8xv
```
To build the rom generation tool, use the provided Visual Studio solution in the [tiboyce-romgen](tiboyce-romgen) directory, or use the Makefile to build with GCC or your C compiler of choice.

The same applies to the save converter in the [tiboyce-convertsav](tiboyce-convertsav) directory.
Expand Down
26 changes: 26 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off
set exit_timeout=-1
@echo on

set version_arg=
for /f %%i in ('git describe --tags "--dirty=*" "--abbrev=7"') do set "version_arg="-DVERSION=\"%%i\"""
set "as=spasm -E -T -L -A"
set "build=build"

if not exist "%build%" mkdir "%build%"

%as% %version_arg% %* tiboyce.asm "%build%/TIBoyDat.8xv" || goto exit
%as% %* launcher.asm "%build%/TIBOYCE.8xp" || goto exit
%as% %* skin.asm "%build%/TIBoySkn.8xv" || goto exit

@echo off
echo.
echo Success!
set exit_timeout=5

:exit
@echo off
@REM Pause if not run from cmd so the window persists and the user can see the output.
@REM https://superuser.com/a/1688485
if /i not "%CMDCMDLINE:"=%" == "%COMSPEC%" timeout /t %exit_timeout%
exit /b
13 changes: 13 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -x

version_arg="-DVERSION=\"$(git describe --tags --dirty=* --abbrev=7)\"" || unset version_arg
set -e
as="spasm -E -T -L -A"
build="build"

mkdir -p "$build"

$as ${version_arg+"$version_arg"} "$@" tiboyce.asm "$build/TIBoyDat.8xv"
$as "$@" launcher.asm "$build/TIBOYCE.8xp"
$as "$@" skin.asm "$build/TIBoySkn.8xv"
9 changes: 7 additions & 2 deletions menu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1395,8 +1395,13 @@ MenuTemplate:
MainMenu:
.db 10

.db 5,8
.db "TI-Boy CE Alpha v0.3.0\nhttps://calc84maniac.github.io/tiboyce",0
VersionLengthBegin:
.db VERSION
VersionLength = $ - VersionLengthBegin
.seek VersionLengthBegin
.org VersionLengthBegin
.db 5, 11 - (VersionLength / 2)
.db "TI-Boy CE Alpha ",VERSION,"\nhttps://calc84maniac.github.io/tiboyce",0

.db "Select to load the game state from the\ncurrent slot for this game.\nPress left/right to change the slot.",0
.db ITEM_DIGIT | ITEM_ROMONLY
Expand Down
5 changes: 5 additions & 0 deletions tiboyce.asm
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#ifndef VERSION
; "*" indicates a potentially modified, or "dirty" in Git terminology, version.
#define VERSION "v0.3.0*"
#endif

#ifdef FASTLOG
#define FASTLOG_EVENT_RUNTIME_ERROR $DE
#define FASTLOG_EVENT_INVALID_OPCODE $AD
Expand Down

0 comments on commit 498da0c

Please sign in to comment.