home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-06 | 3.5 KB | 70 lines | [TEXT/PJMM] |
- { This program, an INIT, demonstrates how to use the code resource ShowIcon7, for displaying INIT icons at startup. }
- { This involves loading, locking, calling, then unloading the code resource. }
- { Written by: Tony Andreoli. 01/01/93 }
-
- unit CallingShowIcon7;
-
- interface
- procedure main;
- procedure ShowIcon (iconID: Integer; advance: Boolean; procAddress: ProcPtr);
- inline
- $205f, { movea.l (a7)+,a0 }
- $4e90; { jsr(a0) }
- { This is the standard calling convention to call any loaded resource. Your calling routine should accept 1 more }
- { parameter than the code resource. i.e. ShowIcon7 takes two parameters, the iconID, and advance. Our routine }
- { to call ShowIcon7 takes 3 parameters, the two mentioned, and the routine's address. The parameters are }
- { pushed on to the stack (the address being last), then we make an inline call to do a sub-routine. The address of }
- { the sub-routine is popped off of the stack (since the stack works in FILO [First In Last Out]), and the }
- { JSR is executed. Our other two parameters are now sitting in the stack when ShowIcon7 is executed, and life }
- { is good again. If our code resource didn't require any parameters, then this inline procedure would only require }
- { one (the JSR address), the inline instructions remain the same. }
-
- implementation
- procedure main;
- var
- codeResourceHandle: Handle; { Handle to our code resource }
- codeResourcePtr: ProcPtr; { Pointer to our code resource }
-
- begin
- codeResourceHandle := GetResource('Code', -4048); { Load the desired resource }
- if (codeResourceHandle <> nil) then { If the load went OK }
- begin
- HLock(codeResourceHandle); { Lock the code resource in place }
- codeResourcePtr := ProcPtr(codeResourceHandle^); { Get the address of our code resource }
-
- ShowIcon(128, false, codeResourcePtr); { The following calls the code resource, with the icon }
- ShowIcon(129, false, codeResourcePtr); { to display in succession. The final line has a "true" }
- ShowIcon(130, false, codeResourcePtr); { in the advance field, allowing the next extension to }
- ShowIcon(131, false, codeResourcePtr); { draw an icon, and not overwrite ours. }
- ShowIcon(132, false, codeResourcePtr);
- ShowIcon(133, false, codeResourcePtr);
- ShowIcon(134, false, codeResourcePtr);
- ShowIcon(135, false, codeResourcePtr);
- ShowIcon(136, false, codeResourcePtr);
- ShowIcon(137, false, codeResourcePtr);
- ShowIcon(138, false, codeResourcePtr);
- ShowIcon(139, false, codeResourcePtr);
- ShowIcon(140, false, codeResourcePtr);
- ShowIcon(141, false, codeResourcePtr);
- ShowIcon(142, false, codeResourcePtr);
- ShowIcon(143, false, codeResourcePtr);
- ShowIcon(144, false, codeResourcePtr);
- ShowIcon(145, false, codeResourcePtr);
- ShowIcon(146, false, codeResourcePtr);
- ShowIcon(147, false, codeResourcePtr);
- ShowIcon(148, false, codeResourcePtr);
- ShowIcon(149, false, codeResourcePtr);
- ShowIcon(150, false, codeResourcePtr);
- ShowIcon(151, false, codeResourcePtr);
- ShowIcon(152, false, codeResourcePtr);
- ShowIcon(153, false, codeResourcePtr);
- ShowIcon(154, false, codeResourcePtr);
- ShowIcon(155, false, codeResourcePtr);
- ShowIcon(156, true, codeResourcePtr);
-
- HUnlock(codeResourceHandle); { Unlock the code resource, we're outta here! }
- end
- else
- SysBeep(1); { If the code resource was nil, to an audio alert }
- end;
- end.