Thread: Using BIOS int 10H and int 16H

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    2

    Exclamation Using BIOS int 10H and int 16H

    need help understanding how to create this program my teacher has explain this only twice and expects me to know it already here are the details.


    Using BIOS int 10H and int 16H interrupts create an elevator floor indictator display simulator (lighted numbers for floors 1-5) . Use int 10H services to create a graphic representation the elevator floor indication display. Use int 16H service 0 to read a number 1 - 5 entered by the user. DO NOT use printf or scanf at all, with the exception that you may use printf to prompt the user for input.

    Entering a ‘1' or ‘2’ or ‘3’ or ‘4’ or ‘5’ will turn on the corresponding floor indicator light and turn off all others.


    need help someone please respond

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    You're kidding right?

    This is MS-DOS stuff.... circa 1985

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    What operating system is on the computer, and what IDE/compiler are you using?

    If it's DOS, what version of DOS?

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    1
    I think he is using a Power C compiler.

  5. #5
    Registered User
    Join Date
    Jan 2011
    Posts
    2
    yes i am using power c compiler

    here is what i have so far

    Code:
    //#include "libepc.h"
    #include "dos.h"
    
    int main(void)
    {
    	char attr1;          // any floor unlit
    	char attr2;         //  any floor lit
    	union REGS r;		//Holds register values for the bios services	
    	int row =12;		//Screen position
    	char ch;			//Character entered by the user
    
    	//  Set Video Mode
    	r.h.ah = 0x00;			//set mode
    	r.h.al = 0x03;			//mode 80 x 25 16 color
    	int86(0x10, &r, &r);
    
    	// create a solid rectangle using the block character
    	for(row = 0; row < 5; row++)
    	{
    		//	SetCursorPosition
    		r.h.ah = 0x02;			//service #
    		r.h.bh = 0x00;			//display page 0
    		r.h.dh = row;			//row #
    		r.h.dl = 11;				//column #
    		//	 r.x.dx = 0x0c28;		//12rd row 40th col
    		int86(0x10, &r, &r);
    
    		//	Write some characters to screen
    		r.h.ah = 0x09;			//write character
    		r.h.al = 0xDB;			//solid bliock character to write
    		r.h.bh = 0x00;			//display page 0
    		r.h.bl = 0x7E;			//characters attribute
    		r.x.cx = 5;			//repeat block 10 times
    		int86(0x10, &r, &r);
    	}
    	for(row = 0; row < 5; row++)
    	{
    		//	SetCursorPosition
    		r.h.ah = 0x02;			//service #
    		r.h.bh = 0x00;			//display page 0
    		r.h.dh = row;			//row #
    		r.h.dl = 17;				//column #
    		//	 r.x.dx = 0x0c28;		//12rd row 40th col
    		int86(0x10, &r, &r);
    
    		//	Write some characters to screen
    		r.h.ah = 0x09;			//write character
    		r.h.al = 0xDB;			//solid bliock character to write
    		r.h.bh = 0x00;			//display page 0
    		r.h.bl = 0x7E;			//characters attribute
    		r.x.cx = 5;			//repeat block 10 times
    		int86(0x10, &r, &r);
    	}
    	// create a solid rectangle using the block character
    	for(row = 0; row < 5; row++)
    	{
    		//	SetCursorPosition
    		r.h.ah = 0x02;			//service #
    		r.h.bh = 0x00;			//display page 0
    		r.h.dh = row;			//row #
    		r.h.dl = 23;				//column #
    		//	 r.x.dx = 0x0c28;		//12rd row 40th col
    		int86(0x10, &r, &r);
    
    		//	Write some characters to screen
    		r.h.ah = 0x09;			//write character
    		r.h.al = 0xDB;			//solid bliock character to write
    		r.h.bh = 0x00;			//display page 0
    		r.h.bl = 0x7E;			//characters attribute
    		r.x.cx = 5;			//repeat block 10 times
    		int86(0x10, &r, &r);
    	}
    	for(row = 0; row < 5; row++)
    	{
    		//	SetCursorPosition
    		r.h.ah = 0x02;			//service #
    		r.h.bh = 0x00;			//display page 0
    		r.h.dh = row;			//row #
    		r.h.dl = 29;				//column #
    		//	 r.x.dx = 0x0c28;		//12rd row 40th col
    		int86(0x10, &r, &r);
    
    		//	Write some characters to screen
    		r.h.ah = 0x09;			//write character
    		r.h.al = 0xDB;			//solid bliock character to write
    		r.h.bh = 0x00;			//display page 0
    		r.h.bl = 0x7E;			//characters attribute
    		r.x.cx = 5;			//repeat block 10 times
    		int86(0x10, &r, &r);
    	}
    for(row = 0; row < 5; row++)
    	{
    		//	SetCursorPosition
    		r.h.ah = 0x02;			//service #
    		r.h.bh = 0x00;			//display page 0
    		r.h.dh = row;			//row #
    		r.h.dl = 35;				//column #
    		//	 r.x.dx = 0x0c28;		//12rd row 40th col
    		int86(0x10, &r, &r);
    
    		//	Write some characters to screen
    		r.h.ah = 0x09;			//write character
    		r.h.al = 0xDB;			//solid bliock character to write
    		r.h.bh = 0x00;			//display page 0
    		r.h.bl = 0x7E;			//characters attribute
    		r.x.cx = 5;			//repeat block 10 times
    		int86(0x10, &r, &r);
    	}
    	
    
    
    	// get a keystroke from the user
    	r.h.ah = 0;
    	int86(0x16, &r, &r);
    	ch = r.h.al;
    
    	//	SetCursorPosition(12,40);
    	r.h.ah = 0x02;			//set curson postition
    	r.h.bh = 0x00;			//display page 0
    	r.h.dh = 12;
    	r.h.dl = 40;
    	//	 r.x.dx = 0x0c28;		//12rd row 40th col
    	int86(0x10, &r, &r);
    
    	//	Write some characters to screen
    	r.h.ah = 0x09;			//write character
    	r.h.al = ch;			//character to write
    	r.h.bh = 0x00;			//display page 0
    	r.h.bl = 0x71;			//characters attribute
    	r.x.cx = 1;			//repeat 'E' three times
    	int86(0x10, &r, &r);
    
    	//  Wait for the user to enter a character
    	//	(This just keeps the screen from scrolling up)
    	r.x.ax = 0x0100;
    	int86(0x21, &r, &r);
    
    	return 0 ;
    }
    having trouble creating location #'s for my boxes and creating a statement to light them up according to what floor its on
    Last edited by Salem; 01-11-2011 at 12:04 PM. Reason: Added [code][/code] tags - learn to use them yourself

  6. #6
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    1: << !! Posting Code? Read this First !! >>

    2: It doesn't matter what version of DOS he's using, 10 and 16 are BIOS interrupts. In general, 1-1F are reserved by Intel for their(and BIOS) use.

  7. #7
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    o_O ... What is that, a unreal mode emulator??? Because you know that BIOS can't directly be used in protected mode, right?

    Edit: Oh, now i get it. It's a MS-DOS emulator, hence the "dos.h"
    Last edited by GReaper; 01-11-2011 at 10:02 AM.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Poker games
    By satory in forum C Programming
    Replies: 6
    Last Post: 11-22-2004, 11:27 AM
  2. What is wrong with this function!!!
    By stupid_mutt in forum C Programming
    Replies: 9
    Last Post: 01-08-2002, 11:34 AM
  3. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM