Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!bagate!cbmvax!jesup From: jesup@cbmvax.commodore.com (Randell Jesup) Newsgroups: comp.sys.amiga.programmer Subject: Re: Direct hardware drive access Message-ID: <20211@cbmvax.commodore.com> Date: 31 Mar 91 04:36:22 GMT References: <2147@pdxgate.UUCP> Reply-To: jesup@cbmvax.commodore.com (Randell Jesup) Organization: Commodore, West Chester, PA Lines: 48 In article <2147@pdxgate.UUCP> bairds@eecs.cs.pdx.edu (Shawn L. Baird) writes: >With the recent flamage/discussion I've revitalized some of my interest >in trying my hand at direct disk reading. I've included a small snippet >of code and will say that I can't even get the drive light to come on. >The code enters with Disable() having been called and all DMA turned >off (I'm not using any disk DMA for stepping out to track 0, so this >shouldn't be a problem should it?). The goal is to step the disk out to >track 0. I assume you've taken over the machine, or you've called GetUnit() to obtain control of the disk hardware. > ; step to the outside of the disk in drive 0 (I wish) > and.b #$7f,ciaaprb ; select motor I would use #~CIAF_DSKMOTOR, that way you don't have to remember the value of 15 million hardware bits. > and.b #$f7,ciaaprb ; select drive 0 This should be #~(CIAF_DSKMOTOR!CIAF_DSKSEL0) - you're in a timing race to see if dskmotor goes high before the disk notices it has been selected. >diskready: btst.b #5,ciaapra ; check DSKRDY > beq.s diskready > or.b #$02,ciaaprb ; set step direction >checktrack0: move.l #3000,d0 For safety when doing calibrates, we usually use 4ms. > jsr wait > btst.b #4,ciaapra ; check DSKTRACK0 > bne.s disktrack0 > and.b #$fe,ciaaprb ; step out > or.b #$01,ciaaprb > bra.s checktrack0 >disktrack0: or.b #$88,ciaaprb ; unselect drive 0 If track 0 is set when you go into calibration, you must step in until the track-0 indication goes away, delay a settle time (15ms on top of the 4ms step), and then reverse direction and search for track 0). -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup Thus spake the Master Ninjei: "To program a million-line operating system is easy, to change a man's temperament is more difficult." (From "The Zen of Programming") ;-)