On Wed, 9 Nov 1994 11:24:14 +0000 (GMT), Simon Cooke said:
> To tell the truth, as far as my tests indicate, the problem's with the speed
> of the SAM...

Then obviously a DMA is needed.

> To read a sector at the moment, you have to do the equivalent of:

[setup deleted]

> main.loop:
>       in a,(status)
>       bit 3,a
>       jr nz,read.byte
>       rla
>       ret nc
>       jr main.loop

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).

> 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".

imc

Reply via email to