-
September 17th, 2014, 04:58 AM
#1
Need some help on Watcom assembling....
Code:
E103: Operand is expected
E065: Invalid instruction operands
Code:
lea eax, [esp+30h+var_28]
Tried to reassemble a decompiled program using wasm.exe
Compiler: Watcom C++ 11.0
Target: DOS4G Extended Environment
Assembled with
wasm -5p program.asm
Unsuccessful in finding reference manuals....
Last edited by lucky6969b; September 17th, 2014 at 05:33 AM.
-
September 17th, 2014, 06:51 AM
#2
Re: Need some help on Watcom assembling....
You cannot typically take decompiled output and use that as source for an assembler.
An assembler will typically need additional information the disassembler doesn't provide
and a disassembler will often have an output that is oriented towards higher readability but not necessarily being compatible for reassembly.
That's what's happening with this lea instruction. It's likely using a var_28 pseudovariable name but there's no actual variable nor symbol defined as such.
considering the use of ESP, it's likely the disassembler differentiating between various different presumed parameters to the function.
Solution: provide the proper value for var_28 or make sure you've a define for it.
-
September 17th, 2014, 07:34 AM
#3
Re: Need some help on Watcom assembling....
Code:
main_ proc near ; CODE XREF: __CMain+40p
var_28 = byte ptr -28h
var_20 = byte ptr -20h
var_18 = dword ptr -18h
So I should change that line from
Code:
lea eax, [esp+30h+var_28]
to
lea eax, [esp+30h-28h] ?
Update
Also having the same problem here
Code:
dword_74520 dd ?
inc dword_74520
Any ideas how to resolve this? Seems to be having trouble with uninitialized data.
I am using IDA Pro. I have solved the previous problems by specifying no stack variables created.
Also esp+... are converted to constants. But I don't know how to resolve this one?
Thanks
Jack
Last edited by lucky6969b; September 17th, 2014 at 08:46 AM.
-
September 17th, 2014, 01:00 PM
#4
Re: Need some help on Watcom assembling....
The inc command should assemble. If not, try adding square brackets around the variable name (some assemblers are picky about that).
but you will need to have code somewhere that initializes it to something of course.
also WASM has a few quirks about syntax issues. If you use IDA Pro, then a MASM 6.1 syntax compatible assembler should be easier.
-
September 18th, 2014, 12:28 AM
#5
Re: Need some help on Watcom assembling....
Hello,
Just wondering how to assemble dos extended program with masm 6.1. I just know how to assemble in real mode.
Thanks
Jack
-
September 18th, 2014, 07:12 AM
#6
Re: Need some help on Watcom assembling....
Wasm has built in support for the DOS4GW (later called CauseWay) DOS extender.
This essently just means it'll link in the setup/interface/cleanup for the extender as well. IIRC, this lib isn't just available, rather, the linker hard-links this in.
MASM can be used for DOS4GW as well, but it doesn't do all of that by itself, you'll need to provide all that setup/interface/cleanup yourself. If you have the dev version of DOS4GW/Causeway, the standard lib to do this (with source) will be available. if you only have the WatCom distributable, you're out of luck on that area and you'll need to do it yourself "the hard way". good luck finding all the necessary documentation to do so
Note that in the disassembled code, you'll probably have all that DOS extender interface code also as part of the disassembly output, so to get properly workable/linkable code for Wasm/Wlink, you'll need to pull all of that out.
It's possible IDA pro does this for you (I doubt it), but I honestly don't know, I never used IDA Pro on (extended) DOS programs.
-
September 18th, 2014, 08:12 AM
#7
Re: Need some help on Watcom assembling....
It's hard to find the old software though, it's a good start anyways.
Thanks a lot.
Jack
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|