Important: The information in this document is obsolete and should not be used for new development.
Defining a Deferred Task
You define a deferred task as a procedure taking no parameters and put the address of that procedure in the deferred task element whose address you pass to theDTInstallfunction. When your task is executed, register A1 contains the optional parameter that you put in thedtParmfield of the task record.If you write your deferred task in a high-level language, such as Pascal, you might need to retrieve the value loaded into register A1. The function
GetA1defined in Listing 6-3 returns the value of the A1 register.Listing 6-3 Finding the value of the A1 register
FUNCTION GetA1: LongInt; INLINE $2E89; {MOVE.L A1,(SP)}You can callGetA1in your deferred task, as illustrated in Listing 6-4.Listing 6-4 Defining a deferred task
PROCEDURE DoDeferredTask (dtParm: LongInt); BEGIN {Your deferred task code goes here.} END; PROCEDURE MyDeferredTask; VAR myParm: LongInt; BEGIN myParm := GetA1; {retrieve parameter put in register A1} DoDeferredTask(myParm); {run the deferred task} END;Note thatMyDeferredTaskcallsGetA1to retrieve the parameter passed in the register A1. ThenMyDeferredTaskcalls the application-defined procedureDoDeferredTask, passing it that parameter. TheDoDeferredTaskprocedure does the real work of the deferred task. (This division into two routines is necessary to prevent problems caused by some optimizing compilers.)