2003-12-28 21:26:11 +00:00
|
|
|
;/*****************************************************************************/
|
|
|
|
;/* */
|
|
|
|
;/* mouse-kernel.inc */
|
|
|
|
;/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
;/* Mouse API */
|
2003-12-28 21:26:11 +00:00
|
|
|
;/* */
|
|
|
|
;/* */
|
|
|
|
;/* */
|
2009-09-26 11:11:14 +00:00
|
|
|
;/* (C) 2003-2009, Ullrich von Bassewitz */
|
|
|
|
;/* Roemerstrasse 52 */
|
|
|
|
;/* D-70794 Filderstadt */
|
|
|
|
;/* EMail: uz@cc65.org */
|
2003-12-28 21:26:11 +00:00
|
|
|
;/* */
|
|
|
|
;/* */
|
|
|
|
;/* */
|
|
|
|
;/* */
|
|
|
|
;/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
;/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
;/* arising from the use of this software. */
|
|
|
|
;/* */
|
|
|
|
;/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
;/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
;/* freely, subject to the following restrictions: */
|
|
|
|
;/* */
|
|
|
|
;/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
;/* claim that you wrote the original software. If you use this software */
|
|
|
|
;/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
;/* appreciated but is not required. */
|
|
|
|
;/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
;/* be misrepresented as being the original software. */
|
|
|
|
;/* 3. This notice may not be removed or altered from any source */
|
|
|
|
;/* distribution. */
|
|
|
|
;/* */
|
|
|
|
;/*****************************************************************************/
|
|
|
|
|
2004-11-07 13:00:29 +00:00
|
|
|
|
2003-12-28 21:26:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Error codes
|
|
|
|
|
|
|
|
.enum
|
|
|
|
MOUSE_ERR_OK ; No error
|
|
|
|
MOUSE_ERR_NO_DRIVER ; No driver available
|
|
|
|
MOUSE_ERR_CANNOT_LOAD ; Error loading driver
|
|
|
|
MOUSE_ERR_INV_DRIVER ; Invalid driver
|
|
|
|
MOUSE_ERR_NO_DEVICE ; Mouse hardware not found
|
2003-12-30 08:18:40 +00:00
|
|
|
MOUSE_ERR_INV_IOCTL ; Invalid ioctl code
|
2004-11-07 12:42:30 +00:00
|
|
|
|
|
|
|
MOUSE_ERR_COUNT ; Special: Number of error codes
|
2003-12-28 21:26:11 +00:00
|
|
|
.endenum
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; The driver header
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.struct MOUSE_HDR
|
|
|
|
ID .byte 3 ; Contains 0x6D, 0x6F, 0x75 ("mou")
|
|
|
|
VERSION .byte 1 ; Interface version
|
2013-05-31 22:53:17 +00:00
|
|
|
LIBREF .addr ; Library reference
|
2013-05-09 11:56:54 +00:00
|
|
|
JUMPTAB .struct
|
|
|
|
INSTALL .addr
|
|
|
|
UNINSTALL .addr
|
|
|
|
HIDE .addr
|
|
|
|
SHOW .addr
|
|
|
|
SETBOX .addr
|
|
|
|
GETBOX .addr
|
|
|
|
MOVE .addr
|
|
|
|
BUTTONS .addr
|
|
|
|
POS .addr
|
2003-12-28 21:26:11 +00:00
|
|
|
INFO .addr
|
2003-12-30 08:18:40 +00:00
|
|
|
IOCTL .addr
|
2013-05-09 11:56:54 +00:00
|
|
|
IRQ .addr
|
|
|
|
.endstruct
|
2006-05-21 11:25:31 +00:00
|
|
|
FLAGS .byte ; Mouse driver flags
|
2004-03-05 18:34:44 +00:00
|
|
|
CALLBACKS .struct ; Jump instructions
|
|
|
|
.byte ; JMP opcode
|
|
|
|
CHIDE .addr ; Jump address
|
|
|
|
.byte
|
|
|
|
CSHOW .addr
|
|
|
|
.byte
|
2004-03-21 22:12:06 +00:00
|
|
|
CMOVEX .addr
|
|
|
|
.byte
|
|
|
|
CMOVEY .addr
|
2004-03-05 18:34:44 +00:00
|
|
|
.endstruct
|
2003-12-28 21:26:11 +00:00
|
|
|
.endstruct
|
|
|
|
|
2004-03-21 22:12:06 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; The mouse callback structure
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.struct MOUSE_CALLBACKS
|
|
|
|
HIDE .addr ; Hide the mouse cursor
|
|
|
|
SHOW .addr ; Show the mouse cursor
|
|
|
|
MOVEX .addr ; Move the mouse cursor
|
2004-03-21 22:12:06 +00:00
|
|
|
MOVEY .addr ; Dito for Y
|
|
|
|
.endstruct
|
|
|
|
|
2003-12-28 21:26:11 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; The mouse API version, stored in MOUSE_HDR::VERSION
|
|
|
|
|
2013-05-31 22:53:17 +00:00
|
|
|
MOUSE_API_VERSION = $03
|
2006-05-21 11:25:31 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Bitmapped mouse driver flags, stored in MOUSE_HDR::FLAGS.
|
|
|
|
; Note: If neither of MOUSE_FLAG_XXX_IRQ is set, no interrupts are supplied
|
|
|
|
; to the driver. If one of the bits is set, the interrupt vector MUST be
|
|
|
|
; valid.
|
2006-05-31 21:18:44 +00:00
|
|
|
; Beware: Some of the bits are tested using the BIT instruction, so do not
|
|
|
|
; change the values without checking the code!
|
2006-05-21 11:25:31 +00:00
|
|
|
|
|
|
|
MOUSE_FLAG_EARLY_IRQ = $40 ; Enable IRQ *before* calling INSTALL
|
|
|
|
MOUSE_FLAG_LATE_IRQ = $80 ; Enable IRQ *after* calling INSTALL
|
2003-12-28 21:26:11 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Mouse button definitions
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
MOUSE_BTN_LEFT = $10
|
2003-12-28 21:26:11 +00:00
|
|
|
MOUSE_BTN_RIGHT = $01
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Structures used to return data from the mouse driver
|
|
|
|
|
|
|
|
.struct MOUSE_POS
|
|
|
|
XCOORD .word
|
|
|
|
YCOORD .word
|
|
|
|
.endstruct
|
|
|
|
|
|
|
|
.struct MOUSE_INFO
|
|
|
|
POS .tag MOUSE_POS
|
|
|
|
BUTTONS .byte
|
|
|
|
.endstruct
|
|
|
|
|
2009-09-26 11:11:14 +00:00
|
|
|
.struct MOUSE_BOX
|
2013-05-09 11:56:54 +00:00
|
|
|
MINX .word
|
|
|
|
MINY .word
|
|
|
|
MAXX .word
|
|
|
|
MAXY .word
|
2009-09-26 11:11:14 +00:00
|
|
|
.endstruct
|
2003-12-28 21:26:11 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Variables
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.global _mouse_drv ; Pointer to driver
|
2004-03-05 18:34:44 +00:00
|
|
|
.global _mouse_hidden ; Counter, 0 = mouse is visible
|
2003-12-28 21:26:11 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; C callable functions
|
|
|
|
|
|
|
|
.global _mouse_load_driver
|
|
|
|
.global _mouse_unload
|
|
|
|
.global _mouse_install
|
|
|
|
.global _mouse_uninstall
|
2004-11-07 13:00:29 +00:00
|
|
|
.global _mouse_geterrormsg
|
2003-12-28 21:26:11 +00:00
|
|
|
.global _mouse_hide
|
|
|
|
.global _mouse_show
|
2009-09-26 11:11:14 +00:00
|
|
|
.global _mouse_setbox
|
2013-05-09 11:56:54 +00:00
|
|
|
.global _mouse_getbox
|
2003-12-28 21:26:11 +00:00
|
|
|
.global _mouse_move
|
|
|
|
.global _mouse_buttons
|
|
|
|
.global _mouse_pos
|
2004-03-05 18:34:44 +00:00
|
|
|
.global _mouse_info
|
2003-12-30 08:18:40 +00:00
|
|
|
.global _mouse_ioctl
|
2003-12-28 21:26:11 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.global _mouse_clear_ptr
|
2006-06-04 09:48:14 +00:00
|
|
|
|
2003-12-28 21:26:11 +00:00
|
|
|
;------------------------------------------------------------------------------
|
2006-06-04 09:48:14 +00:00
|
|
|
; Driver entry points (asm callable)
|
2003-12-28 21:26:11 +00:00
|
|
|
|
|
|
|
.global mouse_install
|
|
|
|
.global mouse_uninstall
|
|
|
|
.global mouse_hide
|
|
|
|
.global mouse_show
|
2013-05-09 11:56:54 +00:00
|
|
|
.global mouse_setbox
|
|
|
|
.global mouse_getbox
|
2003-12-28 21:26:11 +00:00
|
|
|
.global mouse_move
|
|
|
|
.global mouse_buttons
|
|
|
|
.global mouse_pos
|
2004-03-05 18:34:44 +00:00
|
|
|
.global mouse_info
|
2003-12-30 08:18:40 +00:00
|
|
|
.global mouse_ioctl
|
2003-12-28 21:26:11 +00:00
|
|
|
|
|
|
|
|