📄 bi
字号:
@c ----------------------------------------------------------------------
@node bios.h, header
@heading @code{<bios.h>}
This function prototypes all the functions that deal with BIOS calls.
@c ----------------------------------------------------------------------
@node bioscom, bios
@heading @code{bioscom}
@subheading Syntax
@example
#include <bios.h>
int bioscom(int cmd, char data, int port);
@end example
@subheading Description
This function accesses the BIOS interrupt 0x14 function, serial
communication services. The valid values of cmd are:
@table @asis
@item 0 - initialize com port (@var{data} is the settings)
@item 1 - write byte to port
@item 2 - read byte from port
@item 3 - get port status
@item
@end table
For initialization, the byte is made up of the following bits:
@example
0000 0000
7654 3210 Meaning
---- --10 7 bits/character
---- --11 8 bits/character
---- -0-- 1 stop bit
---- -1-- 2 stop bits
---X 0--- no parity
---0 1--- odd parity
---1 1--- even parity
000- ---- 110 baud
001- ---- 150 baud
010- ---- 300 baud
011- ---- 600 baud
100- ---- 1200 baud
101- ---- 2400 baud
110- ---- 4800 baud
111- ---- 9600 baud
@end example
@subheading Return Value
The return value is a sequence of bits that indicate the port status
and, for cmd=0 and 3, the modem status. For read/write operations,
the lower eight bits are the character read.
@example
1111 1100 0000 0000
5432 1098 7654 3210 Meaning
---- ---- ---- ---1 CTS change
---- ---- ---- --1- DSR change
---- ---- ---- -1-- ring change
---- ---- ---- 1--- carrier detect change
---- ---- ---1 ---- CTS present
---- ---- --1- ---- DSR present
---- ---- -1-- ---- ring present
---- ---- 1--- ---- carrier detect
---- ---1 ---- ---- data ready
---- --1- ---- ---- overrun error
---- -1-- ---- ---- parity error
---- 1--- ---- ---- framing error
---1 ---- ---- ---- break detected
--1- ---- ---- ---- transmit holding register empty
-1-- ---- ---- ---- transmit shift register empty
1--- ---- ---- ---- time out (=1 if error present for cmd=1,2)
@end example
@subheading Example
@example
bioscom(0, 0xe3); /* 9600 baud, no parity, one stop, 8 bits */
for (i=0; buf[i]; i++)
bioscom(1, buf[i]);
@end example
@c ----------------------------------------------------------------------
@node biosdisk, bios
@heading @code{biosdisk}
@subheading Syntax
@example
#include <bios.h>
int biosdisk(int cmd, int drive, int head, int track,
int sector, int nsects, void *buffer);
@end example
@subheading Description
This function interfaces with the BIOS disk sevice (interrupt 0x13).
Please refer to a BIOS reference manual for detailed information about
the parameters of this call. All known calls are supported.
@table @asis
@item 0 - reset disk subsystem
@item 1 - get disk subsystem status
@item 2 - read one or more sectors
@item 3 - write one or more sectors
@item 5 - format a track
@item 6 - format back track
@item 7 - format drive
@item 8 - get drive parameters
@item 9 - initialize drive parameters
@item 10 - read long sectors
@item 11 - write long sectors
@item 12 - seek to cylinder
@item 13 - alternate fixed disk reset
@item 14 - read test buffer
@item 15 - write test buffer
@item 16 - test for drive ready
@item 17 - recalibrate drive
@item 18 - controller RAM diagnostic
@item 19 - controller drive diagnostic
@item 20 - controller internal diagnostic
@item 15 - read fixed disk type
@item 22 - read disk change line status
@item 23 - set DASD type (pass dasd in @var{nsects})
@item 24 - set media type for format
@item
@end table
The first request with more than eight sectors will cause a DOS buffer
to be allocated. This buffer is automatically freed when your
application exits. Since this buffer is big enough to hold 18
sectors, requests for more sectors than that will fail.
Request eight returns values in buffer as follows:
@table @asis
@item byte 0 = sectors per track (bits 0..5) and top two bits of cylinder (in bits 6..7)
@item byte 1 = cyliders (bits 0..7)
@item byte 2 = number of drives
@item byte 3 = number of heads
@item
@end table
@subheading Return Value
The value of AH returned by the BIOS.
@subheading Example
@example
char buffer[512];
if (biosdisk(2, 0x80, 0, 0, 0, 1, buffer))
error("disk");
@end example
@c ----------------------------------------------------------------------
@node biosequip, bios
@heading @code{biosequip}
@subheading Syntax
@example
#include <bios.h>
int biosequip(void);
@end example
@subheading Description
This function returns the equipment word from BIOS request 0x11. The
bits correspond to the following values:
@example
1111 1100 0000 0000
5432 1098 7654 3210 Meaning
---- ---- ---- ---X 1 = disk drive(s) installed
---- ---- ---- --X- 1 = math coprocessor installed
---- ---- ---- XX-- System memory 00=16k 01=32k 10=48k 11=64k (non PS/2)
---- ---- ---- -X-- 1 = pointing device installed (PS/2)
---- ---- ---- X--- not used on PS/2
---- ---- --XX ---- initial video mode: 01=CO40 10=CO80 11=MONO
---- ---- XX-- ---- disk drives 00=1 01=2 10=3 11=4 (zero if bit 1=0)
---- ---X ---- ---- 1 = no DMA available
---- XXX- ---- ---- number of serial ports installed (000=0 001=1 etc)
---X ---- ---- ---- 1 = game port adapter installed
--X- ---- ---- ---- 1 = internal modem installed (PS/2)
--X- ---- ---- ---- 1 = serial printer attached (non PS/2)
XX-- ---- ---- ---- number of printers installed (00=0 01=1 10=2 11=3)
@end example
@subheading Return Value
The equipment word.
@subheading Example
@example
if (biosequip() & 0xc000)
do_printing();
@end example
@c ----------------------------------------------------------------------
@node bioskey, bios
@heading @code{bioskey}
@subheading Syntax
@example
#include <bios.h>
int bioskey(int command)
@end example
@subheading Description
@table @asis
@item @var{command} = 0
Returns the next key pressed
@item @var{command} = 1
Checks the keyboard, returns zero if no key pressed, else the key. Does
not dequeue the key.
@item @var{command} = 2
Returns the shift state:
@example
7654 3210 Meaning
---- ---X Right shift key down
---- --X- Left shift key down
---- -X-- Ctrl key down
---- X--- Alt key down
---X ---- Scroll lock on
--X- ---- Num lock on
-X-- ---- Caps lock on
X--- ---- Insert on
@end example
@end table
@subheading Return Value
Depends on @var{command}.
@subheading Example
@example
while (!bioskey(1))
do_stuff();
@end example
@c ----------------------------------------------------------------------
@node biosmemory, bios
@heading @code{biosmemory}
@subheading Syntax
@example
#include <bios.h>
unsigned biosmemory(void);
@end example
@subheading Description
This function returns the amount of system memory in 1k blocks.
Note that this function will return 65535 if the system has more than
64M of memory. This is a limitation of the BIOS.
@subheading Return Value
Bytes of memory / 1024.
@subheading Example
@example
printf("This system has %d bytes of memory\n", biosmemory()/1024);
@end example
@c ----------------------------------------------------------------------
@node biosprint, bios
@heading @code{biosprint}
@subheading Syntax
@example
#include <stdio.h>
int biosprint(int cmd, int byte, int port)
@end example
@subheading Description
@table @asis
@item @var{command} = 0
@code{byte} is sent to parallel port @var{port}.
@item @var{command} = 1
Parallel port @var{port} is reset and initialized.
@item @var{command} = 2
The status of parallel port @var{port} is returned.
@example
7654 3210 Meaning
---- ---X Timeout
---- -XX- Unused
---- X--- I/O Error
---X ---- Selected
--X- ---- Out of paper
-X-- ---- Acknowledged
X--- ---- Idle
@end example
@end table
@subheading Return Value
The printer status.
@subheading Example
@example
while (*c)
biosprint(0, 0, *c++);
@end example
@c ----------------------------------------------------------------------
@node biostime, bios
@heading @code{biostime}
@subheading Syntax
@example
#include <bios.h>
long biostime(int cmd, long newtime);
@end example
@subheading Description
This function reads (@var{cmd}=0) or sets (@var{cmd}=1) the internal
tick counter, which is the number of 18.2 Hz ticks since midnight.
@subheading Return Value
When reading, the number of ticks since midnight.
@subheading Example
@example
long ticks = biostime(0, 0);
@end example
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -