From 148a6569e55822a562380c56df0340bccc653749 Mon Sep 17 00:00:00 2001
From: "ol.sc"
Date: Tue, 15 Jun 2010 21:44:18 +0000
Subject: [PATCH] Clear __oserror on success.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4721 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
libsrc/apple2/close.s | 9 ++++-----
libsrc/apple2/open.s | 1 +
libsrc/apple2/read.s | 5 ++++-
libsrc/apple2/rootdir.s | 4 +---
libsrc/apple2/rwcommon.s | 1 +
libsrc/apple2/write.s | 3 ++-
6 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/libsrc/apple2/close.s b/libsrc/apple2/close.s
index 45c345211..18c4a14dd 100644
--- a/libsrc/apple2/close.s
+++ b/libsrc/apple2/close.s
@@ -7,7 +7,6 @@
.export _close
.import closedirect, freebuffer
- .import return0
.include "errno.inc"
.include "filedes.inc"
@@ -32,10 +31,10 @@ zerofd: lda #$00
jsr freebuffer
; Return success
- jmp return0
-
- ; Set __errno
-errno: jmp __directerrno
+ lda #$00
; Set __oserror
oserr: jmp __mappederrno
+
+ ; Set __errno
+errno: jmp __directerrno
diff --git a/libsrc/apple2/open.s b/libsrc/apple2/open.s
index 9d3c158b6..de0bb63fa 100644
--- a/libsrc/apple2/open.s
+++ b/libsrc/apple2/open.s
@@ -199,6 +199,7 @@ done: lda tmp1 ; Restore fd
; Return success
ldx #$00
+ stx __oserror
rts
freebuffer:
diff --git a/libsrc/apple2/read.s b/libsrc/apple2/read.s
index d85000730..dccde611f 100644
--- a/libsrc/apple2/read.s
+++ b/libsrc/apple2/read.s
@@ -47,8 +47,11 @@ _read:
ldy #READ_CALL
jmp rwcommon
- ; Set counter to zero
+ ; Device succeeds always
device: lda #$00
+ sta __oserror
+
+ ; Set counter to zero
sta ptr3
sta ptr3+1
diff --git a/libsrc/apple2/rootdir.s b/libsrc/apple2/rootdir.s
index e2134e5d4..77d986aae 100644
--- a/libsrc/apple2/rootdir.s
+++ b/libsrc/apple2/rootdir.s
@@ -46,9 +46,7 @@ _rootdir:
lda #$00
sta (ptr1),y
- ; Return success
- tax
- rts
+ ; Return success ; A = 0
; Set __oserror
oserr: jmp __mappederrno
diff --git a/libsrc/apple2/rwcommon.s b/libsrc/apple2/rwcommon.s
index b9f86dff3..c1e78c503 100644
--- a/libsrc/apple2/rwcommon.s
+++ b/libsrc/apple2/rwcommon.s
@@ -51,6 +51,7 @@ rwcommon:
rwepilog:
; Return success
+ sta __oserror ; A = 0
lda mliparam + MLI::RW::TRANS_COUNT
ldx mliparam + MLI::RW::TRANS_COUNT+1
rts
diff --git a/libsrc/apple2/write.s b/libsrc/apple2/write.s
index ec9efa3b7..d8f7fcd84 100644
--- a/libsrc/apple2/write.s
+++ b/libsrc/apple2/write.s
@@ -100,7 +100,8 @@ output: jsr COUT ; Preserves X and Y
bpl next
; Return success
-done: jmp rwepilog
+done: lda #$00
+ jmp rwepilog
; Load errno code
einval: lda #EINVAL
--
2.39.5