X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=run_sed.sh;fp=run_sed.sh;h=115ab6a3f7e922ccf2a090d6708439c8e9d58275;hb=c378213ad0770e0919916c265999f357a49ad75f;hp=0000000000000000000000000000000000000000;hpb=7b64f7cd01d7306460b71a63ab78842545c5224f;p=ia32rtools.git diff --git a/run_sed.sh b/run_sed.sh new file mode 100755 index 0000000..115ab6a --- /dev/null +++ b/run_sed.sh @@ -0,0 +1,37 @@ +#!/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/\/pushfd/;\ +s/\/popfd/;\ +s/\(\\)\tloc_/\1\tnear ptr loc_/;\ +s/\> $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' +# - 0FFxxh constants - masm treats a byte, ONLY sometimes prefix with 'word ptr' +# - jmp near: +# - jmp _strchr