1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-18 00:29:02 +00:00
cc65/libsrc/common/oserrcheck.s
uz 0bdc045f65 Removed a comment that was no longer correct.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4716 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-06-06 14:31:24 +00:00

31 lines
866 B
ArmAsm

;
; Ullrich von Bassewitz, 2003-08-12
;
; Helper function for several high level file functions.
;
; The function will store the value in A into _oserror. If the value is not
; zero, it is translated into a standard error number which is then stored
; into errno, and -1 is returned in a/x. If the value in A was zero, errno
; is not changed, and zero is returned in a/x.
;
.export oserrcheck
.include "errno.inc"
.proc oserrcheck
sta __oserror ; Store the error code
tax ; Did we have an error?
beq ok ; Branch if no
jsr __osmaperrno ; Map os error into errno code
jsr __seterrno ; Save in errno
lda #$FF ; Return -1
tax
ok: rts
.endproc