🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.acorn.tech
5 messages
5 total messages Started by Philip R. Banks Fri, 31 Jul 1992 12:05
I got the EventV Blues.
#90
Author: Philip R. Banks
Date: Fri, 31 Jul 1992 12:05
78 lines
4182 bytes
   I have an interesting problem with some event code I am working on. The
problem is not so much that the code doesn't work at all but that it works
under certain circumstances. You see I have some code designed to catch key
and mouse events and do some processing of them. As the processing is a
little complex I have to use a CallBack to do it.

   Now the code works when the machine is not *loaded* heavily. By this I
mean I am not running a FS intensive/TaskWindow task. When the machine is
heavily loaded (behavior exhibted on an A3000 and an A5000) mouse clicks get
sluggish and sometimes are lost. The general effect is as if the mouse
interupt code has been slowen down to about three quarters normal speed.
Mouse double clicks are, when done at normal speed, quite often interpreted
as single clicks. Drags persist for longer than they should and generally
recognition of mouse events is slow.

   The code attaches itself to the EventV vector and is part of a module. As
far as I can see all registers are safely preserved and I have minimised the
work needed outside the callback, in the interupt code itself. The really
strange thing about it is that keypress activity is completely unaffected.
Can anyone see what I am doing that could be causing this problem? Or have I
hit a hardware/software limitation? (Seems strange given that the code
itself is fairly trivial.)

NB When run under RO2 IRQUtils 0.12 is loaded so CallBacks are functioning
fine.

---Code fragment begins---
.EventV
        STMFD   R13!,{R0-R5,R14}
        MOV     R5,PC           ; Store current settings/processor mode
        ORR     R4,R5,#3
        TEQP    R4,#0           ; Enter SVC mode
        MOV     R0,R0           ; NOP for contention purposes
        STMFD   R13!,{R14}      ; Stack SVC mode link register
.Event_mouse
        TEQ     R0,#10           ; Is it a mouse event?
        BNE     Event_key
        TST     R3,#%111
        BEQ     EventV_exit     ; Check for invalid mouse codes.
        FNmvi(0,mouse_bl%,"")
        TST     R3,#4            ; Select?
        MOVNE   R1,R0
        TST     R3,#2            ; Menu?
        ADDNE   R1,R0,#blocksize%
        TST     R3,#1            ; Adjust?
        ADDNE   R1,R0,#blocksize%*2
        ADR     R0,Event_callback
        SWI     "XOS_AddCallBack"; Set up a callback to process event.
        B       EventV_exit      ; Exit if no button was pressed
.Event_key
        TEQ     R0,#11           ; Is it a key event?
        BNE     EventV_exit      ; So is it a mouse event?
        TEQ     R1,#1            ; Is it a key DOWN event?
        BNE     EventV_exit      ; Exit if no key was pressed
        CMP     R2,#&67
        BHI     EventV_exit      ; Exit if an invalid key code is given
        FNmvi(0,key_bl%,"")
        MOV     R3,#blocksize%
        MUL     R1,R2,R3
        ADD     R1,R0,R1
        ADR     R0,Event_callback
        SWI     "XOS_AddCallBack"; Set up a callback to process event.
.EventV_exit
        LDMFD   R13!,{R14}      ; Restore SVC mode link register
        TEQP    R5,#0           ; Return to original mode
        MOV     R0,R0           ; NOP for contention
        LDMFD   R13!,{R0-R5,R14}; Restore Registers
        MOVS    PC,R14          ; Pass on the call.
---Code fragment ends---

    Philip

--
Philip R. Banks  Syntax: mail < banks_p@kosmos.wcc.govt.nz >            @@@@@/|
                                                                        @@@@/#|
                                                                        @@@/##|
I breathe the air, While they're running in a rat race,                 @@/---|
Way above it all, Standing on higher ground. ---A.P.P.                  @/    |
Re: I got the EventV Blues.
#97
Author: Brian Brunswick on ely.cl.cam.ac...
Date: Sat, 01 Aug 1992 15:04
16 lines
1315 bytes
In article <24A9nhj017n@khantazi.welly.gen.nz> banks_p@kosmos.wcc.govt.nz writes:
>
>   I have an interesting problem with some event code I am working on. The
>problem is not so much that the code doesn't work at all but that it works
>under certain circumstances. You see I have some code designed to catch key
>and mouse events and do some processing of them. As the processing is a
>little complex I have to use a CallBack to do it.
>

Could it be that you are relying on the callbacks being sequenced?
I'm not at all sure that they are... I remember using a test program
with callafters and callbacks, but don't know which one of the two
was mixing things up?

What happens if two events happen before the callback goes off?
Brian.Brunswick@cl.cam.ac.uk  Disclaimer.  Short sig rules!
Re: I got the EventV Blues.
#98
Author: burke
Date: Sun, 02 Aug 1992 18:39
19 lines
1817 bytes
In article <1992Aug1.150444.9705@cl.cam.ac.uk>, Brian.Brunswick@cl.cam.ac.uk (Brian Brunswick on ely.cl.cam.ac.uk) writes:
> Could it be that you are relying on the callbacks being sequenced?
> I'm not at all sure that they are... I remember using a test program
> with callafters and callbacks, but don't know which one of the two
> was mixing things up?

I've written a program which changes the function of the keypad; I was trying
to change the state of the NumLock LED with a CallBack, and discovered that a)
the keyboard handler also changes it the same way, and b) the two CallBacks
didn't always come in the same order - usually the keyboard handler got in
first, but not always. I then added a delay of 0.1 sec with CallAfter, and
everything seems OK.

e----><----p | Stephen Burke           | Internet: burke@vxdesy.desy.de
 H   H   1   | Gruppe FH1T (Liverpool) | DECnet:   vxdesy::burke (13313::burke)
 H   H  11   | DESY, Notkestrasse 85   | BITNET:   BURKE@DESYVAX or SB2@UKACRL
 HHHHH   1   | 2000 Hamburg 52         | JANET:    sb2@uk.ac.rl.ib
 H   H   1   | Germany                 | Phone:    + 49 40 8998 2282
 H   H 11111 | HERA, the world's biggest electron microscope!
Re: I got the EventV Blues.
#100
Author: Philip R. Banks
Date: Mon, 03 Aug 1992 02:10
36 lines
2326 bytes
Brian.Brunswick@cl.cam.ac.uk (Brian Brunswick on ely.cl.cam.ac.uk) writes:

> Could it be that you are relying on the callbacks being sequenced?
> I'm not at all sure that they are... I remember using a test program
> with callafters and callbacks, but don't know which one of the two
> was mixing things up?

  You are right, callbacks are not guaranteed to occur in any order or time
interval. Thats not the problem. The Callback code is *always* being called
properly and indeed the code being called doesn't care which order the data
comes in, all the information needed is contained in R12 passed to it by the
OS on entry.

> What happens if two events happen before the callback goes off?

   The two get enqueued and whichever one comes in last is the one noticed
the most by the user. (As far as I can tell that is) The problem is not so
much that the events are detected but that the OS seems to be not receiving
them *after* my code has finished doing the initial processing. Indeed
presuming for a second that even only one CallBack is permitted during heavy
loads this shouldn't affect the code or the OS as I reset the flags on exit
from the EventV code. (I assuming that the V flag would be set if the
Callback couldn't be arranged.)

   What makes it stranger is that the same code handles mouse and keyboard
events and it is *only* the mouse events that are suffering. All key presses
are making it through just fine.

    Philip

--
Philip R. Banks  Syntax: mail < banks_p@kosmos.wcc.govt.nz >            @@@@@/|
                                                                        @@@@/#|
                                                                        @@@/##|
I breathe the air, While they're running in a rat race,                 @@/---|
Way above it all, Standing on higher ground. ---A.P.P.                  @/    |
Re: I got the EventV Blues.
#101
Author: Philip R. Banks
Date: Mon, 03 Aug 1992 02:13
23 lines
1708 bytes
burke@vxdesy.desy.de writes:

> I've written a program which changes the function of the keypad; I was trying
> to change the state of the NumLock LED with a CallBack, and discovered that a)
> the keyboard handler also changes it the same way, and b) the two CallBacks
> didn't always come in the same order - usually the keyboard handler got in
> first, but not always. I then added a delay of 0.1 sec with CallAfter, and
> everything seems OK.

   This might explain the behavior if the CallBack was stepping in before
the OS gets a chance to record the mouse movement/click. This strikes me as
odd though as I would have expected the OS to have already noted the change
*before* the event gets signaled across the EventV vector. I'll give it a
whirl with a CallAfter and see what happens...

    Philip

--
Philip R. Banks  Syntax: mail < banks_p@kosmos.wcc.govt.nz >            @@@@@/|
                                                                        @@@@/#|
                                                                        @@@/##|
Radiation emissions from Quirium are perilously high, therefore repairs @@/---|
should not be attempted by pilots with vertigo. ---Arc Elite Manual     @/    |
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads