.constructor initscrmem,28
.import findfreeiocb
- .import __seterrno,__do_oserror,__oserror
+ .import __do_oserror,__oserror
.import fddecusage
.import clriocb
.import fdtoiocb
beq iocbok ; we found one
lda #<EMFILE ; "too many open files"
- ldx #>EMFILE
seterr: jsr __seterrno
lda #$FF
tax
.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
; 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
.import clriocb
.import fddecusage,newfd
.import findfreeiocb
- .import __do_oserror,__seterrno,incsp4
+ .import __do_oserror,incsp4
.import ldaxysp,addysp
.import __oserror
.importzp tmp4,tmp2
beq iocbok ; we found one
lda #<EMFILE ; "too many open files"
- ldx #>EMFILE
seterr: jsr __seterrno
jsr incsp4 ; clean up stack
lda #$FF
-;
+;
; common iocb setup routine for read, write
; expects __fastcall__ parameters (int fd, void *buf, int count)
;
; 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:
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