Commodore Amiga A500 Technical Reference Manual page 56

Hide thumbs Also See for Amiga A500:
Table of Contents

Advertisement

HINTS FOR WRITING
YOUR DRIVER CODE:
This is why we refer to loading a "driver'" rather than a "device"
— you can write any sort of code you want to handle your device.
5. Binddriver will search the first hunk for a Resident structure. If it
cannot find one, it will assume some awful mistake has been
made, and will unload the segment
6. Finally we get to running some of YOUR code. InitResident () is
used to start you off and running. The return value from InitResi-
dent (and therefore the return value from your init entry point)
will be checked on exit. If it is zero then the segment will be un-
loaded. This can be useful if you only need to do a bit of initializa-
tion and then can go away, such as allocate additional expansion
memory for a non-expansion architecture board.
Your driver will be launched via InitResident () as discussed above.
If you use the underdocumented. but very useful RTF_AU-TOINIT
option you will have a library node constructed for you. and then
have the code you specified enter. If you don't use
RTF_AUTOINIT. then your code will be entered directly.
You should (among everything else you might be doing) open the
expansion.library and ask for the current buildings (GetCurrent-
BindingO). In this structure will be the head of a singly linked list
of ConfigDev structures. The structures are linked via the cd
NextCD field. You should deal with each member of the list —
they are for you!
There are two actions you must take. One is to unset the CDB
CONFIGME bit in the cd_Flags. If you do not do this then the
board is still available for other drivers (of course, you may actu-
ally want this .. .). If you do unset the CONFIGME bit, please also
record your "node" in the ccLDriver structure. It is assumed that
this is in an exec node, whose LN_NAME field points your name,
and LN_TYPE field is your type of "thing" — library, resource,
device, task, etc. I know that this will not always apply to you, but
try it anyway. It will help the rest of us debug the system when
something goes wrong.
You have now done everything you wanted to. Your init routine is
about to return. If you return a zero, then your code will be un-
loaded. If you return non-zero, then you will stay around
53

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Amiga a2000

Table of Contents