DECmate II CP/M Technical Notes DISCLAIMER This document file was created by scanning the original document and then editing the scanned text. As much as possible, the original text format was restored. Some format changes were made to insure this document would print on current laser printers using 60 lines per page. The original spelling and grammar has been preserved. 30-Mar-1996 30-June-83 DECmate II CP/M Technical Note Index _________________________________________________________________ CP/M No Title Revision Release __ _____ ________ _______ 1 Z80 Memory Map 0, 16-Sep-82 1.0 2 RX50 Diskette Format 3, 22-Dec-82 1.0 3 8BIOS Interface Codes 7, 07-Oct-82 1.0 4 (withdrawn) 5 CP/M Support for RD51D 1, 17-Mar-83 2.x 6 RX50 Diskette Format for CP/M Release 2 0, 11-Feb-83 2.x 7 8BIOS Interface Codes for Release 2 4, 20-Jun-83 2.x 8 (withdrawn) 9 System Bootstrap Operation 1, 20-Jun-83 2.x 10 Z80 memory Map for Release 2 0, 19-Apr-83 2.x 11 Console Standard Modes for Release 2 0, 20-Jun-83 2.x 12 Format of Hard Disk Backup Diskettes 0, 27-Jun-83 13 Loading and Using Extensions to 8BIOS 0, 30-Jun-83 2.x R.F.Morse MLO3-2/E41 DTN 223-6720 Rev 0, 16-Sep-82 DECmate II CP/M Technical Note 1: Z80 Memory Map _________________________________________________________________ This note describes the allocation of the 65536. (64K) bytes of memory in the Z80 APU when operating under CP/M-80 version 2.2. Usage Addresses Length _____ _________ ______ System parms 0000..00FF 100 256. TPA 0100..DFFF DF00 57088. CCP E000..E7FF 800 2048. BDOS E800..F5FF E00 3584. BIOS code F600..FBFF 600 1536. BIOS work area FC00..FFFF 400 1024. When generating a CP/M image with the MOVCPM program, this is described as a 63K system. __ Application programs occupy the transient program area (TPA). Large application programs usually overlay the CCP (console command processor), so the limit on their size is 59136. bytes. This map is for the initial release of the system which supports RX50 and RX01/RX02 diskettes. The release which supports the RD50 Winchester disk will probably require additional space for the BIOS code and work areas, which will reduce the TPA size by 1024. (1K) bytes. None of the storage in the 6120 side of the system is directly available to a CP/M application program. (Extensive amounts of this storage are used by the 8BIOS program which supports ZBIOS.) Rev 3, 22-Dec-82 DECmate II CP/M Technical Note 2: RX50 Diskette Format _________________________________________________________________ This note describes the format and contents of the RX50 diskettes used by the DECmate II version of the CP/M-80 operating system. The description of the size, location and contents of the CPMIMAGE.SYS file on a system disk applies to version 1.0 for RX50-based systems. The RX50 diskette is a 5 1/4", soft-sectored, single-sided, double-density diskette with a track spacing of 96 tracks per inch. The arrangement of address marks, sector headers, data fields and gaps is that used by the 1793 LSI controller chip. A diskette contains 80 tracks, numbered 0 through 79. Each track contains 10 512-byte sectors, numbered 1 through 10. This gives a capacity of 5,120 (5K) bytes per track and 409,600 (400K) bytes per diskette. When used for CP/M, these diskettes may be either system or data ______ ____ disks. A system disk contains the CP/M operating system and the necessary supporting files to allow it to be bootstrap loaded into an idle machine. A data disk contains only CP/M files and cannot be bootstrap loaded. The first 12 bytes of track 1, sector 1 are coded to mark these as CP/M disks and to distinguish system from data disks. The DECmate II hardware bootstrap loader tests these bytes and will not attempt to load a non-system disk. Track usage ___________ Tracks on a diskette are used as follows: Tracks Use ______ ___ 0 On a system disk: data for the SETUP screen, keyboard map, and special user-defined display character sets. On a data disk: sector 1 is zero-filled to prevent any attempt to store SETUP data on the disk and sectors 2..10 are undefined. 1 On a system disk: bootstrap program to load the system into an idle machine. On a data disk: sector 1 is coded to mark it as a CP/M data disk and sectors 2..10 are undefined. 2..79 CP/M directory and data area. These 78 tracks are controlled by CP/M's file system. They begin with a 128-entry CP/M directory and contain program and data files. On a system disk, the first directory entry describes a protected file named CPMIMAGE.SYS RX50 Diskette Format Page 2 _________________________________________________________________ which occupies tracks 75..79 and contains the CP/M system image and the extended DECmate firmware. On a data disk, all 78 tracks are usable for CP/M files. Record addressing _________________ The CP/M file system always transfers data to and from its callers in 128-byte records. Four such records are recorded in _______ each 512-byte sector on an RX50 diskette. The blocking and deblocking of records is performed by the Z80 portion of the BIOS (called ZBIOS; its companion on the 6120 part of the machine is called 8BIOS). From the CP/M point of view, a diskette contains 78 tracks numbered 2 through 79 and each track contains 40 records numbered 0 through 39. These two parameters--track [2..79] and record[0..39]-- are passed by BDOS to the BIOS SETTRK and SETSEC routines, respectively. The ZBIOS code divides the CP/M record number by four and adds one to get the (l-origin) physical sector number. The remainder of this division is multiplied by 128 to get the offset to the start of the record within the sector. Since the BIOS and disk controller cannot access physically consecutive sectors without waiting for an extra revolution of the disk, an interleave scheme is used to map logical sectors into non-consecutive physical ones. An every-other-sector (2:1) interleave is used, as shown in the following table: Logical Physical sector sector _______ ________ 1 1 2 3 3 5 4 7 5 9 6 2 7 4 8 6 9 8 10 10 Since there are four CP/M records in each sector, records 0..3 are placed in physical sector 1, records 4..7 in sector 3, and so on. The actual sector translation table in ZBIOS (whose address is in the DPH and is used by the SECTRAN routine in the BIOS) operates on record numbers. It contains 40 entries to convert a 0-origin record number into a 0-origin interleaved record number. Thus its first eight entries are as follows: RX50 Diskette Format Page 3 _________________________________________________________________ Logical Interleaved record record _______ ___________ 0 0 1 1 2 2 3 3 4 8 5 9 6 10 7 11 8 16 9 17 etc. There is no track-to-track skew in this system; physical sector 1 is the first logical sector on every CP/M track Space allocation ________________ Space in the CP/M area is subdivided into allocation blocks which contain 2K bytes (16 records) each. The 78 tracks of the area hold 390K bytes, so there are 195 allocation blocks, numbered 0..194. Thus every file occupies space whose size is a multiple of 2K. File directory ______________ The CP/M file directory has 128 entry positions of 32 bytes each. These occupy allocation blocks 0 and 1, which are the first 32 records (8 sectors) of track 2. System image file _________________ Each CP/M system disk contains a file named CPMIMAGE.SYS which contains the CP/M system, ZBIOS, 8BIOS, and extended DECmate II firmware. This file is always represented by the first entry in the directory. To protect it from accidental damage and to prevent if from disrupting wild-card operations such as PIP *.*, it has the R/O and SYS attributes and it is assigned to user 15. The directory entry describes the file as occupying the last 12 allocation blocks (numbers 183..194), or 24K bytes. Physically, this comprises the last 8 logical sectors of track 75 and all of tracks 76..79. RX50 Diskette Format Page 4 _________________________________________________________________ The CPMIMAGE.SYS file is divided into three parts: The CP/M-80 system image. This comprises the CCP (2048 ________________________ bytes), BDOS (3584 bytes), and ZBIOS (1536 bytes). These 7K bytes correspond to the standard image described in Digital Research's "CP/M 2 Alteration Guide". This data is stored in standard interleaved file format and can be read and written by any CP/M program (after conquering the R/O and user 15 restrictions). Note: The first record of this file is the beginning of the CCP. This contains the command input buffer, which can be patched with a command to be executed automatically after bootstrap loading. Be sure, however, to rewrite the file IN PLACE--the boot loader code expects to find the system image in the exact sectors described above. The 8BIOS image. This is the code executed by the 6120 _______________ processor. All calls to ZBIOS for I/O services are passed to 8BIOS, which has access the the DECmate's I/O devices. It occupies the last 4 logical sectors of track 76 and all of track 77. DECmate firmware. This code supports the DECmate II screen ________________ and keyboard handling. It occupies all of tracks 78 and 79 and is loaded into the 6120's panel memory during bootstrap loading. Diskette initialization _______________________ The CP/M utility program DISKINIT is used to initialize a diskette as either a system or data disk. For system disks, it copies tracks 0, 1, and 75..79 from another system disk and writes a CP/M directory on track 2 whose first entry describes CPMIMAGE.SYS and whose remaining entries are unused, For data disks, it writes dummy information in sector 1 of tracks 0 and 1 and writes a CP/M directory on track 2 with all its entries unused. Note that any diskette to be used with the DECmate II must be physically formatted by its vendor with 10 512-byte sectors on each of 80 tracks. The DECmate II disk controller cannot rewrite a diskette's format data. RX50 Diskette Format Page 5 _________________________________________________________________ Interchange with other DEC systems __________________________________ The CP/M parameters used for the DECmate II RX50 diskettes are the same as those used by the Rainbow for its CP/M-80/86 and by the Professional for its CP/M-80. To summarize, these parameters are: 1) File area in tracks 2..79; 2) Physical sector interleave sequence of 1,3,5,7,9,2,4,6,8,10; 3) Allocation block size of 2K; 4) Directory containing 128 entries. Any DECmate II CP/M disk--system or data--can be used as a data disk on a Rainbow or Professional CP/M system. A DECmate II system disk cannot, of course, be bootstrap loaded as a system disk on either of those systems. RX50 Diskette Format Page 6 _________________________________________________________________ Appendix A: Contents of System Image File A CP/M system disk has a bootstrap loader and system code stored ______ in tracks 1 and 75 through 80. The contents of each sector in those tracks is described below. All references are to physical tracks (0..79) and 512-byte sectors (1..10). Secondary boot ______________ The secondary boot code occupies one sector (track 1, sector 1). It is written in 12-bit mode and occupies 256 (octal 400) words. This is the code which is brought in by the firmware loader during a power-on boot, and its first few bytes contain the DEC standard boot-block code which marks a CP/M system disk. The secondary boot code source file is called BOOT2. Tertiary boot _____________ The tertiary boot code occupies two sectors (track 1, sectors 2 and 3). It is written in 12-bit mode and occupies 512 (octal 100) words. This code is loaded into field 7 by the secondary boot, and it reads the actual 8BIOS code into fields 0 and 1. The tertiary boot code source file is called BOOT3. 8BIOS _____ The 8BIOS code occupies 18 sectors on parts of tracks 1, 77 and 76. It is written in packed mode (two words in each three bytes) and is 6144 (octal 14000) words long. This code is loaded into fields 0 and 1 by the tertiary boot. The tertiary boot contains the following table which determines which sectors are read and in what order: Track Sector _____ ______ 1 4 Start field 0 1 6 1 8 1 10 1 5 1 7 1 9 77 2 77 4 77 6 77 8 77 10 77 3 Start of field 1 77 5 77 7 77 9 77 1 76 6 RX50 Diskette Format Page 7 _________________________________________________________________ CP/M system image _________________ The CPM system image occupies 14 sectors on tracks 75 and 76 and is written in 8-bit mode. It is 7168 bytes long and is subdivided into three parts: CCP (4 sectors, 2048 bytes), BDOS (7 sectors, 3584 bytes), and ZBIOS (3 sectors, 1536 bytes). The sequence of sectors for this image must correspond to the first 14 physical sectors (56 CP/M logical records) of the CPMIMAGE.SYS file, since the CP/M image is installed by using ordinary BDOS file I/O calls. Track Sector _____ ______ 75 5 CCP, 2048 bytes 75 7 75 9 75 2 75 4 BDOS, 3584 bytes 75 6 75 8 75 10 76 1 76 3 76 5 76 7 ZBIOS, 1536 bytes 76 9 76 2 DECmate firmware ________________ The extended firmware which is loaded into 6120 panel memory occupies all of tracks 78 and 79. Uncommitted sectors ___________________ There are three uncommitted sectors on track 76. Sector 4 can be used to add 512 bytes to ZBIOS and sectors 8 and 10 can be used to add 682 (octal 1252) words to 8BIOS, or all three sectors can be used to add 1024 (octal 2000) words to 8BIOS. Track Sector _____ ______ 76 4 76 8 76 10 In order to use these to expand 8BIOS, the sector tables in the tertiary boot BOOT3 and the utility program PUT234 which writes the code on a system diskette, must be modified accordingly. In order to expand ZBIOS, routines RDCPM and LODCPM in 8BIOS must be modified. R.F.Morse DTN 223-6720 MLO3-2/E41 Rev 7, 07-Oct-82 DECmate II CP/M Technical Note 3: 8BIOS Interface Codes _________________________________________________________________ This technical note describes the interface codes used for commands sent from the Z80 CP/M BIOS to the 6120 8BIOS. Each command consists of a 4-bit command code and an 8-bit data byte. ____________ _________ In a Z80 program, a command is sent by calling the OUTBYT routine in the BIOS. Most commands cause 8BIOS to generate a status or data byte for return to the Z80, which is received by calling the INBYT routine. Two additional routines, BLKRD and BLKWR, transmit blocks of data (such as disk sectors) from or to 8BIOS. Four special call entry points have been added to the CP/M BIOS entry vector to permit a CP/M program to send a command to 8BIOS and to receive a byte from 8BIOS. They are: OUTBYT sends a command to 8BIOS. Entry is at offset 003Fh from the BIOS vector base (whose address is in memory at 0001..0002h). Call with the command code in the low 4 bits of the C register and the data byte in the B register. Returns after sending the command; the A and F registers are destroyed. INBYT receives a byte from 8BIOS. Entry is at offset 003Ch from the BIOS vector base. There are no call arguments. Returns with the data from 8BIOS in the A register with the Z and S flags set to reflect its contents. Alters no other registers. BLKRD receives a block of data from 8BIOS. Entry is at offset 0042h from the BIOS vector base. Call with the HL register addressing the first byte of the area to receive the block. On return, HL will address the last byte filled, plus one. The amount of data transferred is controlled by 8BIOS (e.g. 512 bytes for an RX50 disk sector or 128 bytes for an RX01 sector) and can be determined from the value returned in HL. Destroys registers A, B, C and F. BLKWR sends a block of data to 8BIOS. Entry is at offset 0045h from the BIOS vector base. Call with the HL register addressing the first byte to be sent. On return, HL will address the last byte sent, plus one. The amount of data transferred is controlled by 8BIOS, as described above for BLKRD. Destroys registers A, B, C and F. 8BIOS Interface Codes Page 2 _________________________________________________________________ Commands ________ The following table lists the command codes and their associated data bytes in numerical sequence. Using an undefined code or code/data combination should result in no operation, but is not recommended! Code Data Description ____ ____ ___________ 00 any Signals that a Z80 "HALT" instruction has been executed. This code is generated by hardware on the Z80 board; it should not be used by software. 01 00 CP/M "cold boot" function. Abandons the current state of the Z80 and re-reads the CP/M system image from the disk in drive A. This replaces the stored CP/M image (CCP, BIOS, and ZBIOS) for the Z80, but does not reload the 8BIOS code. A more complete ___ restart which reloads everything can be performed by invoking function 02 0B to simulate a power-on reset. 01 01 CP/M "warm boot" function. Must be followed by a call to BLKRD to read all of CCP and BIOS into Z80 storage. 01 02 Get keyboard status. The following INBYT call will return FFh if a character is available from the keyboard, or 00h if not. 01 03 Get printer output status. The following INBYT call will return FFh if the printer can accept an output character, or 00h if not. 01 04 Get communication input. The following INBYT call will return the next incoming character from the communication port, waiting if necessary until one is available. 01 05 Get keyboard input. The following INBYT call will return the next character from the keyboard, waiting if necessary until one is available. 01 06 Disk "home" request. Sets the track number to 0 for the next disk operation and purges any outstanding read-ahead operation. (Does not perform any physical disk operation.) 01 07 Read disk sector. Reads one sector from the previously-selected drive, track and sector. The following INBYT will return 00h if the read was successful, or a non-zero value if not. If successful, a call to BLKRD must follow to transfer the sector image into Z80 storage. (BLKRD must not ___ 8BIOS Interface Codes Page 3 _________________________________________________________________ be called if the read was unsuccessful!) 01 08 Unused. 01 09 Write disk sector. Writes one sector to the previously-selected drive, track and sector. Must be followed by a call to BLKWR to transfer the sector image to the 6120. After the BLKWR call, INBYT must be called. It will return 00h if the write was successful, or a non-zero value if not. 01 0A Get disk type. The following INBYT call will return a code which indicates the format of the disk in the previously-selected disk drive, as follows: 00 RX01--8", single-density, 128-byte sectors, 26 sectors/track, 77 tracks; 01 RX50--5", double-density, 512-byte sectors, 10 sectors/track, 80 tracks; 02 VT180--5", double-density, 512-byte sectors, 9 sectors/track, 40 tracks; 03 RX02--8", double-density, 256-byte sectors, 26 sectors/track, 77 tracks; 04 Other--5", double-density, not RX50 or VT180 format (use function 02 10 to determine its characteristics); FF Drive not installed. 01 0B Get screen output status. Following INBYT call will return FFh if ready to accept a character, or 00h if not. 01 0C Get printer input. Following INBYT call will return the next character from the printer input port, waiting if necessary until one is available. 01 0D Get printer input status. Following INBYT call will return FFh if a character is available from the printer input port, or 00h if not. 01 0E Get communication output status. Following INBYT call will return FFh if the communication port can accept an output character, or 00h if not. 01 0F Get communication input status. Following INBYT call will return FFh if a character is available from the communication input port, or 00h if not. 02 00 Enable communication XON/XOFF pacing. XON and XOFF 8BIOS Interface Codes Page 4 _________________________________________________________________ characters received at the communication input port will control communication output and will not be available to a caller of function 01 04. (This is the default setting.) 02 01 Disable communication XON/XOFF pacing. Received XON and XOFF characters will not control communication output but will instead be passed to a caller of function 01 04. 02 02 Get modem status from communication port. Following INBYT call will return a byte whose low-order 4 bits reflect the modem status, as follows ("one" indicates a "true" value): bit 7--Set if any of bits 3..0 has changed since the last request for modem status. bit 3--Ring indicator (CCITT 125) bit 2--Data carrier detect (CCITT 109) bit 1--Data set ready (CCITT 107) bit 0--Clear to send (CCITT 106) 02 03 Enable printer XON/XOFF pacing. XON and XOFF characters received at the printer input port will control printer output and will not be available to a caller of function 01 0C. (This is the default setting.) 02 04 Disable printer XON/XOFF pacing. XON and XOFF characters received at the printer input port will not control printer output but will instead be passed to a caller of function 01 0C. 02 05 Disable recognition of the SETUP key. (The key will be re-enabled at the next CP/M warm-start or by function 02 0A.) 02 06 Send BREAK signal to communication output port. A second call to OUTBYT (with a command code of 0Ah) sends a data byte whose value (0..255) specifies the length of the break in units of 10 milliseconds (i.e. a value of 1Ch gives a duration of 280 milliseconds). 02 07 Set modem control lines of communication port. A second call to OUTBYT (with a command code of 0Ah) sends a data byte which is interpreted as follows: bit 4--One asserts request to send (CCITT 105) ___ bit 3--One asserts data terminal ready (CCITT ___ 108.2) bit 2--One asserts signal rate select (CCITT 111) ___ 02 08 Set communication baud rate. A second call to OUTBYT (with a command code of 0Ah) sends a data byte whose 8BIOS Interface Codes Page 5 _________________________________________________________________ low-order 4 bits are interpreted as follows: 00 50 bps 08 1800 01 75 09 2000 02 110 0A 2400 03 134.5 0B 3600 04 150 0C 4800 05 300 0D 7200 06 600 0E 9600 07 1200 0F 19200 Note: The default value is set from the SETUP data stored on the system disk. If the rate is changed by using function 02 08, that change cannot be detected by SETUP, and any subsequent use of the SETUP menu will change the baud rate back to that shown in the menu. 02 09 Set printer port baud rate. A second call to OUTBYT (with a command code of 0Ah) sends a value as described above for function 02 08. The note concerning the use if SETUP also applies to the printer port. 02 0A Enable SETUP key recognition. This reverses the effect of function 02 05. 02 0B Perform power-on reset. Abandons the current state of the machine and begins execution in the bootstrap ROM as if power had just been turned on. 02 0C Reset real-time clock. Sets the time counter to zero. 02 0D Read real-time clock. The real-time clock is a 12-bit register which is incremented every 10 milliseconds and wraps around modulo 4096. The value is read in two INBYT calls. The first returns the high-order 4 bits of the counter in bits 3..0 (bits 7..4 are zero); the second returns the low-order 8 bits of the counter. 02 0E Get screen width. The following INBYT call will return a value of 00h if the screen width is 80 columns or 01h if it is 132 columns. 02 0F Set communication character type. A second call to OUTBYT (with a command code of 0Ah) sends a data byte whose bits are interpreted as follows: bits 7..6 Number of data bits (exclusive of parity bit): 00 -- 5 bits 01 -- 7 bits 8BIOS Interface Codes Page 6 _________________________________________________________________ 10 -- 6 bits 11 -- 8 bits bits 5..4 Unused bits 3..2 Number of stop bits transmitted: 01 -- 1 stop bit 10 -- 1.5 stop bits 11 -- 2 stop bits bit 1 Parity sense (ignored if parity not enabled): 0 -- ODD parity 1 -- EVEN parity Bit 0 Parity enable: 0 -- disable 1 -- enable Using this function reset the communication channel and discards any pending input and output data. The mode after a system reset is 8 data bits, no parity and 1 stop bit; this is not affected by the use of the SETUP key. This function does not alter the communication channel's baud rate; function 02 08 does that. 02 10 Get 5" diskette characteristics. The next 4 INBYT calls will return bytes which describe the physical characteristics of the 5" disk selected by the most recent call to function 06 (do not use for external 8" drives--no useful information can be returned). byte 1: Sectors per track, a binary number in the range 1..32 (01h..20h) byte 2: Sector size code: 00h -- 128 bytes 01h -- 256 bytes 02h -- 512 bytes 03h -- 1024 bytes byte 3: Track density code: 00h -- 48 tpi 01h -- 96 tpi byte 4: Two-sided flag: 00h -- single-sided 01h -- double-sided 02 11 Perform a print-screen operation. Issuing this call has the same effect as the operator's pressing the "Print Screen" key. 02 12 Perform a setup operation. Issuing this call has the same effect as the operator's pressing the "Setup" key. This call will be ignored if SETUP recognition has been disabled by function 02 05. 03 data Send data character to the printer output port. 8BIOS Interface Codes Page 7 _________________________________________________________________ 04 data Send data character to the video screen. 05 data Send data character to the communication output port. 06 data Select disk drive. "Data" is 00..03 for internal RX50 drives and 04..07 for external RX01/RX02 drives. A subsequent INBYT call will return 00h if the drive is installed, or FFh if not. 07 data Select disk track. Two successive calls must be made to send the 16-bit track number; the first call sends the high-order byte. 08 data Select disk sector. Two successive calls must be made to send the 16-bit sector number; the first call sends the high-order byte. 09 data Select disk head. (Not presently used.) 0A data Block data output. Used by the BLKWR routine and for functions (such as 02 07) which require a data byte. The remaining command codes 0B..0F are not presently defined. Rev 1, 17-Mar-83 DECmate II CP/M Technical Note 5: CP/M Support for RD51D Hard Disk _________________________________________________________________ This technical note describes modifications to the 8BIOS and ZBIOS modules of CP/M to accommodate the RD51D hard disk. It should be read in conjunction with the following documents: 1. Programming the DECmate II for the RD51D Disk Subsystem _______________________________________________________ 2. DTN #7: 8BIOS Interface Codes for Release 2 ____________________________________________ 3. CP/M 2 Alteration Guide (by Digital Research) _____________________________________________ CP/M Volumes on an RD51D ________________________ A CP/M system may access up to four hard disk logical volumes at once, using disk drive letters "E" through "H". The 8BIOS select-disk-drive function (command 06 xx) receives hex values 04..07 for hard disk volumes and converts these to references to RD51D devices 0..3. (devices 4 through 15 are not used by CP/M and should have no volumes mounted in them during CP/M operation.) CP/M views each volume as being composed of tracks and sectors. Each track contains 64 logical sectors of 128 bytes, or 16 physical sectors of 512 bytes. Both logical and physical sectors are numbered beginning from 0. The 8BIOS select-disk-sector function (command 08 xx) accepts physical sector numbers in the range 0..15; the select-disk-track function (command 07 xx) accepts track numbers in the range 0 through the volume size minus one. (The volume size is found in the volume's directory entry in the two bytes beginning at offset 14. Since this number represents units of 16 blocks, it is already scaled to CP/M track units.) The 8BIOS select-disk-head function (command 09 xx) is not used. No sector interleave table is used by CP/M for hard disk volumes. The size of a CP/M volume may vary from 1 track (scarcely useful) to 1024 tracks (8 megabytes). The size of the directory and the size of allocation blocks for the volume are computed as a function of the volume size; this algorithm is described below. There are two types of CP/M volumes on an RD51D: system and ______ data. These are distinguished by the byte at offset 17 in the ____ CP/M Support for RD51D Hard Disk Page 2 _________________________________________________________________ volume's directory entry: 40h Data volume. The directory starts in block 0 and the ____ entire volume is usable for CP/M files. C0h System volume. The first four tracks (blocks 0..63) ______ contain a bootable CP/M system, as follows: Blocks Contents ______ ________ 0 System boot loader, written in 12-bit mode. 1..47 8BIOS code in compressed 8-bit format (this area holds 16042 words, or just under four fields). 48..51 CP/M's CCP (2048 bytes). 52..58 CP/M's BDOS (3584 bytes). 59..63 ZBIOS (up to 2560 bytes). The directory begins at block 64, which is the first sector of track 4 from CP/M's point of view. Directory and allocation block sizes ____________________________________ CP/M allocates the space on a volume to files in units called "allocation blocks" (ALB's). The size of an allocation block varies, depending upon the size of the volume and the space available in the bit map area in the ZBIOS which is used by BDOS when the volume is logged on. The ZBIOS contains a 1024-bit (128-byte) area (called the "allocation vector" or ALV) for each of the four devices assigned to the RD51D. Therefore, the ALB size for a volume is chosen such that there will be no more than 1024 ALB's on it. The CP/M directory occupies one or more consecutive ALB's beginning with ALB number 0. Each entry in the directory describes a file (or an extent of a large file) and contains the numbers of the ALB's assigned to the file. A directory entry occupies 32 bytes. The following table shows the ALB and directory sizes for the various ranges of volume sizes (note--these are the sizes after subtracting 32KB if the volume is a system volume): Volume size ALB size Directory ALB's for ALB's per (kilobytes) (kilobytes) entries directory entry ___________ ___________ _________ _________ _________ 16.. 256 1 96 3 16 257.. 512 2 128 2 16 513..2048 2 256 4 8 2049..4096 4 384 3 8 4097..8192 8 512 2 8 CP/M Support for RD51D Hard Disk Page 3 _________________________________________________________________ BIOS Data Tables ________________ Two data tables in ZBIOS describe the characteristics of each CP/M disk device: the "disk parameter header" (DPH) and the "disk parameter block" (DPB). There is one DPH for each disk drive supported by the BIOS and there is one DPB for each different supported disk type and size. Each DPH contains a pointer to the DPB which describes the disk currently mounted on the DPH's drive. The contents of these are described in chapter 10 of the CP/M 2 Alteration Guide. _______________________ The DECmate II BIOS adds a 12-byte prefix to each DPH to describe some of the physical attribute of its device and to support CP/M's logical blocking/deblocking algorithm. When a device is used to access an RD51D volume, the contents of these two tables must be adjusted to reflect the size of the mounted volume. Data for the variable areas of these two blocks are set up by the 8BIOS get-hard-disk-characteristics function (command 01 08) and passed to ZBIOS in two block transfers--a "D" record for the DPH prefix and a "P" record for the DPB. The D record contains 10 bytes which are moved into the prefix to ________ the standard DPH. These bytes are shown below (two-byte numeric values are stored low-order byte first): Byte Name Contents ____ ____ ________ 1 D_FLAG Volume type: 81h if a CP/M volume; 00h otherwise 2 D_TYP Device type: 88h (constant) 3..4 D_BPS Bytes per physical sector: 512 (constant) 5..6 D_SPT Physical sectors per track: 16 (constant) 7..8 D_TPD Number of tracks in the volume: from the volume's directory entry (this value is taken straight from the directory; it is not adjusted for a "system" volume.) 9 D_SAB Physical sectors per CP/M allocation block: computed by the formula (ALB_SIZE * 2); this value is meaningless for non CP/M volumes 10 D_1PS Number of first physical sector on a track: 0 (constant) The P record contains 15 bytes which constitute a complete DPB. ________ Several of these are derived from ALB_SIZE, which is the CP/M allocation block size expressed as a number of kilobytes. ALB_SIZE has one of the five values 1, 2, 4, 8 or 16. The bytes in a P record are shown below (two-byte numeric values are stored low_order byte first): CP/M Support for RD51D Hard Disk Page 4 _________________________________________________________________ Byte Name Contents ____ ____ ________ 1..2 P_SPT Logical sectors per track: 64 (constant) 3 P_BSH Block shift factor: the number of bits in P_BLM 4 P_BLM Allocation block mask: (ALB_SIZE * 8) - 1 This is the number of 128-byte records in an allocation block, minus 1. 5 P_EXM Extent mask: depends upon the allocation block size and the number of allocation blocks in the volume, thus: if P_DSM < 256 then P_EXM - P_BLM shr 3 else P_EXM - P_BLM shr 4 where "shr" is a right-shift operation which fills the vacated high-order bits with zeros. 6..7 P_DSM Number of allocation blocks in the volume, minus one (i.e. the highest ALB number) 8..9 P_DRM Number of directory entries, minus one. This must agree with the size implied by the number of ALB's assigned to the directory in P_ALD, below. There are 32 entries per kilobyte. 10..11 P_ALD Sixteen-bit map to reserve allocation blocks for the directory. Bits are set, beginning with the high-order bit of byte 10 and proceeding toward the low-order bit of byte 11, one for each ALB used for the directory. For example, a volume with ALB_SIZE = 2K and 256 directory entries uses the first 4 ALB's for the directory, so the bytes of P_ALD are F0h, 00h and P_DRM is 255. 12..13 P_CKS Directory checksum area size. Not used for RD51D volumes; always 0. 14..15 P-OFF Offset to the track upon which the first ALB starts. 0 for an RD51D data volume; 4 for a system volume. Non-CP/M Volume Access ______________________ Non-CP/M volumes can be accessed by a CP/M program by using direct calls to ZBIOS which address physical sectors and transfer data in 512-byte blocks. such a volume cannot be accessed via normal BDOS calls. The 8-megabyte volume size limit does not apply to non-CP/M volumes. CP/M Support for RD51D Hard Disk Page 5 _________________________________________________________________ 8BIOS Functions _______________ The following 8BIOS functions are used for both diskettes and hard disk volumes: 06 xx Select disk drive 07 xx Select disk track 08 xx Select disk sector 01 06 Home (selects track 0) 01 07 Read disk sector 01 09 Write disk sector 01 0A Get disk type code (code 88h has been added for hard disk devices) Function 02 10, get diskette characteristics, may be used only for 5 1/4" diskettes. Attempting to use it for 8" diskettes or a hard disk device will return useless bytes. The following new functions have been added to support the RD51D: 01 08 Get hard disk characteristics. Returns DPH and _____________________________ DPB data to fill in tables in ZBIOS to reflect the dimensions of the volume on the currently selected device. After sending this function code to 8BIOS, the caller must issue two BLDRD calls: the first returns a 10-byte D record and the second returns a 15-byte P record. 02 1F Execute RD51D command. This is a general _____________________ function to allow a Z80 program to execute any RD51D command. After sending this function code, the program must issue one OUTBYT call to send the right 8 bits of the controller command code (the high 4 bits are always 0). The program must then call either BLDRD or BLDWRT to transfer the data required by the command. The direction of the transfer and the number of bytes transferred depend upon the command. Following the block transfer, the program must issue one INBYT call to receive the error code from the RD51D (0 indicates no error). Note: This call does not properly handle SET block and SET PHYSICAL ADDRESS commands; these require 12-bit values. This problem is to be resolved. R.F.Morse DTN 223-6720 MLO3-2/E41 Rev 0, 11-Feb-83 DECmate II CP/M Technical Note 6: RX50 Diskette Format for CP/M Release 2 _________________________________________________________________ This note describes the format and contents of the RX50 diskettes used by the DECmate II version of the CP/M-80 operating system. The description of the size, location and contents of the CPMIMAGE.SYS file on a system disk applies to CP/M Release 2 for RX50-based systems. The RX50 diskette is a 5 1/4", soft-sectored, single-sided, double-density diskette with a track spacing of 96 tracks per inch. The arrangement of address marks, sector headers, data fields and gaps is that used by the 1793 LSI controller chip. A diskette contains 80 tracks, numbered 0 through 79. Each track contains 10 512-byte sectors, numbered 1 through 10. This gives a capacity of 5,120 (5K) bytes per track and 409,600 (400K) bytes per diskette. When used for CP/M, these diskettes may be either system or data ______ ____ disks. A system disk contains the CP/M operating system and the necessary supporting files to allow it to be bootstrap loaded into an idle machine. A data disk contains only CP/M files and cannot be bootstrap loaded. The first 12 bytes of track 1, sector 1 are coded to mark these as CP/M disks and to distinguish system from data disks. The DECmate II hardware bootstrap loader tests these bytes and will not attempt to load a non-system disk. Track usage ___________ Tracks on a diskette are used as follows: Tracks Use ______ ___ 0 On a system disk: data for the SETUP screen, keyboard map, and special user-defined display character sets. On a data disk: sector 1 is zero-filled to prevent any attempt to store SETUP data on the disk and sectors 2..10 are undefined. 1 On a system disk: bootstrap program to load the system into an idle machine. On a data disk: sector 1 is coded to mark it as a CP/M data disk and sectors 2..10 are undefined. 2..79 CP/M directory and data area. These 78 tracks are controlled by CP/M's file system. They begin with a 128-entry CP/M directory and contain program and data files. On a system disk, the first directory entry describes a protected file named CPMIMAGE.SYS RX50 Diskette Format for CP/M Release 2 Page 2 _________________________________________________________________ which occupies tracks 74..79 and contains the CP/M system image and the extended DECmate firmware. On a data disk, all 78 tracks are usable for CP/M files. Record addressing _________________ The CP/M file system always transfers data to and from its callers in 128-byte records. Four such records are recorded in _______ each 512-byte sector on an RX50 diskette. The blocking and deblocking of records is performed by the Z80 portion of the BIOS (called ZBIOS; its companion on the 6120 part of the machine is called 8BIOS). From the CP/M point of view, a diskette contains 78 tracks numbered 2 through 79 and each track contains 40 records numbered 0 through 39. These two parameters--track [2..79] and record[0..39]--are passed by BDOS to the BIOS SETTRK and SETSEC routines, respectively. The ZBIOS codes divides the CP/M record number by four and adds one to get the (l-origin) physical sector number. The remainder of this division is multiplied by 128 to get the offset to the start of the record within a sector. Since the BIOS and disk controller cannot access physically consecutive sectors without waiting for an extra revolution of the disk, an interleave scheme is used to map logical sectors into non-consecutive physical ones. An every-other-sector (2:1) interleave is used, as shown in the following table: Logical Physical sector sector ______ ______ 1 1 2 3 3 5 4 7 5 9 6 2 7 4 8 6 9 8 10 10 Since there are four CP/M records in each sector, records 0..3 are placed in physical sector 1, records 4..7 in sector 3, and so on. The actual sector translation table in ZBIOS (whose address is in the DPH and is used by the SECTRAN routine in the BIOS) operates on record numbers. It contains 40 entries to convert a 0-origin record number into a 0-origin interleaved record number. Thus its first eight entries are as follows: RX50 Diskette Format for CP/M Release 2 Page 3 _________________________________________________________________ Logical Interleaved record record ______ ___________ 0 0 1 1 2 2 3 3 4 8 5 9 6 10 7 11 8 16 9 17 etc. There is no track-to-track skew in this system; physical sector 1 is the first logical sector on every CP/M track Space allocation ________________ Space in the CP/M area is subdivided into allocation blocks which contain 2K bytes (16 records) each. The 78 tracks of the area hold 390K bytes, so there are 195 allocation blocks, numbered 0..194. Thus every file occupies space whose size is a multiple of 2K. File directory ______________ The CP/M file directory has 128 entry positions of 32 bytes each. These occupy allocation blocks 0 and 1, which are the first 32 records (8 sectors) of track 2. System image file _________________ Each CP/M system disk contains a file named CPMIMAGE.SYS which contains the CP/M system, ZBIOS, 8BIOS, and extended DECmate II firmware. This file is always represented by the first entry in the directory. To protect it from accidental damage and to prevent if from disrupting wild-card operations such as PIP *.*, it has the R/O and SYS attributes and it is assigned to user 15. The directory entry describes the file as occupying the last 15 allocation blocks (numbers 180..194), or 30K bytes. Physically, this comprises all of tracks 74 through 79. RX50 Diskette Format for CP/M Release 2 Page 4 _________________________________________________________________ The CPMIMAGE.SYS file is divided into three parts: The CP/M-80 system image. This comprises the CCP (2048 ________________________ bytes), BDOS (3584 bytes), and ZBIOS (2048 bytes). These 7.5K bytes correspond to the standard image described in Digital Research's "CP/M 2 Alteration Guide". This data is stored in standard interleaved file format and can be read and written by any CP/M program (after conquering the R/O and user 15 restrictions). Note: The first record of this file is the beginning of the CCP. This contains the command input buffer, which can be patched with a command to be executed automatically after bootstrap loading. Be sure, however, to rewrite the file IN PLACE--the boot loader code expects to find the system image in the exact sectors described above. The 8BIOS image. This is the code executed by the 6120 _______________ processor. All calls to ZBIOS for I/O services are passed to 8BIOS, which has access the the DECmate's I/O devices. It occupies parts of tracks 1, 75, 76 and 77 (see Appendix A). DECmate firmware. This code supports the DECmate II screen ________________ and keyboard handling. It occupies all of tracks 78 and 79 and is loaded in to the 6120's panel memory during bootstrap loading. Diskette initialization _______________________ The CP/M utility program DISKINIT is used to initialize a diskette as either a system or data disk. For system disks, it copies tracks 0, 1 and 74..79 from another system disk and writes a CP/M directory on track 2 whose first entry describes CPMIMAGE.SYS and whose remaining entries are unused, For data disks, it writes dummy information in sector 1 of tracks 0 and 1 and writes a CP/M directory on track 2 with all its entries unused. Note that any diskette to be used with the DECmate II must be physically formatted by its vendor with 10 512-byte sectors on each of 80 tracks. The DECmate II disk controller cannot rewrite a diskette's format data. RX50 Diskette Format for CP/M Release 2 Page 5 _________________________________________________________________ Interchange with other DEC systems __________________________________ The CP/M parameters used for the DECmate II RX50 diskettes are the same as those used by the Rainbow for its CP/M-80/86 and by the Professional for its CP/M-80. To summarize, these parameters are: 1) File area in tracks 2..79; 2) Physical sector interleave sequence of 1,3,5,7,9,2,4,6,8,10; 3) Allocation block size of 2K; 4) Directory containing 128 entries. Any DECmate II CP/M disk--system or data--can be used as a data disk on a Rainbow or Professional CP/M system. A DECmate II system disk cannot, of course, be bootstrap loaded as a system disk on either of those systems. RX50 Diskette Format for CP/M Release 2 Page 6 _________________________________________________________________ Appendix A: Contents of System Image File A CP/M system disk has a bootstrap loader and system code stored ______ in tracks 1 and 74 through 80. The contents of each sector in those tracks is described below. All references are to physical tracks (0..79) and 512-byte sectors (1..10). Secondary boot ______________ The secondary boot code occupies one sector (track 1, sector 1). It is written in 12-bit mode and occupies 256 (octal 400) words. This is the code which is brought in by the firmware loader during a power-on boot, and its first few bytes contain the DEC standard boot-block code which marks a CP/M system disk. The secondary boot code source file is called BOOT2. Tertiary boot _____________ The tertiary boot code occupies two sectors (track 1, sectors 2 and 3). It is written in 12-bit mode and occupies 512 (octal 1000) words. This code is loaded into field 7 by the secondary boot, and it reads the actual 8BIOS code into fields 0, 1 and 2. The tertiary boot code source file is called BOOT3. 8BIOS _____ The 8BIOS code occupies 30 sectors on parts of tracks 1, 77, 76 and 75. It is written in packed mode (two words in each three bytes) and is 10240 (octal 24000) words long. This code is loaded into fields 0, 1 and 2 by the tertiary boot. The tertiary boot contains the following table which determines which sectors are read and in what order: RX50 Diskette Format for CP/M Release 2 Page 7 _________________________________________________________________ Track Sector _____ ______ 1 4 Start field 0 1 6 1 8 1 10 1 5 1 7 1 9 77 2 77 4 77 6 77 8 77 10 77 3 Start of field 1 77 5 77 7 77 9 77 1 76 4 76 6 76 8 76 10 76 2 76 5 76 7 76 9 Start of field 2 76 1 76 3 75 6 75 8 75 10 Table A-1. 8BIOS Image Sector Map CP/M system image _________________ The CPM system image occupies 15 sectors on tracks 74 and 75 and is written in 8-bit mode. It is 7680 bytes long and is subdivided into three parts: CCP (4 sectors, 2048 bytes), BDOS (7 sectors, 3584 bytes), and ZBIOS (4 sectors, 2048 bytes). The sequence of sectors for this image must correspond to the first 15 physical sectors (60 CP/M logical records) of the CPMIMAGE.SYS file, since the CP/M image is installed by using ordinary BDOS file I/O calls. RX50 Diskette Format for CP/M Release 2 Page 8 _________________________________________________________________ Track Sector _____ ______ 74 1 CCP, 2048 bytes 74 3 74 5 74 7 74 9 BDOS, 3584 bytes 74 2 74 4 74 6 74 8 74 10 75 1 75 3 ZBIOS, 2048 bytes 75 5 75 7 75 9 Table A-2. ZBIOS Image Sector Map DECmate firmware ________________ The extended firmware which is loaded into 6120 panel memory occupies all of tracks 78 and 79. Uncommitted sectors ___________________ There are two uncommitted sectors on track 75. Sectors 2 and 4 can be used to add 682 (octal 1252) words to 8BIOS, or 1024 bytes to ZBIOS or can be split between them. Track Sector _____ ______ 75 2 75 4 In order to use these to expand 8BIOS, the sector tables in the tertiary boot BOOT3 and the utility program PUT234 which writes the code on a system diskette, must be modified accordingly. In order to expand ZBIOS, routines RDCPM and LODCPM in 8BIOS must be modified. R.F.Morse DTN 223-6720 MLO3-2/E41 Rev 7, 20-Jun-83 DECmate II CP/M Technical Note 7: 8BIOS Interface Codes for Release 2 _________________________________________________________________ This Tech Note has not been found -- yet. Rev 1, 20-Jun-83 DECmate II CP/M Technical Note 9: System Bootstrap Operation _________________________________________________________________ This note describes the operation of the DECmate II system bootstrap under three conditions: -- At power-on, -- when Remove and Do are pressed while the SETUP screen is displayed, -- When the panel request instruction PR3, 6 is issued. This description applies to systems which have panel code ROM chips at level 19 or greater. These support the optional RD51D hard disk system as well as the standard RX50 diskette drive. Power-on ________ When system power is turned on, the ROM code first does basic system checks (these result in the screen patterns full of "U" and "a"), and then searches for a bootable system disk in either RX50 drive 0 or (if installed) on the RD51 hard disk. This power-on boot search operates as follows: ____________________ REPEAT IF RX50 drive 0 is ready AND track 1 sector 1 has bootable-disk code AND track 0 sector 1 has valid firmware THEN attempt to load the system firmware and the operating system from diskette ELSE display the flashing diskette picture. IF RD51 is installed and ready AND block 0 indicates valid firmware AND there is a volume marked with the "startup" flag which is bootable THEN load the system firmware, mount the startup volume on device 0, and attempt to load the operating system from it. UNTIL a system is successfully loaded. For a system which does not have an RD51, this simply attempts to boot from RX50 drive 0 until a valid bootable disk is inserted. For a system with both RX50 and RD51 drives, it will boot from System Bootstrap Operation Page 2 _________________________________________________________________ whichever becomes ready first. Thus, if the RD51 has a valid startup volume and no diskette is in drive 0, the RD51 will be booted. If there is a bootable diskette in drive 0, it will be used in preference to the RD51. The normal spinup delay of 15 to 20 seconds for the RD51 gives ample time to insert a diskette and close its door to preempt a hard-disk boot. REMOVE option of SETUP ______________________ When the standard system SETUP screen is displayed, pressing the Remove and Do keys initiates a power-on boot search operation ____________________ exactly as described above for power-on. Thus if a user has been running from the RD51 and wishes to change to a diskette-resident system (e.g. WPS), he can do this by entering SETUP, inserting the WPS system disk in diskette drive 0, and pressing Remove and Do. Conversely, if he wishes to go from a diskette-resident system to the RD51, he need only be sure that diskette drive 0 is not ready (door open) before pressing Remove and Do. Panel Request 3 _______________ Function 6 of panel request 3 is invoked by the following 6120 instruction sequence: PR3 0006 -1 The action performed depends upon the contents of the accumulator, as follow: AC Action __ ______ 0 Display the SETUP screen -1 Display the 6120 HALT screen -2 Attempt to boot from RX50 drive 0 -3 Attempt to boot from the RD51 volume presently mounted on logical device 0. If either boot attempt fails, the system then goes to the power-on boot search process described above. Warning: This PRQ should not be used to change between _______ ___ diskette-loaded and hard-disk-loaded systems. This is because the panel code firmware is not reloaded when this PRQ is issued. When the firmware was loaded, it noted which device--diskette or hard disk--it was loaded from, and thereafter always refers to System Bootstrap Operation Page 3 _________________________________________________________________ that device when the SETUP function is invoked. Therefore, using PR3, 6 to change from, say, a diskette-based operating system to one loaded from the hard disk will not alter the firmware, which will still attempt to use the diskette for a SETUP operation. R.F.Morse DTN 233-6720 MLO3-2/E41 Rev 0, 19-Apr-83 DECmate II CP/M Technical Note 10: Z80 Memory Map for Release 2 _________________________________________________________________ This note describes the allocation of the 65536. (64K) bytes of memory in the Z80 APU when operating under CP/M 2.2 release 2. There are two maps: one for diskette-only systems and one for systems which support an RD51 hard Disk. Diskette-only system (nominal size of 63K): ____________________ Usage Addresses Length _____ _________ ______ System parms 0000..00FF 100 256. TPA 0100..DFFF DF00 57088. CCP E000..E7FF 800 2048. BDOS E800..F5FF E00 3548. BIOS code F600..FBFF 600 1536. BIOS work area FC00..FFFF 400 1024. Diskette and hard disk system (nominal size of 62K): _____________________________ Usage Addresses Length _____ _________ ______ System parms 0000..00FF 100 256. TPA 0100..DBFF DB00 56064. CCP DC00..E3FF 800 2048. BDOS E400..F1FF E00 3548. BIOS code F200..F9FF 800 2048. BIOS work area FA00..FFFF 600 1536. Application programs occupy the transient program area (TPA). Large application programs usually overlay the CCP (console command processor), so the limit on their size is the sum of the sizes of the TPA and the CCP from the tables. The area described as "BIOS code" is loaded from the CP/M system image during a cold start. It may actually have some work area at its end if the assembled code is smaller than the maximum. The top of the BIOS code cannot exceed address FD00 in any system, since the monitor program which transfers data from the 6102 to the Z80 during a cold start begins there. R.F.Morse DTN 223-6720 MLO3-2/E41 Rev 0, 20-Jun-83 DECmate II CP/M Technical Note 11: Console Standard Modes for Release 2 _________________________________________________________________ This note describes what CP/M does upon cold starts and warm starts to set the console and keyboard to a standard state. The large number of programmable operating modes, display character sets, and keyboard interpretations means that an application program can leave the system in such a state that it is difficult or impossible to enter a command to CP/M or to execute subsequent applications. Therefore, the CP/M BIOS takes the steps described below whenever it receives control after initial loading (a "cold start") and after every application program ends (a "warm start"). CP/M establishes the following conditions for the display: -- USASCII character set -- ANSI level 2 control sequences -- 7-bit mode (insensitive to the high-order bit of any character sent to the screen. -- full-screen scrolling region -- character-replace mode -- no auto-wrap at the end of a line -- line-feed mode (not new-line) -- normal character rendition -- cursor visible For the keyboard: -- keyboard unlocked -- top row function keys active -- the three keys above the "+" key generate ESC, BS and LF -- function keys emit the two-character CSI prefix "ESC [" -- 7-bit mode -- auto-repeat enabled -- keypad in numeric mode -- arrow keys generate cursor-positioning codes The following things are not changed: -- screen width -- cursor style -- keyclick -- black or white screen background -- scrolling speed -- "caps lock" vs. "shift lock" -- COMPOSE key activation Console Standard Modes for Release 2 Page 2 _________________________________________________________________ -- current case of the keyboard Note that the preceding means that two of the items on the SETUP screen are overridden by CP/M: the cursor is made visible and the terminal mode is made ANSI (shown as "VT100" on the setup menu). Application programs may issue the appropriate control sequences to alter the display and keyboard features to suit themselves. In particular, a communication program may choose to change to full level 2 mode with 8-bit characters in order to emulate a VT2xx terminal, and a text processing program may use the full DEC multinational character set and 8-bit character codes. Warm start actions __________________ The following actions take place (in the order shown) whenever CP/M is initially loaded and whenever it reloads its console command processor (CCP) following the execution of an application program: -- Enter ANSI mode (in case terminal is in VT52 mode) ESC < -- Terminate control string ESC \ -- Select level 2 mode with 2-character CSI ESC [ 6 2 ; 1 " p -- Enable keyboard auto-repeat ESC [ ? 8 h -- Make cursor visible ESC [ ? 2 5 h -- Activate the ESC, BS, and LF keys PR3, 0010, -1 with AC=0000 -- Select 7-bit host mode PR3, 0014, -1 with AC=0000 (This sequence can be sent to the console at any time by calling the BIOS OUTBYT routine to send command 02 23, as described in DTN#7, 8BIOS Interface Codes.) _____________________ Invoking 8-bit mode ___________________ Application programs which wish to use the full 8-bit capabilities of the terminal firmware must use an extended BIOS command (see DTN#7) to execute a panel request in the 6120. To invoke 8-bit mode, send command 02 21 followed by the two hexadecimal data bytes 0C and 01 (this executes the instruction Console Standard Modes for Release 2 Page 3 _________________________________________________________________ sequence PR3, 0014, -1 with 0001 in the AC). The ANSI sequence ESC [ 6 2 ; 1 " p which invokes level 2 operation also sets all the top row function keys to generate multicharacter control sequences. If the one-character ESC, BS, and LF codes are needed from the keys so labelled, the panel request listed above under warm start actions must be issued after sending the ANSI sequence. This can be accomplished by _____ sending extended BIOS command 01 21 followed by data bytes 08 and 00. Compatibility with CP/M release 1 _________________________________ The standard console modes described above are generally the same as those established by a warm start in CP/M release 1 for the DECmate II. Release 2 is more thorough: it also sets the character set to USASCII, turns off autowrap, and sets the scrolling region to full screen and absolute origin mode. Unlike release 1, the case shift of the keyboard is not altered during a cold start. This means that it will be lower-case if the system firmware was loaded as part of the cold start (as in loading from a diskette), but may be either case if CP/M was invoked from some other system (e.g. the master menu) in a Winchester environment. R.F.Morse DTN 223-6720 MLO3-2/E41 Rev 0, 27-Jun-83 DECmate II CP/M Technical Note 12: Format of Hard Disk Backup Diskettes _________________________________________________________________ This note describes the manner in which the contents of an RD51 hard disk volume are transcribed to one or more RX50 diskettes to create a literal backup copy. These backup diskettes are written by the "HD" utility program (both the Master Menu and CP/M versions) and are intended only for use by that program--they are not compatible with any operating system's file format. Each backup diskette contains up to 790 blocks from a hard disk volume. As many diskettes as required by the volume's size are used, and all save the last diskette contain 790 blocks from the volume. The diskettes are numbered in sequence, starting from 1. This sequence number and the number of diskettes used to hold the volume are recorded in a label record, whose contents are described below. Volume data arrangement _______________________ A volume is copied to diskettes by reading its blocks in ascending order from block 0 through block n-1, where n is the number of blocks in the volume. Each group of 10 blocks is written onto one track of a diskette. To enhance performance, the diskette sectors are written in an interleaved pattern which enables writing (or reading) a track in two revolutions. The sequence of sector numbers is 1, 3, 5, 7, 9, 2, 4, 6, 8, 10. Thus, for example, hard disk block 0 is written into diskette sector 1, block 1 into sector 3, block 9 into sector 10, and block 10 into sector 1 of the next diskette track. Seventy-nine tracks of each diskette (except possibly the last) are used in descending track number sequence from track 79 down through track 2, and then track 0 (track 1 is reserved for the label). This apparently perverse ordering is intended to reduce the chances that an operating system will recognize the first diskette of a backup copy as an OS-format diskette. The contents of the tracks of the last diskette of a backup set which are not required to hold volume data are unspecified. Likewise, the contents of the unused sectors in the last track of the last diskette are also unspecified. Format of Hard Disk Backup Diskettes Page 2 _________________________________________________________________ Diskette labels _______________ A label record is written into sector 1 of track 1 of each backup diskette. (Sectors 2 through 10 of track 1 are not used; their contents are unspecified.) This label identifies the volume from which the backup was made and contains the date and time of the backup. The label record is identical for every diskette of a backup set, except for the sequence number. When a backup copy is read to restore it to a hard disk, the HD utility checks that all the diskette labels are identical in order to prevent mixing diskettes from backup copies made at different times. The contents of the label are described below. Byte positions are given as decimal offsets from the beginning of the sector. All unused bytes (0..255 and 366..511) are binary zero. Bytes Contents _________ _____________ 256..263 Signature pattern: the 7 ASCII characters "RDBackup" followed by a NULL 264..287 24-byte volume directory entry, exactly as read from the hard disk's directory, except as noted: 264..271 volume name 272..275 passwords 276..277 starting block--set to 0 278..279 volume size in units of 8K (low-order byte first) 280 volume flags--set to hex 10 ("valid volume" value) 281 OS-type flags 282..287 Miscellaneous data 288 Diskette sequence number: 8-bit unsigned binary, beginning with 1 289 Number of diskettes in backup set: 8-bit unsigned binary 290..298 Date of backup: 8 ASCII characters "mm/dd/yy" followed by a NULL 299..304 Time of backup: 5 ASCII characters "hh:mm" followed by a NULL 305..365 User's remark: 0 to 60 ASCII characters, the last followed by a NULL R.F.Morse DTN 223-6720 MLO3-2/E41 Rev 0, 7/1/83 Fri DECmate II CP/M Technical Note 13: Loading and Using Extensions to 8BIOS _________________________________________________________________ This note describes the use of the 8BIOS reverse mini-monitor (RMM) by CP/M-80 application programs. The RMM features are a part of release 2 of DECmate II CP/M 2.2. The RMM is used to load data to and from the 6120 program memory. These data may be stored in either 8 or 12 bit modes; the data content is irrelevant to the RMM. Uses for such data may be o Program overlay storage for the Z80 o Data storage for the Z80 o Additional BIOS functionality required by a CP/M application and not presently implemented by Digital For purposes of explanation, the reader is assumed to be familiar with DTN #7 - 8BIOS Interface Codes for Release 2 of DECmate II CP/M-80. With reference to DTN #7 - there are nine 8BIOS functions available for implementation of the RMM. These are: 02 17 Set block transfer address 02 18 Set block transfer count 02 19 Block transfer to 6120 in 12-bit mode 02 1A Block transfer to 6120 in 8-bit mode 02 1B Block transfer from 6120 in 12-bit mode 02 1C Block transfer from 6120 in 8-bit mode 02 1D Start 6120 execution at transfer address 02 1E Restore interrupt vector 0A xx Reserved for user functions A thorough knowledge of PDP-8 architecture and programming is assumed by the user of the RMM if it is desired to add 8BIOS functionality by means of the RMM. Guidelines for memory and interrupt usage are set forth in this note. Loading and Using Extensions to 8BIOS Page 2 _________________________________________________________________ Use of the RMM for data storage _______________________________ Regardless of the user's choice of data length (8-bit or 12-bit) the order of function calls remains the same. To exchange a block of data between the Z80 and 6120 main memory, use the following procedure: Set the 6120 transfer address - this is a 15-bit address transferred in two bytes. CAUTION -- the user is not protected from overwriting any ___ 6120 memory area! Consult the section in this note entitled '6120 Memory Map'. Set the 6120 transfer count - this is a positive 12-bit number of bytes (or 12-bit words) to be transferred in this block. The minimum number of byte/words transferred per block transfer allowed is one (1); maximum is 4096 decimal. The transfer count function requires two data bytes to describe the 12-bit count. Note that a transfer count of zero will result in a full field (4096) transfer. Field boundaries can not be crossed during a single block transfer operation. Attempts to do so will result in a wrap-around within the field boundary described by the transfer address. Request the block transfer function (either 8-bit or 12-bit mode). The next Z80 program function should be to perform a BLKWRT (to move data from the Z80 to the 6120) or a BLKRD (to move data from the 6120 to the Z80). The 6120 counts the number of transfers and terminates the block transfer. Note - the user program is responsible for initializing the Z80 for performing the BLKWRT or BLKRD (see DTN #7). Loading and Using Extensions to 8BIOS Page 3 _________________________________________________________________ 6120 Memory Map _______________ Field Octal Location(s) Contents - Description _________________________________________________________________ 0 0000-0200 RESERVED - 8BIOS data storage 0201 Address of communications interrupt service routine (ISR) 0202 Address of printer input ISR 0203 Address of keyboard ISR 0204 Address of printer output ISR 0205 Address of modem ISR 0206 Address of 100 Hz clock ISR 0207 Address of function Axx CALL 0210 Field of function Axx CALL 0211 Interrupt Vector Terminator 0212-0221 AVAILABLE for use by RMM for one _________ ___ cross-field interrupt call 0222-7777 RESERVED - 8BIOS program code and stacks 1 0000-7777 RESERVED - 8BIOS program code 2 0000-7777 RESERVED - 8BIOS program code and data storage 3 0000-7777 AVAILABLE for use by RMM _________ 4 0000-7777 RESERVED - 8BIOS data storage 5 0000-7777 RESERVED - 8BIOS data storage 6 0000-7777 AVAILABLE for use by RMM _________ 7 0000-7777 AVAILABLE for use by RMM _________ Use of the 8BIOS Interrupt Vector _________________________________ There are eight fixed locations at the beginning of 8BIOS which contain the interrupt vector locations. For users desiring to replace interrupt service code or to add additional BIOS functions, the following discussion is of interest. The interrupt vector resides in 6120 main memory field 0, beginning at location 201. As described in the '6120 Memory Map', each location from 201 to 205 contains an address pointer into the beginning of reserved interrupt service routines. The beginnings of each ISR must reside in field 0 of the 6120 memory. ____ Once execution of an ISR begins in field 0, the user is free to transfer control into an AVAILABLE field for his/her own use as an alternative ISR. Loading and Using Extensions to 8BIOS Page 4 _________________________________________________________________ Room has been reserved from 0212-0221 for cross-field calls to a user supplied ISR. Since it is expected that user-supplied ISRs will principally be used to augment communications support, only one reserved area has been made available in field 0 which does not require the user to overwrite a reserved portion of 8BIOS. If a second type of ISR must be supplied by the user, then it is at the user's discretion to overwrite a portion of 8BIOS code. That code is non-recoverable except by re-booting CP/M. Location 207 (octal) in the Interrupt Service Vector contains the address that the user wishes to transfer control to for extensions to 8BIOS through the use of Function Axx. Location 210 is used to hold the field (3, 6 or 7) that the Axx parser resides in. The format for the field is 'X0' where 'X' is the field number, ie: 30 in location 210 means that the ISR resides in field 3. With reference to DTN #7, note that Function 1xx is broken into a main function (100 hex), and sixteen sub-functions (00 - 0F hex). When the Z80 program requests any function from 100h to 10Fh, 8BIOS parses the two low order digits in the function call to determine the sub-function; then executes that function. If additional data are required to be passed to or from the 6120 by the function (ie: Function 10A - Get Disk Type Code), then those data are sent and received as a part of the function, with control returning to the 8BIOS IDLE routine. Therefore, it is up to the user to perform similar parsing for Function Axx. If only one additional BIOS function is desired by the user, then the two low order digits passed (Axx) may be also __ used to pass a byte of data to the user function. All Axx function parsing and processing; stack house-keeping and non Digital-supplied interrupt service is the responsibility of the user. When the user wishes to return to basic 8BIOS functionality, and the BIOS control path has not been disturbed (through use of Function 21D - Execute 6120 code), Function 21E (Restore Interrupt Vector) may be issued. Function 21E replaces the present contents of the Interrupt Service Vector with the original contents for locations 0201-0210. All control and ISR structure is then returned to the Digital-supplied 8BIOS. WARNING - no flags, variables or locations are guaranteed to be preserved in any future releases of the DECmate II CP/M product unless specified within this document. Program Structure in 8BIOS __________________________ The BIOS code supplied by Digital makes use of the two data stacks available in the 6120. Stack one is the CALL/RETURN Loading and Using Extensions to 8BIOS Page 5 _________________________________________________________________ stack; stack two is a DATA stack. An important distinction is made between local routines and cross-field callable routines. ______________ _____________________________ Local routines are those which reside in a given field, and can only be called from, and return control to that field. Cross-field callable routines are identified in BIOS listings as 'ROUTINE NAME X0', where x0 is a field value (00, 10, 20). These routines can be called from any field, and automatically return control to the proper PC in the calling field. For both types of routines, stack one is used to preserve the return address, and field if necessary. In the following examples, ROUNAM stands for a routine name; field 7 is used only for example purposes. Example of code to call a routine starting at location 0200, as a local routine: _____________ PPC1 /form return address and save on stack 1 JMP I ROUNAM /jump indirect to ROUNAM Example of code to return to caller as a portion of a local _____ routine: _______ RTN1 /return to PC from stack 1 Example of code to call a cross-field routine, starting in field ___________________ 7: CLA /start with cleared AC RIF /place present instruction field in AC PAC1 /place present instruction field on stack 1 CIF 70 /change to called routine instruction field PPC1 /form return address and save on stack 1 JMP I ROUNAM /jump indirect to ROUNAM Example of code to return to caller as a portion of a cross-field ___________ routine: _______ POP1 /get return address from stack 1 DCA GOTO /save as the return address POP1 /get return instruction field from stack 1 TAD (CIF 00 /add a CIF 00 instruction to form full CIF /needed DCA .+1 /and place the built CIF instruction in line 0 /position holder for the CIF JMP I GOTO /jmp indirect back to caller It is important to understand the implications of Function Axx in terms of CALL and RETURN. The Axx function is defined to be a cross-field callable routine. As such, the Interrupt Vector has Loading and Using Extensions to 8BIOS Page 6 _________________________________________________________________ a dummy routine address when BIOS is startup up. This feature protects the user from an inadvertent call to Function Axx before the RMM has been used to place a new Axx vector in place. The dummy routine merely returns control to the BIOS IDLE routine. Once the user describes, via the Interrupt Vector, the field and address of the user's installed Function Axx, a call to that function will be a cross-field call. Therefore, stack 1 will contain (at the top) the return address, and then one level down, the return instruction field. A return from this routine is then responsible to use the data on the stack to do a 'proper' return. Furthermore, the active data field is not changed by calling Function Axx, it is the responsibility of ALL cross-field called routines to: 1) establish the present data field to be what the routine requires; and 2) preserve the data field found at entry into the routine so that when control is returned to the calling code, the data field will be properly set for that code. C.P.Gerstle MLO3-2/E41 DTN 223-2703