DkTronics CPM
Contents
CPM+ with Memory expansions
CP/M+ already supports the Dk'Tronics RAM expansion but the CP/M+ on the system discs doesn't run on the CPC464/664 because it uses firmware v1.1 calls. Dk'Tronics provide patches to allow it to run on the 464/664.
One version is run as follows:
RUN"BANK
Press RETURN at the prompt. Then:
|EMULATE |CPM
The disc boots, executes PATCH from PROFILE.SUB and is then ready to use.
The other version doesn't require BANK. You only need to type:
|CPM
Technical
The patch to C10CPM3.EMS is a single-byte change, to ignore the result of the ROM version check:
ld c, 0FFh call KL_PROBE_ROM ld de, -513 ; Check that ROM is version 0201h add hl, de ld a, h or l ret z ; DK'Tronics replaces this with a plain RET
CPM+ with Silicon Disk
The Silicon Disk rom has a command "|SETCPMPLUS" which patches the Amstrad CP/M with support for the Silicon disk. The resulting EMS file is called CPM3SEMI.EMS.
Technical
The |SETCPMPLUS command creates a file called PATCHER.COM, which contains (at offset 689h) a table of changes to make. The changes are made blindly to the first EMS file that PATCHER.COM finds; the user is responsible for ensuring it is run on a genuine C10CPM3.EMS.
Each change is formed:
DW start ;Address of first byte to change DW end ;Address of last byte to change DB data ;Replacement bytes
The addresses are as if the EMS file was loaded at 0100h.
Initialisation
The first few changes are to the initialisation code at the start of the EMS file:
DW 107h ;Replace a call to 0BD19h (MC_WAIT_FLYBACK) with a DW 108h ;call to initialise the ramdisc. DW 7100h
DW 1C5h ;Remove the LDIR that clears memory between DW 1C6h ;0FE58h and 0FF9Fh (this has been populated by the. DW 0 ;initialisation call).
DW 1D5h ;Place a RET at the start of the firmware version DW 1D5h ;check, so that CP/M will run on a 464/664. DB 0C9h
DW 358h ;Display the Silicon Disk sign-on message. DW 359h DW 0FE80h
The first change sets up the call to the code that initialises the ramdisc. This code consists of 512 bytes added to the end of the EMS file; since it is not trying to fit in spare space within the existing CP/M system, it is not as constrained for memory as the other patches.
The initialisation code copies itself to 0100h, and runs from there. The first thing it does is probe for available memory. There are two possible memory ranges: 192k (banks CC-CF, D4-D7, DC-DF) and 256k (banks E4-E7, EC-EF, F4-F7, FC-FF). The ramdisc can occupy either or both. If neither range is available, no drive is added to the system, and a minimal version of the sign-on routine (which displays no message) is constructed at 0FE80h.
Assuming that memory was found, the DPH for the new drive is added to the drive table. The first memory bank of the ramdisc is paged in, and the system checks that the first byte of each directory entry is either 0E5h or 00h-0Fh. If it is not, the entire first bank is cleared to 0E5h. This means that the presence of CP/M disc labels or date stamps will cause the ramdisc to be erased on boot.
The appropriate DPB for the size of ramdisc is copied to 0FF53h and the sign-on message altered to hold the correct size. The full version of the sign-on code is copied to 0FE80h.
Finally memory from 0FF64h to 0FF9Fh is blanked and the code resumes the normal initialisation sequence by jumping to MC_WAIT_FLYBACK.
Helper functions
After initialisation, the next two patches are helper functions, which occupy free space between CP/M modules. One is at 03E9h, in the gap between the CD and TE modules; the other at 0EE2h, in the gap at the end of DD. The first one backs up 128 bytes of memory at 8080h (which is normally used by the font) so it becomes available as a transfer buffer. The second reverses this, restoring the font.
Disk access
The disk access functions follow; these are placed between 8960h and 89FFh, in memory that's probably reserved for the system message table. Since they page memory, they switch to a local stack, which grows down from 3CFEh.
The actual I/O functions are reasonably simple. READ pages in the correct bank, copies 128 bytes to the transfer buffer at 8080h, and then uses the CP/M XMOVE and MOVE functions to copy the data to the right place. WRITE performs similar operations in reverse order; XMOVE and MOVE to get the data to 8080h, then page in the correct bank and copy the data there.
The other two operations are LOGIN (which consists simply of
EX DE, HL ;DPH is passed in DE, should be returned in HL on RET ;success
) and INIT (a simple RET).
Banked BIOS
The next few changes allocate space for the extra DPB. In a stock CPC CP/M Plus, the stack grows down from 0FF64h. In CPM3SEMI this is lowered to 0FF53h, freeing up 17 bytes for the drive DPB.
Space also needs to be allocated for the DPH. The existing subroutine at 3FE0h is moved to 3FD0h (removing 16 apparently unused bytes) and then the new DPH occupies 3FD7h - 3FF9h.
The new drive also requires space for an allocation vector. This is placed at 3C89h, in memory intended for patches to the BDOS.
CPM2.2 with Memory Expansions
Dk'tronics Bank Switch software comes with NEWCPM.COM CP/M program which installs a 61K TPA CPM2.2 which uses the Dk'Tronics RAM. The documents describe how to make this CPM. They are repeated here and a pre-made dsk is linked to this page.
ENTER FIRMWARE
Dk'tronics NEWCPM.COM doesn't support using ENTER FIRMWARE from TPA because it runs from bank 2 of memory.
Creating the DkTronics 61K TPA CPM 2.2
Boot into CPM2.2 from system discs:
A>disckit2
Use disckit2 to format a vendor disc. This will become 'Dk'Tonics CPM Disk'.
A>BOOTGEN
This initialises the boot sector.
Source is: CPM 2.2 disk. Now insert 'Dk'tronics CPM Disk'.
A>SYSGEN
This puts CPM2.2 onto the disc. Source is CPM2.2 disk. Destination is 'Dk'Tronics CPM Disk'.
A>FILECOPY movcpm.com
This puts movcpm.com onto the disk. Source is 'CPM 2.2 system disc' disk. Destination is 'Dk'Tronics CPM Disk' disk.
A>FILECOPY save.com
This puts save.com onto the disk. Source is 'CPM 2.2 system disc' disk. Destination is 'Dk'Tronics CPM Disk' disk.
A>FILECOPY newcpm.com
This transfers Dk'Tronics newcpm.com. Source is 'Dk'Tronics bank switch software' disk. Destination is 'Dk'Tronics CPM Disk' disk.
A>FILECOPY oldcpm.com
This transfers Dk'Tronics oldcpm.com. Source is 'Dk'Tronics bank switch software' disk. Destination is 'Dk'Tronics CPM Disk' disk.
Now boot the Dk'Tronics CPM Disk.
A>MOVCPM 255 *
This configures a 63K CPM.
A>SAVE 34 NEWCPM.SYS
This saves a 63K CPM for Dk'Tronics CPM to use.
Your Dk'Tronics CPM is setup.
Technical
- 61K TPA is not active until NEWCPM.COM is run.
- 61K CPM is stored in "NEWCPM.SYS" and is loaded by NEWCPM.COM
NEWCPM.COM
- NEWCPM.COM is a normal COM file. It is loaded like a normal COM file. It resides in memory in bank 0 but configures a 61K CPM in bank 1 and transfers control to it. It remains in bank 0 and implements parts of the 61K CPM BIOS.
- NEWCPM.COM sets up a BIOS jumpblock in page C7 at &FC00. This calls into the resident NEWCPM.COM code in bank 0
- NEWCPM.SYS is first loaded to B00 in bank 0, it is later copied into bank 1 to it's correct location.
TPA upper address is &F300. BIOS jump is at &FC00. Code after &FC00 is part of the BIOS in bank 1.
OLDCPM.COM
- OLDCPM.COM is much simpler than NEWCPM.COM. It restores the dormant CPM in bank 0. If NEWCPM.COM was used it remains dormant in bank 1.
CPM 2.2 with Silicon Disk
The Silicon Disk has a command "|SETCPM" which patches CPM2.2 for the Silicon Disk.
Downloads
- File:Dkcpm.dsk - CPM2.2 configured for 61K TPA - This was made following instructions in the Bank software
- File:Dkplusbank.dsk - CPM3.0 with Dk'tronics PATCH (run BANK first) - This was made following instructions
- File:Dkplusnobank.dsk - CPM3.0 with Dk'tronics PATCH (BANK not required) - This was made following instructions