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.
  • 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.
  • Use of the Z180 DMA for inter-bank moves (but see note below).
Warning: This is not a stable release, so use it at your own risk:
  • There are DMA bank-boundary crossing problems, since the Z180 cannot do DMA to physical addresses. Currently affected are floppy I/O operations (only for programs that access the BIOS disk I/O functions directly; the drive will be changed for PIO-mode operation) and the XMOVE function (a quick workaround was made, but is rather inefficient.)
  • There is currently a limitation in the GIDE boot chain: the boot partition number is not passed to CPMLDR. As result, CPMLDR will load CPM.SYS from the first active partition, instead of the one specified at the boot prompt.

The BIOS follows the modular structure recomended 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 are initialized to 19200 and 9600 baud respectively after cold boot. 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 fucntions: MISC.MAC
    Z180 MMU, interrupt and programmable timer initializations; 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

Instructions coming soon...

Last updated: 5-Aug-2007