#!/bin/sh GREEN='\033[0;32m' RED='\033[0;31m' NC='\033[0m' make asm_files > /dev/null if [ ! "$(command -v ./sim8086)" ]; then echo -e "\nError: 'sim8086' executable not found" exit 1 fi for ASM_BIN in asm_files/*.bin; do ./sim8086 "$ASM_BIN" instructions > output.asm 2> /dev/null nasm output.asm -o output.bin 2> /dev/null ASM_FILE=${ASM_BIN%.*}.asm if [ ! -e output.bin ]; then rm output.asm echo -e "${ASM_FILE}: ${RED}Issue decoding assembly: Could not produce bin${NC}" continue fi diff "${ASM_BIN}" output.bin > /dev/null if [ $? -eq 0 ]; then echo -e "${ASM_FILE}: ${GREEN}Decoded properly${NC}" else echo -e "${ASM_FILE}: ${RED}Bin files do not match!${NC}" fi rm output.asm output.bin done