UNIT BiosData; INTERFACE type WordPtr=^Word; const biosDataSeg=$40; biosDataOfs=$00; biosKeyboardStatusFlagsOfs=$17; biosDataPtr=Ptr(biosDataSeg,biosDataOfs); biosKeyboardStatusFlagsPtr=Ptr(biosDataSeg,biosDataOfs+biosKeyboardStatusFlagsOfs); type KeyBoardStatusFlags=(kfRightShiftPressed, kfLeftShiftPressed, kfEitherCtrlPressed, kfEitherAltPressed, kfScrollLockActive, kfNumLockActive, kfCapsLockActive, kfInsertActive, kfLeftCtrlPressed, kfLeftAltPressed, kfSysRegPressed, kfPauseActive, kfScrollLockPressed, kfNumLockPressed, kfCapsLockPressed, kfInsertPressed ); KeyboardStatusSet=set of KeyBoardStatusFlags; KBSS1Ptr=^KeyBoardStatusSet; TEgaVgaControl=(evCursorEmulationDisable, evMonoMonitor, evWaitToDisplayEnable, evEgaVgaInactive, evReserved, evRAM2, evRAM3, evDoNotClearVideoRAM ); TEgaVgaControlSet=set of TEgaVgaControl; EgaVgaSwitches=(bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7 { bits 7-4: power-on state of feature connector bits 3-0 bits 3-0: configuration switches 4-1 (=0 on, =1 off) PriMda_SecEgaOldColorDisplay40x25, PriMDA_SecEGAoldColorDisplay80x25, PriMDA_SecEGAECDnormalModeCGAemul, PriMDA_SecEGAECDenhancedMode, PriCGA40x25_SecEGAmonoDisplay, PriCGA80x25_SecEGAmonoDisplay, PriEGAoldColorDisplay40x25_SecMDA, PriEGAoldColorDisplay80x25_SecMDA, PriEGAECDnormalModeCGAemul_Sec MDA, PriEGAECDenhancedMode_Sec MDA, PriEGAmonoDisplay_SecCGA40x25, PriEGAmonoDisplay_SecCGA80x25} ); EgaVgaSwitchesSet=set of EgaVgaSwitches; MCgaVgaControl=(mvVgaActive, mvGrayScaleSummingEnabled, mvMonoDisplay, mvNoDefaultPaletteLoadingEnabledAtModeSet, mvVgaUse400lineModeAtNextModeSet, mvReserved, mvDisplaySwitchingEnabled, mvBit7 ); MCgaVgaControlSet=set of MCgaVgaControl; const kbFirstKeyboardStatusFlag=kfRightShiftPressed; kbLastKeyboardStatusFlag =kfInsertPressed; (* Format of BIOS Data Segment at segment 40h: {items in curly braces not documented by IBM} *) type PVideoSaveTable=^TVideoSaveTable; PGraphicsCharacterSetOverride=^TGraphicsCharacterSetOverride; PAlphaCharacterSetOverride=^TAlphaCharacterSetOverride; SerialPort=(SerialPort1, SerialPort2, SerialPort3, SerialPort4); SerialPortsBaseAddressArray=array[SerialPort] of word; ParallelPort=(ParallelPort1, ParallelPort2, ParallelPort3, ParallelPort4); ParallelPortsBaseAddressArray=array[ParallelPort] of word; CursorPosition=record col,row:Byte; end; TModeSelectRegisterBit=(msrbText80x25, msrbGraphics, msrbMonochrome, msrbVideoSignalEnabled, msrbMode6GraphicsInMonochrome, msrbAttributeBit7ControlsBlinkingInsteadOfBackground, msrb6, msrb7); TModeSelectRegister=set of TModeSelectRegisterBit; DataOfBIOSptr=^DataOfBios; DataOfBios=record SerialPorts:SerialPortsBaseAddressArray; ParallelPorts:ParallelPortsBaseAddressArray; InstalledHardware:word; ManufacturingTestInitialisationFlags:byte; BaseMemorySizeInKbytes:word; ManufacturingTestScratchPad:byte; ManufacturingTestScratchPad2:byte; KeyboardStatusFlags:KeyBoardStatusSet; KeyboardAltnnnKeypadWorkspace:byte; KeyboardPtrToNextChar:word; KeyboardPtrToFirstFree:word; KeyboardCircularBuffer:array[0..15] of word; DisketteRecalibrateStatus:byte; DisketteMotorStatus:byte; DisketteMotorTurnOffTimeOutCount:byte; DisketteLastOperationStatus:byte; DisketteFixedDiskStatusCommandBytes:array[0..6] of byte; VideoCurrentMode:byte; VideoColumnsOnScreen:word; VideoPageSize:word; VideoCurrentPageStartAddressInRegenBuffer:word; VideoCursorPosition:array[0..7] of CursorPosition; VideoCursorType:word; VideoCurrentPageNumber:byte; VideoCRTcontrollerBaseAddress:word; VideoSettingOfModeSelectRegister:TModeSelectRegister; VideoCurrentSettingOfCGApaletteRegister:byte; POSTrealModeReentryPoint:pointer; POSTlastUnexpectedInterrupt:byte; TimerTicksSinceMidnight:longint; TimerOverflow:byte; CtrlBreakFlag:byte; POSTresetFlag:word; FixedDiskLastOperationStatus:byte; NumberOfFixedDiskDrives:byte; FixedDiskControlByte:byte; FixedDiskIOportOffset:byte; ParallelDevicesTimeOutCounters:array[0..3] of byte; SerialDevicesTimeOutCounters:array[0..3] of byte; KeyboardBufferStartOffset:word; KeyboardBufferEndOffset:word; {XT BIOS dated 11/08/82 ends here} VideoRowsOnScreenMinusOne:byte; VideoCharacterHeightInScanLines:word; VideoEgaVgaControl:TEgaVgaControlSet; VideoEgaVgaSwitches:EgaVgaSwitchesSet; VideoMCgaVgaModeSetOptionControl:McgaVgaControlSet; VideoMCgaVgaIndexIntoDisplayCombinationCodeTable:Byte; DisketteMediaControl:byte; (* [not XT]: bits 7-6: Last data rate set by controller: 00=500kbps, 01=300kbps, 10=250kbps, 11=reserved bits 5-4: Last diskette drive step rate selected bits 3-2: {Data rate at start of operation} bits 1-0: reserved*) FixedDiskControllerStatus:byte; { [not XT]} FixedDiskControllerErrorStatus:byte; { [not XT] } FixedDiskInterruptControl:byte; { [not XT] } DisketteControllerInformation:byte; { [not XT]: bit 7: reserved bit 6: =1 drive 1 determined bit 5: =1 drive 1 is multi-rate, valid if drive determined bit 4: =1 drive 1 supports 80 tracks, always valid bit 3: reserved bit 2: =1 drive 0 determined bit 1: =1 drive 0 is multi-rate, valid if drive determined bit 0: =1 drive 0 supports 80 tracks, always valid} DisketteDriveMediaState:array[0..1] of byte; { bits 7-6: Data rate: 00=500kbps, 01=300kbps, 10=250kbps bit 5: =1 if double stepping reqd (e.g. 360kB in 1.2MB) bit 4: =1 if media established bit 3: reserved bits 2-0: on exit from BIOS, contain: 000 trying 360kB in 360kB 001 trying 360kB in 1.2MB 010 trying 1.2MB in 1.2MB 011 360kB in 360kB established 100 360kB in 1.2MB established 101 1.2MB in 1.2MB established 110 reserved 111 all other formats/drives } DisketteDriveMediaStateAtStartOfOperation:array[0..1] of byte; DisketteDriveCurrentTrackNumber:array[0..1] of byte; KeyboardStatusByte3:byte; { bit 7 =1 read-ID in progress bit 6 =1 last code read was first of two ID codes bit 5 =1 force Num Lock if read-ID and enhanced keyboard bit 4 =1 enhanced keyboard installed bit 3 =1 Right Alt pressed bit 2 =1 Right Ctrl pressed bit 1 =1 last code read was E0h bit 1 =1 last code read was E1h } KeyboardStatusByte2:byte; { bit 7 =1 keyboard transmit error flag bit 6 =1 LED update in progress bit 5 =1 RESEND received from keyboard bit 4 =1 ACK received from keyboard bit 3 reserved, must be zero bit 2 Caps Lock LED bit 1 Num Lock LED bit 0 Scroll Lock LED } Timer2ptrToUserWaitCompleteFlag:pointer; { see INT 15, AX=8300h) } Timer2userWaitCountInMicroseconds:longint; Timer2waitActiveFlag:byte; { bit 7 =1 wait time elapsed bits 6-1 reserved bit 0 =1 INT 15h, AH=86h has occurred} ReservedForNetworkAdapters:array[1..3] of byte; SavedFixedDiskInterruptVector:pointer; VideoSaveTablePtr:PVideoSaveTable; (* ACh-AFh reserved B0h DWORD ptr to 3363 Optical disk driver or BIOS entry point. When 3363 BIOS present, the signature "OPTIC ",00h occurs 3 bytes beyond this entry point. When 3363 BIOS and 3363 File System Driver present, the signature "FILE SYSTEM DRIVER",00h occurs 3 bytes beyond this entry point. B4h WORD reserved B6h 3 BYTEs reserved for POST? B9h 7 BYTEs ??? C0h 14 BYTEs reserved CEh WORD count of days since last boot? D0h-EFh reserved F0h-FFh reserved for user 100h BYTE Print Screen Status byte *) end; {Format of Video Parameter Table [EGA, VGA only]:} PVideoParameterTable=^TVideoParameterTable; {Format of Video Parameter Table element [EGA, VGA only]:} TVideoParameterTableElement=record ColumnsOnScreen:byte; RowsOnScreenMinusOne:byte; HeightOfCharacterInScanLines:byte; SizeOfVideoBuffer:word; ValuesForSequencerRegisters:array[1..4] of byte; ValueForMiscellaneousOutputRegister:byte; ValuesForCRTCRegisters:array[1..25] of byte; ValuesForAttributeControllerRegisters:array[1..20] of byte; ValuesForGraphicsControllerRegisters:array[1..9] of byte; end; TVideoParameterTable=record case boolean of True: (ega:array[1..23] of TVideoParameterTableElement); False:(vga:array[1..29] of TVideoParameterTableElement); end; (*An array of 23 [EGA] or 29 [VGA] elements, each element being 64 bytes long. Elements appear in the order: 00h-03h Modes 00h-03h in 200-line CGA emulation mode 04h-0Eh Modes 04h-0Eh 0Fh-10h Modes 0Fh-10h when only 64kB RAM on adapter 11h-12h Modes 0Fh-10h when >64kB RAM on adapter 13h-16h Modes 00h-03h in 350-line mode 17h VGA Modes 00h or 01h in 400-line mode 18h VGA Modes 02h or 03h in 400-line mode 19h VGA Mode 07h in 400-line mode 1Ah-1Ch VGA Modes 11h-13h *) PSecondaryVideoSavePointerTable=^TSecondaryVideoSavePointerTable; PSecondaryAlphaCharacterSetOverride=^TSecondaryAlphaCharacterSetOverride; {Format of Video Save Pointer Table [EGA/VGA/MCGA only]:} TVideoSaveTable=record VideoParameterTablePtr:PVideoParameterTable; ParameterDynamicSaveAreaPtr:pointer; { else 0 [EGA/VGA only]} AlphaCharSetPtr:PAlphaCharacterSetOverride; { else 0 } GraphicsCharSetPtr:PGraphicsCharacterSetOverride; { else 0} SecondarySavePointerTablePtr:PSecondaryVideoSavePointerTable; {[VGA only] must be valid} Reserved:pointer; { zero } Reserved1:pointer; { zero } {Note: table initially in ROM, copy to RAM to alter, then update 40h:A8h.} end; TSecondaryVideoSavePointerTable=record Length:word; DisplayCombinationCodePtr:pointer; AlpphaCharSetOverridePtr:PSecondaryAlphaCharacterSetOverride; UserPalettePtr:pointer; Reserved1,Reserved2,Reserved3:pointer; end; {Format of Alphanumeric Character Set Override:} TAlphaCharacterSetOverride=object LengthOfChar:byte; BankToLoad:byte; { 0=normal } NumberOfChar:word; { normally 256 } FirstChar:word; { normally 0 } FontTablePtr:pointer; Rows:byte; { (FFh=use maximum calculated value) } {Array of mode values to which this font is to pertain, FFh end of array} end; TSecondaryAlphaCharacterSetOverride=object CharLength:byte; Bank:byte; Reserved:byte; FontTable:pointer; {Array of mode values to which this font is to pertain, FFh end of array} end; {Format of Graphics Character Set Override:} TGraphicsCharacterSetOverride=object Rows:byte; LengthOfChar:word; FontTablePtr:pointer; {Array of mode values to which this font is to pertain, FFh end of array} end; {Format of Second Alphanumeric Character Set Override: Authorities differ, some say same as first override above, but IBM say: Offset Size Description 00h BYTE Length in bytes of each character in font table 01h BYTE Character generator RAM bank to load, normally non-zero 02h BYTE reserved 03h DWORD ptr to font table 07h BYTEs Array of mode values to which this font is to pertain BYTE FFh end of array } (* Format of Secondary Video Save Pointer Table [VGA only]: Offset Size Description 00h WORD Length of this table in bytes, including this word (1Ah) 02h DWORD ptr to Display Combination Code Table, must be valid 06h DWORD ptr to second Alphanumeric Character Set Override, else 0 0Ah DWORD ptr to User Palette Profile Table, else 0 0Eh DWORD reserved, zero 12h DWORD reserved, zero 16h DWORD reserved, zero Note: table initially in ROM, copy to RAM to alter, then alter Save Ptr Table. Format of Video Parameter Table [MCGA only] {guesswork from inspection}: - 16 triplet BYTEs of R,G,B DAC info for 16 colors; - An array of 11 elements, each element being 32 bytes long. Elements appear in the order: Modes 00h,01h in 200-line mode for digital displays Modes 00h,01h in 400-line mode for analog displays Modes 02h,03h in 200-line mode for digital displays Modes 02h,03h in 400-line mode for analog displays Modes 04h,05h in 200-line mode for digital displays Modes 04h,05h in 400-line mode for analog displays Mode 06h in 200-line mode for digital displays Mode 06h in 400-line mode for analog displays Mode 11h Mode 13h in 200-line mode for digital displays Mode 13h in 400-line mode for analog displays Format of Video Parameter Table element [MCGA only]: Offset Size Description 00h BYTE Columns on screen (see 40h:4Ah) 01h BYTE Rows on screen minus one (see 40h:84h) 02h BYTE Height of character in scan lines (see 40h:85h) 03h WORD Size of video buffer (see 40h:4Ch) 05h WORD ??? always zero 07h 21 BYTEs Video data registers 00h-14h to port 3D5h indexed by 3D4h 1Ch BYTE PEL Mask to port 3C6h 1Dh BYTE CGA Mode Control to port 3D8h 1Eh BYTE CGA Border Control to port 3D9h 1Fh BYTE Extended Mode Control to port 3DDh Format of Video Parameter Dynamic Save Area [EGA, VGA only]: Offset Size Description 00h 16 BYTEs Last data written to Attribute Controller Palette Registers 0-15 10h BYTE Last data written to Attribute Controller Overscan Register 11h-FFh Reserved Note: Need for table was that EGA registers were write-only. Note: If default values (from the Video Parameter Table) are over-ridden at a mode set by the VGA User Palette Profile Table, then the Dynamic Save Area is updated with the default values, not the User Profile ones. Format of Display Combination Code Table [VGA only]: Offset Size Description 00h BYTE Number of entries in the DCC table at offset 04h 01h BYTE Version number 02h BYTE Maximum display type code that can appear in DCC table 03h BYTE reserved 04h ARRAY OF 2 BYTEs Each pair of bytes gives a valid display combination 9 Meaning of each byte: 00h no display 01h MDA with mono display 02h CGA with color display 03h reserved 04h EGA with color display 05h EGA with mono display 06h Professional Graphics Controller 07h VGA with mono display 08h VGA with color display 09h reserved 0Ah MCGA with digital color display 0Bh MCGA with analog mono display 0Ch MCGA with analog color display FFh unrecognised video system Format of User Palette Profile Table [VGA only]: Offset Size Description 00h BYTE Underlining: 01h=enable in all alphanumeric modes 00h=enable in monochrome alphanumeric modes only FFh=disable in all alphanumeric modes 01h BYTE reserved 02h WORD reserved 04h WORD Number (0-17) of Attribute Controller registers in table 06h WORD Index (0-16) of first Attribute Controller register in table 08h DWORD ptr to table of Attribute Controller registers to override Table is an array of BYTEs. 0Ch WORD Number (0-256) of video DAC Color registers in table 0Eh WORD Index (0-255) of first video DAC Color register in table 10h DWORD ptr to table of video DAC Color registers to override Table is ??? triplets ??? of BYTEs??? 14h BYTEs array of mode values to which this profile is to pertain BYTE FFh end of array *) var Data:DataOfBios absolute BiosDataSeg:BiosDataOfs; IMPLEMENTATION END.