From 60f7539b5bd64b7bbcd43ef0de297a705e1c1633 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 10 Nov 2013 02:46:42 +0200 Subject: [PATCH] first compiling version --- runimp.sh | 36 ++++++++++++++++++++++++++++++++++++ runsed.sh | 21 +++++++++++++++++++++ uni.inc | 0 3 files changed, 57 insertions(+) create mode 100755 runimp.sh create mode 100755 runsed.sh create mode 100644 uni.inc diff --git a/runimp.sh b/runimp.sh new file mode 100755 index 0000000..25086c7 --- /dev/null +++ b/runimp.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +grep 'extrn ' StarCraft.asm | awk '{print $2}' | awk -F: '{print $1}' > implist + +echo -n "" > tramp.s + +cat implist | while read i; do + rm -f tmpsym + case $i in + __imp_*) + si=`echo $i | cut -c 7-` + ;; + *) + si=$i + ;; + esac + + grep "\<_$si\>" /usr/i586-mingw32msvc/lib/lib* | awk '{print $3}' | \ + while read f; do + sym=`i586-mingw32msvc-nm $f | grep "\<_$si\>" | grep ' T ' | awk '{print $3}'` + if test -n "$sym"; then + echo $sym > tmpsym + break + fi + done + sym=`cat tmpsym` + if test -z "$sym"; then + echo "no file/sym for $i, lf $f" + exit 1 + fi + + echo ".globl $i" >> tramp.s + echo "$i:" >> tramp.s + echo " jmp $sym" >> tramp.s + echo >> tramp.s +done diff --git a/runsed.sh b/runsed.sh new file mode 100755 index 0000000..c2821ba --- /dev/null +++ b/runsed.sh @@ -0,0 +1,21 @@ +#!/bin/sh -x + +# sed -i -e '/.model flat/i\ +# \t\t.xmm\r' StarCraft.asm + +usyms="copy_start ___from_strstr_to_strchr unknown_libname_36 unknown_libname_41 unknown_libname_58" + +f=/tmp/sedcmd_ +echo -n "sed -i -e '/.model flat/i\\\t\t.xmm\r' -e '" > $f +for sym in $usyms; do + echo -n "s/^\<$sym\>:\([^:]\)/$sym::\1/g;" >> $f +done + +echo "\ +s/^\(loc[r_].*[0-9A-F]:\)[^:]\(.*\;\)/\1:\t\2/g;\ +s/dd[[:blank:]]rva/dd/;\ +s/\\t\[esp+4+var_4\]/fldcw\tword ptr \[esp\]/;\ +s/\> $f +. $f + diff --git a/uni.inc b/uni.inc new file mode 100644 index 0000000..e69de29 -- 2.39.2