CP/M 3.0 BIOS

Here is a CP/M 3.0 BIOS implementation for the P112. It has the following features:

  • Support for Banked and Non-Banked operation.
  • 60K TPA with Banked BIOS.
  • Support for two floppy drives.
  • Support for GIDE hard disks, up to four partitions.
  • RAM disk created out of the remaining available memory.
  • Real-time clock interrupts, used for keeping the Time-Of-Day and for controlling the floppy drive motors.
  • The Time-Of-Day routines use the hardware CMOS clock.

The BIOS follows the modular structure recommended by the Digital Research documentation. Here is a list of the modules with their corresponding file names:

  • Floppy disk: FDIO.MAC
    Most of the code for the floppy disk module was taken from the original P112 BIOS for CP/M 2.2, with the enhancements made by Hal Bower. Therefore, the system recognizes the same variety of floppy drives and formats the previous BIOS did.
  • Hard disk: HDIO.MAC
    Currently, only the GIDE interface is supported. Up to four partitions are automatically recognized (see the FDISK program), each one up to 32 Mbytes in size. All partitions are assumed to have the same characteristics (4K block size, 2048 directory entries, 2 reserved tracks).
  • RAM disk: RAMDISK.MAC

    Automatically creates a drive M: from the remaining available memory.
  • Character I/O: CHARIO.MAC
    Three devices are defined: COM1, COM2 and LPT, corresponding to the first and second serial interfaces and the parallel port of the P112, respectively. The serial devices support baud rate change by software (e.g. by using the DEVICE command), and both are initialized to the value stored in the DS1202 NV RAM. COM1 divisor values assume a 16MHz CPU.
  • Root module: BIOSKRNL.MAC
    This is the invariant portion of the BIOS and contains only a minimal set of changes from the original Digital Research's version.
  • Cold/Warm boot loader module: BOOT.MAC
    The main setup is done here: initial device assignment, the Z180 MMU and interrupt initialization routines are called, CCP.COM is reloaded and the sign-on message is displayed.
  • Drive table definition: DRVTBL.MAC
    Which disk drive corresponds to which letter can be found here. Normally, the first two floppies are assigned to A and B, the first GIDE partition is C, the second D, etc. and the RAM-disk is M.
  • P112-specific functions: MISC.MAC
    Z180 MMU, interrupt and programmable timer initialization; interrupt handling, etc.
  • Intra/Inter-bank moves: MOVE.MAC

  • System Control Block definitions: SCB.MAC

  • Real-time clock support: TIME.MAC
    DS-1202/1302 access routines and date/time conversion routines.

This BIOS can also be used with ZPM3 and ZCCP, except that you will not be able to boot from a GIDE partition (e.g. drive C): for some reason, ZCCP always looks for ZINSTAL.ZPM in drive A, so booting from a different drive will not work. Booting ZPM3/ZCCP from A: works fine, though.

Compiling the system

There are two SUBMIT files included in the distribution that you can use to build the BIOS:

BIOS.SUB - builds a non-banked version.
BNKBIOS.SUB - builds a banked version.

The SUBMIT files assume that you have Microsoft's M80 and Digital Research's LINK on the same disk. Both command files call GENCPM at the end of compilation.

Example of banked system generation:

C>gencpm


CP/M 3.0 System Generation
Copyright (C) 1982, Digital Research

Default entries are shown in (parens).
Default base is Hex, precede entry with # for decimal

Use GENCPM.DAT for defaults (Y) ? 

Create a new GENCPM.DAT file (N) ? 

Display Load Map at Cold Boot (Y) ? 

Number of console columns (#80) ? 
Number of lines in console page (#24) ? 
Backspace echoes erased character (N) ? 
Rubout echoes erased character (Y) ? 

Initial default drive (C:) ? 

Top page of memory (FF) ? 
Bank switched memory (Y) ? 
Common memory base page (C0) ? 

Long error messages (Y) ? 

Accept new system definition (Y) ? 

Setting up Checksum vector for drive A:
Setting up Checksum vector for drive B:

*** Bank 1 and Common are not included ***
*** in the memory segment table.       ***

Number of memory segments (#2) ? 

CP/M 3 Base,size,bank (7F,41,00)

Enter memory segment table:
 Base,size,bank (00,7F,00) ? 
 Base,size,bank (00,C0,02) ? 

 CP/M 3 Sys    7F00H 4100H  Bank 00
 Memseg No. 00 0000H 7F00H  Bank 00
 Memseg No. 01 0000H C000H  Bank 02

Accept new memory segment table entries (Y) ? 

Setting up directory hash tables:
 Enable hashing for drive A: (N) ? 
 Enable hashing for drive B: (N) ? 
 Enable hashing for drive C: (N) ? 

Setting up Blocking/Deblocking buffers:

The physical record size is 0400H:                                              

     Available space in 256 byte pages:
     TPA = 00F1H, Bank 0 = 007FH, Other banks = 00C0H

               Number of directory buffers for drive A: (#1) ? 

     Available space in 256 byte pages:
     TPA = 00F1H, Bank 0 = 007AH, Other banks = 00C0H

               Number of data buffers for drive A: (#4) ? 
               Allocate buffers outside of Common (Y) ? 

     Available space in 256 byte pages:
     TPA = 00F1H, Bank 0 = 007AH, Other banks = 00B0H

               Number of directory buffers for drive B: (#1) ? 

     Available space in 256 byte pages:
     TPA = 00F1H, Bank 0 = 0076H, Other banks = 00B0H

               Number of data buffers for drive B: (#4) ? 
               Allocate buffers outside of Common (Y) ? 

The physical record size is 0200H:

     Available space in 256 byte pages:
     TPA = 00F1H, Bank 0 = 0076H, Other banks = 00A0H

               Number of directory buffers for drive C: (#1) ? 

     Available space in 256 byte pages:
     TPA = 00F1H, Bank 0 = 0074H, Other banks = 00A0H

               Number of data buffers for drive C: (#4) ? 
               Allocate buffers outside of Common (Y) ? 

The physical record size is 0080H:

     Available space in 256 byte pages:
     TPA = 00F1H, Bank 0 = 0074H, Other banks = 0098H

               Number of directory buffers for drive M: (#1) ? 

     Available space in 256 byte pages:
     TPA = 00F1H, Bank 0 = 0073H, Other banks = 0098H


Accept new buffer definitions (Y) ? 

 BNKBIOS3 SPR  F700H  0900H
 BNKBIOS3 SPR  AC00H  1400H
 RESBDOS3 SPR  F100H  0600H
 BNKBDOS3 SPR  7E00H  2E00H

*** CP/M 3.0 SYSTEM GENERATION DONE ***                                         
C>

The initial device assignment is:

CON: = COM1:
AUX: = COM2:
LST: = LPT:

and the disk assignment:

A: = first floppy drive
B: = second floppy drive
C: = first CP/M partition found
D: = second CP/M partition found
E: = third CP/M partition found
F: = fourth CP/M partition found
M: = RAM disk

Installing CP/M 3.0 on a hard disk partition

General steps:

  1. Create the partition with FDISK, if you haven't yet done so. Set the type to CP/M 3.0, and flag it as bootable.
  2. Boot CP/M 3 from a floppy or from another HD partition, and make sure the new partition is recognized (note the drive letter).
  3. Initialize the partition (erase the directory with the supplied ERADIR utility).
  4. Create HCPMLDR.BIN from the LDRHD.ASM and CPMLDR.REL files:
    M80 =LDRHD.ASM
    LINK HCPMLDR.BIN=CPMLDR,LDRHD[OC,L100]
  5. Compile HDBOOT.BIN:
    M80 =HDBOOT
    LINK HDBOOT.BIN=HDBOOT[NR,OC,L0]
  6. Use e.g. DDTZ to create a boot track image by combining HDBOOT.BIN and HCPMLDR.BIN, the last should be loaded at relative offset 200h (L200 command below). Update the checksum byte of the boot loader before saving:
    A>DDTZ
    DDTZ v2.7M by CB Falconer. CPU=Z80
    -F100,7FFF,0
    -NHDBOOT.BIN
    -L
    Next  PC  Save
    0280 0100 2
    -NHCPMLDR.BIN
    -L200
    Next  PC  Save
    1880 0100 24
    -A8000
    8000   LXI H,100
    8003   LXI D,1FF
    8006   XRA A
    8007   ADD M
    8008   INX H
    8009   DCX D
    800A   MOV C,A
    800B   MOV A,D
    800C   ORA E
    800D   MOV A,C
    800E   JNZ 8007
    8011   CMA
    8012   INR A
    8013   MOV M,A
    8014   RST 7
    8015   .
    -G8000
    *8017
    C0Z0M0E0I0 A=36 B=00CA D=0000 H=02FF>3136 S=EBF5>E410 P=8015 NOP
    -NBOOTTRK.BIN
    -W
    
    -Q
    A>
    
    If you have SUBMIT and XSUB on your floppy, then you can use this submit file instead.
  7. Use the supplied PUTSYS utility to copy the boot track image to the hard disk partition.
  8. Copy all the CP/M 3 *.SPR modules and CCP.COM to the partition.
  9. Run GENCPM in order to create a CPM3.SYS file, and specify the partition drive letter as default system disk. You can erase the *.SPR files after this.
  10. If you want to run PROFILE.SUB at startup, copy SUBMIT.COM and GET.COM to the new partition.
  11. Copy any utilities you may want or need to the partition. Normally that would include all the standard CP/M 3 utilities.
  12. Reboot!
Note: HCPMLDR cannot be executed from the CP/M 2.2 command prompt to bring up CP/M 3 (unlike the floppy version FCPMLDR.COM), as the program expects hard disk partition parameters passed to it via the Z80 index registers IX and IY from the boot loader chain. That's why it is better to give the file a BIN extension to prevent accidental execution.

Last updated: 11-Apr-2018