4 wait states are added to the IDE access by negating the RDY signal for 4 clocks. IDE needs setup time before write or read strobes, so two clocks (140nS) are for setup and 2 clocks for read/write strobes.
With IDE working, I have modified the bootstrap ROM to enable dual boot; the ROM program loops on serial data received or DOM not-busy. If a serial input is received, it will jump to a serial load routine waiting for 256 bytes of serial data before executing the serially uploaded program; if DOM is not busy, then it will load 256 bytes of data from DOM's Master Boot Record and execute. DOM (as well as CF disk) requires about 1/2 second to initialize before negating its busy flag, so that gives enough time to press a key if serial bootstrap is desired. The ROM program size grew to 64 bytes now which is still small enough to fit in the CPLD with enough logic left for VGA video, I hope.
Now I need to write a serially loadable utility program that writes DOM bootstrap program into Master Boot Record and also puts EhBASIC somewhere in the DOM disk. This way Proto65 can bootstrap by first load & execute the program in Master Boot Record which, in turn, load and execute EhBASIC. Well, that's the plan anyway...
Code: Select all
000000r 1 SerData = $eff9 ;CPLD serial register
000000r 1 SerStat = $eff8 ;CPLD serial status, bit 0 is receive ready, bit 1 is txempty
000000r 1 CFdata = $ee00 ;CF data register
000000r 1 CFerr = $ee01 ;CF error reg
000000r 1 CFsectcnt = $ee02 ;CF sector count reg
000000r 1 CF07 = $ee03 ;CF LA0-7
000000r 1 CF815 = $ee04 ;CF LA8-15
000000r 1 CF1623 = $ee05 ;CF LA16-23
000000r 1 CF2427 = $ee06 ;CF LA24-27
000000r 1 CFstat = $ee07 ;CF status/command reg
000000r 1
000000r 1 .ORG $ff80
00FF80 1 readbsy:
00FF80 1 AD F8 EF LDA SerStat ;check receive ready
00FF83 1 29 01 AND #1 ;receive ready is bit 0
00FF85 1 D0 1F BNE serboot ;if serial data ready, do serial bootstrap
00FF87 1 AA TAX ;initialize X to zero
00FF88 1 AD 07 EE LDA CFstat ;read CF status
00FF8B 1 2A ROL ;busy bit is bit 7
00FF8C 1 B0 F2 BCS readbsy ;loop until either CF ready or received serial data
00FF8E 1 A9 20 LDA #$20 ;issue read CF command
00FF90 1 8D 07 EE STA CFstat
00FF93 1 chkdrq:
00FF93 1 AD 07 EE LDA CFstat ;check data request bit set before read CF data
00FF96 1 29 08 AND #8 ;bit 3 is DRQ, wait for it to set
00FF98 1 F0 F9 BEQ chkdrq
00FF9A 1 getCFdata:
00FF9A 1 AD 00 EE LDA CFdata
00FF9D 1 9D 00 B0 STA $b000,x ;get 256 bytes of data to $b000
00FFA0 1 E8 INX
00FFA1 1 D0 F7 BNE getCFdata
00FFA3 1 4C 00 B0 JMP $b000
00FFA6 1 serboot:
00FFA6 1 AD F9 EF LDA SerData ;discard the first serial data
00FFA9 1 serboot1:
00FFA9 1 AD F8 EF LDA SerStat
00FFAC 1 6A ROR ;receive ready is bit 0
00FFAD 1 90 FA BCC serboot1 ;if serial data ready, do serial bootstrap
00FFAF 1 AD F9 EF LDA SerData
00FFB2 1 9D 00 B0 STA $b000,x
00FFB5 1 E8 INX
00FFB6 1 D0 F1 BNE serboot1
00FFB8 1 4C 00 B0 JMP $b000