]> git.sur5r.net Git - cc65/commitdiff
New module tgi_geterrormsg.s
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 15 Jun 2004 09:02:05 +0000 (09:02 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 15 Jun 2004 09:02:05 +0000 (09:02 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3122 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/tgi/Makefile
libsrc/tgi/tgi_geterrormsg.s [new file with mode: 0644]

index 9f39c4569a46eb836bef98505eab696d71ffe03e..4ffea9d0131ed93887d989260403966e01df5d1f 100644 (file)
@@ -29,6 +29,7 @@ S_OBJS =              tgi-kernel.o            \
                 tgi_getcolorcount.o     \
                 tgi_getdefpalette.o     \
                 tgi_geterror.o          \
+                tgi_geterrormsg.o       \
                 tgi_getmaxcolor.o       \
                 tgi_getmaxx.o           \
                 tgi_getmaxy.o           \
diff --git a/libsrc/tgi/tgi_geterrormsg.s b/libsrc/tgi/tgi_geterrormsg.s
new file mode 100644 (file)
index 0000000..4a76ddb
--- /dev/null
@@ -0,0 +1,52 @@
+;
+; Ullrich von Bassewitz, 2004-06-15
+;
+; const char* __fastcall__ tgi_geterrormsg (unsigned char code);
+; /* Get an error message describing the error in code. */
+;
+
+        .include        "tgi-kernel.inc"
+        .include        "tgi-error.inc"
+
+
+.proc   _tgi_geterrormsg
+
+        cmp     #TGI_ERR_COUNT
+        bcs     L1
+        lda     #TGI_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)
+        .byte   <(msg7-msgtab)
+
+msgtab:
+msg0:   .asciiz         "No error"
+msg1:   .asciiz         "No driver available"
+msg2:   .asciiz         "Error loading driver"
+msg3:   .asciiz         "Invalid driver"
+msg4:   .asciiz         "Mode not supported by driver"
+msg5:   .asciiz         "Invalid function argument"
+msg6:   .asciiz         "Function not supported"
+msg7:   .asciiz         "Unknown error"
+