]> git.sur5r.net Git - cc65/commitdiff
New function mouse_geterrormsg()
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 7 Nov 2004 12:41:18 +0000 (12:41 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 7 Nov 2004 12:41:18 +0000 (12:41 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3289 b7a2c559-68d2-44c3-8de9-860c34a00d81

include/mouse.h
libsrc/mouse/Makefile
libsrc/mouse/mouse_geterrormsg.s [new file with mode: 0644]

index af91ceccaf1b7314b3426b2a0e5797e79b9bb764..1a8745572677941d30a977a05ba1b5631f22d089 100644 (file)
@@ -118,6 +118,9 @@ unsigned char __fastcall__ mouse_install (const struct mouse_callbacks* c,
 unsigned char __fastcall__ mouse_uninstall (void);
 /* Uninstall the currently loaded driver. Returns an error code. */
 
+const char* __fastcall__ mouse_geterrormsg (unsigned char code);
+/* Get an error message describing the error in code. */
+
 void __fastcall__ mouse_hide (void);
 /* Hide the mouse. The function manages a counter and may be called more than
  * once. For each call to mouse_hide there must be a call to mouse_show to make
index 4c30e0805fb91ce435d46b0378ca14cd87ccd100..dee8f70dd9920a4081a107c10597fcfcf1fda80d 100644 (file)
@@ -31,14 +31,15 @@ CFLAGS      = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
 
 C_OBJS =        mouse_load.o
 
-S_OBJS =        mouse-kernel.o  \
-                mouse_box.o     \
-                mouse_hide.o    \
-                mouse_info.o    \
-                mouse_ioctl.o   \
-                mouse_move.o    \
-                mouse_pos.o     \
-                mouse_show.o    \
+S_OBJS =        mouse-kernel.o          \
+                mouse_box.o             \
+                mouse_geterrormsg.o     \
+                mouse_hide.o            \
+                mouse_info.o            \
+                mouse_ioctl.o           \
+                mouse_move.o            \
+                mouse_pos.o             \
+                mouse_show.o            \
                 mouse_unload.o
 
 #--------------------------------------------------------------------------
diff --git a/libsrc/mouse/mouse_geterrormsg.s b/libsrc/mouse/mouse_geterrormsg.s
new file mode 100644 (file)
index 0000000..f4189af
--- /dev/null
@@ -0,0 +1,49 @@
+;
+; Ullrich von Bassewitz, 2004-11-07
+;
+; const char* __fastcall__ mouse_geterrormsg (unsigned char code);
+; /* Get an error message describing the error in code. */
+;
+
+        .include        "mouse-kernel.inc"
+
+
+.proc   _mouse_geterrormsg
+
+        cmp     #MOUSE_ERR_COUNT
+        bcc     L1
+        lda     #MOUSE_ERR_COUNT        ; "Unknown error"
+L1:     tay
+        ldx     #>msgtab
+        lda     #<msgtab
+        clc
+        adc     offs,y
+        bcc     L2
+        inx
+L2:     rts
+
+.endproc
+
+
+;----------------------------------------------------------------------------
+; Error messages. The messages are currently limited to 256 bytes total.
+
+.rodata
+
+offs:   .byte   <(msg0-msgtab)
+        .byte   <(msg1-msgtab)
+        .byte   <(msg2-msgtab)
+        .byte   <(msg3-msgtab)
+        .byte   <(msg4-msgtab)
+        .byte   <(msg5-msgtab)
+        .byte   <(msg6-msgtab)
+
+msgtab:
+msg0:   .asciiz         "No error"
+msg1:   .asciiz         "No driver available"
+msg2:   .asciiz         "Cannot load driver"
+msg3:   .asciiz         "Invalid driver"
+msg4:   .asciiz         "Mouse hardware not found"
+msg5:   .asciiz         "Invalid ioctl code"
+msg6:   .asciiz         "Unknown error"
+