#!/bin/bash

# Disassembles a hex value into the corresponding instruction
# (c) 2004 Randolph Chung, GPLv2

T=a$$

if [ $# -lt 1 ]; then
	echo "$0 <insn>"
	exit 0
fi

insn=$1

if [ $insn = ${insn/0x/} ]; then
	insn=0x$insn
fi

echo ".level 2.0" > $T.s
echo ".text" >> $T.s
echo ".word $insn" >> $T.s
as -o $T.o $T.s
objdump -d $T.o |grep "0:"
rm -f $T.o $T.s
