[Coco] Re: Re: Questions about the 502 controller vs theDisto SCII

Warren Hoslet dermunda at hotmail.com
Thu Jul 27 19:01:28 EDT 2006


>>It isn't too hard to do sector I/O without using the HALT line, but you  
>>still need to mask interrupts so I'm not sure what the point would be.
>
>    The main point is that when using the HALT line, it will not latch an  
>IRQ source. Masking IRQ's off will still latch an IRQ that you can process  
>once you turn them back on. With HALT, they are lost forever (unless the  
>IRQ device itself holds it for you).

In the CoCo, the PIAs keep the IRQ lines asserted until you clear them by 
reading the corresponding data register, so I would think that any irq 
occurring while the CPU is HALTed would be serviced as soon as execution 
resumes.

>>I  implemented a read routine that works (with limited testing) on a  CoCo 
>>2 with an FD-501. You just have to monitor the DRQ bit in the  status 
>>register ($FF48) to know when a byte is available. The trick is  that 
>>after a certian number of cycles have elapsed without a DRQ, you  must 
>>assume the transfer is complete and stop testing the status  register so 
>>that you don't clear the INTRQ request when it comes.

>     On read, yes, this does work.  It's on write that we can't get it to  
>fully keep up. I believe myself, Robert Gault and Alan Dekok all tried,  
>and we just couldn't quite make it.

Well, being the inquisitve type, I will have to try it myself. I don't see 
why a sector write would be more problematic than a read (the timing 
shouldn't be any different). The only potential issue I can think of is that 
the FDC might generate the INTRQ after you give it the last data byte, but 
before it has completed writing the CRC bytes at the end of the sector (but 
this seems unlikely). It is this 'dead time' that you need to detect the I/O 
completion so that you don't inadvertantly clear the INTRQ. This is why it 
won't work for Track Read/Write operations.

By the way, in my code example I used a SYNC instruction to wait for the 
NMI. This is bad because the SYNC will resume execution even when a masked 
interrupt occurs. Using 'CWAI $FF' will ignore the masked interrupts.





More information about the Coco mailing list