> Then obviously a DMA is needed. Yup :)
> Do you _really_ have to do this much checking for each pair of bytes? > If that's the case then there's something wrong with the hardware. You > should just be able to tell the disk to read a sector and then do 512 INs > in a row to read it. Even the ZX Microdrive did that (well, as far as I > remember anyway). If an error occurs in the middle, the hardware should > compensate by giving the program dummy values until al lthe bytes have been > read, at which point it can check for an error indication. By the way, you > can save T-states in that loop with: > > main.loop: > in a,(status) > rla > ret nc > and 16 > jr z,main.loop > > (this loses 3 T-states if data is immediately available but saves 8 on each > time round the loop). The amount of checking is *just in case* the drive is slow on providing a byte -- some drives may be slower than others in this respect. > > read.byte: > > in a,(data) > > ld (hl),a > > inc hl > > in a,(data) > > ld (hl),a > > inc hl > > jr main.loop > > What's wrong with "ini"? It takes 16 cycles to the 24 of "in a,(n);ld(hl),a; > inc hl". Also, "jp" is two cycles faster than "jr". This code was only written as an example, and besides: (1) the ports ain't finalised yet, so INI couldn't be used if say there's a different port for each byte of the word to read in (2) It's relocatable as it is ;) Si

