I've now got my PCW to load the FID file from the SD card, which means there's no need for a floppy drive at all to boot the PCW. Unless you want a PROFILE.SUB file to be loaded, as it still looks on drive A: for that.
I spent quite a lot of time reading the disassembled source code of J15CPM3.EMT until I could work out how FID files are loaded. I then patched it so that it would load the FID file out of the J15CPM3.EMT file itself.
It's slightly convoluted. I added some code onto the end of the EMT file and also modified a couple of existing bits of code. The boot process now goes like this:
- ROM code loads first 48Kb of SD card (which contains J15CPM3.EMT) into pages 0, 1 and 2 or RAM.
- Execution starts at 0000h. The existing code sets the stack pointer, and then I've replaced the next 13 bytes with a call to a880h (where the EMT file would normally end, but where my extra code now sits), followed by some NOPs.
- My code switches page 16 into bank 0 and copies the rest of the extra code from the end of memory to the start of page 16.
- The code then executes the instructions I had to replace in order to call my code, and then returns.
- The rest of the normal boot process continues, until it gets to loading FID files.
- At this point, I've replaced 8 bytes with my own code which switches page 16 into bank 2 and jumps to it.
- This code loads the FID (which was also tacked onto the end of the EMT file) to 0100h and sets up an FCB entry at 005ch.
- It then overwrites the 8 bytes I'd replaced with the original code, and then copies some more code from page 16/bank 2 into bank 1, and jumps to it.
- This code switches bank 16 back out, removes a call to a file closing routine, and then calls the original code which would have been called just after loading a FID file from the disk.
- After this returns, the original call to the file closing routine is reinstated.
- I then call the original FID loading code, so that extra FIDs could be loaded. (Or I would, if it worked. This is commented out right now, and I jump to the end of the FID finding code instead.
- The rest of the boot process continues, the CCP is loaded and it tries to load PROFILE.SUB from drive A: I need to fix this.
Hopefully I can remember how this works tomorrow. If I can't remember what any of this means after a night's sleep then I'll re-write it!
Here's a video of the computer booting. Unfortunately, my phone doesn't like focusing on the screen, so a lot of it is rather blurry.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.