This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
29
libsrc/common/strerror.s
Normal file
29
libsrc/common/strerror.s
Normal file
@@ -0,0 +1,29 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 17.05.2000
|
||||
;
|
||||
; char* __fastcall__ strerror (int errcode);
|
||||
; /* Map an error number to an error message */
|
||||
;
|
||||
|
||||
.export _strerror
|
||||
.import __sys_errlist
|
||||
|
||||
.include "errno.inc"
|
||||
|
||||
_strerror:
|
||||
cpx #$00 ; High byte must be zero
|
||||
bne @L1 ; Jump if invalid error
|
||||
cmp #EMAX ; Valid error code (map EUNKNOWN to 0)?
|
||||
bcc @L2 ; Jump if ok
|
||||
@L1: lda #$00 ; "Unknown error"
|
||||
@L2: asl a ; * 2
|
||||
tay
|
||||
|
||||
; Load the pointer to the error message and return
|
||||
|
||||
lda __sys_errlist+1,y
|
||||
tax
|
||||
lda __sys_errlist,y
|
||||
rts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user