;/*                                                                           */
 ;/*                                                                           */
 ;/*                                                                           */
-;/* (C) 2003-2006 Ullrich von Bassewitz                                       */
-;/*               Römerstraße 52                                              */
-;/*               D-70794 Filderstadt                                         */
-;/* EMail:        uz@cc65.org                                                 */
+;/* (C) 2003-2009, Ullrich von Bassewitz                                      */
+;/*                Roemerstrasse 52                                           */
+;/*                D-70794 Filderstadt                                        */
+;/* EMail:         uz@cc65.org                                                */
 ;/*                                                                           */
 ;/*                                                                           */
 ;/*                                                                           */
            UNINSTALL   .addr
                    HIDE        .addr
            SHOW        .addr
-           BOX         .addr
+                   SETBOX      .addr
+           GETBOX      .addr
            MOVE        .addr
            BUTTONS     .addr
            POS         .addr
 ;------------------------------------------------------------------------------
 ; The mouse API version, stored in MOUSE_HDR::VERSION
 
-MOUSE_API_VERSION       = $01
+MOUSE_API_VERSION       = $02
 
 ;------------------------------------------------------------------------------
 ; Bitmapped mouse driver flags, stored in MOUSE_HDR::FLAGS.
         BUTTONS .byte
 .endstruct
 
+.struct MOUSE_BOX
+       MINX    .word
+       MINY    .word
+       MAXX    .word
+       MAXY    .word
+.endstruct
 
 ;------------------------------------------------------------------------------
 ; Variables
         .global _mouse_geterrormsg
         .global _mouse_hide
         .global _mouse_show
-        .global _mouse_box
+        .global _mouse_setbox
+       .global _mouse_getbox
         .global _mouse_move
         .global _mouse_buttons
         .global _mouse_pos
         .global mouse_uninstall
         .global mouse_hide
         .global mouse_show
-        .global mouse_box
+        .global mouse_setbox                    
+       .global mouse_getbox
         .global mouse_move
         .global mouse_buttons
         .global mouse_pos
 
 
 /* Structure containing the mouse coordinates */
 struct mouse_pos {
-    int x;
-    int y;
+    int                x;
+    int                y;
 };
 
 /* Structure containing information about the mouse */
     unsigned char       buttons;       /* Mouse button mask */
 };
 
+/* Structure used for getbox/setbox */
+struct mouse_box {
+    int                minx;
+    int                miny;
+    int                maxx;
+    int                maxy;
+};
+
 /* Structure containing mouse callback functions. These functions are declared
  * in C notation here, but they cannot be C functions (at least not easily),
  * since they may be called from within an interrupt.
 void __fastcall__ mouse_show (void);
 /* Show the mouse. See mouse_hide for more information. */
 
-void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
+void __fastcall__ mouse_setbox (const struct mouse_box* box);
 /* Set the bounding box for the mouse pointer movement. The mouse X and Y
  * coordinates will never go outside the given box.
  * NOTE: The function does *not* check if the mouse is currently inside the
  * are really what you want, you have to use your own cursor routines.
  */
 
+void __fastcall__ mouse_getbox (struct mouse_box* box);
+/* Get the current bounding box for the mouse pointer movement. */
+
 void __fastcall__ mouse_move (int x, int y);
 /* Set the mouse cursor to the given position. If a mouse cursor is defined
  * and currently visible, the mouse cursor is also moved.
 
 CC     = ../../src/cc65/cc65
 LD     = ../../src/ld65/ld65
 
-AFLAGS = -t $(SYS) -I../../asminc
+AFLAGS = -t $(SYS) --forget-inc-paths -I../../asminc       
 CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
 
 #--------------------------------------------------------------------------
 C_OBJS =
 
 S_OBJS =        mouse-kernel.o          \
-                mouse_box.o             \
                 mouse_buttons.o         \
+               mouse_getbox.o          \
                 mouse_geterrormsg.o     \
                 mouse_hide.o            \
                 mouse_info.o            \
                 mouse_load.o            \
                 mouse_move.o            \
                 mouse_pos.o             \
+                mouse_setbox.o          \
                 mouse_show.o            \
                 mouse_unload.o
 
 
 ;
-; Ullrich von Bassewitz, 2003-12-28
+; Ullrich von Bassewitz, 2003-12-28, 2009-09-26
 ;
 ; Common functions of the mouse driver API.
 ;
 mouse_uninstall:jmp     return0
 mouse_hide:     jmp     return0
 mouse_show:     jmp     return0
-mouse_box:      jmp     return0
+mouse_setbox:   jmp     return0
+mouse_getbox:  jmp     return0
 mouse_move:     jmp     return0
 mouse_buttons:  jmp     return0
 mouse_pos:      jmp     return0
 
+++ /dev/null
-;
-; Ullrich von Bassewitz, 2004-03-23
-;
-; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
-; /* Set the bounding box for the mouse pointer movement. The mouse X and Y
-;  * coordinates will never go outside the given box.
-;  * NOTE: The function does *not* check if the mouse is currently inside the
-;  * given margins. The proper way to use this function therefore is:
-;  *
-;  *   - Hide the mouse
-;  *   - Set the bounding box
-;  *   - Place the mouse at the desired position
-;  *   - Show the mouse again.
-;  *
-;  * NOTE2: When setting the box to something that is larger than the actual
-;  * screen, the positioning of the mouse cursor can fail. If such margins
-;  * are really what you want, you have to use your own cursor routines.
-;  */
-;
-
-        .import         incsp6
-
-        .include        "mouse-kernel.inc"
-
-.proc   _mouse_box
-
-        jsr     mouse_box               ; Call the driver
-        jmp     incsp6                  ; Cleanup the stack
-
-.endproc
-
-
-