19 May 2009, 16:08 | #1 |
Users Awaiting Email Confirmation
Join Date: Nov 2008
Location: Hong Kong
Posts: 56
|
SIGBREAK_CTRL_C from assembler?
I'm trying to write a small routine that waits until CTRL-C is pressed. The program is run from the CLI on WB1.3 (AmigaForever A500). For some reason the following just locks up the machine at the same time as making the screen flicker madly... Any ideas on how to do this right?
Many thanks in advance Code:
SIGBREAKF_CTRL_C equ $1000 move.l 4,a6 ; system base move.l #SIGBREAKF_CTRL_C,d0 ; signal on CTRL-C jsr _LVOWait(a6) ; wait for this signal |
19 May 2009, 16:12 | #2 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Code:
move.l #1<<12,d1 ; SIGBREAKF_CTRL_C move.l DOSbase(a5),a6 jsr _LVOCheckSignal(a6) tst.l d0 beq.b .nobreak ; break signal received here. nop .nobreak rts |
19 May 2009, 16:40 | #3 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
@Anding:
Your code is correct, except that it is missing an RTS at the end and _LVOWait is not definined. I assume that this is only an extract of the entire program and your mistake is elsewhere, not shown here. @StingRay: Your code does not wait for the signal. It returns immediately. |
19 May 2009, 16:44 | #4 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
Edit: I got your point now Thomas and what you said is of course true. Anding: Your code should work work fine, can it be you maybe just forget the rts as Thomas already guessed? Last edited by StingRay; 19 May 2009 at 16:54. |
|
19 May 2009, 16:44 | #5 |
Users Awaiting Email Confirmation
Join Date: Nov 2008
Location: Hong Kong
Posts: 56
|
Thanks Stingray. What I am trying to do though is put my task to sleep until it is killed with CTRL-C. If possible I would like to avoid a busy loop, hence my hopes with _LVOWait? (The reason for this by the way is that I'm experimenting with some simple display code and wanted a quick way to just hold the screen until I'm ready to quit out).
|
19 May 2009, 16:51 | #6 |
Users Awaiting Email Confirmation
Join Date: Nov 2008
Location: Hong Kong
Posts: 56
|
@ Thomas,
Yes I include to define _LVOWait, and have an RTS in the following section. I assume I must have a problem elsewhere in my program that sets this up to fail. When I run a simple executable with this code alone, it works Code:
include exec/exec_lib.i ; equates SIGBREAKF_CTRL_C equ $1000 ; code section CODE_C ; chipram for custom chip DMA access ; wait for a signal move.l 4,a6 ; system base move.l #SIGBREAKF_CTRL_C,d0 ; signal on CTRL-C jsr _LVOWait(a6) ; wait for this signal ; exit moveq #0,d0 rts |
19 May 2009, 16:52 | #7 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
This code works when compiled with DCC's or VBCC's builtin assembler (it's the entire program, not only a snippet):
Code:
section code,code SIGBREAKF_CTRL_C equ $1000 _LVOWait equ -318 move.l 4,a6 ; system base move.l #SIGBREAKF_CTRL_C,d0 ; signal on CTRL-C jsr _LVOWait(a6) ; wait rts |
19 May 2009, 17:00 | #8 |
Users Awaiting Email Confirmation
Join Date: Nov 2008
Location: Hong Kong
Posts: 56
|
StingRay, thomas,
Thank you both for such speedy help! |
20 May 2009, 17:22 | #9 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,127
|
stingray: do you use dos.library/CheckSignal() in a loop? Just wondering for future shitty DOS programs.
Or do I call a GetMsg()? |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Which assembler to use | BanisterDK | Coders. General | 4 | 10 January 2012 15:13 |
C to assembler | Jherek Carnelia | Coders. General | 5 | 23 July 2011 20:22 |
Help with Assembler | redblade | Coders. General | 8 | 23 April 2010 16:00 |
Assembler for AmigaOS? | oRBIT | Coders. General | 40 | 03 July 2009 13:54 |
assembler | harlequin | request.Apps | 26 | 07 February 2002 20:53 |
|
|