Article View: comp.lang.oberon
Article #795Interrupt-time PROCEDURES with MacOberon S3R2 & TRUE Mac Apps?
From: Bob Brown
Date: Wed, 17 Jan 1996 03:50
Date: Wed, 17 Jan 1996 03:50
118 lines
4169 bytes
4169 bytes
Hi all!
I am Bob Brown.
I have been trying to use the Application Linker for MacOberon S3R2.03
(created 16 Aug 1995 @ 2.51pm) to create a stand-alone (true) Mac App.
I am trying to use the Mac's Time Manager and I am finding that, although
the PROCEDURE I am establshing gets called, the system crashes.
I am following the procedures laid out in Inside Macintosh and Think
Reference but with no success.
In :Toolbox:SampleApp.Mod there is code for a filter:
PROCEDURE VertAction(control: TB.ControlHandle; part: INTEGER);
VAR ...
BEGIN
SYSTEM.GETREG(7, reg.d7); SYSTEM.GETREG(4, reg.d4); SYSTEM.GETREG(11, reg.a3
);
...
SYSTEM.PUTREG(11, reg.a3); SYSTEM.PUTREG(4, reg.d4); SYSTEM.PUTREG(7, reg.d7
)
END VertAction;
This register save/restore sequence is not according to the normal Mac
conventions.
Am I right to believe that the Oberon compiler doesn't follow the 'normal'
mac conventions for parameter passing and return and doesn't address
globals in the same way?
IF this IS the case, then I shouldn't be saving/restoring the A5 register,
as is normally required when an interrupt procedure wants to access global
variables, but what SHOULD I be doing.
Here is my code, so that you can see what I am trying to do:
TYPE
TMInfoPtr = POINTER- TO TMInfo;
TMInfo =
RECORD
aTmTask: MP.TMTask;
tmRefCon: LONGINT;
END;
-- VAR
systemVersion: LONGINT;
gTheDialog: TB.WindowPtr;
gMyTMTask: TMInfo;
gBeatCalled: BOOLEAN;
PROCEDURE- GetTMInfo (): TMInfoPtr 02EH, 089H;
PROCEDURE Beat;
VAR
recPtr: TMInfoPtr;
myDelay,
oldA5: LONGINT;
BEGIN
recPtr := GetTMInfo ();
oldA5 := ME.SetA5 (recPtr.tmRefCon);
gBeatCalled := TRUE; (* GLOBAL VAR! *)
oldA5 := ME.SetA5 (oldA5);
MP.PrimeTime (SYSTEM.VAL (ME.Ptr, SYSTEM.ADR (recPtr)), 1000);
END Beat;
PROCEDURE InstallTMTask;
BEGIN
(* set up Beat to be called at 1 sec intervals *)
gMyTMTask.aTmTask.tmAddr := Beat;
gMyTMTask.aTmTask.tmWakeUp := 0;
gMyTMTask.aTmTask.tmReserved := 0;
gMyTMTask.tmRefCon := ME.SetCurrentA5 ();
MP.InsXTime (SYSTEM.VAL (ME.Ptr, SYSTEM.ADR (gMyTMTask)));
MP.PrimeTime (SYSTEM.VAL (ME.Ptr, SYSTEM.ADR (gMyTMTask)), 1000);
END InstallTMTask;
What am I dong wrong? What does the Oberon Compiler need me to do? All
help gratefully received!
On a related subject, when I set out to write this application, I found that
the :Toolbox:MacProcesses.Mod file was incorrect with respect to the Time
Manager info (& the Notification Manager and VBL stuff). For instance,
the file had:
TMTask*=RECORD
qLink: MacMemory.Ptr;
qType: INTEGER;
tmAddr: PROCEDURE;
tmCount, tmWakeUp, tmReserved: LONGINT;
END;
TMMaskPtr*=POINTER- TO TMTask; (*** TYPO! should be TMTaskPtr ***)
Is this deliberate (barring the typo!)? Can't I write an interrupt routine
in MacOberon. If not, can I write a C CODE resource and establish IT as
the interrupt procedure? Suggestions???
I am VERY grateful for any help anyone can give me.
Thanks.
BOB
---------------------------------------------------------------
BOB BROWN | Here I am, 'Living The Dream.'
DSTC PTY LTD |
Level 7, Gehrmann Laboratories | Trouble is, I don't know WHOSE
The University of Queensland | dream and what induced it!
QLD 4072 |-------------------------------
Australia | Tel: 61 (7) 3365 4310
bob@dstc.edu.au | FAX: +61 (7) 3365 4311
http://www.dstc.edu.au/ |
Technical Details
Message-ID:
<4dhrlv$fti@azure.dstc.edu.au>Path:
arc1-ca.pugleaf.net!azure.dstc.edu.au!usenetShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!azure.dstc.edu.au!usenet From: Bob Brown <bob@dstc.edu.au> Newsgroups: comp.lang.oberon Subject: Interrupt-time PROCEDURES with MacOberon S3R2 & TRUE Mac Apps? Date: 17 Jan 1996 03:50:23 GMT Organization: DSTC PTY LTD Message-ID: <4dhrlv$fti@azure.dstc.edu.au> NNTP-Posting-Host: fatcat.dstc.edu.au Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.12 (X11; I; OSF1 V3.2 alpha) X-URL: news:comp.lang.oberon