CP/M-86 3.x/4.x XIOS data
The DEVICE utility in Personal CP/M-86 (and probably other utilities as well) uses an XIOS data area ("the BIOS Kernel Data Header") in the CP/M data segment. It assumes that the area is at a fixed offset within the XIOS.
To find the correct segment for this data area, call BDOS function 31. This will return the correct segment in ES.
Offsets in the area include:
Offset Size Data Description
0F00h DB bh_delay ;If this is nonzero, then, on each tick, the ;system flag change function will be called ;with DL=1. This is set by the BDOS if a ;process is waiting on the timer; it should ;be initialised to 0. 0F01h DB bh_ticksec ;Timeslices per second 0F02h DB bh_gdopen ;The "Media changed" flag. 0FFh if the XIOS ;has detected a disc change. 0F03h DB bh_inint ;Nonzero if the XIOS is servicing an ;interrupt. 0F04h DB bh_nextflag ;Number of next available system flag 0F05h DB bh_lastflag ;Total number of system flags 0F06h DB bh_intconin ;0FFh if the CONIN: device is interrupt ;driven. If so, the XIOS calls the BDOS ;when characters are received, rather than ;the BDOS polling the XIOS. 0F07h DB bh_8087 ;0FFh if an 8087 is present ;BUG: In the Amstrad PC1512 DOSPLUS, ;the code to detect the 8087 is buggy, and ;this byte never gets set. Instead some ;code in the code segment is overwritten; ;but fortunately this code is never called. ;This bug is fixed in DOSPLUS 1.2-je2. 0F08h DW drive0 ;This is the equivalent of the CP/M-80 DW drive1 ;drives table. Each entry is the offset ... ;within this segment of the DPH for a drive. DW drive15 0F28h DW physdev0 ;This is the equivalent of the CP/M-80 DW physdev1 ;devices table. Each entry is the offset DW physdev2 ;within this segment of a physical device DW physdev3 ;descriptor (eg: CON0 or PRN0). ... ;If all entries are 0, device redirection is DW physdev15 ;not supported. 0F48h DW bh_ciroot ;Device assignment for CONIN: DW bh_coroot ;Device assignment for CONOUT: DW bh_airoot ;Device assignment for AUXIN: DW bh_aoroot ;Device assignment for AUXOUT: DW bh_loroot ;Device assignment for LST: ;Device assignments are also stored as the ;offset of a physical device descriptor. ;CONOUT: AUXOUT: and LST: can have more ;than one physical device attached; this ;is done using a linked list. 0F52h DW bh_bufbase ;The offset and base of an uninitialised area 0F54h DW bh_buflen ;in this segment. Not used by the BDOS; ;it is set by GENCPM. Existing XIOSes ;do not appear to use it either. 0F56h DW mem_table ;32 entries, each of 6 bytes. An entry is: ; DW segment of area ; DW length of area (paragraphs) ; DW status (0FEh is free; 0FFh is an ; unused entry) 1016 DW bdos_messages ; The addresses of 13 messages in this ; segment. Doing the messages like this ; allows national language versions to be ; put in (for example by N.CMD). ; The messages ($-terminated) are: ; 'Cannot load program' ; 'Cannot load CCP' ; 4,'USER' ; 'CP/M Error On ' ; 'BDOS function=' ; 'File=' ; 'Disk Read/Write Error' ; 'Read-Only Disk' ; 'Read-Only File' ; 'Invalid Drive' ; 'Password Error' ; 'File Exists' ; '? in Filename'
This area ends at 1030h. The area from 1030h-106Dh is used by DOSPLUS for localisation information:
1030 DW date format ; DOS 2.11 country data: Date format 1032 DB currency symbol ; 5 bytes ASCIIZ 1037 DB comma separator ; 2 bytes ASCIIZ 1039 DB decimal point ; 2 bytes ASCIIZ 103B DB date separator ; 2 bytes ASCIIZ 103D DB time separator ; 2 bytes ASCIIZ 103F DB currency format flags 1040 DB digits in currency after decimal point 1041 DB time format 1042 DD upper-case subroutine in XIOS 1046 DB data comma ; 2 bytes ASCIIZ 1048 RS 6 ; Reserved 104E DW country code ; (DOSPLUS 2.1 only) 1050 DB switchar ; DOS switch character (usually '/') 1051 DB centisecs ; Centisecond counter (will be returned in DL ; by INT 21h/AH=2Ch) 1052 DW dos_msg ; The address of a table of DOS messages ; in this segment ('Reading', 'Writing', ; 'Abort or Retry?' etc.) 1054 DW ccp_msg ; The address of a table of CCP messages ; in this segment. 1056 DB lastdrive ; (DOSPLUS 2.1 only) Last drive 1-16, cf ; CONFIG.SYS 'LASTDRIVE' directive. If zero, ; assume 5, ie LASTDRIVE=E 1057 RS 9 ; Reserved 1060 DB 'IBM 4.1' ; 1068 DW rdisk_size ; Offset of ramdisk size in this segment 106A DB 'JW' ; Possibly initials of Joe Wein 106C DB xios_keymaps ; Offset of XIOS localisation ; table, zero if none.
Offset Size Data Description
0 6 'NAME ' ;Physical device name 6 DW supchar ;Bitmap of supported protocol options ;Bit 0: XON/XOFF ;Bit 1: ETX/ACK ;Bit 2: RTS ;Bit 3: DTR ;Bit 4: DTR/RTS polarity ;Bit 5: Odd parity ;Bit 6: Even parity ;Bit 7: Mark parity ;Bit 8: Space parity ;Bit 9: 5 databits ;Bit 10: 6 databits ;Bit 11: 7 databits ;Bit 12: 8 databits ;Bit 13: 1 stop bit ;Bit 14: 1.5 stop bits ;Bit 15: 2 stop bits 8 DW curchar ;Current device options ;Bits 0-3: Protocol (only one can be set) ;Bit 0: XON/XOFF ;Bit 1: ETX/ACK ;Bit 2: RTS ;Bit 3: DTR ;Bit 4: Polarity (1=high 0=low) ;Bit 5: Enable parity ;Bits 6-7: Parity (0=Odd 1=Even 2=Mark 3=Space) ;Bits 8-9: No. of data bits minus 5 ;Bits 10-11: No. of stop bits (0=>1 1=>1.5 2=>2) ;Bits 12-15: Unused A DB supoem ;OEM-defined flags supported B DB curoem ;OEM-defined flags currently selected ;These are defined by the BIOS implementor. ;DEVICE assumes that there is a one-to-one ;mapping between supoem and curoem. C DB txb ;Transmit baud rate D DB rxb ;Receive baud rate E DB type ;Device flags: ; Bit 0 set if device can input ; Bit 1 set if device can output ; Bit 2 set if baud rate can be set ; Bit 3 set if device is serial ; Bit 4 set if device provides 'coblock' ; Bit 5 set if device provides 'aiblock' ; Bit 6 set if device provides 'aoblock' F DB iinput ;0FFh if input from this device is ;interrupt-driven. 10 DB nflags ;Number of system flags used by this device ;(0 if the device is polled). Used by GENCPM ;to calculate system flag requirements 11 DB resvd ;Reserved (not used). 12 DW colink ;Next device in CONOUT: linked list; 0 for end 14 DW aolink ;Next device in AUXOUT: linked list 16 DW lolink ;Next device in LST: linked list 18 DW init ;Offsets of functions in XIOS code segment: ; Initialise device (DEVINI) 1A DW input ; Read character from device into AX (CONIN) 1C DW instat ; Return input ready status in AL (CONST) 1E DW output ; Write character in CL to device (CONOUT) 20 DW outstat ; Return output ready status in al (CONOST) ; ; Below this point, fields are not documented and may not exist in all ; versions... ; 22 DW coblock ; Output fixed-size buffer to console 24 DW aiblock ; Read fixed-size buffer from aux: input 26 DW aoblock ; Output fixed-size buffer to aux: output 28 DW ? 2A DW ? 2C DW ? 2E DW aux_trans ; Translation table for auxiliary devices 30 DW ? 32 DW lpt_trans ; Translation table for print devices
Baud rates are: 0 => None 1 => 50 2 => 62.5 3 => 75 4 => 110 5 => 134.5 6 => 150 7 => 200 8 => 300 9 => 600 A => 1200 B => 1800 C => 2000 D => 2400 E => 3600 F => 4800 10=> 7200 11=> 9600 12=> 19200 13=> 38400 14=> 56000 15=> 76800 16=> OEM1 17=> OEM2 18=> OEM3
Translation tables are used to change the characters being output to the printer or communications ports - for example, to translate the screen codepage to the printer codepage.
John Elliott 2017-01-30