|
-
Mar 21st, 2001, 04:06 PM
#1
Thread Starter
Hyperactive Member
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!
Last edited by Warmaster199; Mar 21st, 2001 at 04:09 PM.
Designer/Programmer of the Comtech Operating System(CTOS)
-
Mar 21st, 2001, 04:09 PM
#2
Frenzied Member
www.softseek.com
Look in their programming section and it may have one.
-
Mar 21st, 2001, 04:44 PM
#3
Thread Starter
Hyperactive Member
Sorry, I didn't find anything there
Designer/Programmer of the Comtech Operating System(CTOS)
-
Mar 21st, 2001, 05:47 PM
#4
Thread Starter
Hyperactive Member
This is important! I need help soon!
Designer/Programmer of the Comtech Operating System(CTOS)
-
Mar 22nd, 2001, 12:33 AM
#5
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
-
Mar 22nd, 2001, 03:08 PM
#6
Here, try this...
void setbxdx(int a_bx, int a_dx)
{
__asm
{
mov bx, a_bx
mov dx, a_dx
}
}
Knight Vision
-
Mar 22nd, 2001, 05:06 PM
#7
Thread Starter
Hyperactive Member
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?
Designer/Programmer of the Comtech Operating System(CTOS)
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
|