From 155c5629a96393b54757d1f86ab0e1c7f26346de Mon Sep 17 00:00:00 2001
From: "ol.sc"
Date: Tue, 15 Jun 2010 20:38:05 +0000
Subject: [PATCH] Make use of the new common __directerrno and __mappederrno
function.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4720 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
libsrc/apple2/Makefile | 1 -
libsrc/apple2/close.s | 10 +++++-----
libsrc/apple2/fileerr.s | 18 ------------------
libsrc/apple2/open.s | 9 ++++-----
libsrc/apple2/read.s | 5 ++---
libsrc/apple2/rootdir.s | 6 +++---
libsrc/apple2/rwcommon.s | 6 +++---
libsrc/apple2/write.s | 9 ++++-----
libsrc/apple2enh/Makefile | 1 -
9 files changed, 21 insertions(+), 44 deletions(-)
delete mode 100644 libsrc/apple2/fileerr.s
diff --git a/libsrc/apple2/Makefile b/libsrc/apple2/Makefile
index 9f5c08b4f..36b85b8e1 100644
--- a/libsrc/apple2/Makefile
+++ b/libsrc/apple2/Makefile
@@ -72,7 +72,6 @@ S_OBJS= _scrsize.o \
dosdetect.o \
drives.o \
filedes.o \
- fileerr.o \
filename.o \
get_ostype.o \
gotoxy.o \
diff --git a/libsrc/apple2/close.s b/libsrc/apple2/close.s
index 737e29d1c..45c345211 100644
--- a/libsrc/apple2/close.s
+++ b/libsrc/apple2/close.s
@@ -7,9 +7,9 @@
.export _close
.import closedirect, freebuffer
- .import errnoexit, oserrexit
.import return0
+ .include "errno.inc"
.include "filedes.inc"
_close:
@@ -34,8 +34,8 @@ zerofd: lda #$00
; Return success
jmp return0
- ; Return errno
-errno: jmp errnoexit
+ ; Set __errno
+errno: jmp __directerrno
- ; Return oserror
-oserr: jmp oserrexit
+ ; Set __oserror
+oserr: jmp __mappederrno
diff --git a/libsrc/apple2/fileerr.s b/libsrc/apple2/fileerr.s
deleted file mode 100644
index 91dbcbdd6..000000000
--- a/libsrc/apple2/fileerr.s
+++ /dev/null
@@ -1,18 +0,0 @@
-;
-; Oliver Schmidt, 15.01.2004
-;
-; Error handling for ProDOS 8 file I/O
-;
-
- .export errnoexit, oserrexit
-
- .include "errno.inc"
-
-errnoexit:
- jsr __seterrno ; Returns with A = 0
-
-oserrexit:
- sta __oserror
- lda #$FF
- tax
- rts
diff --git a/libsrc/apple2/open.s b/libsrc/apple2/open.s
index aef0f56e8..9d3c158b6 100644
--- a/libsrc/apple2/open.s
+++ b/libsrc/apple2/open.s
@@ -11,7 +11,6 @@
.destructor closeallfiles, 17
.import pushname, popname
- .import errnoexit, oserrexit
.import iobuf_alloc, iobuf_free
.import addysp, incsp4, incaxy, pushax, popax
@@ -54,8 +53,8 @@ _open:
; Cleanup stack
errno: jsr incsp4 ; Preserves A
- ; Return errno
- jmp errnoexit
+ ; Set __errno
+ jmp __directerrno
; Save fdtab slot
found: tya
@@ -138,8 +137,8 @@ oserr1: ldy tmp2 ; Restore fdtab slot
jsr freebuffer
pla ; Restore oserror code
- ; Return oserror
- jmp oserrexit
+ ; Set __oserror
+ jmp __mappederrno
open: ldy tmp2 ; Restore fdtab slot
diff --git a/libsrc/apple2/read.s b/libsrc/apple2/read.s
index ed84e70e1..d85000730 100644
--- a/libsrc/apple2/read.s
+++ b/libsrc/apple2/read.s
@@ -7,7 +7,6 @@
.constructor initprompt
.export _read
.import rwprolog, rwcommon
- .import errnoexit
.import RDKEY, COUT
.include "zeropage.inc"
@@ -101,5 +100,5 @@ check: lda ptr3
; Load errno code
einval: lda #EINVAL
- ; Return errno
-errno: jmp errnoexit
+ ; Set __errno
+errno: jmp __directerrno
diff --git a/libsrc/apple2/rootdir.s b/libsrc/apple2/rootdir.s
index f3cf1f1ae..e2134e5d4 100644
--- a/libsrc/apple2/rootdir.s
+++ b/libsrc/apple2/rootdir.s
@@ -5,7 +5,7 @@
;
.export _rootdir
- .import popax, oserrexit
+ .import popax
.include "zeropage.inc"
.include "errno.inc"
@@ -50,5 +50,5 @@ _rootdir:
tax
rts
- ; Return oserror
-oserr: jmp oserrexit
+ ; Set __oserror
+oserr: jmp __mappederrno
diff --git a/libsrc/apple2/rwcommon.s b/libsrc/apple2/rwcommon.s
index 06d791164..b9f86dff3 100644
--- a/libsrc/apple2/rwcommon.s
+++ b/libsrc/apple2/rwcommon.s
@@ -3,10 +3,10 @@
;
.export rwprolog, rwcommon, rwepilog
- .import oserrexit
.import popax
.include "zeropage.inc"
+ .include "errno.inc"
.include "fcntl.inc"
.include "mli.inc"
.include "filedes.inc"
@@ -55,5 +55,5 @@ rwepilog:
ldx mliparam + MLI::RW::TRANS_COUNT+1
rts
- ; Return oserror
-oserr: jmp oserrexit
+ ; Set __oserror
+oserr: jmp __mappederrno
diff --git a/libsrc/apple2/write.s b/libsrc/apple2/write.s
index 9b6d2561c..ec9efa3b7 100644
--- a/libsrc/apple2/write.s
+++ b/libsrc/apple2/write.s
@@ -6,7 +6,6 @@
.export _write
.import rwprolog, rwcommon, rwepilog
- .import errnoexit, oserrexit
.import COUT
.include "zeropage.inc"
@@ -106,9 +105,9 @@ done: jmp rwepilog
; Load errno code
einval: lda #EINVAL
- ; Return errno
-errno: jmp errnoexit
+ ; Set __errno
+errno: jmp __directerrno
- ; Return oserror
-oserr: jmp oserrexit
+ ; Set __oserror
+oserr: jmp __mappederrno
diff --git a/libsrc/apple2enh/Makefile b/libsrc/apple2enh/Makefile
index 4ed14d989..eaca78064 100644
--- a/libsrc/apple2enh/Makefile
+++ b/libsrc/apple2enh/Makefile
@@ -75,7 +75,6 @@ S_OBJS= _scrsize.o \
dosdetect.o \
drives.o \
filedes.o \
- fileerr.o \
filename.o \
get_ostype.o \
gotoxy.o \