1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-05 06:28:57 +00:00

__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
.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 ; "too many open files"
ldx #>EMFILE
seterr: jsr __seterrno
lda #$FF
tax

View File

@ -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
ldx #>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

View File

@ -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 ; "too many open files"
ldx #>EMFILE
seterr: jsr __seterrno
jsr incsp4 ; clean up stack
lda #$FF

View File

@ -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
ldx #>EINVAL
jsr __seterrno
jmp retminus ; return -1