Disc Motor Spinning

Hardware Hacking, Programming and Game Solutions/Cheats
Post Reply
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Disc Motor Spinning

Post by pser1 »

Hello,
When, from a ML program, you send a command to the D.O.S. like DIR, LOAD, SAVE or anything that turns the motor on, it seems that you have to wait until the light is off to disable interrupts, in the contrary case, it is said that the disc could be spinning until next time you access it, or forever if you don't.
Compusense tells us to poll &H605 until it reaches zero value.
This works, but wasting time, does anybody know if there is any possibility of forcing the disk to stop without losing data if you were writing?

Maybe just being able to reduce the time it requires to stop the motor would be enough.

thanks
pere
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Disc Motor Spinning

Post by zephyr »

The DragonDOS controller uses Bit 2 of $FF48 to turn the floppy drive motors on/off. POKE&HFF48,0 was often used to turn off the floppy drive motors from within a BASIC program or from the BASIC command prompt.

$FF48 Write-only data latch

Bit 7 Not used
Bit 6 Not used
Bit 5 Enables !NMI Interrupt from 2797 INTRQ
Bit 4 Enables write pre-compensation (Single Density only)
Bit 3 Single Density enable
Bit 2 Motor on(set)/Motor off(clear)
Bits1,0 Drive unit number 0 - 3
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: Disc Motor Spinning

Post by pser1 »

Thanks a lot Steve,
good to know. In this situation:
A program receives data via serial port (interrupts disabled), makes some calculations (unzipping) and then writes a disc sector.
This procedure will be done inside a loop (from 18 to 720 times)
Once the DOS sector write routine is called ($C028), would it be safe to immediately clear that bit in $FF48? or I should better wait for a little while (a short NOPs loop)?
Maybe a bit of trial and error will be necessary to find out the shortest loop that is safe enough.
One more time, thanks for your help
best regards
pere
Post Reply