Skip to content

Commit

Permalink
Added build script
Browse files Browse the repository at this point in the history
  • Loading branch information
xeleh committed Feb 13, 2022
1 parent 13f1285 commit 77d8def
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Demoscene-ish tiny intros and other sizecoding experiments.

Assemble with [nasm](https://www.nasm.us/).
Assemble with [nasm](https://www.nasm.us/) or use the provided `build.sh` bash script.
29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# $1 : name of the folder to build
# Make sure that nasm is on the PATH!

# fail if no folder name is specified
if [[ "$#" -eq 0 ]] ; then
exit 1
fi

# try to find the main .asm file
file="$1"
[ ! -f "$1/$file.asm" ] && file="main"
[ ! -f "$1/$file.asm" ] && file="test"
[ ! -f "$1/$file.asm" ] && exit 1

# assemble it
if command -v nasm &> /dev/null ; then
nasm -w+error -f bin -o "$1/$file.com" "$1/$file.asm" || exit 1
else
echo "nasm not on path?"
exit 1
fi

# show .com file size
if [[ -f "$1/$file.com" ]] ; then
size=$(stat -f%z "$1/$file.com")
echo "$1/$file.com" : "$size" bytes
fi

0 comments on commit 77d8def

Please sign in to comment.