]> git.sur5r.net Git - cc65/blob - libsrc/apple2/oserror.s
Fixed gcc compiler warning (#867)
[cc65] / libsrc / apple2 / oserror.s
1 ;
2 ; Ullrich von Bassewitz, 17.05.2000
3 ;
4 ; int __fastcall__ _osmaperrno (unsigned char oserror);
5 ;
6
7         .export         __osmaperrno
8
9         .include        "errno.inc"
10
11 __osmaperrno:
12         ldx     #ErrTabSize
13 :       cmp     ErrTab-2,x      ; Search for the error code
14         beq     :+              ; Jump if found
15         dex
16         dex
17         bne     :-              ; Next entry
18
19         ; Code not found, return EUNKNOWN
20         lda     #<EUNKNOWN
21         ldx     #>EUNKNOWN
22         rts
23
24         ; Found the code
25 :       lda     ErrTab-1,x
26         ldx     #$00            ; High byte always zero
27         rts
28
29         .rodata
30
31 ErrTab: .byte   $01, ENOSYS     ; Bad system call number
32         .byte   $04, EINVAL     ; Bad system call parameter count
33         .byte   $25, ENOMEM     ; Interrupt table full
34         .byte   $27, EIO        ; I/O error
35         .byte   $28, ENODEV     ; No device connected
36         .byte   $2B, EACCES     ; Disk write protected
37 ;       .byte   $2E, EUNKNOWN   ; Disk switched
38         .byte   $2F, ENODEV     ; Device off-line
39         .byte   $40, EINVAL     ; Invalid pathname
40         .byte   $42, EMFILE     ; Maximum number of files open
41         .byte   $43, EINVAL     ; Invalid reference number
42         .byte   $44, ENOENT     ; Directory not found
43         .byte   $45, ENOENT     ; Volume not found
44         .byte   $46, ENOENT     ; File not found
45         .byte   $47, EEXIST     ; Duplicate filename
46         .byte   $48, ENOSPC     ; Volume full
47         .byte   $49, ENOSPC     ; Volume directory full
48         .byte   $4A, ENOEXEC    ; Incompatible file format
49         .byte   $4B, EINVAL     ; Unsupported storage_type
50 ;       .byte   $4C, EUNKNOWN   ; End of file encountered
51         .byte   $4D, ESPIPE     ; Position out of range
52         .byte   $4E, EACCES     ; File access error
53         .byte   $50, EINVAL     ; File is open
54 ;       .byte   $51, EUNKNOWN   ; Directory structure damaged
55         .byte   $52, ENODEV     ; Not a ProDOS volume
56         .byte   $53, ERANGE     ; Invalid system call parameter
57         .byte   $55, EMFILE     ; Volume Control Block table full
58         .byte   $56, EINVAL     ; Bad buffer address
59 ;       .byte   $57, EUNKNOWN   ; Duplicate volume
60 ;       .byte   $5A, EUNKNOWN   ; File structure damaged
61
62 ErrTabSize = (* - ErrTab)