[net.micro.amiga] Traps and Exceptions, some questions and a BUG.

claudio@ethz.UUCP (Claudio Nieder) (04/24/86)

Traps & Exceptions
==================

While porting the One Pass Modula Compiler to the AMIGA several
questions about Tasks, Processes, Trap and Exception Handling occured.

I read the tutorial postings from Robert A. Peck but they don't answer
my questions completely.

1.)	I want to handle Traps (CHK instruction et al.) myself, instead
	of having this nice requester ("Software Error - Task Held").
	I arrived to detect these traps, but I don't want to return to
	the program that initiated the trap. Is there any other way than
	replacing the return address on the stack? Does changing to 
	UserState reenable Task-Switching automatically?
2.)	I want to handle "Ctrl-C, -D, -E, -F" by an Exception. Again I
	arrived to detect these events by using SetExcept() for the bits
	12..15, but my task is held if I press "Ctrl-C" twice very fast.
	This should be prevented by Exec as I interpreted the ROM Kernel
	Manual. Am I wrong? How can I get to any different place without
	replacing the return address on the stack?
3.)	I want to start one of my procedures as a DOS process in the
	same way as the multitasking-tutorial spawned a task. This way
	IO and DOS procedure calls would be possible. Is this feasible?
4.)	No Question, BUG report:
	Interface code to CreatePort() in Amiga.lib will never detect
	that there are no signals available on this task.

		MOVE.L	#FFFFFFFF, -(A7);	PUSH -1
		JSR	AllocSignal	;	AllocSignal(-1)
		MOVE.L	D0, D2
		MOVE.B	D2, D6
		MOVE.B	D6, D5
		MOVEQ	#0, D2		;	Clear D2
		MOVE.B	D6, D2		;	Move lowest byte
		CMPI.L	#FFFFFFFF, D2	; 	ALWAYS F A L S E !!
		...

	If this is the code of the c-program in the ROMKernel Manual
	I would call this a bug in the C-Compiler!

Hope that anybody out there in netland can help me.

				Thanx, kussi
				( ... mcvax!cernvax!ethz!schaub )