#!/bin/sh
# Define filename as variable
PROGNAME="hires"
# Only set C65LIBPATH if not already defined
if [ -z "$C65LIBPATH" ]; then
    export C65LIBPATH=$(readlink -f "../../lib")
fi
# Compile
c65gm -in ${PROGNAME}.c65 -out ${PROGNAME}.s
if [ $? -ne 0 ]; then
    echo "Compilation terminated"
    exit 1
fi
echo assemble.
acme ${PROGNAME}.s
if [ -f ${PROGNAME}.prg ]; then
    rm ${PROGNAME}.prg
fi
# main.bin ${PROGNAME}.prg
mv main.bin main.prg