'DIM ABSOLUTE an integer array over the BIOS Data Area, and with the 'following list of constants, the entire BDA becomes a simple set of memory 'variables which you can read and set as easy as a=b. 'BIOS Data Area (PC Memory Map) ' The first 512 ints represent the int vector table ' The next 128 ints represent the stack area used during post and bootstrap ' which should now be free to use for whatever we want %COM1Addr = &H200 %COM2Addr = &H201 %COM3Addr = &H202 %COM4Addr = &H203 %LPT1Addr = &H204 %LPT2Addr = &H205 %LPT3Addr = &H206 %LPT4Addr = &H207 ' except PS2 %Equipment = &H208 ' 2 bytes Equipment list flags (see also INT 11) ' ' ³7³6³5³4³3³2³1³0³ 40:10 (value in INT 11 register AL) ' ³ ³ ³ ³ ³ ³ ³ ÀÄ IPL diskette installed ' ³ ³ ³ ³ ³ ³ ÀÄÄ math coprocessor ' ³ ³ ³ ³ ÃÄÅÄÄÄ old PC system board RAM < 256K ' ³ ³ ³ ³ ³ ÀÄÄ pointing device installed (PS2) ' ³ ³ ³ ³ ÀÄÄÄ not used on PS2 ' ³ ³ ÀÄÁÄÄÄÄ initial video mode ' ÀÄÁÄÄÄÄÄÄÄ # of diskette drives, less 1 ' ' ³7³6³5³4³3³2³1³0³ 40:11 (value in INT 11 register AH) ' ³ ³ ³ ³ ³ ³ ³ ÀÄ 0 if DMA installed ' ³ ³ ³ ³ ÀÄÁÄÁÄÄ number of serial ports ' ³ ³ ³ ÀÄÄÄÄÄÄÄ game adapter ' ³ ³ ÀÄÄÄÄÄÄÄÄ not used, internal modem (PS2) ' ÀÄÁÄÄÄÄÄÄÄÄÄ number of printer ports ' %MemoryKbytes = &H209 ' Memory size in Kbytes (see INT 12) %KbdFlags1 = &H20B ' (LSB only) Kbd flag byte 0 (see also KB FLAGS) ' ' ³7³6³5³4³3³2³1³0³ Kbd flag byte 0 ' ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ right shift key down ' ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ left shift key down ' ³ ³ ³ ³ ³ ÀÄÄÄÄÄ CTRL key down ' ³ ³ ³ ³ ÀÄÄÄÄÄÄ ALT key down ' ³ ³ ³ ÀÄÄÄÄÄÄÄ scroll-lock is on ' ³ ³ ÀÄÄÄÄÄÄÄÄ num-lock is on ' ³ ÀÄÄÄÄÄÄÄÄÄ caps-lock is on ' ÀÄÄÄÄÄÄÄÄÄÄ insert is on ' %KbdFlags2 = &H20C ' (MSB only) Kbd flag byte 1 (see also KB FLAGS) ' ' ³7³6³5³4³3³2³1³0³ Kbd flag byte ' ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ left CTRL key down ' ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ left ALT key down ' ³ ³ ³ ³ ³ ÀÄÄÄÄÄ system key down and held ' ³ ³ ³ ³ ÀÄÄÄÄÄÄ suspend key has been toggled ' ³ ³ ³ ÀÄÄÄÄÄÄÄ scroll lock key is down ' ³ ³ ÀÄÄÄÄÄÄÄÄ num-lock key is down ' ³ ÀÄÄÄÄÄÄÄÄÄ caps-lock key is down ' ÀÄÄÄÄÄÄÄÄÄÄ insert key is down ' %KeyBufHead = &H20D ' Offset from 40:00 to Kbd buffer head %KeyBufTail = &H20E ' Offset from 40:00 to Kbd buffer tail ' 40:1E 32bytes Kbd buffer (circular queue buffer) %DriveStat = &H21F ' (MSB) Drive recal status ' ' ³7³6³5³4³3³2³1³0³ drive recalibration status ' ³ ³ ³ ³ ³ ³ ³ ÀÄÄ 1=recalibrate drive 0 ' ³ ³ ³ ³ ³ ³ ÀÄÄÄ 1=recalibrate drive 1 ' ³ ³ ³ ³ ³ ÀÄÄÄÄ 1=recalibrate drive 2 ' ³ ³ ³ ³ ÀÄÄÄÄÄ 1=recalibrate drive 3 ' ³ ÀÄÁÄÁÄÄÄÄÄÄ unused ' ÀÄÄÄÄÄÄÄÄÄÄÄ 1=working int flag ' ' %DriveStat (LSB) Diskette motor status ' ' ³7³6³5³4³3³2³1³0³ diskette motor status ' ³ ³ ³ ³ ³ ³ ³ ÀÄÄ 1=drive 0 motor on ' ³ ³ ³ ³ ³ ³ ÀÄÄÄ 1=drive 1 motor on ' ³ ³ ³ ³ ³ ÀÄÄÄÄ 1=drive 2 motor on ' ³ ³ ³ ³ ÀÄÄÄÄÄ 1=drive 3 motor on ' ³ ÀÄÁÄÁÄÄÄÄÄÄ unused ' ÀÄÄÄÄÄÄÄÄÄÄÄ 1=write operation ' %DiskOps = &H220 ' (MSB) Motor shutoff counter (decremented by INT 8) ' How many tics before drive motor shuts off ' (LSB) Status of last diskette operation ' ³7³6³5³4³3³2³1³0³ status of last diskette operation ' ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ invalid diskette command ' ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ diskette Addr mark not found ' ³ ³ ³ ³ ³ ÀÄÄÄÄÄ sector not found ' ³ ³ ³ ³ ÀÄÄÄÄÄÄ diskette DMA error ' ³ ³ ³ ÀÄÄÄÄÄÄÄ CRC check / data error ' ³ ³ ÀÄÄÄÄÄÄÄÄ diskette controller failure ' ³ ÀÄÄÄÄÄÄÄÄÄ seek to track failed ' ÀÄÄÄÄÄÄÄÄÄÄ diskette time-out %VideoMode = &H224 ' (LSB) current video mode %ScreenCols = &H225 ' Number of screen columns %VidRegenSize = &H226 ' Size of current video regen buffer in bytes %OffVidPageRB = &H227 ' Offset of current video page in video regen buffer %CursorPos0 = &H228 ' Cursor pos of pg 0, MSB=Row/LSB=Col %CursorPos1 = &H229 ' Cursor pos of pg 1, MSB=Row/LSB=Col %CursorPos2 = &H22A ' Cursor pos of pg 2, MSB=Row/LSB=Col %CursorPos3 = &H22B ' Cursor pos of pg 3, MSB=Row/LSB=Col %CursorPos4 = &H22C ' Cursor pos of pg 4, MSB=Row/LSB=Col %CursorPos5 = &H22D ' Cursor pos of pg 5, MSB=Row/LSB=Col %CursorPos6 = &H22E ' Cursor pos of pg 6, MSB=Row/LSB=Col %CursorPos7 = &H22F ' Cursor pos of pg 7, MSB=Row/LSB=Col %CursorSize = &H230 ' (MSB) Cursor ending (bottom) scan line ' (don't change directly) ' (LSB) Cursor starting (top) scan line ' (don't change directly) %DisplayPage = &H231 ' (MSB) on display page number %CRTBaseAddr = &H232 ' (MSB) Base Addr for on 6845 CRT controller ' (B4h=3B4h=mono), (D4h=3D4h=color) ' this is lsb, MSB is actually the LSB of %displaypage %CRTControlReg= &H232 ' (LSB) 6845 CRT mode control register value ' (port 3x8h) EGA/VGA values emulate those of MDA/CGA %CGAPalette = &H233 ' CGA current color palette mask setting (port 3d9h) ' EGA and VGA values emulate the CGA %TimerCounter = &H236 ' Daily timer counter, equal to zero at midnight; ' incremented by INT 8; read/set by INT 1A %ClockBreakFlags=&H238 ' (MSB) = Clock rollover flag, set when TimerCounter ' exceeds 24 hours ' (LSB) Break Flag, Bit 7 is set if CONTROL-BREAK ' has EVER been hit (I guess you can reset it) %RebootFlag = &H239 ' Soft reset flag via Ctl-Alt-Del or JMP FFFF:0 ' 1234h Bypass memory tests & CRT initialization ' 4321h Preserve memory ' 5678h System suspend ' 9ABCh Manufacturer test ' ABCDh Convertible POST loop %HDStatus = &H23A ' (MSB) Status of last hard disk operation (see %DiskOps) ' (LSB) Number of hard disks attached %LPT12TimeOut= &H23C ' (MSB) Timeout in secs for LPT1 (you can set it) ' (LSB) Timeout in secs for LPT2 %LPT34TimeOut= &H23D ' (MSB) Timeout in secs for LPT3 (you can set it) ' (LSB) Timeout in secs for LPT4 (not PS/2) %COM12TimeOut= &H23E ' (MSB) Timeout in secs for COM1 (you can set it) ' (LSB) Timeout in secs for COM2 %COM34TimeOut= &H23F ' (MSB) Timeout in secs for COM3 (you can set it) ' (LSB) Timeout in secs for COM4 %KeyBufStart = &H240 ' Kbd buffer start offset (seg=40h) %KeyBufEnd = &H241 ' Kbd buffer end offset (seg=40h) %ScreenRows = &H242 ' (MSB) Rows on the screen (less 1, EGA+) %KBModeLED = &H246 ' (MSB) Kbd mode/type ' ' ³7³6³5³4³3³2³1³0³ Kbd mode/type ' ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ last code was the E1 hidden code ' ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ last code was the E0 hidden code ' ³ ³ ³ ³ ³ ÀÄÄÄÄÄ right CTRL key down ' ³ ³ ³ ³ ÀÄÄÄÄÄÄ right ALT key down ' ³ ³ ³ ÀÄÄÄÄÄÄÄ 101/102 enhanced Kbd installed ' ³ ³ ÀÄÄÄÄÄÄÄÄ force num-lock if Rd ID & KBX ' ³ ÀÄÄÄÄÄÄÄÄÄ last char was first ID char ' ÀÄÄÄÄÄÄÄÄÄÄ read ID in process ' ' (LSB) Kbd LED flags ' ' ³7³6³5³4³3³2³1³0³ Kbd LED flags ' ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄ scroll lock indicator ' ³ ³ ³ ³ ³ ³ ÀÄÄÄÄ num-lock indicator ' ³ ³ ³ ³ ³ ÀÄÄÄÄÄ caps-lock indicator ' ³ ³ ³ ³ ÀÄÄÄÄÄÄ circus system indicator ' ³ ³ ³ ÀÄÄÄÄÄÄÄ ACK received ' ³ ³ ÀÄÄÄÄÄÄÄÄ re-send received flag ' ³ ÀÄÄÄÄÄÄÄÄÄ mode indicator update ' ÀÄÄÄÄÄÄÄÄÄÄ Kbd transmit error flag ' %KBLastScan = &H25D ' Scan code of last key (convertible) %DayCounter = &H25C ' Day counter (convertible and after) %ICAStart = &H25E ' Intra-Applications Communications Area (16 bytes) ' Useable data area, remains static between programs %PrtScrn = &H280 ' Print screen status byte ' 00 = PrtSc not on, ' 01 = PrtSc in progress ' FF = error %User26 = &H282 ' 26 Bytes more user area ' officially categorized as ' 50:04 byte DOS single diskette mode flag, 0=A:, 1=B: ' 50:05 10bytes POST work area ' 50:0F byte BASIC shell flag; set to 2 if current shell ' 50:10 word BASICs default DS value (DEF SEG) ' 50:12 dword pntr to BASIC INT 1Ch int handler ' 50:16 dword pntr to BASIC INT 23h int handler ' 50:1A dword pntr to BASIC INT 24h disk error handler DIM ABSOLUTE BIOS(&H300) AS INTEGER AT 0 COLOR 14,1:CLS:PRINT "BIOS Data Area Information." ? ,"COM1: " + HEX$(BIOS(%COM1Addr)); ? ,"COM2: " + HEX$(BIOS(%COM2Addr)); ? ,"COM3: " + HEX$(BIOS(%COM3Addr)); ? ,"COM4: " + HEX$(BIOS(%COM4Addr)) ? ,"LPT1: " + HEX$(BIOS(%LPT1Addr)); ? ,"LPT2: " + HEX$(BIOS(%LPT2Addr)); ? ,"LPT3: " + HEX$(BIOS(%LPT3Addr)) ? ? ,"The current video mode is";BIOS(%VideoMode)\256 ? ,"You are currently in" ; BIOS(%ScreenCols) ; "Column mode" ? ,"There are";(BIOS(%ScreenRows) AND 255)+1;"Rows on the screen" ? ,"The current display page is";BIOS(%DisplayPage) AND 255