davidgiven / cpmish

An open source sort-of CP/M 2.2 distribution.
http://cowlark.com/cpmish
Other
344 stars 37 forks source link

Boot the main CPM bootloader from Basic, like the NC100 does? #53

Open theshinyknight opened 2 years ago

theshinyknight commented 2 years ago

There is a different CPM variant that run on the NC100, which is basically able to run via function-X keypress from a ram card. Would be possible to do the same on cpmish so you can bypass the floppy altogether and run everything from the PCMCIA 32 mb card? This would also save the hassle to boot from floppy and then swap system disk to the PCMCIA card and have improved speed.

davidgiven commented 2 years ago

The on-board ROM doesn't understand CF cards and can only boot from SRAM cards. It wouldn't be difficult to write a simple sideloader which could boot from a CF card, but you still need a way to get it onto the machine in the first place --- CP/M trashes all the RAM so you'd need to reload it each time.

theshinyknight commented 2 years ago

I see; so the ROM can figure out that a RAM card is in there but can't see the CF card as one, no matter how you format it. I was hoping there was a way to format the CF card so the first 2 MB would be recognized as RAM non volatile, so you can save documents and the bootloader; and then sideload the bootloader from the first 2 mb area on the device to boot the CPM running on the remaining space of the CF card. Is there any way to get this accomplished?

I also assume that you can't swap on the fly a RAM card with a CF card; otherwise it would be possible to use the RAM card as storage, boot CPM and then swap the RAM card with the CF card where CPM is on. I heard that it is possible to damage the device if you remove the card while the unit is on, so I don't see this as being a feasible solution

davidgiven commented 2 years ago

That would actually be possible. You'd put a Basic program on the SRAM card which prompts you to swap to the CF card and then boots from it. (You can't use bootable SRAM cards for storage, sadly.)

Regarding hot-swapping cards: I honestly have no idea. The manual tells you not to, but that could just be because the software can't handle it.

theshinyknight commented 2 years ago

That would wipe the card thought, right? Which means that every time I want to run CPM again I would have to plug the serial cable and re-download on the card the bootable executable that I would run via basic. I am thinking at this point that it is not really feasible to do so and instead it is just simpler to use the floppy to boot and then swap the OS main partition to the card.

Maybe in the future someone will be able to write an updated ROM that can be burned on a chip and installed in the device; which would include a bootloader to use the PCMCIA CF card adapter directly.

davidgiven commented 2 years ago

You'd load the bootstrap program from the SRAM card, run it, and then change to the CF card. The bootstrap would then load CP/M proper from that. Talking to a CF card is actually not difficult as it's just IDE, so a Basic program which just self-assembles just enough to load the 512-byte boot sector of the CF card would be totally possible. See https://github.com/davidgiven/cpmish/blob/master/arch/nc200/supervisor/pcmcia.inc. Then, that would load the rest of the supervisor. The SRAM card itself never gets written to.

For me, the tricky bit is that I don't have a battery for my SRAM card so I can't use it as persistent storage!

Re a ROM update: yes, that would be the most sensible way to do it. It's socketed, too, which would make it easy to replace.

theshinyknight commented 2 years ago

Thanks for the explanation. So it is actually possible to leave the SRAM card untouched and use it as bootstrap for the actual OS that would be on the CF card. Once the program reside in memory it should be possible to press the power button and remove the SRAM card and swap it with the CF card; so neither the main board nor the pc cards will fry by swapping while the unit is on.

Assuming you have no plans to set up this memory exchange bootloader right? I'll try to give it a shot but this is all foreign to me, as I am not familiar with baremetal hardware development. And if nobody ever made an updated ROM I assume there is not even the desire to get that started.

What battery is your SRAM card using? I just used a standard button battery and it works fine with mine (it is not a CR232 but a slightly smaller one; sold online for very cheap)