Skip to content

Instantly share code, notes, and snippets.

@jdonszelmann
Last active October 7, 2019 06:55
Show Gist options
  • Save jdonszelmann/b74bc5f99c535eedbc87ff020d9f741c to your computer and use it in GitHub Desktop.
Save jdonszelmann/b74bc5f99c535eedbc87ff020d9f741c to your computer and use it in GitHub Desktop.
compile semicolon seperated assembly instructions and hexdump
#!/usr/bin/bash
if [ -p /dev/stdin ]; then
stdinput=`cat`
else
stdinput=""
fi
params="${@}"
echo "$stdinput; $params" | sed -e $'s/;/\\\n/g' | as -o tmp.o
ld --entry=0x0 -Ttext 200000 --oformat binary -o tmp.bin tmp.o
rm tmp.o
objdump -D -b binary -mi386:x86-64 tmp.bin
rm tmp.bin
@jdonszelmann
Copy link
Author

jdonszelmann commented Oct 6, 2019

example:
echo "inc %al | dumpasm"
dumpasm inc %al
dumpasm inc %al; inc %ah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment