C interface subroutine, the library is: dos.h, bios.h

xiaoxiao2021-03-06  70

Interface subroutine, the library is: dos.h, bios.hunsigned sleep (unsigned seconds) Pause Seconds microseconds (one percent) Int unlink (char * filename) delete file filenameunsigned fp_off (Void Far * Farptr) this The function used to take far pointer Farptr's offset unsigned fp_seg (Void Far * Farptr) This function is used to set the value Void FAR * mk_fp (unsigned seg, unsigned off) according to segment SEG and offset OFF according to segment SEG and offset OFF Construct a FAR pointer unsigned getPSP () section address of the sequence sequence prefix, and return this address char * PARSFNM (CHAR * CMDLINE, STRUCT FCB * FCBPTR, INT OPTION) Function Analysis of a string, usually, for a file name It is a command line referred to by cmdline. The file name is put in a FCB as a drive, file name, and extension. Fcb is specified by the FCBPTR. Option parameter is the value of the DOS analysis system call, Al text value .

INT Absread (int DRID * BUFFER) This function function is read to read a specific disk sector, Drive is the driver number (0 = a, 1 = b, etc.), NSECTS is the number of sectors to read. SectNO starts logo area number, buffer to save the save space of the read data Int AbsWrite (int DRIVE, INT NSECTS, INT Sectno, Void * Buffer) This function is written to write a specific disk sector, Drive is the drive letter. (0 = a, 1 = b, etc.), nsects is the number of sectors to be written, and SECTNO starts logical fan area number, buffer is the space of the Save the space Void getDFree (int Drive, Struct Dfree * DFreeP) this The function is used to take the free space of the disk, and Drive is a disk number (0 = Current, 1 = A, etc.). The function puts the DFREE structure of the disk characteristic by DFreeP. DFree structure is as follows: ┌───────── ────────── ┐ │STRUCT DFREE │ │ {│ │ unsigned df_avail; / * Useful cluster number * / │ │ unsigned df_total; / * total cluster number * / │ │ unsigned DF_BSEC; / * Each sector byout the number * / │ unsigned df_sclus; / * The number of sectors per cluster * / │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Char Far * getdta () Take the disk conversion address DTAVOID SETDTA (CHAR FAR * DTA) Set Disk Transformation Address DTAVOID GETFAT (INT Drive, Fatinfo * Fatblkp) This function returns the specified drive Drive (0 = Current, 1 = A, 2 = B The file allocation table information is stored in FATBLKP, the structure As follows: ┌ --─────────── │ │ {│ │ Char Fi_SClus; / * Each cluster sector * / │ │ CHAR FI_FAC; / * File allocation table bytes * / │ │ │ │ │ in │ │ 字 * / │ │} │ └─────────── ───────── ─ ┘void getfatd (Struct Fatinfo * FatBLKP) This function returns the file allocation table information of the current drive, and stores the structure FATBLKP, the structure is as follows: ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ──────── ┐ │STRUCT FATINFO │ │ {│ │ CHAR FI_SCLUS; / * Each cluster sector number * / │ │ char fi_fatid; / * File allocation table byte * / │ │ INT FI_NCLUS; / * Number of clusters * / │ │ INT FI_BYSEC;

/ * Each sector byout the number * / │ │} │ └ --───────────────────────────────────────────────────────────────────────────────────────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─te The MSDOS system is called, and DOSDX is the value of the register DX. Dosal is the value of the register Al, and the dosfun is called the function number INT BDOSPTR (INT DOSFUN, VOID * ARGUMENT, UNSIIGNED DOSAL) This function is called, and argument is the value of the register DX. , DOSAL is the value of the register Al, DOSFUN is executed in the function number int inru, the INTR_NUM number is interrupted, and the user-defined register value is stored in the structure inregs, and will return after execution. The register value is stored in the structure Outregs. Int INT86X (INT INTR_NUM, UNION REGS * INREGS, Union Regs * OUTREGS, STRUCT SREGS * SegRegs) Execute the INTR_NUM number interrupt, and the user-defined register value is stored in the structure inregs and the structure Segregs, execute Follow the returned register values ​​in Outregs. InTdos (Union Regs * INREGS, UNION REGS * OUTREGS) This function performs the DOS interrupt 0x21 to call a specified DOS function, and the user-defined register value exists in INREGS. After the function is executed, the return register value is stored in the structure Outregs INT INTDOSX (Union Regs * INREGS, UNION REGS * OUTREGS, STRUCT SREGS * SegRegs) This function performs DOS interrupt 0x21 to call a specified DOS function, user-defined The register value is stored in the structure inRegs and Segregs, and the function is executed to save the returned register value in the structure of Void INTR (int INTR_NUM, STRUCT Regpack * preg). The 8086 software interrupt interface can produce a 8086 software interrupt specified by the parameter INTR_NUM. The function replicates the user-defined register value to each register before executing the software interrupt. After the software is broken, the function will currently have the current registers. The value is copied to the structure preg. The parameter is as follows: INTR_NUM executed interrupt number preg is the structure of saving user-defined register values ​​- ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─ ┐ │STRUCT Regpa │ │ {│ │ unsigned R_ax, R_BX, R_CX, R_DX; │ │ Unsigned R_BP, R_SI, R_DI, R_DS, R_ES, R_FLAGS;

│ │} │ └ - ───────────────────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ Size returns to MSDOS in Status, but the program remains in memory, the occupied space is determined by Size .void CtrlBRK (int (* fptr) ()) Set the interrupt handler after the interrupt. VOID Disable () is disabled. An interrupt VOID enable () allows interrupt VOID GENINTERRUPT (INT INTR_NUM) to execute the software displayed by INTR_NUM (* getvect (int INTR_NUM)) () returns an interrupt handler for INTR_NUM, for example: OLD_INT_10H = GetVect (0x10); Void setVect (int INTR_NUM, VOID INTERRUPT (* ISR) ()) Set the interrupt code INTR_NUM is ISR, for example: setVect (0x10, new_int_10h); Void Harderr (int (* fptr) )) Define a hardware error handler, whenever an error occurs, calling the program void hardresume (int tent "hardware error handle processing function void hardretn hardware error handler Int Inport (int prot) from the specified Enter a word in the input port and return this word int inportb (int port) to read a byte from the specified input port, and return this byte void output (int port, int Word) Word Word write the specified output port portvoid outportb (int port, char byte) write the byte to the specified output port portint peek (int segment, unsigned offset) function returns the segment: char offset word at a peekb (int segment, unsigned offset) function returns the segment : A byte Void Poke (int segment, int offset, char value) at the Offset Write the word value to segment: offset Void Pokeb (int segment, int offset, int value) Write byte value to segment: offset INT randbrd (struct fcb * fcbptr, int RECCNT) function is written to the FCB of the FCBWR (Struct) function referring to the FCBWR (Struct) function referred to in the FCBPTR to write the RECCNT record in the FCB referred to in FCBPTR to disk. The Void Segread (STRUCT SREGS * SEGTBL) function puts the current value of the segment register into the structure of the int GETVERIFY () to take the inspection mark (0 = inspection, 1 = verification Open) Void setVerify (int value) settings Inspection status, Value is 0 indicates a closing test, and the current setting of the Open Test INT getcBRK () This function returns the current setting of the control interrupt detection for setting the control interrupt detection to turn it on or disconnects when Value = 0, for disconnection. When value = 1, for the detection

INT DOSEXTERR (STRUCT DOSERR * EBLKP) takes an extended error. After the DOS error occurs, this function fills the extended error message in the Doserr structure referred to EBLKP. This structure is defined as follows: ┌──────── ─ ─ ┐ │STRUCT DOSERR │ │ {│ │ Int EXTERROR; / * Extension error * / │ │ │ │ │ │ 错 错 错 类 * / │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ar * Error / │ │} │ └───────────────────────────────── This function is responsible for the communication of data, CMD can be the following Value: 0 Communication parameters as byte BYTE Value 1 Send Characters By communication line output 2 Retrieve character 3 from the communication line Returns the communication port, port = 0 When the communication port is COM1, Port = 1 When the communication port For COM2, the parameters when transmitting or receiving data is to transmit or receive data, and the combination of the following bit: ┌ - ─ ───────────────────────── ┐ │BYTE Value │ meaning │BYTE Value │ meaning │BYTE Value │ Significance │ │ ├─ ──────────────────────────────────── ┤ │0x02 │7 data │0x03 │8 data │0x00 │1 stop │ │ │0X04 │2 stop │0x00 │ 无 奇 │0x08 │ odd parity │ │ │0X18 │ 数 奇性 │0x00 │ 110 baud │0x20 │150 Baud │ │ │0x40 │ 300 baud │0x60 │600 baud │0x80 │1200 baud │ │ │0xa0 │2400 baud │0xc0 │4800 baud │0XE0 │9600 Baud │ │ └ - ┴─────────────────────────────────── ─ ┴──────────────── ┘, for example: 0xE0 | 0x08 | 0x00 | 0x03 means that the communication port is 9600 baud, odd parity, 1 stop bit, 8 data bits. Function The return value is a 16-bit integer, defined as follows: 15th time timeout 14th transfer shift register empty line 13 Interrupt Detection of the 11th frame error 10th parity Error 9th overload operation Error 8th Data Ready Section 7 Receive Line Signal Detection of the 6th Ring Indicator Fifth Bit Data Setting Ready 4th Clear Send The third bit δ receiving line signal detector The second bit falling edge ring detector No. 1 Δ Data Setting Ready 0th Bit δ Clear Send

INT BiosDisk (int CMD, int DRIVE, INT NSECTS, VOID * BUFFER) This function is used to make a certain operation for the drive, the cmd is the function number, Drive is the drive letter (0 = A, 1 = B, 0x80 = C, 0x81 = D, 0x82 = E, etc.). Cmd can be the following value: 0 Reset Soft Disk System. This is forced the drive controller to perform hard reset. Ignore all other parameters. 1 Return the last hard disk Operating status. Ignore all other parameters 2 read one or more disk sectors to memory. The sector read is given by Head, Track, Sector. The sector number is given by nsects. Reading 512 bytes of data of each sector into buffer 3 writes from memory read data to one or more sectors. The sector written by Write is given by Head, Track, and Sector. The sector number is given by nsects. Write data in Buffer, 512 bytes per sector. 4 Test one or more sectors. Start the sector by Head, Track, Sector. The sector number is given by nsects. 5 Format a track, which is given by Head and Track. Buffer points a table to the sector header written on the specified track. The following CMD values ​​are only allowed for XT or AT microcomputers: 6 formatted a track, and set a bad sector flag. 7 Format the beginning of the drive on the specified track. 8 Returns the current drive parameter, the drive information returns to the buffer (indicated in four bytes). 9 Initialize a pair of driver characteristics. 10 Perform a long reading, each sector reading 512 plus 4 additional bytes 11 Perform a long writing, each sector write 512 plus 4 additional bytes 12 Perform a disk lookup 13 alternate disk reset 14 read fan District buffer 15 write sector buffer 16 Check that the specified drive is ready 17 Review Drive 18 Controller RAM Diagnostics 19 Drive Diagnostics 20 Controller The internal diagnosis function returns the status byte of the following bits: 0x00 operation success 0x01 bad Command 0x02 address tags Can't find 0x04 records Can't find 0x05 Reset failure 0x07 Drive Parameters Activity Failure 0x09 Attempt DMA At 64K Limit 0x0B Check DBR Tag 0x10 Direct ECC Reads 0x11 ECC Correction Data Errors (Note It Not an error) 0x20 controller failure 0x40 lookup failed 0x80 response connection failed 0XBB unfained error 0xFF read operation failed

INT biodquip () checks the device, the function returns a byte, which represents a message, as follows: 15th printer number 14th printer number 13th unworthoped game I / O No. 11 The 8th bit of the RS232 port number did not use the seventh-bit soft disk number sixth-bit soft disk number, 00 is No. 1 driver, 01 is 2 drivers, 10 is driven, 11 is the 5th digit of the No. 4 driver. 4th Display mode 00 is not used, 01 is 40x25bw color display card 10 is 80x25bw color display card, 11 is 80x25bw monochrome display card 3rd mother hose second random memory capacity, 00 is 16K, 01 is 32K, 10 is 48K, 11 is 64K First Pointers to Point Shared Processors 0 bits From Soft Disk Guide INT Bioskey (int CMD) This function is used to perform various keyboard operations, determined by CMD. The CMD can be the following value: 0 Returns the next button on the keyboard. If the low 8 bits are non-0, it is an ASCII character; if the low 8 bits are 0, return the expanded keyboard code. 1 Test if the keyboard can be used to read. Returns 0 indicates that there is no key to be available; otherwise returns the next knock key value. The knock key itself keeps the value returned by the Bioskey, which is 0, the CMD value of the next call. 2 Returns the current keyboard status, which is represented by each bit of an integer, see the table: ┌ - ┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ 0 0 意 意 意 1 1 意 意 意 意 意 状态 ┼ ┼ 状态 状态 ┼ ┼ 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态 状态│ 大写 │ │ 5 │ Digital Status, Numlock Lights Light │ Corbital Status, Numlock Lights Off - │ │ 4 │Scrollock Lights Light │Scrolllock Lights Off │ │ 3 │ALT Press │ALT Unpaid │ │ │CTRL Press Lower │CTRL unpub │ │ 1 │ left Shift Press │ Left Shift Unforce │ │ 0 │ Right Shift Press │ Right Shift Unforgettable │ └ - ┴──────── ┴──────────── ─ ┘int biosmemory () Returns the memory size, in K.int BiospRINT (INT CMD, INT BYTE, INT Port) Controls the input / output of the printer. Port is the printer number, 0 is LPT1, 1 is LPT2, 2 is LPT3 and other CMDs may be the following value: 0 print characters, send character BYTE to the printer 1 Printer port Initialization 2 Read the printer status function Return value consisting of the following bit value indicating the current printer status 0x01 device Time timeout 0x08 input / output error 0x10 selected 0x20 paper 0x40 recognition 0x80 is not busy

INT Biostime (int cmd, long newtime) control, cmd is functional number, can return the current value of the timer for the following value 0 Function 1 Set the timer to a new value NewTIMESTRUCT Country * Country (int COUNTRYCMODE, STRUCTRY * Countryp This function is used to control information about a country, such as date, time, currency, etc. If countryp = -1, the current country is set to countrycode value (must be non-0). Otherwise, the country pointed to by Countryp The structure is filled with the following national related information: (1) Current country (if countrycode is 0 or 2) by Countrycode, the country is given. Structure country defines the following: ┌ --──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ───────┐ │struct country │ │ {│ │ int co_date; / * date format * / │ │ char co_curr [5]; / * currency symbols * / │ │ char co_thsep [2]; / * number Delivery * / │ │ / * Decan points * / │ │ CHAR CO_DTSEP [2]; / * Date Separator * / │ │ CHAR CO_TMSEP [2]; / * Time Delivery * / │ │ Char CO_CURRSTYLE; / * Monetary Form * / │ │ CHAR CO_DIGITS; / * Valid Number * / │ │ INT (FAR * CO_CASE) (); / * Event Processing Function * / │ │ CHAR CO_DASEP; / * Data Separator * / │ │ Char CO_FILL [10]; / * Supplemental Character * / │ │} │ └ - ───────────── ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ^ The currency display is 0 currency symbols before the value, the middle spaceless 1 currency symbol After the value, the middle spaceless 2 currency symbols in front of the value, there is a space 3 currency symbol After the value, there is a space in the middle

转载请注明原文地址:https://www.9cbs.com/read-85391.html

New Post(0)