home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
053.lha
/
Esuom
/
HandlerInterface.asm
< prev
Wrap
Assembly Source File
|
1986-11-20
|
2KB
|
43 lines
* HandlerInterface()
* from RKM Vol I, Pg 3-113 for use with ADD_HANDLER example program
* original code allowed C function as input handler
* too slow, so new code rewrites it in ASM
* Sean Riddle
* OKC ACE BBS (405) 631-9040
* let's see, InputEvent pointer in A0....
CSECT HandlerInterface
* XREF _myhandler ; don't need, since not used
XDEF _HandlerInterface
_HandlerInterface:
* MOVE.L A1,-(A7) ; old code: push data area
* MOVE.L A0,-(A7) ; and InputEvent pointer onto stack,
* JSR _myhandler ; call C function
* ADDQ #8,A7 ; fix stack, then exit (RTS)
CMPI.B #2,4(A0) ; IS THIS A RAWMOUSE EVENT?
BNE OUTTAHERE ; NOPE, LET'S LEAVE IT ALONE
NEG.W 10(A0) ; MAKE OPPOSITE X DIRECTION
NEG.W 12(A0) ; MAKE OPPOSITE Y DIRECTION
CMPI.W #$68,6(A0) ; LBUTTON DOWN?
BNE NOTLBUT ; NOPE, TRY RBUTTON
MOVE.W #$69,6(A0) ; YES, MAKE IT RBUTTON
BRA BUTUP ; SKIP NEXT TEST (ALWAYS PASSES, HMMM)
NOTLBUT CMPI.W #$69,6(A0) ; RBUTTON DOWN?
BNE BUTUP ; NO, TRY LBUTTON UP
MOVE.W #$68,6(A0) ; YES, MAKE IT LBUTTON
BUTUP CMPI.W #$E8,6(A0) ; HAS LBUTTON BEEN RELEASED?
BNE LBNOTUP ; NAH, TEST RBUTTON
MOVE.W #$E9,6(A0) ; YUP, MAKE IT RBUTTON UP
BRA OUTTAHERE ; LET'S GO
LBNOTUP CMPI.W #$E9,6(A0) ; HAS RBUTTON BEEN RELEASED?
BNE OUTTAHERE ; NOPE, TIME TO EXIT
MOVE.W #$E8,6(A0) ; YES, NOW IT'S A LBUTTON UP
OUTTAHERE MOVE.L A0,D0 ; EXIT LIKE C WOULD - PTR IN D0
RTS
END