2005-04-12 09:12:48 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 17.05.2000
|
|
|
|
;
|
2022-08-28 19:52:53 +00:00
|
|
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
2005-04-12 09:12:48 +00:00
|
|
|
;
|
|
|
|
|
2022-08-28 19:52:53 +00:00
|
|
|
.export ___osmaperrno
|
2005-04-12 09:12:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "errno.inc"
|
2005-04-12 09:12:48 +00:00
|
|
|
|
2022-08-28 19:52:53 +00:00
|
|
|
___osmaperrno:
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #ErrTabSize
|
|
|
|
: cmp ErrTab-2,x ; Search for the error code
|
|
|
|
beq :+ ; Jump if found
|
2005-04-12 09:12:48 +00:00
|
|
|
dex
|
|
|
|
dex
|
2013-05-09 11:56:54 +00:00
|
|
|
bne :- ; Next entry
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
; Code not found, return EUNKNOWN
|
2013-05-09 11:56:54 +00:00
|
|
|
lda #<EUNKNOWN
|
|
|
|
ldx #>EUNKNOWN
|
2005-04-12 09:12:48 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
; Found the code
|
2013-05-09 11:56:54 +00:00
|
|
|
: lda ErrTab-1,x
|
|
|
|
ldx #$00 ; High byte always zero
|
2005-04-12 09:12:48 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
.rodata
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ErrTab: .byte $01, ENOSYS ; Bad system call number
|
|
|
|
.byte $04, EINVAL ; Bad system call parameter count
|
|
|
|
.byte $25, ENOMEM ; Interrupt table full
|
|
|
|
.byte $27, EIO ; I/O error
|
|
|
|
.byte $28, ENODEV ; No device connected
|
|
|
|
.byte $2B, EACCES ; Disk write protected
|
|
|
|
; .byte $2E, EUNKNOWN ; Disk switched
|
|
|
|
.byte $2F, ENODEV ; Device off-line
|
|
|
|
.byte $40, EINVAL ; Invalid pathname
|
|
|
|
.byte $42, EMFILE ; Maximum number of files open
|
|
|
|
.byte $43, EINVAL ; Invalid reference number
|
|
|
|
.byte $44, ENOENT ; Directory not found
|
|
|
|
.byte $45, ENOENT ; Volume not found
|
|
|
|
.byte $46, ENOENT ; File not found
|
|
|
|
.byte $47, EEXIST ; Duplicate filename
|
|
|
|
.byte $48, ENOSPC ; Volume full
|
|
|
|
.byte $49, ENOSPC ; Volume directory full
|
2016-06-13 18:40:01 +00:00
|
|
|
.byte $4A, ENOEXEC ; Incompatible file format
|
2013-05-09 11:56:54 +00:00
|
|
|
.byte $4B, EINVAL ; Unsupported storage_type
|
|
|
|
; .byte $4C, EUNKNOWN ; End of file encountered
|
|
|
|
.byte $4D, ESPIPE ; Position out of range
|
|
|
|
.byte $4E, EACCES ; File access error
|
|
|
|
.byte $50, EINVAL ; File is open
|
|
|
|
; .byte $51, EUNKNOWN ; Directory structure damaged
|
|
|
|
.byte $52, ENODEV ; Not a ProDOS volume
|
|
|
|
.byte $53, ERANGE ; Invalid system call parameter
|
|
|
|
.byte $55, EMFILE ; Volume Control Block table full
|
|
|
|
.byte $56, EINVAL ; Bad buffer address
|
|
|
|
; .byte $57, EUNKNOWN ; Duplicate volume
|
|
|
|
; .byte $5A, EUNKNOWN ; File structure damaged
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
ErrTabSize = (* - ErrTab)
|