--- /dev/null
+#!/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
--- /dev/null
+#!/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/\<fldcw\>\t\[esp+4+var_4\]/fldcw\tword ptr \[esp\]/;\
+s/\<large \(.*fs:\)/\1/;\
+' StarCraft.asm" >> $f
+. $f
+