Skip to content

Instantly share code, notes, and snippets.

@MasWag
Created November 28, 2015 00:06
Show Gist options
  • Save MasWag/f681b161850637532069 to your computer and use it in GitHub Desktop.
Save MasWag/f681b161850637532069 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ "$1" = "" ]]; then
echo "usage : bash $0 [assembly-name]"
else
IFS=$'\n'
BAK="$1~"
PC=0
mv "$1" $BAK
for l in $(cat $BAK); do
if [[ $l =~ \.text|\.data|\.globl|\.long|:|^[\ \t]*# ]]; then
echo $l >> $1
else
echo "$l # $PC" >> $1
((++PC))
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment