For CPC AMSDOS the BIOS jumpblock has the following addresses in it:
boot - C1B2 wboot - C2BE const - C2E1 conin - C2C3 conout - C2C8 list - C2D2 punch - C2D7 reader - C2DC home - CDE9 seldsk - c2f2 settrk - c524 setsec - c529 setdma - c51a read - c2f7 write - c2fc listst - c2cd sectran - c55a
* &ad33 - &ad36 => "enter firmware" jump. This doesn't move when MOVCPM is used.
low firmware jumpblock, &100..<top of TPA>, CCP/BDOS, BIOS jumpblock, <free space>, &AD33 "enter firmware", firmware etc.
=== Patching the BIOS jumpblock ===
The BIOS jump block can be patched.
Note that the default boot and wboot call into the ROM and they are effectively a JP. They don't return.
* WBOOT re-reads the CCP and BDOS from the system tracks and re-initialises the jumpblocks. It doesn't re-initialise ENTER FIRMWARE.
WBOOT is triggered when a transient CP/M program is quit. (e.g. run CLOAD and then press ESC to return back to CP/M).
Therefore it's problematic if patching the BIOS jumpblock.
* BOOT effectively performs a |CPM command from the beginning, re-loads the boot sector, re-loads the configuration sector and then re-runs WBOOT. This is also problematic to patch.
Both WBOOT/BOOT may not be patchable (to be confirmed) and if they are you need to use very specific firmware related hacks or quite involved hacks.
=== Installing persistent programs ===
There are various ways to install persistent programs but they are all specific to the CPC version of CP/M 2.2.
==== Method 1 ====
This method installs a persistent program outside of CP/M.
* Use MOVCPM to allocate some RAM - TPA will always be reduced even when your program is not running.
* When your COM program is loaded locate the BIOS jumpblock.
* Add &33 to this to get the first byte of useable RAM - the last byte is &AD32. You can use this to check if there is enough free space for your program to be installed. There doesn't seem to be a way to determine if there is a program installed already so it looks like only 1 program at a time can be put here.
* Your program can then patch the BIOS jumpblock and re-direct to it's own functions. It is best to keep a copy of the functions you patched so that you can call them.
Example template for a device driver.
==== Method 2 ====
This method installs a persistent program inside CP/M and uses TPA when it's installed.
=== Links ===