From bfdfd83fdeb22a87c50cc3ef24b222e6ce2b0f50 Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 13 May 2004 21:56:31 +0000 Subject: [PATCH] __seterrno is now a common function available on all platforms with slightly different calling conventions. git-svn-id: svn://svn.cc65.org/cc65/trunk@3038 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/atari/graphics.s | 3 +-- libsrc/atari/lseek.s | 12 +++++------- libsrc/atari/open.s | 3 +-- libsrc/atari/rwcommon.s | 10 ++-------- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/libsrc/atari/graphics.s b/libsrc/atari/graphics.s index e49f01842..181aeed64 100644 --- a/libsrc/atari/graphics.s +++ b/libsrc/atari/graphics.s @@ -11,7 +11,7 @@ .constructor initscrmem,28 .import findfreeiocb - .import __seterrno,__do_oserror,__oserror + .import __do_oserror,__oserror .import fddecusage .import clriocb .import fdtoiocb @@ -46,7 +46,6 @@ parmok: jsr findfreeiocb beq iocbok ; we found one lda #EMFILE seterr: jsr __seterrno lda #$FF tax diff --git a/libsrc/atari/lseek.s b/libsrc/atari/lseek.s index 69e83da31..ac033004c 100644 --- a/libsrc/atari/lseek.s +++ b/libsrc/atari/lseek.s @@ -10,7 +10,7 @@ .export _lseek .import incsp6,__oserror .import __inviocb,ldax0sp,ldaxysp,fdtoiocb - .import __seterrno,__dos_type + .import __dos_type .import fd_table .importzp sreg,ptr1,ptr2,ptr3,ptr4 .importzp tmp1,tmp2,tmp3 @@ -21,12 +21,10 @@ ; seeking not supported, return -1 and ENOSYS errno value no_supp:jsr incsp6 lda #ENOSYS - jsr __seterrno - ldx #0 - stx __oserror - dex - txa + jsr __seterrno ; set __errno, return zero in A + sta __oserror + lda #$FF + tax sta sreg sta sreg+1 rts diff --git a/libsrc/atari/open.s b/libsrc/atari/open.s index 7d97a7dff..ea3ae543b 100644 --- a/libsrc/atari/open.s +++ b/libsrc/atari/open.s @@ -16,7 +16,7 @@ .import clriocb .import fddecusage,newfd .import findfreeiocb - .import __do_oserror,__seterrno,incsp4 + .import __do_oserror,incsp4 .import ldaxysp,addysp .import __oserror .importzp tmp4,tmp2 @@ -39,7 +39,6 @@ parmok: jsr findfreeiocb beq iocbok ; we found one lda #EMFILE seterr: jsr __seterrno jsr incsp4 ; clean up stack lda #$FF diff --git a/libsrc/atari/rwcommon.s b/libsrc/atari/rwcommon.s index 6dd7f14fc..6775d9950 100644 --- a/libsrc/atari/rwcommon.s +++ b/libsrc/atari/rwcommon.s @@ -1,4 +1,4 @@ -; +; ; common iocb setup routine for read, write ; expects __fastcall__ parameters (int fd, void *buf, int count) ; @@ -47,7 +47,7 @@ iocberr:jsr incsp4 ; pop args ; this routine updates errno. do a JMP here right after calling ; CIOV. we expect status in Y. ; - .export __do_oserror,__seterrno,__inviocb + .export __do_oserror,__inviocb __do_oserror: sty __oserror ; save os dependent error code retminus: @@ -55,17 +55,11 @@ retminus: tax ; return -1 rts -__seterrno: - sta __errno - stx __errno+1 - rts - ; ; sets EINVAL error code and returns -1 ; __inviocb: lda #EINVAL jsr __seterrno jmp retminus ; return -1 -- 2.39.5