[comp.sys.mac] LightSpeed C Inline Assembler & TRAP

sbg@kuling.UUCP (Stefan B. Grinneby <Bladesong>) (12/02/87)

I'm using Lightspeed C 2.01 and a MacPlus. This is what I want to do:
The Motorola 68K has an instruction TRAP #<vector>. 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 |
 +----------------------------------------------------------------+