[comp.sys.atari.st] receiving interrupts in an user prog

csch@tub.UUCP (04/04/87)

I think, it has something to do with how the 68000 wants her
exception-handlers to terminate.

Your (almost any) C-compiler ends functions with a RTS instruction,
but exception-handlers MUST take care of register-contents, stack-
pointer (usp) and have to return with RTE (return from exception).

On the ST you may ONLY use the VBL-IRQ directly from C. Functions
queued in the VBL-QUEUE (pointer to is $456 (points to $4ce))
may simply return with a RTS instruction.

If you want to use OTHER IRQ vectors you have to add a simple
assembly-language subroutine like

	movem.l	d0-a6, -(a7)	* save registers
	move.l	a7, sp_save	* save stack-pointer
	jsr	c_function	* call C function
	move.l	sp_save, a7	* restore stack-pointer
	movem.l (a7)+, d0-a6	* get registers back from supervisor-stack
	rte			* return from exception

NOTE!!!!! This is ONLY a SHORT example how you can START doing that stuff!!
		  ====         =======

Rgds.

Clemens (csch@tub.uucp = {unido | pyramid} ! tub ! csch)