3 # sed -i -e '/.model flat/i\
4 # \t\t.xmm\r' StarCraft.asm
6 usyms="copy_start ___from_strstr_to_strchr unknown_libname_36 unknown_libname_41 unknown_libname_58"
9 echo -n "sed -i -e '/.model flat/i\\\t\t.xmm\r' -e '" > $f
11 echo -n "s/^\<$sym\>:\([^:]\)/$sym::\1/g;" >> $f
15 s/^\(loc[r_].*[0-9A-F]:\)[^:]\(.*\;\)/\1:\t\2/g;\
16 s/dd[[:blank:]]rva/dd/;\
17 s/\<fldcw\>\t\[esp+4+var_4\]/fldcw\tword ptr \[esp\]/;\
18 s/\<large \(.*fs:\)/\1/;\
19 s/lea\t\(e.[px]\), \[\1+0\]/align 10h/;\
20 s/\[\(e..\)+\(e.p\)\]/\[\2+\1\]/;\
21 s/\<lea\t\(e..\), \[\(e.p\)+\(e.x\)+/lea\t\1, \[\3+\2+/;\
22 s/\[\(e.p\)+\(e.i\)+/\[\2+\1+/;\
25 s/\(\<j[mn]\?[abceglopszp]e\?\>\)\tloc_/\1\tnear ptr loc_/;\
26 s/\<jmp\tsub_/jmp\tnear ptr sub_/;\
27 ' StarCraft.asm" >> $f
31 # - 'end start' -> 'end'
32 # - 'lea ecx, [ecx+0]' -> align
33 # - add 'near ptr' to some jumps
34 # - 'cmp [ebp+edx+0], cl' -> 'cmp [edx+ebp+0], cl'
35 # - 0FFxxh constants - masm treats a byte, ONLY sometimes prefix with 'word ptr'