Article View: comp.sys.amiga.tech
Article #12075Re: Requesting help with 'disk.resource'.
From: Randell Jesup
Date: Wed, 12 Apr 1989 04:59
Date: Wed, 12 Apr 1989 04:59
45 lines
2728 bytes
2728 bytes
In article <268@spycal.UUCP> gord@spycal.UUCP (Gordon Delaney) writes:
>I have a requirement to directly access the disk hardware on my A1000
>and wanted to do it in an "acceptable" way. I have the original C-A
>RKM (for V1.1?) which glosses over the resources facilities very
>vaguely. I am looking for other references to using the resources
>properly and possibly some sample code using the disk and misc
>resources.
Read resources/disk.h AND .i. Read the autodocs.
Now, having done that, here's the way to use it: if AllocUnit
fails, then you can still use GetUnit/GiveUnit. However, the trackdisk
will probably have control of the hardware whenever you don't. Make sure
you put your name in the ln_Name of DiscResourceUnit, and fill in the IS_CODE
and IS_DATA of any interrupts you plan to turn on. Also, for good measure,
set ln_Type of the Interrupt structure to NT_INTERRUPT.
If GetUnit succeeds, you have control of the hardware. Make sure
you've restored things as shown in the autodoc before GiveUnit, and make certain
you've turned off AND cleared any interrupts you turned on.
Your interrupt routines will be called with A1 == your IS_DATA.
restore all but D0/D1/A0/A1.
If trackdisk is also using the unit, it is HIGHLY advisable to return
the head to the same track when finished if a disk is in the drive, since
trackdisk will assume it's still on the same track, and gets very confused
if it isn't. You can find out the current track by reading the track and
looking at the track number in the sector headers.
Another thing to note: 1.2/1.3 disk resource doesn't check if you
own the unit when you do a GiveUnit. Unfortunately, 1.2/1.3 trackdisk has
a bug that causes it to (rarely) do this when there are empty drives in the
system. 1.3.1 SetPatch (soon to be available, don't ask for dates - I don't
know them) has a fix for this.
Last note: the disk resource is tough to use from C, since there
are no entries in amiga.lib for it (stubs). With lattice 4.0 or later, you
can make pragma files for it. Your interrupt code should probably be in
ASM.
Good luck (you'll need it)
--
Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup
Technical Details
Message-ID:
<6592@cbmvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!oliveb!amiga!cbmvax!jesupReferences:
<268@spycal.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!oliveb!amiga!cbmvax!jesup From: jesup@cbmvax.UUCP (Randell Jesup) Newsgroups: comp.sys.amiga.tech,comp.sys.amiga Subject: Re: Requesting help with 'disk.resource'. Message-ID: <6592@cbmvax.UUCP> Date: 12 Apr 89 04:59:02 GMT References: <268@spycal.UUCP> Reply-To: jesup@cbmvax.UUCP (Randell Jesup) Distribution: na Organization: Commodore Technology, West Chester, PA Lines: 45