[comp.sys.amiga] CTRL-C with assembler

bjc@pollux.UUCP (Betty J. Clay) (03/16/88)

Checking for CTRL-C is easy in BASIC, and C does it for us, but I cannot 
find a way to check for it using assembler.  Can someone help, please?

Betty Clay

kenchiu@phoenix.Princeton.EDU (Kenneth Chiu) (03/16/88)

In article <7113@pollux.UUCP> bjc@pollux.UUCP (Betty J. Clay) writes:
>Checking for CTRL-C is easy in BASIC, and C does 
it for us, but I cannot 
>find a way to check for it using assembler.  Can someone help, please?

It's a pre-allocated system signal.  The defines are in dos.i or dosextens.i.
You can use an exec function to poll the signal, SetSignal() is the one
you should use, I think, but you should check.

If you want to make ^C cause a kind of "interrupt," then you have to set-up
an exception handler.  I've never done, this, so some guru will have to help
there.

Ken Chiu

bryce@eris.berkeley.edu (Bryce Nesbitt) (03/17/88)

In article <> bjc@pollux.UUCP (Betty J. Clay) writes:
>
>Checking for CTRL-C is easy in BASIC, and C does it for us, but I cannot 
>find a way to check for it using assembler.  Can someone help, please?

#include "libraries/dos.i"
	....
	moveq	#0,d0			;Set specified signal to zero
	move.l	#SIGBREAKF_CTRL_C,d1	;Choose just the CTRL_C signal
	move.l	4,a6			;Get ExecBase
	jsr	_LVOSetSignal(a6)
	btst.l	#SIGBREAKB_CTRL_C,d0	;See if signal was set
	bne.s	Control_C_hit
	....

;SIGBREAKF is the 32 bit number with just the proper bit set.
;SIGBREAKB is the actual bit number (0 to 31).


Don't bother trying to get an interrupt out of this.  Too much work,
too may obscure traps.

[Because the question was asked in comp.sys.amiga, I'm coss-posting there]
[I hope we get less and less of this type of question in .amiga, and move]
[it all over to .tech]

|\_/|  . ACK!, NAK!, EOT!, SOH!
{O_o} .     Bryce Nesbitt
 (")        BIX: mleeds (temporarily)
  U	    USENET: bryce@eris.berkeley.EDU -or- ucbvax!eris!bryce