__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
This commit is contained in:
cuz
2004-05-13 21:56:31 +00:00
parent d44cdad9ce
commit bfdfd83fde
4 changed files with 9 additions and 19 deletions

View File

@@ -11,7 +11,7 @@
.constructor initscrmem,28 .constructor initscrmem,28
.import findfreeiocb .import findfreeiocb
.import __seterrno,__do_oserror,__oserror .import __do_oserror,__oserror
.import fddecusage .import fddecusage
.import clriocb .import clriocb
.import fdtoiocb .import fdtoiocb
@@ -46,7 +46,6 @@ parmok: jsr findfreeiocb
beq iocbok ; we found one beq iocbok ; we found one
lda #<EMFILE ; "too many open files" lda #<EMFILE ; "too many open files"
ldx #>EMFILE
seterr: jsr __seterrno seterr: jsr __seterrno
lda #$FF lda #$FF
tax tax

View File

@@ -10,7 +10,7 @@
.export _lseek .export _lseek
.import incsp6,__oserror .import incsp6,__oserror
.import __inviocb,ldax0sp,ldaxysp,fdtoiocb .import __inviocb,ldax0sp,ldaxysp,fdtoiocb
.import __seterrno,__dos_type .import __dos_type
.import fd_table .import fd_table
.importzp sreg,ptr1,ptr2,ptr3,ptr4 .importzp sreg,ptr1,ptr2,ptr3,ptr4
.importzp tmp1,tmp2,tmp3 .importzp tmp1,tmp2,tmp3
@@ -21,12 +21,10 @@
; seeking not supported, return -1 and ENOSYS errno value ; seeking not supported, return -1 and ENOSYS errno value
no_supp:jsr incsp6 no_supp:jsr incsp6
lda #<ENOSYS lda #<ENOSYS
ldx #>ENOSYS jsr __seterrno ; set __errno, return zero in A
jsr __seterrno sta __oserror
ldx #0 lda #$FF
stx __oserror tax
dex
txa
sta sreg sta sreg
sta sreg+1 sta sreg+1
rts rts

View File

@@ -16,7 +16,7 @@
.import clriocb .import clriocb
.import fddecusage,newfd .import fddecusage,newfd
.import findfreeiocb .import findfreeiocb
.import __do_oserror,__seterrno,incsp4 .import __do_oserror,incsp4
.import ldaxysp,addysp .import ldaxysp,addysp
.import __oserror .import __oserror
.importzp tmp4,tmp2 .importzp tmp4,tmp2
@@ -39,7 +39,6 @@ parmok: jsr findfreeiocb
beq iocbok ; we found one beq iocbok ; we found one
lda #<EMFILE ; "too many open files" lda #<EMFILE ; "too many open files"
ldx #>EMFILE
seterr: jsr __seterrno seterr: jsr __seterrno
jsr incsp4 ; clean up stack jsr incsp4 ; clean up stack
lda #$FF lda #$FF

View File

@@ -1,4 +1,4 @@
; ;
; common iocb setup routine for read, write ; common iocb setup routine for read, write
; expects __fastcall__ parameters (int fd, void *buf, int count) ; 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 ; this routine updates errno. do a JMP here right after calling
; CIOV. we expect status in Y. ; CIOV. we expect status in Y.
; ;
.export __do_oserror,__seterrno,__inviocb .export __do_oserror,__inviocb
__do_oserror: __do_oserror:
sty __oserror ; save os dependent error code sty __oserror ; save os dependent error code
retminus: retminus:
@@ -55,17 +55,11 @@ retminus:
tax ; return -1 tax ; return -1
rts rts
__seterrno:
sta __errno
stx __errno+1
rts
; ;
; sets EINVAL error code and returns -1 ; sets EINVAL error code and returns -1
; ;
__inviocb: __inviocb:
lda #<EINVAL lda #<EINVAL
ldx #>EINVAL
jsr __seterrno jsr __seterrno
jmp retminus ; return -1 jmp retminus ; return -1