]> git.sur5r.net Git - cc65/blob - libsrc/tgi/tgi_geterrormsg.s
Fixed TGI error codes and messages. Removed the Atari specific ones.
[cc65] / libsrc / tgi / tgi_geterrormsg.s
1 ;
2 ; Ullrich von Bassewitz, 2004-06-15
3 ;
4 ; const char* __fastcall__ tgi_geterrormsg (unsigned char code);
5 ; /* Get an error message describing the error in code. */
6 ;
7
8         .include        "tgi-kernel.inc"
9         .include        "tgi-error.inc"
10
11
12 .proc   _tgi_geterrormsg
13
14         cmp     #TGI_ERR_COUNT
15         bcc     L1
16         lda     #TGI_ERR_COUNT          ; "Unknown error"
17 L1:     tay
18         ldx     #>msgtab
19         lda     #<msgtab
20         clc
21         adc     offs,y
22         bcc     L2
23         inx
24 L2:     rts
25
26 .endproc
27
28
29 ;----------------------------------------------------------------------------
30 ; Error messages. The messages are currently limited to 256 bytes total.
31
32 .rodata
33
34 offs:   .byte   <(msg0-msgtab)
35         .byte   <(msg1-msgtab)
36         .byte   <(msg2-msgtab)
37         .byte   <(msg3-msgtab)
38         .byte   <(msg4-msgtab)
39         .byte   <(msg5-msgtab)
40         .byte   <(msg6-msgtab)
41         .byte   <(msg7-msgtab)
42         .byte   <(msg8-msgtab)
43         .byte   <(msg9-msgtab)
44
45 msgtab:
46 msg0:   .asciiz         "No error"
47 msg1:   .asciiz         "No driver available"
48 msg2:   .asciiz         "Cannot load driver"
49 msg3:   .asciiz         "Invalid driver"
50 msg4:   .asciiz         "Mode not supported by driver"
51 msg5:   .asciiz         "Invalid function argument"
52 msg6:   .asciiz         "Function not supported"
53 msg7:   .asciiz         "Invalid font file"
54 msg8:   .asciiz         "Out of memory"
55 msg9:   .asciiz         "Unknown error"
56