From d458c38041b6c2749a58f5d056d2403c13efc088 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 10 Nov 2013 20:28:06 +0200 Subject: [PATCH] fix .text position, storm and stuff --- runimp.sh | 7 ++++--- runsed.sh | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/runimp.sh b/runimp.sh index 25086c7..fd049d0 100755 --- a/runimp.sh +++ b/runimp.sh @@ -2,7 +2,8 @@ grep 'extrn ' StarCraft.asm | awk '{print $2}' | awk -F: '{print $1}' > implist -echo -n "" > tramp.s +echo ".data" > tramp.s +echo ".align 4" >> tramp.s cat implist | while read i; do rm -f tmpsym @@ -15,7 +16,7 @@ cat implist | while read i; do ;; esac - grep "\<_$si\>" /usr/i586-mingw32msvc/lib/lib* | awk '{print $3}' | \ + grep "\<_$si\>" /usr/i586-mingw32msvc/lib/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 @@ -31,6 +32,6 @@ cat implist | while read i; do echo ".globl $i" >> tramp.s echo "$i:" >> tramp.s - echo " jmp $sym" >> tramp.s + echo " .long $sym" >> tramp.s echo >> tramp.s done diff --git a/runsed.sh b/runsed.sh index c2821ba..ba98e54 100755 --- a/runsed.sh +++ b/runsed.sh @@ -16,6 +16,16 @@ 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/\\)\tloc_/\1\tnear ptr loc_/;\ ' StarCraft.asm" >> $f . $f +# manual fixup: +# = 'end start' -> 'end' +# - 'lea ecx, [ecx+0]' -> align +# - add 'near ptr' to some jumps +# - 'cmp [ebp+edx+0], cl' -> 'cmp [edx+ebp+0], cl' +# - 0FFFFh constant - masm treats a byte, sometimes prefix with 'word ptr' -- 2.39.2