Runtime Library Reference
· Constants
· Data types
Standard C
· assert.h
· complex.h
· ctype.h
· fenv.h
· float.h
· locale.h
· math.h
· setjmp.h
· signal.h
· stdarg.h
· stddef.h
· stdio.h
· stdlib.h
· string.h
· time.h
Standard C++
· IOstream
· new
Win32
· gc.h
DOS, DOS32, Win16
· bios.h
· cerror.h
· disp.h
· dos.h
· dos.h part 2
· emm.h
· handle.h
· int.h
· msmouse.h
· sound.h
· swap.h
· tsr.h
· winio.h
Other C
· bitops.h
· conio.h
· controlc.h
· direct.h
· fltpnt.h
· io.h
· page.h
· process.h
· search.h
· sys\stat.h
· tabsize.h
· trace.h
· utime.h
· unmangle.h
· util.h
Other C++
· regexp.h
· class complex
|
bios.h
- Header
- bios.h
- Prototype
- int biosdisk(int cmd, int drive, int head, int track, int sector, int nsects, void *buffer);
- Description
- biosdisk accesses interrupt 0x13 for BIOS disk operations on the
drive specified by the drive argument.
For floppy drives, 0 identifies the first
drive, 1 is for the second drive, and so forth.
This function is not available under DOSX.
cmd specifies the disk operation to perform.
head, track, sector, nsects, and buffer provide
further information for the command specified by cmd.
The following command values are available:
| cmd
| Meaning
|
| 0
| Resets disk system by a hard reset; all other parameters are ignored.
|
| 1
| Returns the status of the last disk operation; all other parameters are ignored.
|
| 2
| Reads the specified disk sectors. The head, track, and sector arguments specify the starting sector. The nsects argument specifies the number of sectors to read. The read data is stored in buffer.
|
| 3
| Writes disk sectors from memory. The head, track, and sector arguments specify the starting sector. The nsects argument specifies the number of sectors to write. The data is read from buffer.
|
| 4
| Verifies sectors. The head, track, and sector arguments specify the starting sector. The nsects argument specifies the number of sectors to verify.
|
| 5
| Formats a track. The head and track arguments specify the track to format. Buffer stores the sector headers.
|
| 6
| Formats a track and sets bad sector flags.
|
| 7
| Formats the drive beginning at a specific track.
|
| 8
| Gets the current drive parameters and stores them in buffer.
|
| 9
| Initializes drive-pair characteristics.
|
| 10
| Does a long read.
|
| 11
| Does a long write.
|
| 12
| Does a disk seek.
|
| 13
| Alternates disk reset.
|
| 14
| Reads sector buffer.
|
| 15
| Writes sector buffer.
|
| 16
| Tests the specified drive to see if it is ready.
|
| 17
| Recalibrates the drive.
|
| 18
| Performs diagnostics on controller RAM.
|
| 19
| Performs drive diagnostics.
|
| 20
| Performs controller internal diagnostics.
|
- Return Value
- A status byte that can contain the following values:
| 0x00
| Successful completion
|
| 0x01
| Bad command
|
| 0x02
| Address mark not found
|
| 0x03
| Attempt to write to write-protected disk
|
| 0x04
| Sector not found
|
| 0x05
| Reset failed (hard disk)
|
| 0x06
| Disk changed since last operation
|
| 0x07
| Drive parameter activity failed
|
| 0x08
| Direct memory access (DMA) overrun
|
| 0x09
| Attempt to perform DMA across 64K
|
| 0x0A
| Bad sector detected
|
| 0x0B
| Bad track detected
|
| 0x0C
| Usupported track
|
| 0x11
| CRC/ECC corrected data error
|
| 0x20
| Controller failure
|
| 0x40
| Seek operation failed
|
| 0x80
| Attachment failed to respond
|
| 0xAA
| Drive not ready (hard disk)
|
| 0xBB
| Undefined errror occurred (hard disk)
|
| 0xCC
| Write fault occurred
|
| 0xE0
| Status error
|
| 0xFF
| Sense operation failed
|
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- See Also
- absread
abswrite
_bios_disk
- Example
/* Example for biosdisk */
#include <stdio.h>
#include <stdlib.h>
#include <bios.h>
void main()
{
int result;
char buffer[512];
printf("Attempting to read from drive A:\n");
result = biosdisk(_DISK_READ, 0, 0, 1, 1, 1, buffer);
}
- Header
- bios.h
- Prototype
- int _bios_keybrd(int flag);
int bioskey(int flag);
- Description
- The _bios_keybrd and bioskey functions pass flag to BIOS
interrupt 0x16, the keyboard interrupt. The values for flag are:
| Name
| Value
| Meaning
|
| _KEYBRD_READ | 0x00
| Read the next key value from the keyboard input buffer. Wait for one if none are available.
|
| _KEYBRD_READY | 0x01
| Determine if any keys are in the keyboard input buffer.
|
| _KEYBRD_SHIFTSTATUS | 0x02
| Read the status of the shift keys.
|
| _NKEYBRD_READ | 0x10
| Enhanced read
|
| _NKEYBRD_READY | 0x11
| Enhanced ready
|
| _NKEYBRD_SHIFTSTATUS | 0x12
| Enhanced shift status
|
- Return Value
- If flag is 0, the value returned is the key value.
The ASCII value of the key is returned in the low byte,
and the scan code in the high byte.
If the low byte is 0, then the key value is not an ASCII key
(it might be an arrow or function key).
If flag is 1, 0 is returned if there are no keys in the input buffer,
otherwise the next key value is returned.
The key value is not removed from the input buffer,
and is still available to be read.
If flag is 2, the value returned is the state of the shift keys
encoded into the bits as follows:
| 0x01
| Right shift key is down
|
| 0x02
| Left shift key is down
|
| 0x04
| Ctrl key is down
|
| 0x08
| Alt key is down
|
| 0x10
| Scroll Lock is toggled
|
| 0x20
| Num Lock is toggled
|
| 0x40
| Caps Lock is toggled
|
| 0x80
| Ins is toggled
|
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- Example
/* Example for _bios_keybrd */
#include <bios.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
int key, shift;
int lastshift;
while (1)
{
shift = _bios_keybrd(2);
/* if shift status changes */
if (shift != lastshift)
printf("Shift = 0x% 02x \n", shift);
/* if a key is available */
if (_bios_keybrd(1))
{
/* read the key */
key = _bios_keybrd(0);
if ((key & 0xFF) == 'q')
break;
printf("Key = 0x% 04x \n", key);
}
lastshift = shift;
}
}
- Output
- Press the right shift key down, release it.
- Press the right shift key down, then the left,
release the right then release the left.
- Press 'q' to quit.
Output looks like this:
Shift = 0x20
Shift = 0x21
Shift = 0x20
Shift = 0x21
Shift = 0x23
Shift = 0x22
Shift = 0x20
- Header
- bios.h
- Prototype
- int biosprint(int cmd, int abyte, int port);
- Description
- The biosprint function performs printer functions using BIOS
interrupt 0x17. The cmd argument specifies a print command; the
abyte argument specifies the character to print, and the port
argument specifies the port to which the printer is connected. Port
numbers are zero-based. (That is, a port argument of 0 indicates
LPT1; 1 indicates LPT2, and so on.)
The cmd argument specifies one of the following operations:
| cmd | operation
| | 0 | Print the character specified in the abyte argument.
| | 1 | Initialize the selected printer. Ignore abyte argument.
| | 2 | Return current printer status. Ignore abyte argument.
|
- Return Value
- The current printer status. Possible values are:
| value | meaning
| | 0x01 | Printer timed out
| | 0x08 | I/ O error
| | 0x10 | Printer selected
| | 0x20 | Out of paper
| | 0x40 | Acknowledge
| | 0x80 | Printer not busy
|
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- See Also
- _bios_equiplist
_bios_printer
_bios_serialcom
- Example
/* Example for biosprint */
#include <stdio.h>
#include <bios.h>
void main ()
{
int status, bit_number;
char *description[] =
{
"Printer timed out",
"Unknown status",
"Unknown status",
"I/O error",
"Printer selected",
"Out of paper",
"Acknowledge",
"Printer not busy"
};
status = biosprint (_PRINTER_STATUS, 0, 1);
for (bit_number = 0; bit_number < 8; bit_number += 1)
if (status & (1 << bit_number))
printf("% s\n", description[bit_number]);
}
- Output
I/O error
Acknowledge
Printer not busy
- Header
- bios.h
- Prototype
- long biostime(int cmd, long newtime);
- Description
- The biostime function either reads or sets the BIOS timer, using BIOS interrupt
0x1A. The cmd argument determines whether the time is to be read (cmd = 0) or
set (cmd = 1). If the time is to be read, the function returns current BIOS time
(in clock ticks since midnight). If the time is to be set, the BIOS time of day
counter is set to the value of newtime. The BIOS timer counts ticks since
midnight at a rate of approximately 18. 2 clock ticks per second.
- Return Value
- If the cmd argument is 0, the current value of the BIOS timer is returned. If
the cmd argument is 1, the timer is set to the long value in the newtime
argument.
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- See Also
- _bios_timeofday
- Example
/* Example for biostime */
#include <stdio.h>
#include <bios.h>
void main ()
{
long ticks;
ticks = biostime (0, 0L);
printf("Ticks since midnight is %d\n", ticks);
}
- Output
Ticks since midnight is 25622
- Header
- bios.h
- Prototype
- int _bios_disk(unsigned service, struct diskinfo_t *info);
- Description
- _bios_disk is a direct interface to the BIOS disk control interrupt 0x13.
service specifies the disk function desired;
info specifies the disk parameters.
This function is not available under DOSX.
Six services are available on a basic IBM PC.
They are selected by service:
| service
| Value
| Operation
|
| _DISK_RESET
| 0
| Causes a hard reset of the floppy disk controller and is useful after an error occurs. Ignores the info parameter.
|
| _DISK_STATUS
| 1
| Obtains the status of the last disk operation. Ignores the info parameter.
|
| _DISK_READ
| 2
| Reads one or more disk sectors into the memory buffer pointed to by buffer in the diskinfo_t structure. Requires all fields in the diskinfo_t structure, pointed to by info, be correctly set up.
|
| _DISK_WRITE
| 3
| Writes one or more disk sectors with data from the memory buffer pointed to by buffer in the diskinfo_t structure. Requires all fields in structure diskinfo_t, pointed to by info, be correctly set up.
|
| _DISK_VERIFY
| 4
| Verifies that disk sectors exist and are readable.
Performs a CRC (cyclic redundancy check).
Requires all fields in structure diskinfo_t, pointed to by info,
be correctly set up.
|
| _DISK_FORMAT
| 5
| Formats the track specified in the head and track fields of the diskinfo_t structure pointed to by info. Only one track can be formatted in each call. The buffer field contains a set of sector markers, the format of which depends on the type of disk drive. See an IBM reference manual for marker formats.
|
The format of the diskinfo_t structure is:
struct diskinfo_t {
unsigned drive; /* drive number*/
unsigned head; /* head number*/
unsigned track; /* track number*/
unsigned sector; /* start sector no.*/
unsigned nsectors; /* sectors to process */
void __far *buffer; /* Memory buffer to use */
};
- Return Value
- Depends on the service requested. Reset and format services do not return
meaningful values. Read, write, and verify services return the number of sectors
processed in the low byte; the high byte is 0. The status service, and if an
error has occurred, the read, write, or verify service, places a code in the
high byte of the return value.
The status codes are:
| 0x01
| Invalid request / bad command
|
| 0x02
| Address mark not found
|
| 0x04
| Sector not found
|
| 0x05
| Reset failure
|
| 0x07
| Drive parameter activity failure
|
| 0x09
| DMA overrun
|
| 0x0a
| Bad sector flag detected
|
| 0x10
| Data read (ECC) error
|
| 0x11
| Corrected data read (ECC) error
|
| 0x20
| Controller failure
|
| 0x40
| Seek error
|
| 0x80
| Disk timed out / not responding
|
| 0xaa
| Drive not ready
|
| 0xbb
| Undefined error
|
| 0xcc
| Write fault
|
| 0xe0
| Status error
|
| 0XFF
| Sense operation failed
|
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- See Also
- biosdisk
- Example
/* Example for _bios_disk */
#include <bios.h>
#include <stdio.h>
#include <stdlib. h>
int lowbytes (int tomask)
{
return (tomask & 0x00FF);
}
int highbytes (int toshift)
{
return (toshift >> 8);
}
void main()
{
int status;
struct diskinfo_t disk;
status = _bios_disk (1, &disk);
status = highbytes (status);
if (status != 0)
printf("Last disk operation had error %x\n", status);
else
printf("Last disk operation completed OK.\n");
}
- Output
Last disk operation completed OK.
- Header
- bios.h
- Prototype
- int _bios_equiplist(void);
- Synonym
- biosequip
- Description
- The _bios_equiplist function executes BIOS interrupt 0x11 to determine what equipment is present.
- Return Value
- A register value indicating what equipment is installed.
| Bit | Meaning
| | 15,14 | The number of printers attached
| | 13 | Not used
| | 12 | 1 if a game adaptor is attached
| | 11,10,9 | The number of serial (RS232) ports
| | 8 | Not used
| | 7,6 | The number of diskette drives (maximum 4)
| | 5,4 | The initial video mode
| | 00 | Not used
| | 01 | 40x25 color
| | 10 | 80x25 color
| | 11 | Monochrome
| | 3,2 | Planar RAM size (11 = 64k which is normal)
| | 1 | Not used
| | 0 | Set if there are any diskette drives
|
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- See Also
- _bios_keybrd
_bios_memsize
_bios_printer
_bios_serialcom
_bios_disk
- Example
/* Example for _bios_equiplist */
#include <bios.h>
#include <stdio.h>
#include <stdlib. h>
#define GAME_ADAPTOR 0x0c
void main()
{
unsigned equipment;
equipment = _bios_equiplist();
if (equipment & GAME_ADAPTOR)
printf("Game adaptor installed.\n");
else
printf("No game adaptor installed.\n");
}
- Output
Game adaptor installed.
- Header
- bios.h
- Prototype
- int _bios_keybrd(int flag);
int bioskey(int flag);
- Description
- The _bios_keybrd and bioskey functions pass flag to BIOS
interrupt 0x16, the keyboard interrupt. The values for flag are:
| Macro | flag | Meaning
| | _KEYBRD_READ | 0x00
| Read the next key value from the
keyboard input buffer. Wait for one
if none are available.
| | _KEYBRD_READY | 0x01
| Determine if any keys are in the
keyboard input buffer.
| | _KEYBRD_SHIFTSTATUS | 0x02 | Read the status of the shift keys.
| | _NKEYBRD_READ | 0x10 | Enhanced read
| | _NKEYBRD_READY | 0x11 | Enhanced ready
| | _NKEYBRD_SHIFTSTATUS | 0x12 | Enhanced shift status
|
- Return Value
- If flag is 0, the value returned is the key value. The ASCII value of
the key is returned in the low byte, and the scan code in the high
byte. If the low byte is 0, then the key value is not an ASCII key (it
might be an arrow or function key). If flag is 1, 0 is returned if
there are no keys in the input buffer, otherwise the next key value is
returned. The key value is not removed from the input buffer, and is
still available to be read. If flag is 2, the value returned is the state
of the shift keys encoded into the bits as follows:
| 0x01 | Right shift key is down
| | 0x02 | Left shift key is down
| | 0x04 | Ctrl key is down
| | 0x08 | Alt key is down
| | 0x10 | Scroll Lock is toggled
| | 0x20 | Num Lock is toggled
| | 0x40 | Caps Lock is toggled
| | 0x80 | Ins is toggled
|
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- Example
/* Example for _bios_keybrd */
#include <bios.h>
#include <stdio.h>
#include <stdlib. h>
void main()
{
int key, shift;
int lastshift;
while (1)
{
shift = _bios_keybrd (2);
/* if shift status changes */
if (shift != lastshift)
printf("Shift = 0x% 02x \n", shift);
/* if a key is available */
if (_bios_keybrd(1))
{
/* read the key */
key = _bios_keybrd(0);
if ((key & 0xFF) == 'q') break;
printf("Key = 0x% 04x \n", key);
}
lastshift = shift;
}
}
- Output
- Press the right shift key down, release it.
Press the right shift key down, then the left,
release the right
then release the left. Press 'q' to quit.
Output looks like this:
Shift = 0x20
Shift = 0x21
Shift = 0x20
Shift = 0x21
Shift = 0x23
Shift = 0x22
Shift = 0x20
- Header
- bios.h
- Prototype
- int _bios_memsize(void);
- Synonym
- biosmemory()
- Description
- The function _bios_memsize executes a BIOS interrupt 0x12, which is the memory
size determination routine.
- Return Value
- Returns the maximum number of contiguous 1K memory blocks which are present, as
an integer.
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- See Also
- _bios_equiplist
- Example
/* Example for _bios_memsize */
#include <bios.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
printf("The memory size of this system is %dK\n",
_bios_memsize());
}
- Output
The memory size of this system is 636K
- Header
- bios.h
- Prototype
- int _bios_printer(unsigned service, unsigned printer, unsigned data);
- Description
- _bios_printer executes a BIOS interrupt 0x17, which is the printer
interface routine. service determines which of three possible
operations to perform:
| service | Value | Operation
| | _PRINTER_WRITE | 0 | Write the low order byte of data
to the printer which was specified in the printer argument.
| | _PRINTER_INIT | 1 | Initialize the selected printer.
Ignore the data argument.
| | _PRINTER_STATUS | 2 | Return the current printer
status. Ignore the data argument.
|
_bios_printer is not supported under windows.
- Return Value
- The low byte of the return value, for all three services, contains the printer
status. Possible values are:
| 0x01 | Printer timed out
| | 0x08 | I/ O error
| | 0x10 | Printer selected
| | 0x20 | Out of paper
| | 0x40 | Acknowledge
| | 0x80 | Printer not busy
|
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- See Also
- _bios_equiplist
biosprint
- Example
-
/* Example for _bios_printer
*/
#include <bios.h>
#include <stdio.h>
#include <stdlib. h>
void main()
{
unsigned i, data = 36;
unsigned status;
printf("Place printer offline and press [Enter]\n");
getchar ();
status = _bios_printer(2, 0, data);
printf("Status with printer offline: %x\n", status);
printf("Press [Enter] to initialize printer\n");
getchar();
status = _bios_printer(1, 0, data);
printf("Status after printer initialized: %x\n", status);
printf("Press [Enter] to print\n");
getchar();
for (i= 0; i> 10; i++)
_bios_printer(0, 0, data);
status = _bios_printer(0, 0, '\n');
printf("Status after printing %d %c's:% x\n", i, data, status);
}
- Output
Place printer offline and press [Enter]
Status with printer offline:
Press [Enter] to initialize printer
Status after printer initialized:
Press [Enter] to print
Status after printing $'s:
- Header
- bios.h
- Prototype
- int _bios_serialcom(unsigned service, unsigned port, unsigned data);
- Synonym
- bioscom()
- Description
- This function uses the BIOS to provide serial RS232 operations. The function is not supported under Microsoft Windows. The IBM BIOS allows only polled operation of the serial ports, not interrupt operation. The port argument is the number of the serial port to address. This is set to 0 for COM1 and 1 for COM2.
Four services are provided:
| _COM_INIT, or 0 | Set up the serial port as specified in the data argument (see below).
| | _COM_SEND, or 1 | Transmit the data character through the selected serial port
| | _COM_RECEIVE, or 2 | Accepts an input character through the selected serial port.
| | _COM_STATUS, or 3 | Return the current status of the selected serial port.
|
The data argument for the initialize service is created by OR'ing together one value from each of the following categories.
| Baud Rate | Value
| | _COM_110 | 0
| | _COM_150 | 32
| | _COM_300 | 64
| | _COM_600 | 96
| | _COM_1200 | 128
| | _COM_2400 | 160
| | _COM_4800 | 192
| | _COM_9600 | 224
|
| Data Word Length | Value
| | _COM_CHR7 | 2
| | _COM_CHR8 | 3
|
| # of Stop Bits | Value
| | _COM_STOP1 | 0
| | _COM_STOP2 | 4
|
| Parity | Value
| | _COM_NOPARITY | 0
| | _COM_ODDPARITY | 8
| | _COM_EVENPARITY | 24
|
- Return Value
- A 16-bit integer whose high byte contains status bits. The low byte
varies according to the service requested. High byte status bits are:
| Bit | Meaning when set
| | 15 | Timed out
| | 14 | Transmitter Shift register empty
| | 13 | Transmitter Holding register empty
| | 12 | Break detected
| | 11 | Framing Error
| | 10 | Parity Error
| | 9 | Overrun Error
| | 8 | Data Ready
|
If the send service is requested but data cannot be sent, bit 15 is set.
If the receive service is requested, the byte read is returned in the low byte. If an error occurrs, at least one bit in the high byte is set to indicate the source of the error.
If the service requested is either initialize or status, additional status information are returned in the low byte:
| Bit | Meaning when set
| | 7 | Data Carrier Detect (DCD) state
| | 6 | Ring Indicator (RI) state
| | 5 | Data Set Ready (DSR) state
| | 4 | Clear To Send (CTS) state
| | 3 | Change in DCD
| | 2 | Change in RI
| | 1 | Change in DSR
| | 0 | Change in CTS
|
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- Example
/* Example for _bios_serialcom */
#include <bios.h>
#include <stdio.h>
#include <stdlib. h>
void main()
{
unsigned com1_status;
com1_status = _bios_serialcom (3,0,0);
printf("Com1 status : %x\n", com1_status);
}
- Output
Com1 status : 6000
- Header
- bios.h
- Prototype
- int _bios_timeofday(unsigned mode, long *btime);
- Description
- _bios_timeofday provides an interface to the IBM BIOS time of day functions,
interrupt 0x1A (26).
mode determines whether the time is to be read or set:
| mode
| Value
| Meaning
|
| _TIME_GETCLOCK | 0 | Retrieve time
|
| _TIME_SETCLOCK | 1 | Set time
|
If the time is to be read, the current BIOS time (in clock ticks since midnight) is placed in the long integer pointed to by btime. Otherwise, the BIOS time of day counter is set to the value of that
long. There are approximately 18. 2 clock ticks per second.
- Return Value
- If mode is 0, the function returns 1 if the system clock has passed midnight since the last time it was read. Otherwise, it returns 0. If mode is 1, no meaningful value is returned.
- Compatibility
- DOS Windows 3.x Phar Lap DOSX
- See Also
- biostime
- Example
/* Example for _bios_timeofday */
#include <bios.h>
#include <stdio.h>
#include <stdlib. h>
void main()
{
unsigned hours, minutes;
long btime;
_bios_timeofday (0,& btime);
btime = (btime* 10)/ 182;
minutes = (unsigned) btime / 60;
hours = minutes / 60;
minutes %= 60;
printf("The time is %2d:%2d\n",
hours, minutes);
}
- Output
The time is 15:34
- Header
- dos.h
- Prototype
- int _int86(int intnum, union _REGS *regsin, union REGS *regsout);
- Description
-
int int86_real(int intnum, union _REGS *regsin, union REGS *regsout);
The _int86 functions perform a software interrupt, where intnum
is the interrupt number (0.. 255), regsin is a pointer to a structure
containing the values of the registers AX, BX, CX, DX, SI and DI to
be passed to the interrupt, and regsout is a pointer to a structure
into which the return values of the registers will be written.
The _REGS structure is defined in dos. h. Consult your system
hardware and software manuals to determine what the interrupt
numbers are and what they do on your machine.
In the 32-bit memory models, the functions _bdos, bdos, bdosx,
_int86, int86, _int86x, int86x, _intdos, intdos,
_intdosx, and intdosx filter parameters sent to the real mode
interrupt. For example, if DOS function 40h (write) is detected, the
source buffer is copied to a buffer in conventional memory (dos-buffer)
and a pointer to dos-buffer is passed to DOS, since DOS
could not properly use the buffer located in extended memory. If
the information passed is larger than dos-buffer, there are multiple
calls to DOS to transfer all information, which may be much larger
than 64k. Where pointers are passed to these functions, they are
assumed to contain protected mode addresses. The filtering routine
used for these functions assumes that all far pointers passed in
registers to DOS have a segment address of DGROUP. If you use
int86x to execute INT 21h and specify selectors other than
DGROUP, the results will be unpredictable. It is possible to bypass
this filtering by using the function int_86real instead of int86.
This function bypasses all protected mode filtering in both the Phar
Lap and DOSX extenders and executes the interrupt in real mode. It
can be used to retrieve real mode segment values from the BIOS or
from DOS if desired. Under the X memory model, not all DOS calls
are supported in the filtering process. DOS calls (listed in hex) that
are completely supported include:
0..9, b, d, e, 19, 2a..2e, 30, 33, 36, 39..43, 45..47, 4c..4f, 54..58, 5b..5c, 63, 66..68
Partial support is provided for:
| 0c | AL = 0AH not supported
| | 1a | DTA set to a location in conventional memory
| | 2f | Get DTA returns protected mode address of DTA in conventional memory
| | 44 | Subfunctions 2, 3, 4, 5, c, and d are not supported
| | 59 | Information at ES: DI not available
| | 5a | Information at ds: dx is not available
| | 62 | returns protected mode selector, not real mode segment
|
Functions not supported:
0a, 0f..17, 1b..1c, 21..29, 31, 35, 38, 48..4b, 5e..5f, 65
- Synonym
- Function: int86
- Return Value
- The _int86 function returns the value in the AX register at the
completion of the interrupt. The state of the carry flag can be
determined from x. cflag in regsout. Do not use _int86 for
interrupts 0x25 or 0x26. Use dos_abs_disk_read / write for
those.
- Compatibility
- _int86: DOS Windows 3. x Phar Lap/ DOSX
int86_real: DOS Windows 3. x Phar Lap/ DOSX
- See Also
- _int86x
int86x_real
_intdos
- Example
/* Example for _int86 */
#include <dos.h>
#include <stdio.h>
void main ()
{
union _REGS inregs, outregs;
unsigned char last_flags, new_flags;
int n;
char *description[] =
{
"right shift",
"left shift",
"control",
"alt",
"scroll lock",
"num lock",
"caps lock",
"insert"
};
printf("Press keyboard toggles and shift
keys\n");
printf("Press ctrl-break to quit\n");
for (;;)
{
inregs. h. ah = 2; /* get keyboard flags */
_int86 (0x16, &inregs, &outregs);
new_flags = outregs. h. al ^ last_flags;
if (new_flags)
for (n = 0; n < 8; n += 1)
if (new_flags & (1 << n))
printf("% s %s\n", description[n],
outregs. h. al & (1 << n)? "on":
"off");
last_flags = outregs. h. al;
}
}
- Output
Press keyboard toggles and shift keys
Press ctrl-break to quit
alt on
left shift on
left shift off
alt off
insert on
right shift on
alt on
control on
right shift off
control off
alt off
num lock off
num lock on
control on
^C
- Header
- dos.h
- Prototype
- int _int86x(int intnum, union _REGS *regsin, union _REGS *regsout, struct _SREGS *segregs);
int int86x_real(int intnum, union _REGS *regsin, union _REGS *regsout, struct _SREGS *segregs);
- Description
- The _int86x and int86x_real functions perform a software
interrupt, where intnum is the interrupt number (0 through 255).
regsin is a pointer to a structure containing the values of the
registers AX, BX, CX, DX, SI and DI to be passed to the interrupt.
segregs is a pointer to a structure containing the values of the
segment registers to be passed to the interrupt. These functions also
are used to return the values in the segment registers after the
interrupt has completed. regsout is a pointer to a structure into
which the return values of the registers will be written. The _REGS,
and _SREGS structures are defined in dos. h. Consult your system
hardware and software manuals to determine what the interrupt
numbers are and what they do on your machine.
The int86x_real function is used with the 32-bit models. For a
further explanation of performing interrupts in the 32-bit model, see
_int86, int86_real.
- Synonym
- Function: int86x
- Return Value
- The _int86x and int86x functions return the value in the AX
register at the completion of the interrupt. The state of the carry flag can be determined from x. cflag in regsout. Do not use _int86x
for interrupts 0x25 or 0x26. For _int86x, if an error occurs, the
cflag field in regsout is non-zero and _doserrno is set to the
corresponding error code.
- Compatibility
- _int86x: DOS Windows 3.x Phar Lap/ DOSX
int86x_real: DOS Windows 3.x Phar Lap/ DOSX
- See Also
- _int86
int86_real
_intdos
_intdosx
- Example
- See _int86
|