271 lines
14 KiB
Plaintext
271 lines
14 KiB
Plaintext
|
I B M P C B I O S S e r v i c e R o u t i n e s
|
|||
|
|
|||
|
Adapted from IBM Technical Reference Release 11/08/82
|
|||
|
by Roy Smith
|
|||
|
----------------------------------------------------------------------------
|
|||
|
Vector Interrupt BIOS Entry
|
|||
|
Address Number Name label
|
|||
|
----------------------------------------------------------------------------
|
|||
|
00-03 0 Divide by Zero D11
|
|||
|
04-07 1 Single Step D11
|
|||
|
08-0B 2 Nonmaskable NMI_INT
|
|||
|
0C-0F 3 Breakpoint D11
|
|||
|
10-13 4 Overflow D11
|
|||
|
14-17 5 Print Screen PRINT_SCREEN
|
|||
|
18-1B 6 Reserved D11
|
|||
|
1C-1F 7 Reserved D11
|
|||
|
|
|||
|
---- Hardware Service Routines ---------------------------------------------
|
|||
|
20-23 8 Time of Day Service TIMER_INT
|
|||
|
24-27 9 Keyboard Service KB_INT
|
|||
|
28-2B A Reserved D11
|
|||
|
2C-2F B Communications Service COM2: D11
|
|||
|
30-33 C Communications Service COM1: D11
|
|||
|
34-37 D Disk Service D11
|
|||
|
38-3B E Diskette Service DISK_INT
|
|||
|
3C-3F F Printer Service D11
|
|||
|
----------------------------------------------------------------------------
|
|||
|
|
|||
|
40-43 10 Video I/O VIDEO_IO
|
|||
|
44-47 11 Equipment Check EQUIPMENT
|
|||
|
48-4B 12 Memory MEMORY_SIZE_DETERMINE
|
|||
|
4C-4F 13 Diskette/Disk I/O DISKETTE_IO
|
|||
|
50-53 14 Communications RS232_IO
|
|||
|
54-57 15 Cassette CASSETTE_IO
|
|||
|
58-5B 16 Keyboard I/O KEYBOARD_IO
|
|||
|
5C-5F 17 Printer PRINTER_IO
|
|||
|
60-63 18 Resident BASIC F600:0000
|
|||
|
64-67 19 Bootstrap BOOT_STRAP
|
|||
|
68-6B 1A Time of Day TIME_OF_DAY
|
|||
|
6C-6F 1B Keyboard Break DUMMY_RETURN
|
|||
|
70-73 1C Timer Tick (18.2 per second) DUMMY_RETURN
|
|||
|
74-77 1D Video Initialization VIDEO_PARMS
|
|||
|
78-7B 1E Diskette Operating Parameters DISK_BASE
|
|||
|
7C-7F 1F Video Graphics Characters 0
|
|||
|
|
|||
|
+--------------------------------------------------------------------------+
|
|||
|
| I B M P C B I O S I n t e r f a c e R o u t i n e s |
|
|||
|
+--------------------------------------------------------------------------+
|
|||
|
Intr Func In Out Comments
|
|||
|
# (AH) Regs Regs
|
|||
|
|
|||
|
10 --------------- Video I/O ---------------------------------------------
|
|||
|
--- 0 Set CRT Mode
|
|||
|
AL 0=40 x 25 Black & white 1= 40 x 25 Color
|
|||
|
2=80 x 25 Black & white 3= 80 x 25 Color
|
|||
|
4=320 x 200 Medium resolution color
|
|||
|
5=320 x 200 Medium resolution black & white
|
|||
|
6=640 x 200 High resolution black & white
|
|||
|
--- 1 Set Cursor Type
|
|||
|
CH Start scan line (0-7 C/G, 0-14 Mono)
|
|||
|
CL End scan line (set start to 20H for no curs.)
|
|||
|
--- 2 Set Cursor Position
|
|||
|
DH,DL Row, column (0,0 = Home)
|
|||
|
BH Video page
|
|||
|
--- 3 Read Cursor Position
|
|||
|
BH Video page
|
|||
|
DH,DL Row, column (0,0 = Home)
|
|||
|
--- 4 Read Light Pen
|
|||
|
AH 0=Light pen not trig, 1=valid info in regs:
|
|||
|
DH,DL Row, column of character LP position
|
|||
|
CH Raster line
|
|||
|
BX Pixel column (0-319 med-res,0-619 hi-res)
|
|||
|
--- 5 Select Active Page
|
|||
|
AL New page (0-7 for 40x25,0-3 for 80x25)
|
|||
|
--- 6 Scroll Active Page Up
|
|||
|
--- 7 Scroll Active Page Down
|
|||
|
AL Number of lines to scroll (0 if entire screen)
|
|||
|
CH,CL Row, column of upper left corner
|
|||
|
DH,DL Row, column of lower right corner
|
|||
|
BH Attribute to use in blanked lines
|
|||
|
--- 8 Read Attribute / Character at current cursor position
|
|||
|
BH Video page
|
|||
|
AL Character read
|
|||
|
AH Attribute of char (alpha modes only)
|
|||
|
--- 9 Write Attribute / Character at current cursor position
|
|||
|
BH Video page
|
|||
|
CX Count of characters to write
|
|||
|
AL Character to write
|
|||
|
BL Attribute to write
|
|||
|
--- A Write Character only at current cursor position
|
|||
|
BH Video page
|
|||
|
CX Count of characters to write
|
|||
|
AL Character to write
|
|||
|
--- B Set Color Palette
|
|||
|
BH Palette color ID being set
|
|||
|
BL Color value to be used with that color ID
|
|||
|
--- C Write Dot
|
|||
|
DX,CX Row, column number
|
|||
|
AL Color value (If bit 7=1, value is OR'ed in)
|
|||
|
--- D Read Dot
|
|||
|
DX,CX Row, column number
|
|||
|
AL Dot read
|
|||
|
--- E Write Teletype to Active Page
|
|||
|
AL Character to write
|
|||
|
BL Foreground color in graphics mode
|
|||
|
--- F Get Current Video State
|
|||
|
AL Mode currently set (see func. 0)
|
|||
|
AH Columns on screen
|
|||
|
|
|||
|
+--------------------------------------------------------------------------+
|
|||
|
| I B M P C B I O S I n t e r f a c e R o u t i n e s |
|
|||
|
+--------------------------------------------------------------------------+
|
|||
|
Intr Func In Out Comments
|
|||
|
# (AH) Regs Regs
|
|||
|
|
|||
|
11 -------------------------------------------------+
|
|||
|
Intr Func In Out Comments
|
|||
|
# (AH) Regs Regs
|
|||
|
|
|||
|
11 --------------- Equipment ---------------------------------------------
|
|||
|
None
|
|||
|
AX Equipment attached : Bits set as follows
|
|||
|
A H A L
|
|||
|
0 0 X 0 0 0 0 X 0 0 0 0 0 0 X 0
|
|||
|
--- - ----- --- --- --- -
|
|||
|
1 2 3 4 5 6 7
|
|||
|
|
|||
|
1 Number of printers
|
|||
|
2 Game I/O
|
|||
|
3 RS232 cards
|
|||
|
4 Drives
|
|||
|
5 Initial video mode
|
|||
|
6 System board RAM
|
|||
|
7 IPL from diskette
|
|||
|
|
|||
|
12 -------------- Memory Size ---------------------------------------------
|
|||
|
None
|
|||
|
AX Number of bytes in Kbytes
|
|||
|
|
|||
|
13 ------------- Diskette I/O ---------------------------------------------
|
|||
|
--- 0 Reset Diskette System
|
|||
|
None None Hard resets all diskette drives, recal req'd
|
|||
|
--- 1 Read Diskette Status
|
|||
|
AL Status byte : Bits set as follows
|
|||
|
80 Attachment failed to respond
|
|||
|
40 Seek operation failed
|
|||
|
20 NEC controller failure
|
|||
|
10 Bad CRC on diskette read
|
|||
|
09 Attempt to DMA across a 64k bound
|
|||
|
08 DMA overrun on operation
|
|||
|
04 DMA overrun on operation
|
|||
|
03 Write attempted on wrt prot disk
|
|||
|
02 Address mark not found
|
|||
|
01 Bad command passed to diskette I/O
|
|||
|
|
|||
|
--- 2 Read the desired sectors into memory
|
|||
|
--- 3 Write the desired sectors from memory
|
|||
|
--- 4 Verify the desired sectors
|
|||
|
--- 5 Format the desired track
|
|||
|
|
|||
|
DL Drive number (0-3)
|
|||
|
DH Head number
|
|||
|
CH Track number
|
|||
|
CL Sector number
|
|||
|
AL Number of sectors (not used for format)
|
|||
|
ES:BX Address of buffer (not used for verify)
|
|||
|
|
|||
|
AH Status of operation (see above)
|
|||
|
CY 1 if failed, 0 if ok
|
|||
|
|
|||
|
+--------------------------------------------------------------------------+
|
|||
|
| I B M P C B I O S I n t e r f a c e R o u t i n e s |
|
|||
|
+--------------------------------------------------------------------------+
|
|||
|
Intr Func In Out Comments
|
|||
|
# (AH) Regs Regs
|
|||
|
|
|||
|
14 ------------- RS-232 I/O -----------------------------------------------
|
|||
|
--- 0 Initialize Communications Port
|
|||
|
DX Interface card (0=COM1:, 1=COM2:)
|
|||
|
AL Parameters to set up : Bits are as follows
|
|||
|
A L
|
|||
|
0 0 0 0 0 0 0 0
|
|||
|
--- - --- -----
|
|||
|
1 2 3 4
|
|||
|
|
|||
|
1 Word length (10=7 bit, 11=8 bit)
|
|||
|
2 Stopbits (0=1, 1=2)
|
|||
|
3 Parity (00=none, gth (10=7 bit, 11=8 bit)
|
|||
|
2 Stopbits (0=1, 1=2)
|
|||
|
3 Parity (00=none, 01=odd, 11=even)
|
|||
|
4 Baud (000=110, 001=150, 010=300, 011=600,
|
|||
|
100=1200, 101=2400, 110=4800, 111=9600)
|
|||
|
|
|||
|
AH Set as in status (call 3)
|
|||
|
--- 1 Send Character to 100=1200, 101=2400, 110=4800, 111=9600)
|
|||
|
|
|||
|
AH Set as in status (call 3)
|
|||
|
--- 1 Send Character to Communications Line
|
|||
|
DX Interface card (0=COM1:, 1=COM2:)
|
|||
|
AL Character to send
|
|||
|
AH Set as in status (call 3)
|
|||
|
--- 2 Recieve Character from Communications Line
|
|||
|
DX Interface card (0=COM1:, 1=COM2:)
|
|||
|
AL Character
|
|||
|
AH 0 if no error, set as status if nonzero
|
|||
|
--- 3 Get Communications Status
|
|||
|
DX Interface card (0=COM1:, 1=COM2:)
|
|||
|
AH Line status : Bits set as follows
|
|||
|
80 Time out
|
|||
|
40 Transmit shift reg empty
|
|||
|
20 Transmit holding reg empty
|
|||
|
10 Break detect
|
|||
|
08 Framing error
|
|||
|
04 Parity error
|
|||
|
02 Overrun error
|
|||
|
01 Data ready
|
|||
|
|
|||
|
AL Modem status : Bits set as follows
|
|||
|
80 Recieved line signal detect
|
|||
|
40 Ring indicator
|
|||
|
20 Data set ready
|
|||
|
10 Clear to send
|
|||
|
08 Delta recieved line signal detect
|
|||
|
04 Trailing edge ring detector
|
|||
|
02 Delta data set ready
|
|||
|
01 Delta clear to send
|
|||
|
|
|||
|
15 ----------- Cassette I/O ----( Obsolete )-------------------------------
|
|||
|
|
|||
|
+--------------------------------------------------------------------------+
|
|||
|
| I B M P C B I O S I n t e r f a c e R o u t i n e s |
|
|||
|
+--------------------------------------------------------------------------+
|
|||
|
Intr Func In Out Comments
|
|||
|
# (AH) Regs Regs
|
|||
|
|
|||
|
16 ----------- Keyboard I/O -----------------------------------------------
|
|||
|
--- 0 Read Next Character
|
|||
|
AL Character struck
|
|||
|
AH Scan code of key
|
|||
|
--- 1 Check Typeahead Status
|
|||
|
ZF 1 if no key available, 0 if key available
|
|||
|
AL,AH Character/Scan code if available. Keystroke
|
|||
|
remains in buffer.
|
|||
|
--- 2 Get Current Shift Status
|
|||
|
AL Shift flag status : Bits set as follows
|
|||
|
80 Insert state
|
|||
|
40 Caps lock state
|
|||
|
20 Num lock state
|
|||
|
10 Scroll lock state
|
|||
|
08 Alt shift is depressed
|
|||
|
04 Ctl shift is depressed
|
|||
|
02 Left shift is depressed
|
|||
|
01 Right shift is depressed
|
|||
|
|
|||
|
17 ----------- Printer I/O ------------------------------------------------
|
|||
|
--- 0 Print Character
|
|||
|
DX Printer to be used (0,1,2)
|
|||
|
AL Character to print
|
|||
|
AH Status set as in call 2
|
|||
|
--- 1 Initialize Printer Port
|
|||
|
DX Printer to be used (0,1,2)
|
|||
|
AH Status set as in call 2
|
|||
|
--- 2 Get Printer Status
|
|||
|
DX Printer to be used (0,1,2)
|
|||
|
AH Printer status : Bits set as follows
|
|||
|
80 Not busy (ready?)
|
|||
|
40 Acknowledge
|
|||
|
20 Out of paper
|
|||
|
10 Selected
|
|||
|
08 I/O error
|
|||
|
01 Time out
|