Re: QL flash programming
Posted: Mon Sep 15, 2025 3:30 pm
Regarding flash programming:
Most (not all, there are read while program chips, but prices are high and there are other limitations) flash chips cannot be read while in program mode. Hence, your approach depends on the need to execute code from the same flash chip. If not, then you have to be sure you can get to the data to program the flash with (pre-load in RAM?) and the flash programming code must be completely independent of anything in that flash chip, and then there is the concern if you have anything to return to after programming, or the system should be re-booted.
If code needs to be executed from the flash, re-programming is a 'blind alley', i.e. after the flash is programmed, there MUST be a re-boot.
Here is an example: if you are using the flash to store code which is later going to be loaded into RAM and executed from there, but the flash is still accessible at some address, then programming with the OS is possible, it can even be a basic program. Of course, you have to take precautions that you do not brick the machine on re-boot, perhaps by retaining a default OS for recovery and offering a jumper (or similar) that maps this to the appropriate address at power-up, so the machine can be un-bricked. Having a basic command to do the programming is certainly possible under these conditions. Timing is no problem as the chip offers a busy signal which can be timed in a loop for the required 'overprogram', even if the timing ends up longer, at worst the programming will not be optimally fast, which I would not consider a problem. Additionally, the simplest programming method is usually supported by all manner of flash chips, it is not the fastest possible but it will always work.
The remaining problem is the initial programming. So, either the chip needs to be programmed with he default OS (which may include the programming command) off board, or, which I would consider a better option, how about making an adapter which disables the on-board CPU and then the board is connected to another machine. Since flash unlock and program is a series of normal reads and writes to the flash location, this should not be too difficult.
Relevant aside: the SGC copies the QL ROM and parts of it's own ROM into shadow RAM at the same addresses, and then runs everything from the copy. The QL ROM and ROM slot are still accessible at $400000 (not sure about the SGC ROM though...) BUT it is read only, SGC does not generate write cycles to the QL bus for those addresses. Why of why??? Enabling write would do no harm as the motherboard select logic simply ignores writes, but something like Aurora could have used it for flash writing (not to mention a writable ROM port...)
@Dave, since you are using a FSM for writes to the QL bus, why not use it for reads too, and then just run the QL side at 7-5MHz, while the CPU side can always work at 30MHz?
Most (not all, there are read while program chips, but prices are high and there are other limitations) flash chips cannot be read while in program mode. Hence, your approach depends on the need to execute code from the same flash chip. If not, then you have to be sure you can get to the data to program the flash with (pre-load in RAM?) and the flash programming code must be completely independent of anything in that flash chip, and then there is the concern if you have anything to return to after programming, or the system should be re-booted.
If code needs to be executed from the flash, re-programming is a 'blind alley', i.e. after the flash is programmed, there MUST be a re-boot.
Here is an example: if you are using the flash to store code which is later going to be loaded into RAM and executed from there, but the flash is still accessible at some address, then programming with the OS is possible, it can even be a basic program. Of course, you have to take precautions that you do not brick the machine on re-boot, perhaps by retaining a default OS for recovery and offering a jumper (or similar) that maps this to the appropriate address at power-up, so the machine can be un-bricked. Having a basic command to do the programming is certainly possible under these conditions. Timing is no problem as the chip offers a busy signal which can be timed in a loop for the required 'overprogram', even if the timing ends up longer, at worst the programming will not be optimally fast, which I would not consider a problem. Additionally, the simplest programming method is usually supported by all manner of flash chips, it is not the fastest possible but it will always work.
The remaining problem is the initial programming. So, either the chip needs to be programmed with he default OS (which may include the programming command) off board, or, which I would consider a better option, how about making an adapter which disables the on-board CPU and then the board is connected to another machine. Since flash unlock and program is a series of normal reads and writes to the flash location, this should not be too difficult.
Relevant aside: the SGC copies the QL ROM and parts of it's own ROM into shadow RAM at the same addresses, and then runs everything from the copy. The QL ROM and ROM slot are still accessible at $400000 (not sure about the SGC ROM though...) BUT it is read only, SGC does not generate write cycles to the QL bus for those addresses. Why of why??? Enabling write would do no harm as the motherboard select logic simply ignores writes, but something like Aurora could have used it for flash writing (not to mention a writable ROM port...)
@Dave, since you are using a FSM for writes to the QL bus, why not use it for reads too, and then just run the QL side at 7-5MHz, while the CPU side can always work at 30MHz?