mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
Merge branch 'develop'
This commit is contained in:
107
doc-collection/interrupts/interrupt.ils
Normal file
107
doc-collection/interrupts/interrupt.ils
Normal file
@@ -0,0 +1,107 @@
|
||||
/* test comment */
|
||||
// test comment
|
||||
|
||||
/* yeah, using a bit of syntax inspiration from Perl */
|
||||
exit unless global dialect == "interrupt list"; /* this is a list of interrupts, do not parse otherwise, just quietly exit with success */
|
||||
|
||||
/* IBM PC BIOS interrupt list */
|
||||
if global platform == "ibm-pc" {
|
||||
interrupt 0x10 {
|
||||
type software;
|
||||
name "Video BIOS";
|
||||
description "Video and video related BIOS functions";
|
||||
select by register ah {
|
||||
case 0x00 {
|
||||
name "Set video mode";
|
||||
input {
|
||||
register al bits [6:0] type integer;
|
||||
name "Video mode";
|
||||
}
|
||||
input {
|
||||
register al bit 7 type !flag; /* set bit to NOT clear video memory */
|
||||
name "Clear video memory";
|
||||
}
|
||||
}
|
||||
case 0x01 {
|
||||
name "Set text mode cursor shape";
|
||||
input {
|
||||
register ch bits [4:0] type integer;
|
||||
name "Top scan line of the cursor, inclusive";
|
||||
}
|
||||
input {
|
||||
register cl bits [4:0] type integer;
|
||||
name "Bottom scan line of the cursor, inclusive";
|
||||
}
|
||||
input {
|
||||
register ch bits [6:5] type integer;
|
||||
name "Cursor blink and invisibility control";
|
||||
if (global videoclass is one of "cga" or "mda") {
|
||||
enum {
|
||||
00b = "normal",
|
||||
01b = "invisible",
|
||||
10b = "erratic blink",
|
||||
11b = "slow blink"
|
||||
}
|
||||
}
|
||||
else {
|
||||
enum {
|
||||
00b = "normal",
|
||||
else = "invisible"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case 0x02 {
|
||||
name "Set cursor position";
|
||||
input {
|
||||
register bh type integer;
|
||||
name "Page number";
|
||||
}
|
||||
input {
|
||||
register dh type integer;
|
||||
name "Row number";
|
||||
description "Row number from top of screen";
|
||||
integer base 0;
|
||||
}
|
||||
input {
|
||||
register dl type integer;
|
||||
name "Column number";
|
||||
description "Column number from left side of screen";
|
||||
integer base 0;
|
||||
}
|
||||
}
|
||||
case 0x03 {
|
||||
name "Get cursor size and position";
|
||||
input {
|
||||
register bh type integer;
|
||||
name "Page number";
|
||||
}
|
||||
output {
|
||||
register ch type integer;
|
||||
name "Top scan line of the cursor, inclusive";
|
||||
}
|
||||
output {
|
||||
register cl type integer;
|
||||
name "Bottom scan line of the cursor, inclusive";
|
||||
}
|
||||
output {
|
||||
register dh type integer;
|
||||
name "Row number";
|
||||
description "Row number from top of screen";
|
||||
integer base 0;
|
||||
}
|
||||
output {
|
||||
register dl type integer;
|
||||
name "Column number";
|
||||
description "Column number from left side of screen";
|
||||
integer base 0;
|
||||
}
|
||||
modified {
|
||||
note "Phoenix BIOS: AX = 0000h (ref. Ralph Brown Interrupt List)";
|
||||
register ax;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,2 +0,0 @@
|
||||
Experimental machine-parsable script to describe interrupts. Syntax is not yet
|
||||
standardized.
|
@@ -1,186 +0,0 @@
|
||||
|
||||
category "MS-DOS";
|
||||
arch "x86" mode "16-bit";
|
||||
description "Machine-parsable list of MS-DOS interrupt calls";
|
||||
charset_encoding "UTF-8"; /* default */
|
||||
|
||||
define var "SDA" {
|
||||
type "farptr 16:16"; /* 16;16 FAR pointer */
|
||||
name "Swappable Data Area";
|
||||
description "A portion of the MS-DOS data segment that can be swapped in and out";
|
||||
}
|
||||
|
||||
define var "DTA" {
|
||||
type "farptr 16:16"; /* 16:16 FAR pointer */
|
||||
name "Disk Transfer Address";
|
||||
description "Memory location where disk transfers and other API functions may occur";
|
||||
stored in SDA;
|
||||
}
|
||||
|
||||
define var "PSP" {
|
||||
type segment;
|
||||
name "Program Segment Prefix";
|
||||
description "A 256-byte region of memory used to carry a program's initial state and command line. Always referred to by 16-bit FAR pointer PSP:0";
|
||||
stored in SDA;
|
||||
}
|
||||
|
||||
define var "dos_version" {
|
||||
type version;
|
||||
name "DOS version, major.minor format";
|
||||
}
|
||||
|
||||
define var "dos_reported_version" {
|
||||
type version;
|
||||
name "DOS version, major.minor format reported through the standard INT 21h call";
|
||||
}
|
||||
|
||||
define var "dos_errorlevel" {
|
||||
type uint8_t;
|
||||
name "ERRORLEVEL aka process return code on exit";
|
||||
}
|
||||
|
||||
define citation "rbil" {
|
||||
name "Ralph Brown Interrupt List";
|
||||
publication_date "2000/07/16";
|
||||
copyright "1989-2000";
|
||||
author "Ralph Brown";
|
||||
web reference "http://www.cs.cmu.edu/~ralf/files.html";
|
||||
web reference "http://hackipedia.org/browse.cgi/Computer/Platform/PC%2c%20IBM%20compatible/Collections/Ralph%20Brown%20Interrupt%20List%20%282000%2d07%2d16%29%20Release%2061/Original%20files" backup;
|
||||
web reference "http://ctyme.com/rbrown.htm" alternative;
|
||||
}
|
||||
|
||||
define citation "msdncd92" {
|
||||
name "Microsoft Developer Network CD Fall 1992";
|
||||
copyright "1992";
|
||||
author "Microsoft Corporation";
|
||||
}
|
||||
|
||||
define citation "programmerpcsourcebook2nd" {
|
||||
name "The Programmer's PC Sourcebook, 2nd Edition, Microsoft Press";
|
||||
copyright "1991";
|
||||
author "Thom Hogan";
|
||||
isbn "1-55615-321-X";
|
||||
purchase url "https://www.amazon.com/Programmers-Sourcebook-Reference-Compatibles-EISA-based/dp/155615321X";
|
||||
}
|
||||
|
||||
interrupt "MS-DOS INT 20" {
|
||||
name "INT 20h DOS Terminte process";
|
||||
interrupt number value 0x20;
|
||||
input segment register CS {
|
||||
content "PSP segment" type segment;
|
||||
description "PSP segment of process to terminate";
|
||||
}
|
||||
output var dos_errorlevel {
|
||||
content value 0x00;
|
||||
description "Return code set to 00h";
|
||||
}
|
||||
exists if dos_version >= version(1.0);
|
||||
description "Terminate the process. Return code aka error level is set to 00h.";
|
||||
see also interrupt "MS-DOS INT 21" select by register AH value 0x00;
|
||||
}
|
||||
|
||||
interrupt "MS-DOS INT 21" {
|
||||
name "INT 21h DOS system interrupt";
|
||||
interrupt number value 0x21;
|
||||
select by register AH {
|
||||
|
||||
value 0x00 {
|
||||
name "Terminate program";
|
||||
input segment register CS {
|
||||
content "PSP segment";
|
||||
description "PSP segment of process to terminate";
|
||||
}
|
||||
output var dos_errorlevel {
|
||||
content value 0x00;
|
||||
description "Return code set to 00h";
|
||||
}
|
||||
exists if dos_version >= version(1.0);
|
||||
description "Terminate the process. Return code aka error level is set to 00h.";
|
||||
|
||||
notes "Microsoft recommends using INT 21/AH=4Ch for DOS 2+. This function sets the program's return code (ERRORLEVEL) to 00h. Execution continues at the address stored in INT 22 after DOS performs whatever cleanup it needs to do (restoring the INT 22,INT 23,INT 24 vectors from the PSP assumed to be located at offset 0000h in the segment indicated by the stack copy of CS, etc.). If the PSP is its own parent, the process's memory is not freed; if INT 22 additionally points into the terminating program, the process is effectively NOT terminated. Not supported by MS Windows 3.0 DOSX.EXE DOS extender" citation rbil;
|
||||
|
||||
/* The <<:"_EOF" .. "_EOF":>> syntax is loosely based on bash shell semantics as a way to support large multi-line string constants without having to escape all the time.
|
||||
However it is <<:"_EOF" .. "_EOF":>> to ensure it cannot be confused with expression syntax and to make it more explicit the beginning and end. */
|
||||
notes <<:"_EOF" Terminates the current process. This is one of several methods that a program can use to perform a final exit. MS-DOS then takes the following actions:
|
||||
|
||||
All memory belonging to the process is released.
|
||||
File buffers are flushed and any open handles for files or devices owned by the process are closed.
|
||||
The termination handler vector (Int 22H) is restored from PSP:000AH.
|
||||
The Ctrl-C handler vector (Int 23H) is restored from PSP:000EH.
|
||||
[2.0+] The critical-error handler vector (Int 24H) is restored from PSP:0012H.
|
||||
Control is transferred to the termination handler.
|
||||
|
||||
If the program is returning to COMMAND.COM, control transfers to the resident portion, and the transient portion is reloaded if necessary. If a batch file is in progress, the next line of the file is fetched and interpreted; otherwise, a prompt is issued for the next user command.
|
||||
|
||||
Any files that have been written to using FCBs should be closed before performing this exit call; otherwise, data may be lost.
|
||||
[3.0+] If the program is running on a network, it should remove all locks it has placed on file regions before terminating. "_EOF":>> citation msdncd92;
|
||||
}
|
||||
|
||||
value 0x01 {
|
||||
name "Read character from standard input, with echo";
|
||||
output register AL {
|
||||
content "character" type uint8_t;
|
||||
description "Character value read";
|
||||
}
|
||||
exists if dos_version >= version(1.0);
|
||||
description "Read from STDIN, with CTRL+C/CTRL+BREAK checking and some CTRL combinations handled by the console automatically";
|
||||
|
||||
notes "^C/^Break are checked, and INT 23 executed if read. ^P toggles the DOS-internal echo-to-printer flag. ^Z is not interpreted, thus not causing an EOF if input is redirected. Character is echoed to standard output. Standard input is always the keyboard and standard output the screen under DOS 1.x, but they may be redirected under DOS 2+" citation rbil;
|
||||
|
||||
notes <<:"_EOF" [1] Inputs a character from the keyboard, then echoes it to the display. If no character is ready, waits until one is available.
|
||||
[2.0+] Reads a character from the standard input device and echoes it to the standard output device. If no character is ready, waits until one is available. Input can be redirected. (If input has been redirected, there is no way to detect EOF.)
|
||||
|
||||
If the standard input is not redirected, and the character read is a Ctrl-C, an Int 23H is executed. If the standard input is redirected, a Ctrl-C is detected at the console, and BREAK is ON, an Int 23H is executed.
|
||||
|
||||
To read extended ASCII codes (such as the special function keys F1 to F10) on the IBM PC and compatibles, you must call this function twice. The first call returns the value 00H to signal the presence of an extended code.
|
||||
[2.0+] You can also read the keyboard by issuing a read (Int 21H Function 3FH) using the predefined handle for the standard input (0000H), if input has not been redirected, or a handle obtained by opening the logical device CON. "_EOF":>> citation msdncd92;
|
||||
}
|
||||
|
||||
value 0x02 {
|
||||
name "Write character to standard output";
|
||||
input register DL {
|
||||
content "character" type uint8_t;
|
||||
description "Character value to write";
|
||||
}
|
||||
output register AL citation rbil {
|
||||
content "character" type uint8_t;
|
||||
exists if dos_version >= version(2.1);
|
||||
description "Last character output, despite official docs which state nothing is returned. MS-DOS 2.1 to 7.0 at least.";
|
||||
}
|
||||
exists if dos_version >= version(1.0);
|
||||
description "Write to STDOUT, with CTRL+C/CTRL+BREAK checking";
|
||||
|
||||
notes "^C/^Break are checked, and INT 23 executed if pressed. Standard output is always the screen under DOS 1.x, but may be redirected under DOS 2+. The last character output will be the character in DL unless DL=09h on entry, in which case AL=20h as tabs are expanded to blanks. If standard output is redirected to a file, no error checks (write- protected, full media, etc.) are performed" citation rbil;
|
||||
|
||||
notes <<:"_EOF" [1] Outputs a character to the currently active video display.
|
||||
[2.0+] Outputs a character to the standard output device. Output can be redirected. (If output is redirected, there is no way to detect disk full.)
|
||||
|
||||
If a Ctrl-C is detected at the keyboard after the requested character is output, an Int 23H is executed.
|
||||
|
||||
If the standard output has not been redirected, a backspace code (08H) causes the cursor to move left one position. If output has been redirected, the backspace code does not receive any special treatment.
|
||||
[2.0+] You can also send strings to the display by performing a write (Int 21H Function 40H) using the predefined handle for the standard output (0001H), if output has not been redirected, or a handle obtained by opening the logical device CON. "_EOF":>> citation msdncd92;
|
||||
}
|
||||
|
||||
value 0x03 {
|
||||
name "Read character from STDAUX";
|
||||
output register AL {
|
||||
content "character" type uint8_t;
|
||||
description "Character value read";
|
||||
}
|
||||
exists if dos_version >= version(1.0);
|
||||
|
||||
notes "Keyboard checked for ^C/^Break, and INT 23 executed if detected. STDAUX is usually the first serial port" citation rbil;
|
||||
|
||||
notes <<:"_EOF" [1] Reads a character from the first serial port.
|
||||
[2.0+] Reads a character from the standard auxiliary device. The default is the first serial port (COM1).
|
||||
|
||||
In most MS-DOS systems, the serial device is unbuffered and is not interrupt-driven. If the auxiliary device sends data faster than your program can process it, characters may be lost.
|
||||
At startup on the IBM PC, PC-DOS initializes the first serial port to 2400 baud, no parity, 1 stop bit, and 8 data bits. Other implementations of MS-DOS may initialize the serial device differently.
|
||||
There is no way for a user program to read the status of the auxiliary device or to detect I/O errors (such as lost characters) through this function call. On the IBM PC, more precise control can be obtained by calling ROM BIOS Int 14H or by driving the communications controller directly.
|
||||
|
||||
If a Ctrl-C is detected at the keyboard, an Int 23H is executed.
|
||||
[2.0+] You can also input from the auxiliary device by requesting a read (Int 21H Function 3FH) using the predefined handle for the standard auxiliary device (0003H) or using a handle obtained by opening the logical device AUX. "_EOF":>> citation msdncd92;
|
||||
}
|
||||
} /* end select by "AH" */
|
||||
} /* end "MS-DOS INT 21" */
|
||||
|
Reference in New Issue
Block a user