-
Please explain?
I am studying hardware programming on this time, some of the codes which may difficult for me to understand. I found this code in the internet. Hope you can explain to me better.
The following program will set the border color to blue.
Code:
#include <conio.h> /* needed for outp() */
#include <stdio.h> /* needed for getchar() */
#include <dos.h> /* for REGS definition */
#define CSReg 0x3d9
#define BLUE 1
void cls()
{
union REGS regs;
regs.h.ah = 15; int86( 0x10, ®s, ®s );
regs.h.ah = 0; int86( 0x10, ®s, ®s );
}
main()
{
cls();
printf("Press any key to set border color to blue.\n");
getchar();
outp( CSReg, BLUE );
}
This part of code which i do not understand, I think this involves assembly language. Can anyone here explain me better about this.
Code:
regs.h.ah = 15; int86( 0x10, ®s, ®s );
regs.h.ah = 0; int86( 0x10, ®s, ®s );
Thanks in advance...
-
Code:
regs.h.ah = 15;
int86( 0x10, ®s, ®s );
regs.h.ah = 0;
int86( 0x10, ®s, ®s );
Are these built-in statements in C?
-
> regs.h.ah = 15;
regs is an instance of the REGS union.
Its purpose is to represent all the possible values of the x86 registers.
> int86( 0x10, ®s, ®s );
This is just a function call, which generates an interrupt service "trap", usually to DOS (int 0x21) or the video BIOS (int 0x10).
The two regs pointers allow you to specify all the input conditions to the interrupt (the 2nd param), and get all the results back (the 3rd param).
These will explain more.
http://www.ctyme.com/intr/int.htm
http://www.cs.cmu.edu/afs/cs.cmu.edu...WWW/files.html
> regs.h.ah = 15; int86( 0x10, ®s, ®s );
Corresponds to
Int 10/AH=0Fh - VIDEO - GET CURRENT VIDEO MODE
> regs.h.ah = 0; int86( 0x10, ®s, ®s );
Int 10/AH=00h - VIDEO - SET VIDEO MODE
-
Thank you so much Salem...