barnacle wrote:
You may have noticed a recent theme in which I've been investigating ways in which a person might build an SBC and program it simply, in situ, using a PC as both the programmer and the terminal. ...
- ...
- The address counter needs to initially reset, and stay reset until cycle 3, after which it can increment at CLK/8. A sufficiently high count (power of 2, so say A14 rising for a 16kB transfer) can be used to disable the counter, and to enable the processor
The nice thing about this is that the transfer is ridiculously fast: at an 8MHz clock, you're looking at 1ms per kB (if I got my sums right) and you could fill this with whatever... Basic and a monitor or some sort filing system from a memory card or just a simple boot loader. What's in the SPI is non-volatile but easily externally programmed. ...
Note that if you use something like a 74x299 with tri-state output and support for daisychaining, you can shift out 24 bits of data onto htree of daisychained serial shift registers, with one being attached to the data bus and the other two being attached to A0-A15. When /USR_CE is pulled low to output the shift register contents and BE is pulled low to float the data bus, that also floats the address bus for the USR_AL and USR_AH. With a two stage bootloader, you could have a couple of toggle switches read on two VIA GPIO to select one of four available bootup images, and so once the first stage bootloader is written and debugged, it can be left in place.
An advantage of this is that the stop condition can be dead simple ... if it is considered to be enough to write to RAM in the top 32K, then an A15 value of 0 is the "end of load" marker.
Or you could just load a first stage booloader from the serial FlashROM with /RESET and BE low, which then proceeds to execute when /RESET is released, using the system resources to read the full boot image from another location in the serial FlashROM and away you go. You only need 3 65c22 GPIO to access a dedicated serial shift ROM through bit banging. That means you only need a pair of USR shift registers, USR_DATA and USR_ADDRL, and A8-A15 are pulled high through a network resister, so the first stage bootloader is always written to the $FFxx page.
Similar to the single stage bootloader, if 127 bytes is enough for the first stage booloader, the "end of load" trigger can be A7=0.
Then an /S /R flip flop (or a pair of NAND gates used to build an /S /R flip-flop) with the /Reset attached to the /Reboot button and the /Set attached to the USR_ADDRL_IO7 line (which is pulled high with a resister so the process is not stopped unless the /USR_ADDRL_CE = 0).
If 64bytes are enough for the first stage booloader, you can include both a framing mark and an end of load mark at the top of the USR_ADDRL. Clear the pair of serial shift registers when the boot process start, and have the top bit of the address data always 1, for framing, and use the second highest bit of the address data as the end of load marker when low. When Q7 goes from 0 to 1, the read for the FlashROM is paused and the inverse is passed through to /USR_OE and through a pulldown resister to /RAM_CS. Then perhaps NAND(USR_ADDRL_IO7,PHI2) is passed to RAM_R/W through a pull down resister, to accomplish the write.