Changes

Jump to: navigation, search

CP/M 2.2

531 bytes added, 15:00, 12 May 2018
/* XSUB.COM */
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.
=== XSUB.COM and persistent programs in TPA ===
X-Sub is a persistent program which is loaded at the top of TPA. This is how it works:
* The relocated X-Sub module starts with a JP and has 'xsub' immediately after it.
* X-Sub detects if it's installed by reading the BDOS JP and searching for 'xsub'. If found it is already installed, otherwise it's not. Based on this method it uses it assumes it has been installed last.
* It assumes that the address of the JP defines is at the top start of TPA memory (the BDOS code. The JP at 0005, jumps to a JP at the start of CCPthe BDOS 6 bytes in (the first 5 bytes of the BDOS are the CPM2.2 serial code). It then takes the address and subtracts it's size (+ size of CCP) to allocate find the start of the spaceit's allocated itself, it then copies itself up to this memory and relocates the code, and then executes it's startup code.* The X-Sub's startup code installs it's own wboot JP and it's own bdos JP. It intercepts these calls and passes them on the BDOS itself.* It then returns back to CCPto allow it to continue processing.* X-Sub's wboot restores the dma address and jumps back to CCP. It doesn't call the wboot in the BDOS.* X-sub's bdos jump JP handler filters the BDOS calls. It also remembers the dma address when used. To have your own program like this your JP needs to be at the start of your module, you should patch BDOS jp and pass it to the one that was there before to allow it to handle the calls.
=== Installing persistent programs ===
2,541
edits