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