-
Can someone please convert this to inline assembler(For use with BorlandC or C code? It's needed quite urgently.
Code:
public _setbxdx
.MODEL SMALL ;whatever
.CODE
set_struc struc
dw ? ;old bp
dd ? ;return addr (always far call)
p_bx dw ? ;reg bx value
p_dx dw ? ;reg dx value
set_struc ends
;HELP CONVERT THIS FUNCTION TO C/C++!!!
_setbxdx proc far ; must be FAR
push bp
mov bp,sp
mov bx,[bp]+p_bx
mov dx,[bp]+p_dx
pop bp
ret
_setbxdx endp
END
in C, the function prototype is "far setbxdx(int, int);"
I can get most of of the conversion, but I want it to work with the "REGS" structure. I've already posted this in the ASM forum, but it's in more depth here.
I need this urgently!
-
www.softseek.com
Look in their programming section and it may have one.
-
Sorry, I didn't find anything there
-
This is important! I need help soon!
-
I see you pushing bp.. what is in bp at the time of this?
also, can I see what you have converted so far.. maybe i can help...
Knight
-
Here, try this...
void setbxdx(int a_bx, int a_dx)
{
__asm
{
mov bx, a_bx
mov dx, a_dx
}
}
Knight Vision
-
It has to have a return of the FAR type. That's why it pushes/pops bp to return it(I think). I got this code from some code from www.VESA.org It's from their VBE3.0 Specifications. This is to help in switching the videocard's memory banks by a method called Direct-Banking.
Cybrg641 has helped me and has converted it to this:
Code:
FAR setbxdx(int, int);
//-----------------------------------------------------------------
struct set_struc
{
WORD Oldbp; // old bp
DWORD rAddr; // return addr
WORD p_bx; // reg bx value
WORD p_dx; // reg dx value
};
//-----------------------------------------------------------------
FAR setbxdx(int p_bx, int p_dx)
{
asm {
push bp
mov bp, sp
mov bx, [bp] + p_bx
mov dx, [bp] + p_dx
pop bp
}
return 0;
}
It looks good to me... What do you guys say?