Hello All,

I am a newbie to windows programming. I am writing a 16-bit code.

I would like a function to return a dword and takes dword (memory address) as a parameter. This is what I did and the output of this returns only 16 bit. Can anyone give any suggestions?

val read_mem(address) -> calling function

_read_mem proc far
push bp;
push bp, sp;
push esi;
mov esi, ;
xor eax, eax;
mov eax, fs:;
pop esi;
pop bp;

I am expecting a 32-bit value, but this gives me only val[15:0]

Posted on 2004-06-25 17:52:30 by Pablo A Castillo
Sounds like you are feeding this function to some 16 bit compiler, but you did not specify it. Each compiler has different convention of returning values. Say, most 16 bit C compilers use dx:ax for 32 bit values, but not all. Check your compiler manual about mixed language programming. That should give you the correct answer.

BTW, I don't think 16 bit stuff belongs here.
Also, if I were you, I would not post the same message multiple times.
Posted on 2004-06-25 19:37:50 by Starless

the code should possibly look like:

_read_mem proc far
push bp
mov bp, sp
push esi;
mov esi, [bp+6];
mov eax, fs:[esi];
push eax
pop ax
pop dx
pop esi;
pop bp;
Posted on 2004-06-26 00:27:28 by japheth
Thanks for your reply. I will try it out.
Posted on 2004-06-26 17:19:43 by Pablo A Castillo