title: SPI Hardware interface to z80
body: <p>I am attempting to make a retro computer using a z80 and ideally would like to give it the ability to boot from an SD card.  I am 100% set on using a z80 and do not want to use a microcontroller with an internal SPI hardware interface.  I want to understand both the hardware and software aspects of a computer, so arduinos and microcontrollers are off the table as the hardware side is completed before you even purchase it.  Anyways, my main question is would it be possible to combine a shift register, some decoding logic, and software to read from an SD card via SPI mode?  I have searched the internet for hours and read several articles and cant seem to find a tutorial.  I understand SPI protocol, however, there is a lack of information regarding the hardware side because microcontrollers tend to have all the hardware built in.  I planned on connecting the SOMI of the SD card to the serial input pin of a shift register, the SIMO of the SD card to the serial out pin of the shift register, and then connecting a few data pins to some flip flops with some decoding logic inbetween, so that if I output to a specific port, it will toggle the flip flops.  The flip flops would serve as the clock and chip enable lines to the SD card.  I would also connect a pin of the z80 to the latch pin of the shift register (again with decoding logic inbetween) so that if I output to a specific port it will latch the data of the shift register.  Im unconcerned with speed/efficiency, as long as I can accurately read data from the SD card. Also, would I connect the shift register clock input to the same clock as I connect the SD card to?  Any advice on how to implement this would be appreciated, thanks!</p>