1; 2; 2000-05-17, Ullrich von Bassewitz 3; 2014-05-28, Greg King 4; 5; int __fastcall__ _osmaperrno (unsigned char oserror); 6; /* Map a system-specific error into a system-independent code. */ 7; 8 9 .include "errno.inc" 10 11.code 12 13__osmaperrno: 14 ldx #ErrTabSize 15@L1: cmp ErrTab-2,x ; Search for the error code 16 beq @L2 ; Jump if found 17 dex 18 dex 19 bne @L1 ; Next entry 20 21; Code not found, return EUNKNOWN 22 23 lda #<EUNKNOWN 24 ldx #>EUNKNOWN 25 rts 26 27; Found the code 28 29@L2: lda ErrTab-1,x 30 ldx #$00 ; High byte always zero 31 rts 32 33.rodata 34 35ErrTab: 36 .byte 1, EMFILE ; Too many open files 37 .byte 2, EINVAL ; File is open 38 .byte 3, EINVAL ; File not open 39 .byte 4, ENOENT ; File not found 40 .byte 5, ENODEV ; Device not present 41 .byte 6, EINVAL ; File not input 42 .byte 7, EINVAL ; File not output 43 .byte 8, EINVAL ; Filename missing 44 .byte 9, ENODEV ; Illegal device 45 .byte 20, EBUSY ; No sector header 46 .byte 21, EBUSY ; No sync mark 47 .byte 22, EIO ; No sector data 48 .byte 23, EIO ; Checksum error 49 .byte 24, EIO ; Decode error 50 .byte 25, EIO ; Verify error 51 .byte 26, EACCES ; Write protected 52 .byte 27, EIO ; Checksum error 53 .byte 28, EIO ; Write overrun 54 .byte 29, EBUSY ; Disk ID mismatch 55 .byte 30, EINVAL ; Command not recognized 56 .byte 31, ENOSYS ; Command not implemented 57 .byte 32, EINVAL ; Command too long 58 .byte 33, EINVAL ; Invalid write filename 59 .byte 34, EINVAL ; No file given 60 .byte 39, ENOENT ; System file not found 61 .byte 49, EACCES ; Invalid format 62 .byte 50, ESPIPE ; Record not present 63 .byte 51, ENOSPC ; Overflow in record 64 .byte 52, ENOSPC ; File too large 65 .byte 60, EBUSY ; Write file open 66 .byte 61, EINVAL ; File not open 67 .byte 62, ENOENT ; File not found 68 .byte 63, EEXIST ; File exists 69 .byte 64, EINVAL ; File type mismatch 70 .byte 65, ESPIPE ; No block 71 .byte 66, EINVAL ; Illegal track or sector 72 .byte 67, EIO ; Illegal system track or sector 73 .byte 70, EBUSY ; No channel 74 .byte 71, EIO ; BAM error 75 .byte 72, ENOSPC ; Disk full 76 .byte 73, EACCES ; DOS version mismatch 77 .byte 74, ENODEV ; Drive not ready 78 .byte 75, EIO ; Format error 79 .byte 77, EINVAL ; Illegal partition 80 .byte 78, EIO ; Bad system area 81 82ErrTabSize = (* - ErrTab) 83