In Tiny68K I used a state machine to load AT24C256 serial EEPROM into low 32K of memory and released 68000 to run. The state machine is in CPLD and is fairly simple, I recall. It has been 8 years, so I need to refresh my memory, but the state machine may be simple enough to implement in 74xx.
Bill
Yes, but even if I succeed in putting some simple hardware together, I'll still be a software hand at heart, and so having a 65xx CPU as part of the state machine by executing 65xx code on the Diode board is a satisfying approach to me.
To make it mostly circuit board and glue logic, the board I've been sketching around the SPI circuit is built around a triple 3-input OR and hex inverter, to get to the SRAM0 high, IO low logic in a two deep logic ladder:
6NOT:
1A <= BUS_PHI2
1Y => !PHI2
2A <= BUS_A11
2Y => !A11
3OR:
1A <= BUS_A15
1B <= BUS_A14
1C <= BUS_A13
1Y => 2A
2A <= 1Y
2B <= BUS_A12
2B <= NOT_2Y = !A11
2Y => SRAM0_CE1/IO
And a 64KB UM61512A pull with a CE1 and /CE2 to qualify to phase 2 with the !PHI2 signal.
So the memory map would be:
$0000 ZP
$0100 Stack Page
$0200-$03FF Golden RAM
$0400-$07FF 1KB Buffer
$0800-$09FF /IO1, 3 CE1 /CE2 devices with up to 64 registers on bits 9, 8 or else 7 high, and a %00000100.00xxxxxx latch enable line for up to six latches / jumpers (more than one each requires another 74' quad AND).
$0A00-$0BFF /SPI, with MOSI written on $0A00{*}, MISO read with any read in the /SPI space, and the SPI latch with 7 selects and a Mode0_Reset bit written with any /SPI address with bit0=1.
. {* Or indeed, any address inside /SPI with bit0=0}
$0C00-$0FFF reserved for a second SRAM1 for a RAMdisk.
$1000-$FFFF RAM, with a soft-ROM variably at $8000-$FFFF, $C000-$FFFF or $E000-$FFFF.
After the Hex inverter and triple 3-OR logic, the idiosyncratic partially-decoded, partially-undecoded, partially address-as-data I/O is driven in part by what logic gates were left free after the SPI circuit, SRAM0/IO select, /BUS_RESET debouncing and DIODE/MAIN toggle of the /SRAM_RD and /DIODE_RD lines. I'd be skeptical it could be made to run much faster than 8MHz unless all of the logic other than the Schmitt-Trigger NAND is 74ACT family logic.
But, OTOH, I'm not a hardware hand, so if it could run at 4MHz, I would still be well pleased.
The SPI latch Address-as-data is specifically to get the 1st stage bootloader to fit inside 32 bytes, including actual /RESET vector and under-written /BRK vector. The magical appeal of hardware circuitry to a software hand is trying to work out something to make the code more clock cycle efficient and space efficient at the same time.
For instance, the MOSI read -- and driving the actual SPI transaction -- on SPI_address+%x.xxxxxxx0, SPI /SS latch loaded from address lines by any /SPI access, read or write, on SPI_address+%s.ssssssr1, and MISO Read on any read within /SPI, allows SPI devices that rely on selecting the device, putting in a 16bit word and retrieving a byte response in the 2nd byte, and de-selecting the device, to be served efficiently with:
Code: Select all
SPI_AY: ; byte1 in A, byte 2 in Y
; low byte of SS1-SS6 device address in X
STA $0B00,X ; select device
STA $0A00
LDA $0A00
STY $0A00
LDY $0BFF ; de-select all
RTS
... which doesn't work for /SS0, which is address $0AFF, but /SS0 is intended to be the SPI serial flash, which does not tend to work with two byte packets, so that's not a binding constraint.