Mouse handling routine ---------------------- By Thomas Nilsen The routine does not use absolute mode, but relative mode which the system also uses. Short explanation: the routine first locates the systems mouse routine-vector and save its address. It then installs the new routine as set up. When all this is done, each time the mouse is moved, or a button is pressed one can find out by interrogating the "packet". The first byte of this packet indicates the mouse-button status. The 2nd byte is the number of pixels the mouse was moved in X-direction and the last and 3rd bytes controls the Y-movement. If the movement in any direction exceeds 128 a new packet is sent from the system and you only have to repeat the check - but that is of course done automatically as you have to do the check in a continuous loop to handle any movement instant. The cut-down init-code looks like this: move.w #34,-(sp) trap #14 ; Get Kbd vector table lea 2(sp),sp lea H,a1 ; Out own routine move.l d0,a0 move.l d0,SaveOldBase ; Save table-address move.l 16(a0),SaveOldVec ; Save mouse-vector move.l a1,16(a0) ; Mouse Vector pea IkbdString move.w #0,-(sp) ; Length of IKBD String -1 move.w #25,-(sp) ; Write string to kbd trap #14 lea 8(sp),sp H: move.b #3,d0 lea Packet,a1 .L: move.b (a0)+,(a1)+ ; Anu values are written to a0 subq.b #1,d0 ; by the system. bne .L rts So, to use the code we have to perform a loop which gets the values from "Packet". And that's it.