mirror of
https://github.com/cc65/cc65.git
synced 2024-12-25 02:29:52 +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
|
; __do_oserror updates __oserror and errno. Do a JMP here right after
|
||||||
; CIOV. It will return with AX set to -1 ($FFFF). It expects the CIO
|
; calling CIOV. It will return with AX set to -1 ($FFFF). It expects the CIO
|
||||||
; status in Y.
|
; status in Y.
|
||||||
;
|
|
||||||
; __retminus is a routine whitch returns with AX set to -1 ($FFFF).
|
|
||||||
;
|
;
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
|
|
||||||
.export __do_oserror, __retminus
|
.export __do_oserror
|
||||||
|
|
||||||
__do_oserror:
|
__do_oserror:
|
||||||
sty __oserror ; save os dependent error code
|
tya
|
||||||
__retminus:
|
jmp __mappederrno
|
||||||
lda #$FF
|
|
||||||
tax ; return -1
|
|
||||||
rts
|
|
||||||
|
@ -44,9 +44,7 @@ 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"
|
||||||
seterr: jsr __seterrno
|
seterr: jsr __mappederrno ; @@@ probably not correct to set errno here @@@
|
||||||
lda #$FF
|
|
||||||
tax
|
|
||||||
rts ; return -1
|
rts ; return -1
|
||||||
|
|
||||||
;invmode:ldx #>EINVAL
|
;invmode:ldx #>EINVAL
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
; set EINVAL error code and returns -1
|
; set EINVAL error code and returns -1
|
||||||
;
|
;
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
.import __retminus
|
|
||||||
|
|
||||||
.export __inviocb
|
.export __inviocb
|
||||||
|
|
||||||
__inviocb:
|
__inviocb:
|
||||||
lda #<EINVAL
|
lda #<EINVAL
|
||||||
jsr __seterrno
|
jmp __directerrno
|
||||||
jmp __retminus ; return -1
|
|
||||||
|
@ -21,10 +21,7 @@
|
|||||||
; 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
|
||||||
jsr __seterrno ; set __errno, return zero in A
|
jsr __directerrno ; returns with $FFFF in AX
|
||||||
sta __oserror
|
|
||||||
lda #$FF
|
|
||||||
tax
|
|
||||||
sta sreg
|
sta sreg
|
||||||
sta sreg+1
|
sta sreg+1
|
||||||
rts
|
rts
|
||||||
@ -93,8 +90,14 @@ end: ldx tmp3
|
|||||||
bpl l01
|
bpl l01
|
||||||
|
|
||||||
; error returned from CIO
|
; error returned from CIO
|
||||||
xxerr: sty __oserror
|
xxerr: tya
|
||||||
bmi iocberr
|
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)
|
; check for offset 0, SEEK_CUR (get current position)
|
||||||
cont: ldy #3
|
cont: ldy #3
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
.import clriocb
|
.import clriocb
|
||||||
.import fddecusage,newfd
|
.import fddecusage,newfd
|
||||||
.import findfreeiocb
|
.import findfreeiocb
|
||||||
.import __do_oserror,incsp4
|
.import incsp4
|
||||||
.import ldaxysp,addysp
|
.import ldaxysp,addysp
|
||||||
.import __oserror
|
.import __oserror
|
||||||
.importzp tmp4,tmp2
|
.importzp tmp4,tmp2
|
||||||
@ -38,7 +38,7 @@ 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"
|
||||||
seterr: jsr __seterrno
|
seterr: jsr __directerrno
|
||||||
jsr incsp4 ; clean up stack
|
jsr incsp4 ; clean up stack
|
||||||
lda #$FF
|
lda #$FF
|
||||||
tax
|
tax
|
||||||
@ -143,7 +143,8 @@ finish: php
|
|||||||
|
|
||||||
bpl ok
|
bpl ok
|
||||||
jsr fddecusage ; decrement usage counter of fd as open failed
|
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
|
ok: lda tmp2 ; get fd
|
||||||
ldx #0
|
ldx #0
|
||||||
|
Loading…
Reference in New Issue
Block a user