]> git.sur5r.net Git - cc65/blob - libsrc/geos-common/system/oserror.s
Normalized coding style.
[cc65] / libsrc / geos-common / system / oserror.s
1 ;
2 ; Ullrich von Bassewitz, 17.05.2000
3 ; GEOS port: Maciej 'YTM/Elysium' Witkowiak
4 ; 2.7.2001
5 ;
6 ; int __fastcall__ _osmaperrno (unsigned char oserror);
7 ; /* Map a system specific error into a system independent code */
8 ;
9
10             .export __osmaperrno
11
12             .include "errno.inc"
13             .include "const.inc"
14
15 .code
16
17 __osmaperrno:
18         ldx #ErrTabSize
19 @L1:    cmp ErrTab-2,x          ; Search for the error code
20         beq @L2                 ; Jump if found
21         dex
22         dex
23         bne @L1                 ; Next entry
24
25 ; Code not found, return EINVAL
26
27         lda #<EINVAL
28         ldx #>EINVAL
29         rts
30
31 ; Found the code
32
33 @L2:    lda ErrTab-1,x
34         ldx #$00                ; High byte always zero
35         rts
36
37 .rodata
38
39 ErrTab:
40         .byte NO_BLOCKS,        EINVAL  ; ???
41         .byte INV_TRACK,        EINVAL  ; invalid track&sector pair
42         .byte INSUFF_SPACE,     ENOSPC  ; out of space
43         .byte FULL_DIRECTORY,   ENOSPC  ; directory is full
44         .byte FILE_NOT_FOUND,   ENOENT  ; file not found
45         .byte BAD_BAM,          EIO     ; bam inconsistent
46         .byte UNOPENED_VLIR,    EINVAL  ; using VLIR file without opening
47         .byte INV_RECORD,       EINVAL  ; using >128 VLIR record number
48         .byte OUT_OF_RECORDS,   ENOSPC  ; cannot insert/add record
49         .byte STRUCT_MISMAT,    EINVAL  ; ???
50         .byte BFR_OVERFLOW,     ENOMEM  ; file longer than buffer or end of file
51         .byte CANCEL_ERR,       EIO     ; ???
52         .byte DEV_NOT_FOUND,    ENODEV  ; device not found
53         .byte INCOMPATIBLE,     EINVAL  ; ???
54
55 ;       .byte 20,               ; Read error
56 ;       .byte 21,               ; Read error
57 ;       .byte 22,               ; Read error
58 ;       .byte 23,               ; Read error
59 ;       .byte 24,               ; Read error
60 ;       .byte 25,               ; Write error
61         .byte 26, EACCES        ; Write protect on
62 ;       .byte 27,               ; Read error
63 ;       .byte 28,               ; Write error
64 ;       .byte 29,               ; Disk ID mismatch
65 ;       .byte 30,               ; Syntax error
66 ;       .byte 31,               ; Syntax error
67 ;       .byte 32,               ; Syntax error
68         .byte 33, EINVAL        ; Syntax error (invalid file name)
69         .byte 34, EINVAL        ; Syntax error (no file given)
70 ;       .byte 39,               ; Syntax error
71 ;       .byte 50,               ; Record not present
72 ;       .byte 51,               ; Overflow in record
73 ;       .byte 52,               ; File too large
74         .byte 60, EINVAL        ; Write file open
75         .byte 61, EINVAL        ; File not open
76         .byte 62, ENOENT        ; File not found
77         .byte 63, EEXIST        ; File exists
78         .byte 64, EINVAL        ; File type mismatch
79 ;       .byte 65,               ; No block
80 ;       .byte 66,               ; Illegal track or sector
81 ;       .byte 67,               ; Illegal system track or sector
82         .byte 70, EBUSY         ; No channel
83 ;       .byte 71,               ; Directory error
84 ;       .byte 72,               ; Disk full
85 ;       .byte 73,               ; DOS version mismatch
86
87 ErrTabSize      = (* - ErrTab)