-
Help Requested
I have the following function:
extern void SetMode(int);
#pragma aux SetMode ="int 10h"\
parm [eax];
I need to modify this function to call interrupt 0x10 with 0x4F02 in the AX register, and the mode number in the BX register. How would I modify it to do so? I use Open Watcom v1.1 and have limited knowledge regarding interrupts.
If you were wondering, this is a function to set the video mode. Thus far, I can set it to 0x03 (text mode) and 0x13 (320x200x256colors). I need to set it to 0x111 (640x480x65,535 colors), but it needs the requested modification to do so.
Your help is greatly appreciated.
-
I am almost positive you don't need the extern for your functions. For the rest I can't help you:(
-
Can you not use the int86() function?
From the Watcom help file:
int86
Synopsis:
Code:
#include <i86.h>
int int86( int inter_no,
const union REGS *in_regs,
union REGS *out_regs );
Description:
The int86 function causes the computer's central processor (CPU) to be interrupted with an interrupt whose number is given by inter_no. Before the interrupt, the CPU registers are loaded from the structure located by in_regs. Following the interrupt, the structure located by out_regs is filled with the contents of the CPU registers. These structures may be located at the same location in memory.
You should consult the technical documentation for the computer that you are using to determine the expected register contents before and after the interrupt in question.
Returns:
The int86 function returns the value of the CPU AX register after the interrupt.
See Also:
bdos, int386, int386x, int86x, intdos, intdosx, intr, segread
Example:
Code:
/*
* This example clears the screen on DOS
*/
#include <i86.h>
void main()
{
union REGS regs;
regs.w.cx = 0;
regs.w.dx = 0x1850;
regs.h.bh = 7;
regs.w.ax = 0x0600;
#if defined(__386__) && defined(__DOS__)
int386( 0x10, ®s, ®s );
#else
int86( 0x10, ®s, ®s );
#endif
}
Classification:
Intel
Systems:
DOS/16, Windows, Win386, QNX/16, DOS/PM
-
I thank you for your willingness to help. That helps me little, though. I need a function that does exactly what I listed above. If you have a modification for your listed function that will do the same or fairly similar, that could also be of help.
-
Pure NASM:
Code:
[Section .TEXT]
GLOBAL SetMode
__SetMode:
%define mode [ebp+8]
mov ax,04f02h
mov bx,[mode]
int 10h
ret
Pure C:
Code:
#include <dos.h>
void SetMode(int modenum)
{
REGS regs;
regs.x.ax=0x4f02;
regs.x.bx=modenum //can change LFB bit here if u want
int86(0x10,& regs,& regs);
}
For a listing of the interrupts in the system and some common uses for them - http://www-2.cs.cmu.edu/afs/cs/user/...WWW/files.html
-
-