From 96b5da41f15db5d9d8a550eb98c47a416753ad15 Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 19 Dec 2003 18:45:26 +0000 Subject: [PATCH] Invalid error codes will set errno git-svn-id: svn://svn.cc65.org/cc65/trunk@2784 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/common/strerror.s | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libsrc/common/strerror.s b/libsrc/common/strerror.s index 79bf7127a..98a5725b1 100644 --- a/libsrc/common/strerror.s +++ b/libsrc/common/strerror.s @@ -15,12 +15,19 @@ _strerror: 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 + +; The given error code is invalid + +@L1: lda #EINVAL ; = 0 + sta __errno+1 +; lda #$00 ; A contains zero: "Unknown error" ; Load the pointer to the error message and return +@L2: asl a ; * 2 + tay ldx __sys_errlist+1,y lda __sys_errlist,y rts -- 2.39.5