mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +00:00
adapt to new oserror/errno handling
git-svn-id: svn://svn.cc65.org/cc65/trunk@4732 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
ae98a6db40
commit
e673b53850
@ -1,17 +1,12 @@
|
||||
;
|
||||
; __do_oserror updates __oserror. Do a JMP here right after calling
|
||||
; CIOV. It will return with AX set to -1 ($FFFF). It expects the CIO
|
||||
; __do_oserror updates __oserror and errno. Do a JMP here right after
|
||||
; calling CIOV. It will return with AX set to -1 ($FFFF). It expects the CIO
|
||||
; status in Y.
|
||||
;
|
||||
; __retminus is a routine whitch returns with AX set to -1 ($FFFF).
|
||||
;
|
||||
.include "errno.inc"
|
||||
|
||||
.export __do_oserror, __retminus
|
||||
.export __do_oserror
|
||||
|
||||
__do_oserror:
|
||||
sty __oserror ; save os dependent error code
|
||||
__retminus:
|
||||
lda #$FF
|
||||
tax ; return -1
|
||||
rts
|
||||
tya
|
||||
jmp __mappederrno
|
||||
|
@ -44,9 +44,7 @@ parmok: jsr findfreeiocb
|
||||
beq iocbok ; we found one
|
||||
|
||||
lda #<EMFILE ; "too many open files"
|
||||
seterr: jsr __seterrno
|
||||
lda #$FF
|
||||
tax
|
||||
seterr: jsr __mappederrno ; @@@ probably not correct to set errno here @@@
|
||||
rts ; return -1
|
||||
|
||||
;invmode:ldx #>EINVAL
|
||||
|
@ -2,11 +2,9 @@
|
||||
; set EINVAL error code and returns -1
|
||||
;
|
||||
.include "errno.inc"
|
||||
.import __retminus
|
||||
|
||||
.export __inviocb
|
||||
|
||||
__inviocb:
|
||||
lda #<EINVAL
|
||||
jsr __seterrno
|
||||
jmp __retminus ; return -1
|
||||
jmp __directerrno
|
||||
|
@ -21,10 +21,7 @@
|
||||
; seeking not supported, return -1 and ENOSYS errno value
|
||||
no_supp:jsr incsp6
|
||||
lda #<ENOSYS
|
||||
jsr __seterrno ; set __errno, return zero in A
|
||||
sta __oserror
|
||||
lda #$FF
|
||||
tax
|
||||
jsr __directerrno ; returns with $FFFF in AX
|
||||
sta sreg
|
||||
sta sreg+1
|
||||
rts
|
||||
@ -93,8 +90,14 @@ end: ldx tmp3
|
||||
bpl l01
|
||||
|
||||
; error returned from CIO
|
||||
xxerr: sty __oserror
|
||||
bmi iocberr
|
||||
xxerr: tya
|
||||
pha
|
||||
jsr incsp6
|
||||
pla
|
||||
jsr __mappederrno ; returns with $FFFF in AX
|
||||
sta sreg
|
||||
sta sreg+1
|
||||
rts
|
||||
|
||||
; check for offset 0, SEEK_CUR (get current position)
|
||||
cont: ldy #3
|
||||
|
@ -16,7 +16,7 @@
|
||||
.import clriocb
|
||||
.import fddecusage,newfd
|
||||
.import findfreeiocb
|
||||
.import __do_oserror,incsp4
|
||||
.import incsp4
|
||||
.import ldaxysp,addysp
|
||||
.import __oserror
|
||||
.importzp tmp4,tmp2
|
||||
@ -38,7 +38,7 @@ parmok: jsr findfreeiocb
|
||||
beq iocbok ; we found one
|
||||
|
||||
lda #<EMFILE ; "too many open files"
|
||||
seterr: jsr __seterrno
|
||||
seterr: jsr __directerrno
|
||||
jsr incsp4 ; clean up stack
|
||||
lda #$FF
|
||||
tax
|
||||
@ -143,7 +143,8 @@ finish: php
|
||||
|
||||
bpl ok
|
||||
jsr fddecusage ; decrement usage counter of fd as open failed
|
||||
jmp __do_oserror
|
||||
tya ; put error code into A
|
||||
jmp __mappederrno
|
||||
|
||||
ok: lda tmp2 ; get fd
|
||||
ldx #0
|
||||
|
Loading…
Reference in New Issue
Block a user