2 ; 2003-08-12, Ullrich von Bassewitz
3 ; 2015-09-24, Greg King
5 ; Helper function for several high-level file functions.
13 ; ----------------------------------------------------------------------------
14 ; int __fastcall__ _mappederrno (unsigned char code);
15 ; /* Set _oserror to the given platform-specific error code. If it is a real
16 ; ** error code (not zero), set errno to the corresponding system error code,
17 ; ** and return -1. Otherwise, return zero.
18 ; ** Used by the library.
22 sta __oserror ; Store the error code
23 tax ; Did we have an error?
25 jsr __osmaperrno ; Map OS error into errno code
26 jsr __seterrno ; Save in errno (returns with .A = 0)
27 .if (.cpu .bitand CPU_ISET_65SC02)
30 lda #$FF ; Return -1 if error