Hi Wolfgang,
thanks for your reply and information. Comments below!
> The event vector is described pretty well at around p.13 of the QPTR
> manual (just before the "what you get" section)..
Hmmm, that sounds familiar now you come to mention it. I'll have another look
tonight at home, if I get a chance.
> The documentation for IOP_RPTR.says that upon return of the call, all
> bytes are set to 0, except the LSB (the "Pointer" level).
That's what I have got too. Although I didn't know it was the 'pointer' level.
> However, when that was drafted (at least the copy I have), the job
> event byte (sending events to jobs) didn't exist yet, I presume it is
> NOT zero'd on exit, but am not sure.
Well my experiments, granted very simple, show the LSB ony is non-zero the
remainder are zero. Mind you, how exactly do I send an event to a job?
If I PICK the job, or button frame it, then DO it's button, I get the same
event both times - $2D with a Key Stroke of $08.
<SNIP bitmap details>
Interesting. If I position the pointer exactly on 0,0 and simply press a
key (including space and enter) I still get the pointer moved bit set.
I tried repeatedly pressing the same key when the pointer was stationary
- I always get 'the pointer moved', as follows :
xorg yorg eventvec ks kd
0000 0000 0000002B 01 01 <- Pressing SPACE key without moving pointer
0000 0000 0000002B 02 02 <- Pressing ENTER key without moving pointer
0000 0000 0000002D 66 00 <- Pressing 'f' key without moving pointer.
And so on.
So my $2B (0010 1011) is as above, Keystroke in window +
keypress in window + Pointer moved + Pointer in window.
And my $2D (0010 1101) is Keystroke in window + Key up in Window +
Pointer moved + Pointer in window.
Both showing that the pointer moved event took place, but the pointer
coordinates never changed. In addition, in my call to IOP_RPTR, I set the
initial coordinates to 0,0 each time around the loop - it never affects
the pointer position - as far as I can see that is! However, I'm willing
to be convinced that internally it is setting them to 0,0 and then
resetting them to the current pointer position - but I honestly don't
know.
It's the same if I leave the pointer elsewhere in the window - the
coordinates don't change but the vectors says that they did!
>> Hope this helps.
It helps a lot, but also opens up more questions! ;-)
> I haven't seen Bruce's email, or at least I don't remember it.
> What did he ask?
I can't find it in Google anymore. It was something to do with setting up sub
windows and using Aurora - but Google is not listing it any more. I did see it
about two weeks ago at home, and I printed it off! I shall see what I can find
tonight!
FYI, this is the code I'm currently playing with :
Me equ -1 ; Current job id
Timeout equ -1 ; Infinite timeout
OpenOld equ 0 ; Open existing exclusive device
iop_pinf equ $70 ; Get PE information
iop_outl equ $7a ; Outline a primary Window
iop_rptr equ $71 ; Read the pointer
TermVec equ $01 ; When to stop reading
KeyStroke equ $0a ; Keystroke or button
ESC equ $1b ; ESC key code
Space equ ' ' ; One space
LineFeed equ $0a ; Linefeed
bra.s start
dc.l 0
dc.w $4afb
JobName dc.w JobName_x-JobName-2
dc.b 'PTR_RECORD Test v1'
JobName_x equ *
ConChan dc.w 4 ; Console channel name
dc.b 'con_'
ConDef dc.w 412,156,50,30 ; Primary Window width, height, x, y
HexBuff ds.w 1 ; 2 Bytes storage for hex conversion
SpaceTab dc.w 20,18,16,14,13,12,8,6,4,2
PtrRec ds.w 12 ; 24 byte Pointer Record for IOP_RPTR
Start moveq #1,d0 ; IO_OPEN - equate not working funnily
enough!
moveq #me,d1 ; Open for me
moveq #OpenOld,d3 ; Old exclusive device
lea ConChan,a0 ; Channel definition
trap #2 ; Do it
tst.l d0 ; OK
bne Exit ; Nope, bale out.
moveq #sd_wdef,d0 ; Redefine window
moveq #2,d1 ; Red border
moveq #1,d2 ; One pixel wide
lea ConDef,a1 ; Definition block
trap #3 ; Do it
tst.l d0 ; OK
bne Exit ; Nope, bale out
moveq #sd_clear,d0 ; cls
moveq #timeout,d3 ; Infinite timeout
trap #3 ; Do it
tst.l d0 ; OK
bne Exit ; Nope, bale out
FindPE moveq #iop_pinf,d0 ; Get PE information
moveq #timeout,d3 ; Infinite timeout
trap #3 ; Do it
tst.l d0 ; Ok
bne Exit ; No, bale out
GotPE moveq #iop_outl,d0 ; Outline primary window
move.l #$00040004,d1 ; Shadow 4 by 4
moveq #0,d2 ; Ignore window contents
moveq #timeout,d3 ; Infinite timeout
lea ConDef,a1 ; Outln size
trap #3 ; Do it
tst.l d0 ; Ok
bne Exit ; No, bale out
lea SignOn,a1 ; Message, ESC to quit
move.w ut_mtext,a2 ; Print message vector
jsr (a2) ; Do it
bne Exit ; Bale out on error
lea Title,a1 ; Headings
move.w ut_mtext,a2 ; Print message vector
jsr (a2) ; Do it
bne Exit ; Bale out on error
Pointer moveq #iop_rptr,d0 ; Read pointer
moveq #0,d1 ; Initial x,y for pointer
moveq #TermVec,d2 ; Return on button or keypress
moveq #timeout,d3 ; Infinite timeout
lea PtrRec,a1 ; Pointer record storage
trap #3 ; Do it
moveq #0,d0 ; Ignore errors (We know the channel is
open!)
PrintOut moveq #23,d7 ; 24 bytes to print out
lea PtrRec,a2 ; Location of bytes to print = pointer
record
PLoop move.b (a2)+,d6 ; Fetch a byte from pointer record
bsr.s HexIt ; Convert to hex in buffer at (A3)
suba.l #2,a3 ; Adjust buffer pointer
exg a1,a3 ; Buffer now in A1
moveq #IO_SSTRG,d0 ; Send bytes to channel
moveq #2,d2 ; Two bytes only
moveq #timeout,d3 ; Infinite timeout
trap #3 ; Do it
tst.l d0 ; Ok
bne Exit ; No, bale out
exg a1,a3 ; Swap buffers back again
SpaceReqd lea SpaceTab,a3 ; Table of D7 values where a space is
needed
moveq #9,d5 ; 10 values in table
SpaceNext cmp.w (a3)+,d7 ; Counter in table?
dbeq d5,SpaceNext ; Scan until found, or not
bne.s LoopEnd ; It was not found
bsr.s DoSpace ; Print a single space
LoopEnd dbra d7,PLoop ; Do some more bytes
bsr.s DoLinefeed ; Print a linefeed now
Escape lea PtrRec,a2 ; Pointer record again
cmpi.b #ESC,KeyStroke(a2) ; Got ESC key?
bne.s Pointer ; Go around again
Exit move.l d0,d3 ; Error code in D3
moveq #5,d0 ; MT_FRJOB - also not working here -
why???
moveq #timeout,d1 ; Infinite timeout
trap #1 ; Kill me
bra.s Exit ; We never get here, but ...
HexIt lea HexBuff,a3 ; Buffer for output
move.b d6,-(a7) ; Save hex byte
lsr.b #4,d6 ; Keep high nibble in low nibble
bsr.s Nibble ; Convert nibble to hex
move.b (a7)+,d6 ; Restore hex byte
Nibble andi.b #$0f,d6 ; Keep lower nibble
cmpi.b #10,d6 ; Check for a-f
bcs.s Add_0 ; No, 0-9 only
addq.b #7,d6 ; Offset to 'A'
Add_0 add.b #'0',d6 ; ASCII code now
move.b d6,(a3)+ ; And buffer it
rts ; Done
DoSpace moveq #Space,d1 ; Print a space
bra.s DoIt ; Skip next bit
DoLinefeed moveq #LineFeed,d1 ; Print a linefeed
DoIt moveq #io_sbyte,d0 ; Send one byte to channel
moveq #timeout,d3 ; Infinite timeout
trap #3 ; Do it
tst.l d0 ; Ok
bne Exit ; No bale out
rts
SignOn dc.w signon_x-signon-2
dc.b 'Press ESC to quit...',10,10
SignOn_x equ *
Title dc.w Title_x-Title-2
dc.b 'Channel SubW PtrX PtrY KS KD EventVec'
dc.b ' Wide High Xorg Yorg',Linefeed
Title_x equ *
Cheers,
Norman.
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm