Path: utzoo!mnetor!uunet!mcvax!enea!kuling!sbg
From: sbg@kuling.UUCP (Stefan B. Grinneby )
Newsgroups: comp.sys.mac
Subject: LightSpeed C Inline Assembler & TRAP
Message-ID: <566@kuling.UUCP>
Date: 2 Dec 87 11:01:14 GMT
Reply-To: sbg@kuling.UUCP (Stefan B. Grinneby )
Organization: Comp. Science, Univ. of Uppsala, Sweden
Lines: 28
References:
I'm using Lightspeed C 2.01 and a MacPlus. This is what I want to do:
The Motorola 68K has an instruction TRAP #. This I want to use
for some exception processing in a C program (I'm writing a small OS
for the Mac). To do this, I would like to be able to write these
exception routines inside a C program, using "asm { ... }". My thought
was now, that if I wrote like this inside some function:
asm {
move #lbl,$80 ; this is to test the TRAP #0
trap #0
return
lbl move.l 0x42,foo ; this is my exception routine
rte
},
the first instruciton would place the *adress* to my exception routine in
$80 (which I hope is the 0-trap-vector), execute the trap, and then return
from the function. But Alas!, it places "move.l 0x42,foo" on adress $80,
which, as I think you understand, crashes. This is not very good. In fact,
I might perhaps be forced to write my OS on another machine if this is
something that cannot be done on the Mac. Pls, help needed, and *fast*,
the OS is due for examination the 21 Dec!
+----------------------------------------------------------------+
| UUCP: {seismo,mcvax,cernvax}!enea!kuling!sbg |
| ARPA: D84.S-B-Grinneby%CARMEN.UPPSALA.SE@SEISMO |
| Surface: SBG, Nedre Slottsgatan 16:305, 752 20 UPPSALA, SWEDEN |
+----------------------------------------------------------------+