#!/bin/bash
#A script to generate source definitions and necessary code
# for the 246 8085 instructions 

PREFIX=_eef_inst_func_

NUM=0

echo

#write funcs
while [ $NUM -lt 246 ];
do
	#write
	echo "gint";
	echo "${PREFIX}${NUM} (eef_addr_t opnd_addr)"
	echo "{"
	printf "\t"
	echo "gint bytes_consumed = 0;"
	echo
	echo
	echo
	printf "\t"
	echo "return bytes_consumed;"
	echo "}"
	echo

	#incr
	let "NUM = $NUM + 1"
done

#write assign code
echo 
echo "static void"
echo "_eef_inst_assign_all(void)"
echo "{"
echo

let "NUM = 0"

while [ $NUM -lt 246 ];
do
	printf "\t"
	echo "eef_instructions[$NUM] = ${PREFIX}${NUM};"

	let "NUM = $NUM + 1"
done
echo
echo "}"
echo
