[comp.sys.amiga.programmer] amigaDOS packets and BCPL

schuller@DUTIAA.TUDELFT.NL (Schuller Schuller Oijen) (06/27/91)

Subject: AmigaDOS, Packets, AutoBoot, BCPL

  While I was writting an AmigaDOS File-Handler, I encountered some
problems. A number of packets types are not documented and some strange
things were happening while I wrote autoboot code. Can anybody help me with
the following questions:

  What is the function (including arguments and results) of the following
packet types:
ACTION_SETMAP (4), ACTION_DIE (5), ACTION_EVENT (6), ACTION_INFO (26)
ACTION_DISKTYPE (32), ACTION_DISKCHANGE (33),
ACTION_TRUNCATE (1022), ACTION_WRITEPROTECT (1023)

  After rebooting, some resident code (pri=105) recovered my file-handler
with AllocAbs(). After that a bootnode was created with bn_Name a pointer
to a dummy ConfigDev and bn_DeviceNode a pointer to my DeviceNode. The
priority of the bootnode is -5, I have got a HardDisk with autoboot
priority 0. The DeviceNode structure has a valid StackSize, Priority,
SegList and Name, the rest of the structure is null. The SegList is a
BCPL-compatible structure as in "The AmigaDOS Manual".
  Problem 1: On entry of my file-handler register d1 was a bcpl pointer to
a packet but only packet.arg2 was usefull: packet.arg1 (BSTR Name) was a
pointer to garbage and packet.arg3 (BPTR DeviceNode) was a null pointer.
  Problem 2: The DeviceNode.Task field is set, but NOT by me. This is
ofcourse very nice, because I don't have a valid packet.arg3, but doesn't
agree with "The AmigaDOS Manual" which states that a BCPL (file-handler)
process must set it itself.
  Both problems only took place after a recover. Normally (Mount)
everything goes okay.

  The last problem. How does one gracefully exit from a BCPL-like file-
handler process. Must I restore the stack and "RTS" (not very BCPL-like!!);
must I "JMP (A6)" on entry level, or must I call a certain global vector
with "JSR (A5)". The last option is ofcourse not very well documented nor
very compatible with future code. I hope there is another, neater method
than the above mentioned.

Note: The program is written in assembler and is only one segment; all
      variables are longword alligned and no undocumented calls are
      executed.

---------------------------------------------------------------------------
Nanning Buitenhuis | Computers don't make errors,
Holland            | just slight mistakes.

replies to : schuller@dutiad.tudelft.nl