]> git.sur5r.net Git - cc65/blob - libsrc/atari/oserror.s
Fixed _textcolor definition.
[cc65] / libsrc / atari / oserror.s
1 ;
2 ; Christian Groessler, May-2000
3 ;
4 ; os specific error code mapping
5 ; int __fastcall__ _osmaperrno (unsigned char oserror);
6 ;
7
8         .include "errno.inc"
9         .export __osmaperrno
10
11 .proc   __osmaperrno
12
13         cmp     #$80            ; error or success
14         bcs     errcode         ; error, jump
15
16         lda     #0              ; no error, return 0
17         tax
18         rts
19
20 errcode:and     #$7f            ; create index from error number
21         tax
22         cpx     #MAX_OSERR_VAL  ; valid number?
23         bcs     inverr          ; no
24
25         lda     maptable,x
26         ldx     #0
27         rts
28
29 inverr: lda     #<EUNKNOWN
30         ldx     #>EUNKNOWN
31         rts
32
33 .endproc
34
35 .rodata
36
37 maptable:
38         .byte   EINTR   ;BRKABT = 128           ;($80) BREAK key abort
39         .byte   EBUSY   ;PRVOPN = 129           ;($81) IOCB already open error
40         .byte   ENODEV  ;NONDEV = 130           ;($82) nonexistent device error
41         .byte   EACCES  ;WRONLY = 131           ;($83) IOCB opened for write only error
42         .byte   ENOSYS  ;NVALID = 132           ;($84) invalid command error
43         .byte   EINVAL  ;NOTOPN = 133           ;($85) device/file not open error
44         .byte   EINVAL  ;BADIOC = 134           ;($86) invalid IOCB index error
45         .byte   EACCES  ;RDONLY = 135           ;($87) IOCB opened for read only error
46         .byte   EINVAL  ;EOFERR = 136           ;($88) end of file error (should never come,
47                                                 ;      specially handled by read.s)
48         .byte   EIO     ;TRNRCD = 137           ;($89) truncated record error
49         .byte   EIO     ;TIMOUT = 138           ;($8A) peripheral device timeout error
50         .byte   EIO     ;DNACK  = 139           ;($8B) device does not acknowledge command
51         .byte   EIO     ;FRMERR = 140           ;($8C) serial bus framing error
52         .byte   EINVAL  ;CRSROR = 141           ;($8D) cursor out of range error
53         .byte   EIO     ;OVRRUN = 142           ;($8E) serial bus data overrun error
54         .byte   EIO     ;CHKERR = 143           ;($8F) serial bus checksum error
55         .byte   EIO     ;DERROR = 144           ;($90) general device failure
56         .byte   EINVAL  ;BADMOD = 145           ;($91) bad screen mode number error
57         .byte   ENOSYS  ;FNCNOT = 146           ;($92) function not implemented in handler
58         .byte   ENOMEM  ;SCRMEM = 147           ;($93) insufficient memory for screen mode
59 ; codes below taken from "Mein Atari Computer" (german version of "Your Atari Computer")
60 ; also SpartaDOS codes from http://www.atari-central.com/programming/cio_errors.txt
61 ; MyDOS and XDOS codes from Stefan Haubenthal
62         .byte   EUNKNOWN        ; 148 - [SpartaDOS] unrecognized disk format
63         .byte   EUNKNOWN        ; 149 - [SpartaDOS] disk created by incompatible version of SD
64         .byte   EBUSY           ; 150 - serial port already open
65                                 ;       [SpartaDOS] directory not found
66         .byte   EACCES          ; 151 - concurrent mode I/O not enabled (serial)
67                                 ;       [SpartaDOS] file exists
68         .byte   EINVAL          ; 152 - invalid buffer address for concurrent mode
69                                 ;       [SpartaDOS] not binary format
70         .byte   EAGAIN          ; 153 - concurrent mode enabled (and another access tried)
71         .byte   EACCES          ; 154 - concurrent mode I/O not active (serial)
72                                 ;       [SpartaDOS X] loader symbol not defined
73         .byte   EUNKNOWN        ; 155 - haven't found documentation
74         .byte   EUNKNOWN        ; 156 - [SpartaDOS X] bad parameter
75         .byte   EUNKNOWN        ; 157 - haven't found documentation
76         .byte   EUNKNOWN        ; 158 - [SpartaDOS X] out of memory
77         .byte   EUNKNOWN        ; 159 - haven't found documentation
78         .byte   ENOENT          ; 160 - drive number error (DOS)
79         .byte   EMFILE          ; 161 - too many open files
80         .byte   ENOSPC          ; 162 - disk full
81         .byte   EIO             ; 163 - unrecoverable system data I/O error
82         .byte   ESPIPE          ; 164 - file number mismatch (inv. seek or disk data strucs damaged)
83         .byte   ENOENT          ; 165 - invalid file name (e.g. lowercase)
84         .byte   ESPIPE          ; 166 - point data length error
85         .byte   EACCES          ; 167 - file locked (read-only)
86         .byte   ENOSYS          ; 168 - command invalid for disk
87         .byte   ENOSPC          ; 169 - directory full
88         .byte   ENOENT          ; 170 - file not found
89         .byte   ESPIPE          ; 171 - point command invalid
90         .byte   EEXIST          ; 172 - [MYDOS] already exists in parent directory
91         .byte   EUNKNOWN        ; 173 - bad disk - format couldn't complete
92         .byte   EUNKNOWN        ; 174 - [MYDOS] directory not in parent directory
93         .byte   EUNKNOWN        ; 175 - [MYDOS] directory not empty
94         .byte   EUNKNOWN        ; 176 - [DOS 3] incompatible file system
95         .byte   EUNKNOWN        ; 177 - haven't found documentation
96         .byte   EUNKNOWN        ; 178 - haven't found documentation
97         .byte   EUNKNOWN        ; 179 - haven't found documentation
98         .byte   ENOEXEC         ; 180 - not a binary file
99         .byte   EUNKNOWN        ; 181 - [MYDOS] invalid address range
100         .byte   EUNKNOWN        ; 182 - [XDOS] invalid parameter
101
102         .byte   EINVAL          ; 183 - dummy (used by cc65 rtl, see sysremove.s)
103
104 MAX_OSERR_VAL = (* - maptable)