Detecting ANSI.SYS
Compare segment address of a DOS interrupt with the segment of the standard CON device. If equal, then ANSI is not loaded. If the segment address of CON is greater than the DOS interrupt, then ANSI is loaded or a TSR is handling the interrupt. - see INT 21,52 for info on CON device address Detecting DESQView 1. call INT 2F with AX = DE00h 2. if AL = FF on return DESQView is installed Detecting Disk Ready 1. use INT 13,4 (Verify Sector) to check ready for read 2. check for error in AH of: 80h Time out, or Not Ready AAh Drive not ready 00h drive is ready for reading other value indicates drive is ready, but an error occurred 3. use INT 13,2 (Read Sector) followed by INT 13,3 (Write Sector) to check ready for read/write. First read sector, test for ready; write sector back, check for 03h (write protect) or any of the other BIOS disk errors - multiple attempts should be made to allow for diskette motor startup - allows testing of drive ready by bypassing DOS and critical errors - see INT 13,STATUS Detecting Drive Existence 1. save current drive (INT 21,19) 2. set current drive (INT 21,E) 3. get current drive (INT 21,19) 4. if current drive == drive requested then drive exists else drive doesn't exist 5. reset original drive (INT 21,E) - no critical error is generated if invalid drive is selected Detecting EGA Video INT 10h, function 12h (INT 10,12), subfunction 10h (in BL) will return BL = 10h if not an EGA since invalid functions requests return without register modification Detecting VGA Video INT 10,1A can be used to detect the presence of VGA. BL = 7 VGA with analog monochrome display = 8 VGA with analog color display - some enhanced EGA adapters will incorrectly identify as VGA when INT 10,1B is used Detecting Extended Keyboard BIOS 1. use INT 16,5 to stuff FFFF into the keyboard buffer 2. use INT 16,10 to read the keystrokes back 3. if the data stuffed into the keyboard is returned within 16 extended reads, the BIOS handles the extended keyboard 4. byte at 40:96 (BDA) is another method of detecting extended BIOS but is not reliable since some compatibles give false positives - see BIOS DATA AREA INT 9 Detecting present of Expanded Memory Manager 1. attempt to open file/device 'EMMXXXX0' using INT 21,3D; if successful continue, else no EMM 2. make sure EMMXXXX0 is a character device and not a disk file by using IOCTL function 0 (Get Device Info); bit 7 of DX should be set for char device and clear for disk file 3. make sure Expanded Memory Manager is available using IOCTL function 7 (Get Output Status); AL should be non-zero (FF) if Memory Manager is available, and zero if not available. 4. call INT 67,46 to get version information - see also IOCTL,0 IOCTL,7 Detecting Existence of Mouse Driver 1. check INT 33 vector is not 0:0 2. check INT 33 vector does not point to an IRET 3. call INT 33,0 to reset the mouse and get installed state 4. call INT 33,24 to check version, type and IRQ Detecting Miscellaneous Boot drive; see INT 21,33 (DOS 4.0+) CPU type; see CPU Hardware configuration; see INT 11 Logical Drive Assignment; see IOCTL,E Memory size, Base; see INT 12 Memory size, Extended; see CMOS Micro Channel Bus on PS/2; see INT 15,C0 Network or Local Disk; see IOCTL,9 Network or Local File; see IOCTL,A Parallel ports; see BIOS DATA AREA locations 40:08-40:0F RAM Disk; see INT 21,32 and MEDIA DESCRIPTOR Redirection on command line; see IOCTL,0 Removable media; INT 21,1B INT 21,1C MEDIA DESCRIPTOR BYTE and IOCTL,8 Serial ports; see BIOS DATA AREA locations 40:00-40:07 Single drive A: or B: selection; see BIOS DATA AREA byte 50:04 SUBST'ed drive; see INT 21,32 Video Screen Size in Columns; see INT 10,F Video Screen Size in Rows; see INT 10,11 subfunction 30h (EGA+) APPEND resident; see INT 2F,0 ASSIGN resident; see INT 2F,0 DOSSHELL resident; see INT 2F,0 NLSFUNC resident; see INT 2F,0 PRINT resident; see INT 2F,0 SHARE resident; see INT 2F,0