Close

No Floppy Drive Necessary

A project log for The PCW Project

Doing things with an Amstrad PCW

james-otsJames Ots 10/30/2017 at 00:240 Comments

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:

  1. ROM code loads first 48Kb of SD card (which contains J15CPM3.EMT) into pages 0, 1 and 2 or RAM.
  2. 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.
  3. 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.
  4. The code then executes the instructions I had to replace in order to call my code, and then returns.
  5. The rest of the normal boot process continues, until it gets to loading FID files.
  6. At this point, I've replaced 8 bytes with my own code which switches page 16 into bank 2 and jumps to it.
  7. 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.
  8. 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.
  9. 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.
  10. After this returns, the original call to the file closing routine is reinstated.
  11. 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.
  12. 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