View Single Post
Old 25 May 2019, 08:30   #47
Toni Wilen
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 46
Posts: 24,696
Originally Posted by ross View Post
Hi Toni, as known HRM recommends to set #$4000,DSKLEN for idle mode after a write (or to break DMA on disk as in this case).
But there would have been some difference using instead a MOVE.W #$0000,DSKLEN?
It is perhaps to avoid that assembler optimization uses clr.w (double access on 000) on this write only register?
DSKLEN write logic works like this:

If bit 15 was already set previously and new value also has bit 15 set: start DMA. Write enable also requires bit 14 being set in both writes or it becomes read DMA.
If bit 15 is not set (old value = don't care): stop DMA immediately.

I am not sure why HRM recommends $4000. Your guess may be true (read access counts as write with "random" contents or in worst case $ffff) or perhaps there was some Portia or pre-release Paula bug.
Any differences using MOVE.W #$10,DMACON to forcibly stop DMA?
DMACON only "pauses" the DMA (Paula stops sending Agnus disk DMA requests and DSKLEN is not counted down), DMA would continue when re-enabled.
Toni Wilen is online now  
Page generated in 0.04683 seconds with 11 queries