#!/bin/sh -e

ASM="uxncli $HOME/roms/drifblim.rom"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"

ID="sixels"
SRC="${ID}.tal"
DST="${ID}.rom"

CPY="$HOME/roms"
ARG="dafu.sixels"

if [[ "$*" == *"--lint"* ]]
then
	$LIN $SRC
fi

$ASM $SRC $DST

if [[ "$*" == *"--save"* ]]
then
	cp $DST $CPY
fi

# convert an image to sixels

$ASM icnsix.tal icnsix.rom
uxncli icnsix.rom dafu10x10.icn > dafu.sixels
# uxncli icnsix.rom test02x02.icn > dafu.sixels

$EMU $DST $ARG