mirror of
https://github.com/cc65/cc65.git
synced 2025-08-16 12:27:49 +00:00
fix errno related underscores in all libsrc/*.s files
This commit is contained in:
@@ -33,8 +33,8 @@ zerofd: lda #$00
|
|||||||
; Return success
|
; Return success
|
||||||
lda #$00
|
lda #$00
|
||||||
|
|
||||||
; Set __oserror
|
; Set ___oserror
|
||||||
oserr: jmp __mappederrno
|
oserr: jmp ___mappederrno
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
errno: jmp __directerrno
|
errno: jmp ___directerrno
|
||||||
|
@@ -45,9 +45,9 @@ _getdevicedir:
|
|||||||
|
|
||||||
; Handle errors
|
; Handle errors
|
||||||
erange: lda #<ERANGE
|
erange: lda #<ERANGE
|
||||||
jsr __directerrno
|
jsr ___directerrno
|
||||||
bne :+ ; Branch always
|
bne :+ ; Branch always
|
||||||
oserr: jsr __mappederrno
|
oserr: jsr ___mappederrno
|
||||||
: lda #$00 ; Return NULL
|
: lda #$00 ; Return NULL
|
||||||
tax
|
tax
|
||||||
rts
|
rts
|
||||||
@@ -73,7 +73,7 @@ oserr: jsr __mappederrno
|
|||||||
iny
|
iny
|
||||||
lda #$00
|
lda #$00
|
||||||
sta (ptr1),y
|
sta (ptr1),y
|
||||||
sta __oserror ; Clear _oserror
|
sta ___oserror ; Clear __oserror
|
||||||
|
|
||||||
; Success, return buf
|
; Success, return buf
|
||||||
lda ptr1
|
lda ptr1
|
||||||
|
@@ -30,6 +30,6 @@ diocommon:
|
|||||||
|
|
||||||
dioepilog:
|
dioepilog:
|
||||||
; Return success or error
|
; Return success or error
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
ldx #$00
|
ldx #$00
|
||||||
rts
|
rts
|
||||||
|
@@ -24,7 +24,7 @@ _dio_open:
|
|||||||
lda #$28 ; "No device connected"
|
lda #$28 ; "No device connected"
|
||||||
|
|
||||||
; Return oserror
|
; Return oserror
|
||||||
oserr: sta __oserror
|
oserr: sta ___oserror
|
||||||
jmp return0
|
jmp return0
|
||||||
|
|
||||||
; Return success
|
; Return success
|
||||||
@@ -34,5 +34,5 @@ oserr: sta __oserror
|
|||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
ldx #$00
|
ldx #$00
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
rts
|
rts
|
||||||
|
@@ -16,7 +16,7 @@ _dio_query_sectcount:
|
|||||||
; Set handle
|
; Set handle
|
||||||
sta mliparam + MLI::ON_LINE::UNIT_NUM
|
sta mliparam + MLI::ON_LINE::UNIT_NUM
|
||||||
|
|
||||||
; Get ProDOS 8 block size (clears __oserror)
|
; Get ProDOS 8 block size (clears ___oserror)
|
||||||
jsr _dio_query_sectsize
|
jsr _dio_query_sectsize
|
||||||
|
|
||||||
; Alloc buffer
|
; Alloc buffer
|
||||||
@@ -74,7 +74,7 @@ done: lda ptr4
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
nomem: lda #$FF ; Error code for sure not used by MLI
|
nomem: lda #$FF ; Error code for sure not used by MLI
|
||||||
oserr: sta __oserror
|
oserr: sta ___oserror
|
||||||
|
|
||||||
; Save total blocks for failure
|
; Save total blocks for failure
|
||||||
lda #$00
|
lda #$00
|
||||||
@@ -85,7 +85,7 @@ oserr: sta __oserror
|
|||||||
; Check for non-ProDOS disk
|
; Check for non-ProDOS disk
|
||||||
check: cmp #$52 ; "Not a ProDOS volume"
|
check: cmp #$52 ; "Not a ProDOS volume"
|
||||||
bne oserr
|
bne oserr
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
|
|
||||||
; Save total blocks for a 16-sector disk
|
; Save total blocks for a 16-sector disk
|
||||||
lda #<280
|
lda #<280
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
_dio_query_sectsize:
|
_dio_query_sectsize:
|
||||||
; Clear error
|
; Clear error
|
||||||
stx __oserror ; X = 0
|
stx ___oserror ; X = 0
|
||||||
|
|
||||||
; Return ProDOS 8 block size
|
; Return ProDOS 8 block size
|
||||||
txa ; X = 0
|
txa ; X = 0
|
||||||
|
@@ -19,8 +19,8 @@ typerr: lda #$4A ; "Incompatible file format"
|
|||||||
; Cleanup name
|
; Cleanup name
|
||||||
oserr: jsr popname ; Preserves A
|
oserr: jsr popname ; Preserves A
|
||||||
|
|
||||||
; Set __oserror
|
; Set ___oserror
|
||||||
jmp __mappederrno
|
jmp ___mappederrno
|
||||||
|
|
||||||
_exec:
|
_exec:
|
||||||
; Save cmdline
|
; Save cmdline
|
||||||
|
@@ -52,7 +52,7 @@ _clock_getres:
|
|||||||
enosys: lda #ENOSYS
|
enosys: lda #ENOSYS
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
jmp __directerrno
|
jmp ___directerrno
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
@@ -81,13 +81,13 @@ erange: lda #ERANGE
|
|||||||
jsr incsp3 ; Preserves A
|
jsr incsp3 ; Preserves A
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
jmp __directerrno
|
jmp ___directerrno
|
||||||
|
|
||||||
; Cleanup stack
|
; Cleanup stack
|
||||||
oserr: jsr incsp3 ; Preserves A
|
oserr: jsr incsp3 ; Preserves A
|
||||||
|
|
||||||
; Set __oserror
|
; Set ___oserror
|
||||||
jmp __mappederrno
|
jmp ___mappederrno
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
|
@@ -107,13 +107,13 @@ seek_common:
|
|||||||
einval: lda #EINVAL
|
einval: lda #EINVAL
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
errno: jsr __directerrno ; leaves -1 in AX
|
errno: jsr ___directerrno ; leaves -1 in AX
|
||||||
stx sreg ; extend return value to 32 bits
|
stx sreg ; extend return value to 32 bits
|
||||||
stx sreg+1
|
stx sreg+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Set __oserror
|
; Set ___oserror
|
||||||
oserr: jsr __mappederrno ; leaves -1 in AX
|
oserr: jsr ___mappederrno ; leaves -1 in AX
|
||||||
stx sreg ; extend return value to 32 bits
|
stx sreg ; extend return value to 32 bits
|
||||||
stx sreg+1
|
stx sreg+1
|
||||||
rts
|
rts
|
||||||
|
@@ -64,7 +64,7 @@ _open:
|
|||||||
errno: jsr incsp4 ; Preserves A
|
errno: jsr incsp4 ; Preserves A
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
jmp __directerrno
|
jmp ___directerrno
|
||||||
|
|
||||||
; Save fdtab slot
|
; Save fdtab slot
|
||||||
found: tya
|
found: tya
|
||||||
@@ -147,8 +147,8 @@ oserr1: ldy tmp2 ; Restore fdtab slot
|
|||||||
jsr freebuffer
|
jsr freebuffer
|
||||||
pla ; Restore oserror code
|
pla ; Restore oserror code
|
||||||
|
|
||||||
; Set __oserror
|
; Set ___oserror
|
||||||
jmp __mappederrno
|
jmp ___mappederrno
|
||||||
|
|
||||||
open: ldy tmp2 ; Restore fdtab slot
|
open: ldy tmp2 ; Restore fdtab slot
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ done: lda tmp1 ; Restore fd
|
|||||||
|
|
||||||
; Return success
|
; Return success
|
||||||
ldx #$00
|
ldx #$00
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
rts
|
rts
|
||||||
|
|
||||||
freebuffer:
|
freebuffer:
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 17.05.2000
|
; Ullrich von Bassewitz, 17.05.2000
|
||||||
;
|
;
|
||||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export __osmaperrno
|
.export ___osmaperrno
|
||||||
|
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
|
|
||||||
__osmaperrno:
|
___osmaperrno:
|
||||||
ldx #ErrTabSize
|
ldx #ErrTabSize
|
||||||
: cmp ErrTab-2,x ; Search for the error code
|
: cmp ErrTab-2,x ; Search for the error code
|
||||||
beq :+ ; Jump if found
|
beq :+ ; Jump if found
|
||||||
|
@@ -52,7 +52,7 @@ _read:
|
|||||||
|
|
||||||
; Device succeeds always
|
; Device succeeds always
|
||||||
device: lda #$00
|
device: lda #$00
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
|
|
||||||
; Set counter to zero
|
; Set counter to zero
|
||||||
sta ptr3
|
sta ptr3
|
||||||
@@ -107,4 +107,4 @@ check: lda ptr3
|
|||||||
einval: lda #EINVAL
|
einval: lda #EINVAL
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
errno: jmp __directerrno
|
errno: jmp ___directerrno
|
||||||
|
@@ -49,10 +49,10 @@ rwcommon:
|
|||||||
|
|
||||||
rwepilog:
|
rwepilog:
|
||||||
; Return success
|
; Return success
|
||||||
sta __oserror ; A = 0
|
sta ___oserror ; A = 0
|
||||||
lda mliparam + MLI::RW::TRANS_COUNT
|
lda mliparam + MLI::RW::TRANS_COUNT
|
||||||
ldx mliparam + MLI::RW::TRANS_COUNT+1
|
ldx mliparam + MLI::RW::TRANS_COUNT+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Set __oserror
|
; Set ___oserror
|
||||||
oserr: jmp __mappederrno
|
oserr: jmp ___mappederrno
|
||||||
|
@@ -68,4 +68,4 @@ enosys: lda #ENOSYS
|
|||||||
erange: lda #ERANGE
|
erange: lda #ERANGE
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
errno: jmp __directerrno
|
errno: jmp ___directerrno
|
||||||
|
@@ -107,8 +107,8 @@ done: lda #$00
|
|||||||
einval: lda #EINVAL
|
einval: lda #EINVAL
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
errno: jmp __directerrno
|
errno: jmp ___directerrno
|
||||||
|
|
||||||
; Set __oserror
|
; Set ___oserror
|
||||||
oserr: jmp __mappederrno
|
oserr: jmp ___mappederrno
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.export _close
|
.export _close
|
||||||
.import __do_oserror,popax,__oserror
|
.import __do_oserror,popax,___oserror
|
||||||
.import fdtoiocb_down,__inviocb
|
.import fdtoiocb_down,__inviocb
|
||||||
|
|
||||||
.proc _close
|
.proc _close
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
jsr CIOV
|
jsr CIOV
|
||||||
bmi closerr
|
bmi closerr
|
||||||
ok: ldx #0
|
ok: ldx #0
|
||||||
stx __oserror ; clear system specific error code
|
stx ___oserror ; clear system specific error code
|
||||||
txa
|
txa
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.export _dio_phys_to_log
|
.export _dio_phys_to_log
|
||||||
.import popax,__oserror
|
.import popax,___oserror
|
||||||
.importzp ptr1,ptr2,ptr3
|
.importzp ptr1,ptr2,ptr3
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
ldx #0
|
ldx #0
|
||||||
txa
|
txa
|
||||||
ret:
|
ret:
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
rts ; return success
|
rts ; return success
|
||||||
|
|
||||||
; invalid handle
|
; invalid handle
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
.export _dio_log_to_phys
|
.export _dio_log_to_phys
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.importzp ptr1,ptr2,ptr3
|
.importzp ptr1,ptr2,ptr3
|
||||||
.import popax,popptr1,__oserror
|
.import popax,popptr1,___oserror
|
||||||
|
|
||||||
.proc _dio_log_to_phys
|
.proc _dio_log_to_phys
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ _l1: lda (ptr1,x)
|
|||||||
|
|
||||||
txa
|
txa
|
||||||
ret:
|
ret:
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
rts ; return success
|
rts ; return success
|
||||||
|
|
||||||
; invalid handle
|
; invalid handle
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
.export _dio_open, _dio_close
|
.export _dio_open, _dio_close
|
||||||
.export sectsizetab
|
.export sectsizetab
|
||||||
.import __oserror, __sio_call, _dio_read
|
.import ___oserror, __sio_call, _dio_read
|
||||||
.import pushax, addysp, subysp
|
.import pushax, addysp, subysp
|
||||||
.importzp ptr2, sp
|
.importzp ptr2, sp
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
@@ -31,7 +31,7 @@ sectsizetab:
|
|||||||
|
|
||||||
_inv_drive:
|
_inv_drive:
|
||||||
lda #NONDEV ; non-existent device
|
lda #NONDEV ; non-existent device
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
lda #0
|
lda #0
|
||||||
tax
|
tax
|
||||||
rts ; return NULL
|
rts ; return NULL
|
||||||
@@ -49,7 +49,7 @@ _dio_open:
|
|||||||
sta sectsizetab+sst_flag,x ; set flag that drive is "open"
|
sta sectsizetab+sst_flag,x ; set flag that drive is "open"
|
||||||
lda #0
|
lda #0
|
||||||
sta sectsizetab+sst_sectsize+1,x
|
sta sectsizetab+sst_sectsize+1,x
|
||||||
sta __oserror ; success
|
sta ___oserror ; success
|
||||||
tya
|
tya
|
||||||
sta sectsizetab+sst_driveno,x
|
sta sectsizetab+sst_driveno,x
|
||||||
stx ptr2
|
stx ptr2
|
||||||
@@ -156,7 +156,7 @@ s128: lda #128
|
|||||||
lda #0
|
lda #0
|
||||||
ldy #sst_flag
|
ldy #sst_flag
|
||||||
sta (ptr2),y
|
sta (ptr2),y
|
||||||
sta __oserror ; success
|
sta ___oserror ; success
|
||||||
tax
|
tax
|
||||||
rts ; return no error
|
rts ; return no error
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.export _dio_query_sectsize
|
.export _dio_query_sectsize
|
||||||
.importzp ptr1,tmp1
|
.importzp ptr1,tmp1
|
||||||
.import popax, __oserror
|
.import popax, ___oserror
|
||||||
|
|
||||||
.proc _dio_query_sectsize
|
.proc _dio_query_sectsize
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
stx ptr1+1
|
stx ptr1+1
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
|
|
||||||
ldy #sst_sectsize+1
|
ldy #sst_sectsize+1
|
||||||
lda (ptr1),y
|
lda (ptr1),y
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
;
|
;
|
||||||
; __do_oserror updates __oserror and errno. Do a JMP here right after
|
; __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
|
; calling CIOV. It will return with AX set to -1 ($FFFF). It expects the CIO
|
||||||
; status in Y.
|
; status in Y.
|
||||||
;
|
;
|
||||||
@@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
__do_oserror:
|
__do_oserror:
|
||||||
tya
|
tya
|
||||||
jmp __mappederrno
|
jmp ___mappederrno
|
||||||
|
@@ -34,7 +34,7 @@ notsupp:lda #ENOSYS ; "unsupported system call"
|
|||||||
.byte $2C ; bit opcode, eats the next 2 bytes
|
.byte $2C ; bit opcode, eats the next 2 bytes
|
||||||
noiocb: lda #EMFILE ; "too many open files"
|
noiocb: lda #EMFILE ; "too many open files"
|
||||||
jsr incsp2 ; clean up stack
|
jsr incsp2 ; clean up stack
|
||||||
seterr: jmp __directerrno
|
seterr: jmp ___directerrno
|
||||||
|
|
||||||
|
|
||||||
; entry point
|
; entry point
|
||||||
@@ -148,7 +148,7 @@ copycd: lda #ATEOL
|
|||||||
pha ; remember error code
|
pha ; remember error code
|
||||||
jsr close ; close the IOCB (required even if open failed)
|
jsr close ; close the IOCB (required even if open failed)
|
||||||
pla ; put error code back into A
|
pla ; put error code back into A
|
||||||
setmerr:jmp __mappederrno ; update errno from OS specific error code in A
|
setmerr:jmp ___mappederrno ; update errno from OS specific error code in A
|
||||||
|
|
||||||
openok: lda #>buf
|
openok: lda #>buf
|
||||||
sta ICBAH,x ; set buffer address
|
sta ICBAH,x ; set buffer address
|
||||||
|
@@ -41,7 +41,7 @@ _clock_getres:
|
|||||||
enosys: lda #ENOSYS
|
enosys: lda #ENOSYS
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
jmp __directerrno
|
jmp ___directerrno
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; timespec struct with tv_sec set to 1 second
|
; timespec struct with tv_sec set to 1 second
|
||||||
|
@@ -105,7 +105,7 @@ errexit:jsr incsp3 ; Preserves A
|
|||||||
|
|
||||||
; set __errno
|
; set __errno
|
||||||
|
|
||||||
jmp __directerrno
|
jmp ___directerrno
|
||||||
|
|
||||||
; -------
|
; -------
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
.export __graphics
|
.export __graphics
|
||||||
|
|
||||||
.import findfreeiocb
|
.import findfreeiocb
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
.import fddecusage
|
.import fddecusage
|
||||||
.import clriocb
|
.import clriocb
|
||||||
.import fdtoiocb
|
.import fdtoiocb
|
||||||
@@ -45,7 +45,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 __mappederrno ; @@@ probably not correct to set errno here @@@
|
seterr: jsr ___mappederrno ; @@@ probably not correct to set errno here @@@
|
||||||
rts ; return -1
|
rts ; return -1
|
||||||
|
|
||||||
;invmode:ldx #>EINVAL
|
;invmode:ldx #>EINVAL
|
||||||
@@ -94,7 +94,7 @@ doopen: txa
|
|||||||
|
|
||||||
lda tmp2 ; get fd
|
lda tmp2 ; get fd
|
||||||
ldx #0
|
ldx #0
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
rts
|
rts
|
||||||
|
|
||||||
cioerr: sty tmp3 ; remember error code
|
cioerr: sty tmp3 ; remember error code
|
||||||
@@ -103,6 +103,6 @@ cioerr: sty tmp3 ; remember error code
|
|||||||
jsr CIOV ; close IOCB again since open failed
|
jsr CIOV ; close IOCB again since open failed
|
||||||
jsr fddecusage ; and decrement usage counter of fd
|
jsr fddecusage ; and decrement usage counter of fd
|
||||||
lda tmp3 ; put error code into A
|
lda tmp3 ; put error code into A
|
||||||
jmp __mappederrno
|
jmp ___mappederrno
|
||||||
|
|
||||||
.endproc ; __graphics
|
.endproc ; __graphics
|
||||||
|
@@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
__inviocb:
|
__inviocb:
|
||||||
lda #<EINVAL
|
lda #<EINVAL
|
||||||
jmp __directerrno
|
jmp ___directerrno
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
.export _lseek
|
.export _lseek
|
||||||
.import incsp6,__oserror
|
.import incsp6,___oserror
|
||||||
.import __inviocb,ldax0sp,ldaxysp,fdtoiocb
|
.import __inviocb,ldax0sp,ldaxysp,fdtoiocb
|
||||||
.import __dos_type
|
.import __dos_type
|
||||||
.import fd_table
|
.import fd_table
|
||||||
@@ -21,7 +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 __directerrno ; returns with $FFFF in AX
|
jsr ___directerrno ; returns with $FFFF in AX
|
||||||
sta sreg
|
sta sreg
|
||||||
sta sreg+1
|
sta sreg+1
|
||||||
rts
|
rts
|
||||||
@@ -94,7 +94,7 @@ xxerr: tya
|
|||||||
pha
|
pha
|
||||||
jsr incsp6
|
jsr incsp6
|
||||||
pla
|
pla
|
||||||
jsr __mappederrno ; returns with $FFFF in AX
|
jsr ___mappederrno ; returns with $FFFF in AX
|
||||||
sta sreg
|
sta sreg
|
||||||
sta sreg+1
|
sta sreg+1
|
||||||
rts
|
rts
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
.import findfreeiocb
|
.import findfreeiocb
|
||||||
.import incsp4
|
.import incsp4
|
||||||
.import ldaxysp,addysp
|
.import ldaxysp,addysp
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
.ifdef UCASE_FILENAME
|
.ifdef UCASE_FILENAME
|
||||||
.import ucase_fn
|
.import ucase_fn
|
||||||
.endif
|
.endif
|
||||||
@@ -37,7 +37,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 __directerrno
|
seterr: jsr ___directerrno
|
||||||
jsr incsp4 ; clean up stack
|
jsr incsp4 ; clean up stack
|
||||||
lda #$FF
|
lda #$FF
|
||||||
tax
|
tax
|
||||||
@@ -150,11 +150,11 @@ finish: php
|
|||||||
jsr CIOV ; close IOCB again since open failed
|
jsr CIOV ; close IOCB again since open failed
|
||||||
jsr fddecusage ; and decrement usage counter of fd
|
jsr fddecusage ; and decrement usage counter of fd
|
||||||
lda tmp3 ; put error code into A
|
lda tmp3 ; put error code into A
|
||||||
jmp __mappederrno
|
jmp ___mappederrno
|
||||||
|
|
||||||
ok: lda tmp2 ; get fd
|
ok: lda tmp2 ; get fd
|
||||||
ldx #0
|
ldx #0
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@@ -2,13 +2,13 @@
|
|||||||
; Christian Groessler, May-2000
|
; Christian Groessler, May-2000
|
||||||
;
|
;
|
||||||
; os specific error code mapping
|
; os specific error code mapping
|
||||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
.export __osmaperrno
|
.export ___osmaperrno
|
||||||
|
|
||||||
.proc __osmaperrno
|
.proc ___osmaperrno
|
||||||
|
|
||||||
cmp #$80 ; error or success
|
cmp #$80 ; error or success
|
||||||
bcs errcode ; error, jump
|
bcs errcode ; error, jump
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.export _opendir, _readdir, _closedir
|
.export _opendir, _readdir, _closedir
|
||||||
.import findfreeiocb, clriocb
|
.import findfreeiocb, clriocb
|
||||||
.import __oserror, return0, __do_oserror
|
.import ___oserror, return0, __do_oserror
|
||||||
.importzp ptr1, tmp1
|
.importzp ptr1, tmp1
|
||||||
.ifdef DEFAULT_DEVICE
|
.ifdef DEFAULT_DEVICE
|
||||||
.import __defdev
|
.import __defdev
|
||||||
@@ -56,13 +56,13 @@
|
|||||||
jsr CIOV
|
jsr CIOV
|
||||||
bmi cioerr
|
bmi cioerr
|
||||||
lda #0
|
lda #0
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
tax
|
tax
|
||||||
lda diriocb
|
lda diriocb
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
cioerr: sty __oserror
|
cioerr: sty ___oserror
|
||||||
lda #CLOSE
|
lda #CLOSE
|
||||||
sta ICCOM,x
|
sta ICCOM,x
|
||||||
jsr CIOV ; close IOCB again since open failed
|
jsr CIOV ; close IOCB again since open failed
|
||||||
@@ -147,7 +147,7 @@ copychar: lda (ptr1),y ; src=y dest=tmp1
|
|||||||
jsr CIOV
|
jsr CIOV
|
||||||
bmi @cioerr
|
bmi @cioerr
|
||||||
ldx #0
|
ldx #0
|
||||||
stx __oserror ; clear system specific error code
|
stx ___oserror ; clear system specific error code
|
||||||
txa
|
txa
|
||||||
rts
|
rts
|
||||||
@cioerr: jmp __do_oserror
|
@cioerr: jmp __do_oserror
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.import __rwsetup,__do_oserror,__inviocb,__oserror
|
.import __rwsetup,__do_oserror,__inviocb,___oserror
|
||||||
.export _read
|
.export _read
|
||||||
|
|
||||||
_read: jsr __rwsetup ; do common setup for read and write
|
_read: jsr __rwsetup ; do common setup for read and write
|
||||||
@@ -33,7 +33,7 @@ done: lda ICBLL,x ; buf len lo
|
|||||||
lda ICBLH,x ; get buf len hi
|
lda ICBLH,x ; get buf len hi
|
||||||
tax ; to X
|
tax ; to X
|
||||||
okdone: lda #0
|
okdone: lda #0
|
||||||
sta __oserror ; clear system dependend error code
|
sta ___oserror ; clear system dependend error code
|
||||||
pla ; get buf len lo
|
pla ; get buf len lo
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@@ -96,4 +96,4 @@ done: jmp return0
|
|||||||
; load errno code
|
; load errno code
|
||||||
|
|
||||||
enosys: lda #ENOSYS
|
enosys: lda #ENOSYS
|
||||||
drcter: jmp __directerrno
|
drcter: jmp ___directerrno
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
.export __sio_call
|
.export __sio_call
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.import popa,popax,popptr1
|
.import popa,popax,popptr1
|
||||||
.import sectsizetab,__oserror
|
.import sectsizetab,___oserror
|
||||||
.importzp ptr1
|
.importzp ptr1
|
||||||
|
|
||||||
.proc __sio_call
|
.proc __sio_call
|
||||||
@@ -76,7 +76,7 @@ _cont: lda #DISKID ; SIO bus ID of diskette drive
|
|||||||
bmi _req_err ; error occurred
|
bmi _req_err ; error occurred
|
||||||
txa ; no error occurred
|
txa ; no error occurred
|
||||||
_req_err:
|
_req_err:
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
rts
|
rts
|
||||||
|
|
||||||
_inv_hand:
|
_inv_hand:
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
; int __fastcall__ write (int fd, const void* buf, unsigned count);
|
; int __fastcall__ write (int fd, const void* buf, unsigned count);
|
||||||
;
|
;
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.import __rwsetup,__do_oserror,__inviocb,__oserror
|
.import __rwsetup,__do_oserror,__inviocb,___oserror
|
||||||
.export _write
|
.export _write
|
||||||
_write:
|
_write:
|
||||||
jsr __rwsetup ; do common setup
|
jsr __rwsetup ; do common setup
|
||||||
@@ -21,7 +21,7 @@ write9:
|
|||||||
lda ICBLH,x ; buf len high
|
lda ICBLH,x ; buf len high
|
||||||
tax
|
tax
|
||||||
lda #0
|
lda #0
|
||||||
sta __oserror ; clear system dependend error code
|
sta ___oserror ; clear system dependend error code
|
||||||
pla
|
pla
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
;
|
;
|
||||||
; Stefan Haubenthal, 2011-04-18
|
; Stefan Haubenthal, 2011-04-18
|
||||||
;
|
;
|
||||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
; /* Map a system specific error into a system independent code */
|
; /* Map a system specific error into a system independent code */
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
.export __osmaperrno
|
.export ___osmaperrno
|
||||||
|
|
||||||
.proc __osmaperrno
|
.proc ___osmaperrno
|
||||||
|
|
||||||
lda #<EUNKNOWN
|
lda #<EUNKNOWN
|
||||||
ldx #>EUNKNOWN
|
ldx #>EUNKNOWN
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
.include "cbm.inc"
|
.include "cbm.inc"
|
||||||
|
|
||||||
.export _cbm_k_load
|
.export _cbm_k_load
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
.import popa
|
.import popa
|
||||||
.importzp ptr1
|
.importzp ptr1
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ _cbm_k_load:
|
|||||||
ldy ptr1+1
|
ldy ptr1+1
|
||||||
jsr LOAD
|
jsr LOAD
|
||||||
bcc @Ok
|
bcc @Ok
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
ldx ptr1
|
ldx ptr1
|
||||||
ldy ptr1+1
|
ldy ptr1+1
|
||||||
@Ok: txa
|
@Ok: txa
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
; {
|
; {
|
||||||
; cbm_k_setlfs(lfn, device, sec_addr);
|
; cbm_k_setlfs(lfn, device, sec_addr);
|
||||||
; cbm_k_setnam(name);
|
; cbm_k_setnam(name);
|
||||||
; return _oserror = cbm_k_open();
|
; return __oserror = cbm_k_open();
|
||||||
; }
|
; }
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
.import popa
|
.import popa
|
||||||
.import _cbm_k_setlfs, _cbm_k_setnam, _cbm_k_open
|
.import _cbm_k_setlfs, _cbm_k_setnam, _cbm_k_open
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
|
|
||||||
_cbm_open:
|
_cbm_open:
|
||||||
jsr _cbm_k_setnam
|
jsr _cbm_k_setnam
|
||||||
@@ -32,5 +32,5 @@ _cbm_open:
|
|||||||
jsr _cbm_k_setlfs ; Call SETLFS, pop all args
|
jsr _cbm_k_setlfs ; Call SETLFS, pop all args
|
||||||
|
|
||||||
jsr _cbm_k_open
|
jsr _cbm_k_open
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
rts
|
rts
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
; int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size)
|
; int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size)
|
||||||
; /* Reads up to "size" bytes from a file to "buffer".
|
; /* Reads up to "size" bytes from a file to "buffer".
|
||||||
; ** Returns the number of actually read bytes, 0 if there are no bytes left
|
; ** Returns the number of actually read bytes, 0 if there are no bytes left
|
||||||
; ** (EOF) or -1 in case of an error. _oserror contains an errorcode then (see
|
; ** (EOF) or -1 in case of an error. __oserror contains an errorcode then (see
|
||||||
; ** table below).
|
; ** table below).
|
||||||
; */
|
; */
|
||||||
; {
|
; {
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
; static unsigned char tmp;
|
; static unsigned char tmp;
|
||||||
;
|
;
|
||||||
; /* if we can't change to the inputchannel #lfn then return an error */
|
; /* if we can't change to the inputchannel #lfn then return an error */
|
||||||
; if (_oserror = cbm_k_chkin(lfn)) return -1;
|
; if (__oserror = cbm_k_chkin(lfn)) return -1;
|
||||||
;
|
;
|
||||||
; bytesread = 0;
|
; bytesread = 0;
|
||||||
;
|
;
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
.export _cbm_read
|
.export _cbm_read
|
||||||
.importzp ptr1, ptr2, ptr3, tmp1
|
.importzp ptr1, ptr2, ptr3, tmp1
|
||||||
.import popax, popa
|
.import popax, popa
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
|
|
||||||
|
|
||||||
_cbm_read:
|
_cbm_read:
|
||||||
@@ -106,7 +106,7 @@ _cbm_read:
|
|||||||
|
|
||||||
; CHKIN failed
|
; CHKIN failed
|
||||||
|
|
||||||
@E1: sta __oserror
|
@E1: sta ___oserror
|
||||||
lda #$FF
|
lda #$FF
|
||||||
tax
|
tax
|
||||||
rts ; return -1
|
rts ; return -1
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
; static unsigned int byteswritten;
|
; static unsigned int byteswritten;
|
||||||
;
|
;
|
||||||
; /* if we can't change to the outputchannel #lfn then return an error */
|
; /* if we can't change to the outputchannel #lfn then return an error */
|
||||||
; if (_oserror = cbm_k_ckout(lfn)) return -1;
|
; if (__oserror = cbm_k_ckout(lfn)) return -1;
|
||||||
;
|
;
|
||||||
; byteswritten = 0;
|
; byteswritten = 0;
|
||||||
;
|
;
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
; }
|
; }
|
||||||
;
|
;
|
||||||
; if (cbm_k_readst()) {
|
; if (cbm_k_readst()) {
|
||||||
; _oserror = 5; /* device not present */
|
; __oserror = 5; /* device not present */
|
||||||
; byteswritten = -1;
|
; byteswritten = -1;
|
||||||
; }
|
; }
|
||||||
;
|
;
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
.export _cbm_write
|
.export _cbm_write
|
||||||
.importzp ptr1, ptr2, ptr3
|
.importzp ptr1, ptr2, ptr3
|
||||||
.import popax, popa
|
.import popax, popa
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
|
|
||||||
|
|
||||||
_cbm_write:
|
_cbm_write:
|
||||||
@@ -87,7 +87,7 @@ _cbm_write:
|
|||||||
|
|
||||||
; Error entry, error code is in A
|
; Error entry, error code is in A
|
||||||
|
|
||||||
@E2: sta __oserror
|
@E2: sta ___oserror
|
||||||
lda #$FF
|
lda #$FF
|
||||||
tax
|
tax
|
||||||
rts ; return -1
|
rts ; return -1
|
||||||
|
@@ -54,12 +54,12 @@
|
|||||||
ldx unittab,y
|
ldx unittab,y
|
||||||
jsr closecmdchannel ; Close the disk command channel
|
jsr closecmdchannel ; Close the disk command channel
|
||||||
pla ; Get the error code from the disk
|
pla ; Get the error code from the disk
|
||||||
jmp __mappederrno ; Set _oserror and _errno, return 0/-1
|
jmp ___mappederrno ; Set __oserror and _errno, return 0/-1
|
||||||
|
|
||||||
; Error entry: The given file descriptor is not valid or not open
|
; Error entry: The given file descriptor is not valid or not open
|
||||||
|
|
||||||
invalidfd:
|
invalidfd:
|
||||||
lda #EBADF
|
lda #EBADF
|
||||||
jmp __directerrno ; Set _errno, clear _oserror, return -1
|
jmp ___directerrno ; Set _errno, clear __oserror, return -1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
jsr popa
|
jsr popa
|
||||||
jsr diskinit
|
jsr diskinit
|
||||||
beq size
|
beq size
|
||||||
jsr __mappederrno
|
jsr ___mappederrno
|
||||||
bne fail ; Branch always
|
bne fail ; Branch always
|
||||||
|
|
||||||
; Check for sufficient buf size
|
; Check for sufficient buf size
|
||||||
@@ -43,7 +43,7 @@ size: lda ptr3+1
|
|||||||
cmp #3
|
cmp #3
|
||||||
bcs okay ; Buf >= 3
|
bcs okay ; Buf >= 3
|
||||||
lda #<ERANGE
|
lda #<ERANGE
|
||||||
jsr __directerrno
|
jsr ___directerrno
|
||||||
fail: lda #0 ; Return NULL
|
fail: lda #0 ; Return NULL
|
||||||
tax
|
tax
|
||||||
rts
|
rts
|
||||||
@@ -52,7 +52,7 @@ fail: lda #0 ; Return NULL
|
|||||||
|
|
||||||
okay: lda fnunit ; Set by diskinit
|
okay: lda fnunit ; Set by diskinit
|
||||||
jsr devicestr ; Returns 0 in A
|
jsr devicestr ; Returns 0 in A
|
||||||
sta __oserror ; Clear _oserror
|
sta ___oserror ; Clear __oserror
|
||||||
|
|
||||||
; Success, return buf
|
; Success, return buf
|
||||||
|
|
||||||
|
@@ -94,10 +94,10 @@ parmok: jsr popax ; Get flags
|
|||||||
|
|
||||||
lda #EINVAL
|
lda #EINVAL
|
||||||
|
|
||||||
; Error entry. Sets _errno, clears _oserror, returns -1
|
; Error entry. Sets _errno, clears __oserror, returns -1
|
||||||
|
|
||||||
seterrno:
|
seterrno:
|
||||||
jmp __directerrno
|
jmp ___directerrno
|
||||||
|
|
||||||
; Error entry: Close the file and exit. OS error code is in A on entry
|
; Error entry: Close the file and exit. OS error code is in A on entry
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ closeandexit:
|
|||||||
|
|
||||||
; Error entry: Set oserror and errno using error code in A and return -1
|
; Error entry: Set oserror and errno using error code in A and return -1
|
||||||
|
|
||||||
oserror:jmp __mappederrno
|
oserror:jmp ___mappederrno
|
||||||
|
|
||||||
; Read bit is set. Add an 'r' to the name
|
; Read bit is set. Add an 'r' to the name
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ nofile: ; ... else use SA=0 (read)
|
|||||||
|
|
||||||
txa ; Handle
|
txa ; Handle
|
||||||
ldx #0
|
ldx #0
|
||||||
stx __oserror ; Clear _oserror
|
stx ___oserror ; Clear __oserror
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
; 2000-05-17, Ullrich von Bassewitz
|
; 2000-05-17, Ullrich von Bassewitz
|
||||||
; 2014-05-28, Greg King
|
; 2014-05-28, Greg King
|
||||||
;
|
;
|
||||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
; /* Map a system-specific error into a system-independent code. */
|
; /* Map a system-specific error into a system-independent code. */
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
__osmaperrno:
|
___osmaperrno:
|
||||||
ldx #ErrTabSize
|
ldx #ErrTabSize
|
||||||
@L1: cmp ErrTab-2,x ; Search for the error code
|
@L1: cmp ErrTab-2,x ; Search for the error code
|
||||||
beq @L2 ; Jump if found
|
beq @L2 ; Jump if found
|
||||||
|
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
jsr CHKIN
|
jsr CHKIN
|
||||||
bcc @L3 ; Branch if ok
|
bcc @L3 ; Branch if ok
|
||||||
jmp __mappederrno ; Store into __oserror, map to errno, return -1
|
jmp ___mappederrno ; Store into ___oserror, map to errno, return -1
|
||||||
|
|
||||||
; Read the next byte
|
; Read the next byte
|
||||||
|
|
||||||
@@ -123,10 +123,10 @@
|
|||||||
|
|
||||||
done: jsr CLRCH
|
done: jsr CLRCH
|
||||||
|
|
||||||
; Clear _oserror and return the number of chars read
|
; Clear __oserror and return the number of chars read
|
||||||
|
|
||||||
eof: lda #0
|
eof: lda #0
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
lda ptr3
|
lda ptr3
|
||||||
ldx ptr3+1
|
ldx ptr3+1
|
||||||
rts
|
rts
|
||||||
@@ -141,7 +141,7 @@ devnotpresent:
|
|||||||
|
|
||||||
invalidfd:
|
invalidfd:
|
||||||
lda #EBADF
|
lda #EBADF
|
||||||
jmp __directerrno ; Sets _errno, clears _oserror, returns -1
|
jmp ___directerrno ; Sets _errno, clears __oserror, returns -1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
jsr CKOUT
|
jsr CKOUT
|
||||||
bcc @L2
|
bcc @L2
|
||||||
@error: jmp __mappederrno ; Store into __oserror, map to errno, return -1
|
@error: jmp ___mappederrno ; Store into ___oserror, map to errno, return -1
|
||||||
|
|
||||||
; Output the next character from the buffer
|
; Output the next character from the buffer
|
||||||
|
|
||||||
@@ -92,10 +92,10 @@
|
|||||||
|
|
||||||
@L3: jsr CLRCH
|
@L3: jsr CLRCH
|
||||||
|
|
||||||
; Clear _oserror and return the number of chars written
|
; Clear __oserror and return the number of chars written
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
lda ptr3
|
lda ptr3
|
||||||
ldx ptr3+1
|
ldx ptr3+1
|
||||||
rts
|
rts
|
||||||
@@ -112,6 +112,6 @@ devnotpresent:
|
|||||||
|
|
||||||
invalidfd:
|
invalidfd:
|
||||||
lda #EBADF
|
lda #EBADF
|
||||||
jmp __directerrno ; Sets _errno, clears _oserror, returns -1
|
jmp ___directerrno ; Sets _errno, clears __oserror, returns -1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@@ -10,14 +10,14 @@
|
|||||||
.macpack cpu
|
.macpack cpu
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; int __fastcall__ _directerrno (unsigned char code);
|
; int __fastcall__ __directerrno (unsigned char code);
|
||||||
; /* Set errno to a specific error code, clear _oserror, and return -1. Used
|
; /* Set errno to a specific error code, clear __oserror, and return -1. Used
|
||||||
; ** by the library.
|
; ** by the library.
|
||||||
; */
|
; */
|
||||||
|
|
||||||
__directerrno:
|
___directerrno:
|
||||||
jsr __seterrno ; Set errno (returns with .A = 0)
|
jsr ___seterrno ; Set errno (returns with .A = 0)
|
||||||
sta __oserror ; Clear __oserror
|
sta ___oserror ; Clear ___oserror
|
||||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||||
dec a
|
dec a
|
||||||
.else
|
.else
|
||||||
|
@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
invmode:
|
invmode:
|
||||||
lda #EINVAL
|
lda #EINVAL
|
||||||
jsr __seterrno ; Set __errno, returns zero in A
|
jsr ___seterrno ; Set __errno, returns zero in A
|
||||||
tax ; a/x = 0
|
tax ; a/x = 0
|
||||||
jmp incsp4
|
jmp incsp4
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ modeok: ldy #$00
|
|||||||
bne openok
|
bne openok
|
||||||
cmp #$FF
|
cmp #$FF
|
||||||
bne openok
|
bne openok
|
||||||
jmp return0 ; Failure, errno/_oserror already set
|
jmp return0 ; Failure, errno/__oserror already set
|
||||||
|
|
||||||
; Open call succeeded
|
; Open call succeeded
|
||||||
|
|
||||||
|
@@ -11,19 +11,19 @@
|
|||||||
.macpack cpu
|
.macpack cpu
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; int __fastcall__ _mappederrno (unsigned char code);
|
; int __fastcall__ __mappederrno (unsigned char code);
|
||||||
; /* Set _oserror to the given platform-specific error code. If it is a real
|
; /* Set __oserror to the given platform-specific error code. If it is a real
|
||||||
; ** error code (not zero), set errno to the corresponding system error code,
|
; ** error code (not zero), set errno to the corresponding system error code,
|
||||||
; ** and return -1. Otherwise, return zero.
|
; ** and return -1. Otherwise, return zero.
|
||||||
; ** Used by the library.
|
; ** Used by the library.
|
||||||
; */
|
; */
|
||||||
|
|
||||||
__mappederrno:
|
___mappederrno:
|
||||||
sta __oserror ; Store the error code
|
sta ___oserror ; Store the error code
|
||||||
tax ; Did we have an error?
|
tax ; Did we have an error?
|
||||||
bze ok ; Branch if no
|
bze ok ; Branch if no
|
||||||
jsr __osmaperrno ; Map OS error into errno code
|
jsr ___osmaperrno ; Map OS error into errno code
|
||||||
jsr __seterrno ; Save in errno (returns with .A = 0)
|
jsr ___seterrno ; Save in errno (returns with .A = 0)
|
||||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||||
dec a
|
dec a
|
||||||
.else
|
.else
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 16.05.2000
|
; Ullrich von Bassewitz, 16.05.2000
|
||||||
;
|
;
|
||||||
; extern unsigned char _oserror;
|
; extern unsigned char __oserror;
|
||||||
; /* Operating system specific errors from the low level functions */
|
; /* Operating system specific errors from the low level functions */
|
||||||
|
|
||||||
|
|
||||||
.export __oserror
|
.export ___oserror
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
__oserror:
|
___oserror:
|
||||||
.res 1
|
.res 1
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2004-05-13
|
; Ullrich von Bassewitz, 2004-05-13
|
||||||
;
|
;
|
||||||
; __seterrno: Will set __errno to the value in A and return zero in A. Other
|
; ___seterrno: Will set __errno to the value in A and return zero in A. Other
|
||||||
; registers aren't changed. The function is C callable, but
|
; registers aren't changed. The function is C callable, but
|
||||||
; currently only called from asm code.
|
; currently only called from asm code.
|
||||||
;
|
;
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
.proc __seterrno
|
.proc ___seterrno
|
||||||
|
|
||||||
sta __errno
|
sta __errno
|
||||||
lda #0
|
lda #0
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
; Error, no space left
|
; Error, no space left
|
||||||
|
|
||||||
@Error: lda #ENOSPC ; No space left
|
@Error: lda #ENOSPC ; No space left
|
||||||
jsr __seterrno
|
jsr ___seterrno
|
||||||
ldx #$FF ; Return -1
|
ldx #$FF ; Return -1
|
||||||
txa
|
txa
|
||||||
rts
|
rts
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
.export _chdir
|
.export _chdir
|
||||||
|
|
||||||
.import __syschdir
|
.import __syschdir
|
||||||
.import __mappederrno
|
.import ___mappederrno
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------------------------------------------------
|
;--------------------------------------------------------------------------
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
.proc _chdir
|
.proc _chdir
|
||||||
|
|
||||||
jsr __syschdir ; Call the machine specific function
|
jsr __syschdir ; Call the machine specific function
|
||||||
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
|
jmp ___mappederrno ; Store into __oserror, set errno, return 0/-1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
; File is not open
|
; File is not open
|
||||||
|
|
||||||
lda #EINVAL
|
lda #EINVAL
|
||||||
jsr __seterrno
|
jsr ___seterrno
|
||||||
lda #$FF ; Return -1
|
lda #$FF ; Return -1
|
||||||
tax
|
tax
|
||||||
rts
|
rts
|
||||||
|
@@ -78,7 +78,7 @@ err: rts
|
|||||||
; If the file is not valid, fileno must set errno and return -1
|
; If the file is not valid, fileno must set errno and return -1
|
||||||
|
|
||||||
error: lda #<EBADF
|
error: lda #<EBADF
|
||||||
jsr __seterrno
|
jsr ___seterrno
|
||||||
lda #$FF
|
lda #$FF
|
||||||
tax
|
tax
|
||||||
rts
|
rts
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
; Failed to allocate a file stream
|
; Failed to allocate a file stream
|
||||||
|
|
||||||
lda #EMFILE
|
lda #EMFILE
|
||||||
jsr __seterrno ; Set __errno, will return 0 in A
|
jsr ___seterrno ; Set __errno, will return 0 in A
|
||||||
tax
|
tax
|
||||||
rts ; Return zero
|
rts ; Return zero
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@
|
|||||||
; File not open or in error state
|
; File not open or in error state
|
||||||
|
|
||||||
@L1: lda #EINVAL
|
@L1: lda #EINVAL
|
||||||
jsr __seterrno ; Set __errno, return zero in A
|
jsr ___seterrno ; Set __errno, return zero in A
|
||||||
tax ; a/x = 0
|
tax ; a/x = 0
|
||||||
jmp @L99 ; Bail out
|
jmp @L99 ; Bail out
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
; File not open
|
; File not open
|
||||||
|
|
||||||
@L1: lda #EBADF
|
@L1: lda #EBADF
|
||||||
jsr __seterrno ; Returns with A = 0
|
jsr ___seterrno ; Returns with A = 0
|
||||||
tax ; A = X = 0
|
tax ; A = X = 0
|
||||||
jmp incsp6
|
jmp incsp6
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ loop: dec ptr2
|
|||||||
|
|
||||||
overflow:
|
overflow:
|
||||||
lda #<ERANGE
|
lda #<ERANGE
|
||||||
jsr __seterrno ; Returns 0 in A
|
jsr ___seterrno ; Returns 0 in A
|
||||||
tax ; Return zero
|
tax ; Return zero
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
.export _mkdir
|
.export _mkdir
|
||||||
|
|
||||||
.import __sysmkdir
|
.import __sysmkdir
|
||||||
.import __mappederrno
|
.import ___mappederrno
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------------------------------------------------
|
;--------------------------------------------------------------------------
|
||||||
@@ -15,6 +15,6 @@
|
|||||||
.proc _mkdir
|
.proc _mkdir
|
||||||
|
|
||||||
jsr __sysmkdir ; Call the machine specific function
|
jsr __sysmkdir ; Call the machine specific function
|
||||||
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
|
jmp ___mappederrno ; Store into __oserror, set errno, return 0/-1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@@ -169,7 +169,7 @@ addentry:
|
|||||||
; Error entries
|
; Error entries
|
||||||
|
|
||||||
nomem: lda #ENOMEM
|
nomem: lda #ENOMEM
|
||||||
error: jsr __seterrno
|
error: jsr ___seterrno
|
||||||
lda #$FF ; Return -1
|
lda #$FF ; Return -1
|
||||||
tax
|
tax
|
||||||
rts
|
rts
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
.export _remove
|
.export _remove
|
||||||
|
|
||||||
.import __sysremove
|
.import __sysremove
|
||||||
.import __mappederrno
|
.import ___mappederrno
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------------------------------------------------
|
;--------------------------------------------------------------------------
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
.proc _remove
|
.proc _remove
|
||||||
|
|
||||||
jsr __sysremove ; Call the machine specific function
|
jsr __sysremove ; Call the machine specific function
|
||||||
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
|
jmp ___mappederrno ; Store into __oserror, set errno, return 0/-1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
.export _rename
|
.export _rename
|
||||||
|
|
||||||
.import __sysrename
|
.import __sysrename
|
||||||
.import __mappederrno
|
.import ___mappederrno
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------------------------------------------------
|
;--------------------------------------------------------------------------
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
.proc _rename
|
.proc _rename
|
||||||
|
|
||||||
jsr __sysrename ; Call the machine specific function
|
jsr __sysrename ; Call the machine specific function
|
||||||
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
|
jmp ___mappederrno ; Store into __oserror, set errno, return 0/-1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
.export _rmdir
|
.export _rmdir
|
||||||
|
|
||||||
.import __sysrmdir
|
.import __sysrmdir
|
||||||
.import __mappederrno
|
.import ___mappederrno
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------------------------------------------------
|
;--------------------------------------------------------------------------
|
||||||
@@ -15,6 +15,6 @@
|
|||||||
.proc _rmdir
|
.proc _rmdir
|
||||||
|
|
||||||
jsr __sysrmdir ; Call the machine specific function
|
jsr __sysrmdir ; Call the machine specific function
|
||||||
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
|
jmp ___mappederrno ; Store into __oserror, set errno, return 0/-1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@@ -61,7 +61,7 @@ ___sig_ign:
|
|||||||
|
|
||||||
invalidsig:
|
invalidsig:
|
||||||
lda #<EINVAL
|
lda #<EINVAL
|
||||||
jsr __seterrno ; Returns 0 in A
|
jsr ___seterrno ; Returns 0 in A
|
||||||
tax ; A/X = 0
|
tax ; A/X = 0
|
||||||
___sig_dfl:
|
___sig_dfl:
|
||||||
rts
|
rts
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
.export _uname
|
.export _uname
|
||||||
|
|
||||||
.import __sysuname
|
.import __sysuname
|
||||||
.import __mappederrno
|
.import ___mappederrno
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------------------------------------------------
|
;--------------------------------------------------------------------------
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
.proc _uname
|
.proc _uname
|
||||||
|
|
||||||
jsr __sysuname ; Call the machine specific function
|
jsr __sysuname ; Call the machine specific function
|
||||||
jmp __mappederrno ; Store into _oserror, set errno, return 0/-1
|
jmp ___mappederrno ; Store into __oserror, set errno, return 0/-1
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@
|
|||||||
; File is not open or the character is invalid
|
; File is not open or the character is invalid
|
||||||
|
|
||||||
error: lda #EINVAL
|
error: lda #EINVAL
|
||||||
jsr __seterrno
|
jsr ___seterrno
|
||||||
lda #$FF ; Return -1
|
lda #$FF ; Return -1
|
||||||
tax
|
tax
|
||||||
rts
|
rts
|
||||||
|
@@ -140,7 +140,7 @@ L0: ldy #EINVAL
|
|||||||
pla ; Drop ap
|
pla ; Drop ap
|
||||||
pla
|
pla
|
||||||
tya
|
tya
|
||||||
jsr __directerrno ; Return -1
|
jsr ___directerrno ; Return -1
|
||||||
jmp incsp6 ; Drop parameters
|
jmp incsp6 ; Drop parameters
|
||||||
|
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
.export _dio_phys_to_log
|
.export _dio_phys_to_log
|
||||||
.export sectab_1541_l, sectab_1541_h ; for log_to_phys
|
.export sectab_1541_l, sectab_1541_h ; for log_to_phys
|
||||||
.import popax,__oserror
|
.import popax,___oserror
|
||||||
.importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4
|
.importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4
|
||||||
|
|
||||||
.include "dio.inc"
|
.include "dio.inc"
|
||||||
@@ -82,7 +82,7 @@ dio_ctsend:
|
|||||||
ldx #0
|
ldx #0
|
||||||
txa
|
txa
|
||||||
ret:
|
ret:
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
rts ; return success
|
rts ; return success
|
||||||
|
|
||||||
; errors
|
; errors
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
; dio_close does nothing special
|
; dio_close does nothing special
|
||||||
|
|
||||||
.export _dio_open, _dio_close
|
.export _dio_open, _dio_close
|
||||||
.import __oserror, _OpenDisk
|
.import ___oserror, _OpenDisk
|
||||||
.importzp ptr1, tmp1
|
.importzp ptr1, tmp1
|
||||||
|
|
||||||
.include "dio.inc"
|
.include "dio.inc"
|
||||||
@@ -69,7 +69,7 @@ _dio_open:
|
|||||||
|
|
||||||
_inv_drive:
|
_inv_drive:
|
||||||
lda #DEV_NOT_FOUND
|
lda #DEV_NOT_FOUND
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
lda #0
|
lda #0
|
||||||
tax
|
tax
|
||||||
rts
|
rts
|
||||||
@@ -80,6 +80,6 @@ _dio_close:
|
|||||||
lda #0
|
lda #0
|
||||||
ldy #sst_flag
|
ldy #sst_flag
|
||||||
sta (ptr1),y
|
sta (ptr1),y
|
||||||
sta __oserror ; success
|
sta ___oserror ; success
|
||||||
tax
|
tax
|
||||||
rts ; return no error
|
rts ; return no error
|
||||||
|
@@ -5,11 +5,11 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.export _dio_query_sectcount
|
.export _dio_query_sectcount
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
|
|
||||||
_dio_query_sectcount:
|
_dio_query_sectcount:
|
||||||
lda #0
|
lda #0
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
lda #<683
|
lda #<683
|
||||||
ldx #>683
|
ldx #>683
|
||||||
rts
|
rts
|
||||||
|
@@ -5,10 +5,10 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.export _dio_query_sectsize
|
.export _dio_query_sectsize
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
|
|
||||||
_dio_query_sectsize:
|
_dio_query_sectsize:
|
||||||
lda #<256
|
lda #<256
|
||||||
ldx #>256
|
ldx #>256
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
rts
|
rts
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.export _dio_read
|
.export _dio_read
|
||||||
.import dio_params, __oserror
|
.import dio_params, ___oserror
|
||||||
|
|
||||||
.include "geossym.inc"
|
.include "geossym.inc"
|
||||||
.include "jumptab.inc"
|
.include "jumptab.inc"
|
||||||
@@ -18,6 +18,6 @@ _dio_read:
|
|||||||
tay
|
tay
|
||||||
bne err
|
bne err
|
||||||
jsr ReadBlock
|
jsr ReadBlock
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
txa
|
txa
|
||||||
err: rts
|
err: rts
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
.export _dio_log_to_phys
|
.export _dio_log_to_phys
|
||||||
.importzp ptr1,ptr2,ptr3,tmp1,tmp2
|
.importzp ptr1,ptr2,ptr3,tmp1,tmp2
|
||||||
.import popax,__oserror
|
.import popax,___oserror
|
||||||
.import sectab_1541_l, sectab_1541_h
|
.import sectab_1541_l, sectab_1541_h
|
||||||
|
|
||||||
.include "dio.inc"
|
.include "dio.inc"
|
||||||
@@ -78,7 +78,7 @@ dio_stcend:
|
|||||||
ldx #0
|
ldx #0
|
||||||
txa
|
txa
|
||||||
_ret:
|
_ret:
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
rts ; return success
|
rts ; return success
|
||||||
|
|
||||||
; errors
|
; errors
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.export _dio_write_verify
|
.export _dio_write_verify
|
||||||
.import dio_params, __oserror
|
.import dio_params, ___oserror
|
||||||
|
|
||||||
.include "geossym.inc"
|
.include "geossym.inc"
|
||||||
.include "jumptab.inc"
|
.include "jumptab.inc"
|
||||||
@@ -18,6 +18,6 @@ _dio_write_verify:
|
|||||||
tay
|
tay
|
||||||
bne err
|
bne err
|
||||||
jsr VerWriteBlock
|
jsr VerWriteBlock
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
txa
|
txa
|
||||||
err: rts
|
err: rts
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
; int CalcBlksFree (void);
|
; int CalcBlksFree (void);
|
||||||
|
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
.export _CalcBlksFree
|
.export _CalcBlksFree
|
||||||
|
|
||||||
.include "jumptab.inc"
|
.include "jumptab.inc"
|
||||||
@@ -18,7 +18,7 @@ _CalcBlksFree:
|
|||||||
sta r5L
|
sta r5L
|
||||||
stx r5H
|
stx r5H
|
||||||
jsr CalcBlksFree
|
jsr CalcBlksFree
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
lda r4L
|
lda r4L
|
||||||
ldx r4H
|
ldx r4H
|
||||||
rts
|
rts
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
; (fills curName[17] with current disk's name)
|
; (fills curName[17] with current disk's name)
|
||||||
|
|
||||||
.importzp ptr4, ptr3
|
.importzp ptr4, ptr3
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
.export _GetPtrCurDkNm
|
.export _GetPtrCurDkNm
|
||||||
|
|
||||||
.include "jumptab.inc"
|
.include "jumptab.inc"
|
||||||
@@ -34,5 +34,5 @@ namelp: lda (ptr4),y
|
|||||||
bne namelp
|
bne namelp
|
||||||
fin: lda #0
|
fin: lda #0
|
||||||
sta (ptr3),y
|
sta (ptr3),y
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
rts
|
rts
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
; struct tr_se SetNextFree (struct tr_se *startTS);
|
; struct tr_se SetNextFree (struct tr_se *startTS);
|
||||||
|
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
.import gettrse
|
.import gettrse
|
||||||
.export _SetNextFree
|
.export _SetNextFree
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ _SetNextFree:
|
|||||||
sta r3L
|
sta r3L
|
||||||
stx r3H
|
stx r3H
|
||||||
jsr SetNextFree
|
jsr SetNextFree
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
lda r3L
|
lda r3L
|
||||||
ldx r3H
|
ldx r3H
|
||||||
rts
|
rts
|
||||||
|
@@ -14,7 +14,7 @@ FILEDES = 3 ; first free to use file descriptor
|
|||||||
|
|
||||||
.importzp ptr1, ptr2, ptr3, tmp1
|
.importzp ptr1, ptr2, ptr3, tmp1
|
||||||
.import addysp, popax, popptr1
|
.import addysp, popax, popptr1
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
.import _FindFile, _ReadByte
|
.import _FindFile, _ReadByte
|
||||||
.export _open, _close, _read
|
.export _open, _close, _read
|
||||||
|
|
||||||
@@ -65,8 +65,8 @@ _open:
|
|||||||
stx f_offset
|
stx f_offset
|
||||||
stx f_offset+1
|
stx f_offset+1
|
||||||
lda #0 ; clear errors
|
lda #0 ; clear errors
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
jsr __seterrno
|
jsr ___seterrno
|
||||||
lda #FILEDES ; return fd
|
lda #FILEDES ; return fd
|
||||||
sta filedesc
|
sta filedesc
|
||||||
rts
|
rts
|
||||||
@@ -75,14 +75,14 @@ _open:
|
|||||||
.byte $2c ; skip
|
.byte $2c ; skip
|
||||||
@alreadyopen:
|
@alreadyopen:
|
||||||
lda #EMFILE ; too many opened files (there can be only one)
|
lda #EMFILE ; too many opened files (there can be only one)
|
||||||
jmp __directerrno ; set errno, clear oserror, return -1
|
jmp ___directerrno ; set errno, clear oserror, return -1
|
||||||
@oserror:
|
@oserror:
|
||||||
jmp __mappederrno ; set platform error code, return -1
|
jmp ___mappederrno ; set platform error code, return -1
|
||||||
|
|
||||||
_close:
|
_close:
|
||||||
lda #0
|
lda #0
|
||||||
sta __oserror
|
sta ___oserror
|
||||||
jsr __seterrno ; clear errors
|
jsr ___seterrno ; clear errors
|
||||||
lda #0 ; clear fd
|
lda #0 ; clear fd
|
||||||
sta filedesc
|
sta filedesc
|
||||||
tax
|
tax
|
||||||
@@ -92,7 +92,7 @@ _read:
|
|||||||
; a/x - number of bytes
|
; a/x - number of bytes
|
||||||
; popax - buffer ptr
|
; popax - buffer ptr
|
||||||
; popax - fd, must be == to the above one
|
; popax - fd, must be == to the above one
|
||||||
; return -1+__oserror or number of bytes read
|
; return -1+___oserror or number of bytes read
|
||||||
|
|
||||||
inx
|
inx
|
||||||
stx ptr1+1
|
stx ptr1+1
|
||||||
@@ -111,14 +111,14 @@ _read:
|
|||||||
|
|
||||||
@filenotopen:
|
@filenotopen:
|
||||||
lda #EBADF
|
lda #EBADF
|
||||||
jmp __directerrno ; Sets _errno, clears _oserror, returns -1
|
jmp ___directerrno ; Sets _errno, clears __oserror, returns -1
|
||||||
|
|
||||||
@fileok:
|
@fileok:
|
||||||
lda #0
|
lda #0
|
||||||
sta ptr3
|
sta ptr3
|
||||||
sta ptr3+1 ; put 0 into ptr3 (number of bytes read)
|
sta ptr3+1 ; put 0 into ptr3 (number of bytes read)
|
||||||
sta __oserror ; clear error flags
|
sta ___oserror ; clear error flags
|
||||||
jsr __seterrno
|
jsr ___seterrno
|
||||||
|
|
||||||
lda f_track ; restore stuff for ReadByte
|
lda f_track ; restore stuff for ReadByte
|
||||||
ldx f_sector
|
ldx f_sector
|
||||||
@@ -147,11 +147,11 @@ _read:
|
|||||||
bne @L2
|
bne @L2
|
||||||
inc ptr3+1
|
inc ptr3+1
|
||||||
|
|
||||||
@L2: lda __oserror ; was there error ?
|
@L2: lda ___oserror ; was there error ?
|
||||||
beq @L3
|
beq @L3
|
||||||
cmp #BFR_OVERFLOW ; EOF?
|
cmp #BFR_OVERFLOW ; EOF?
|
||||||
beq @done ; yes, we're done
|
beq @done ; yes, we're done
|
||||||
jmp __mappederrno ; no, we're screwed
|
jmp ___mappederrno ; no, we're screwed
|
||||||
|
|
||||||
@L3: dec ptr1 ; decrement the count
|
@L3: dec ptr1 ; decrement the count
|
||||||
bne @L0
|
bne @L0
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
; struct filehandle* Get1stDirEntry (void);
|
; struct filehandle* Get1stDirEntry (void);
|
||||||
|
|
||||||
.import __oserror, return0
|
.import ___oserror, return0
|
||||||
.export _Get1stDirEntry
|
.export _Get1stDirEntry
|
||||||
|
|
||||||
.include "diskdrv.inc"
|
.include "diskdrv.inc"
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
_Get1stDirEntry:
|
_Get1stDirEntry:
|
||||||
jsr Get1stDirEntry
|
jsr Get1stDirEntry
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
txa
|
txa
|
||||||
bne L1 ; jump if disk error
|
bne L1 ; jump if disk error
|
||||||
lda r5L
|
lda r5L
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
; struct filehandle* GetNxtDirEntry (void);
|
; struct filehandle* GetNxtDirEntry (void);
|
||||||
|
|
||||||
.import __oserror, return0
|
.import ___oserror, return0
|
||||||
.export _GetNxtDirEntry
|
.export _GetNxtDirEntry
|
||||||
|
|
||||||
.include "diskdrv.inc"
|
.include "diskdrv.inc"
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
_GetNxtDirEntry:
|
_GetNxtDirEntry:
|
||||||
jsr GetNxtDirEntry
|
jsr GetNxtDirEntry
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
txa
|
txa
|
||||||
bne L1 ; jump if disk error
|
bne L1 ; jump if disk error
|
||||||
tya
|
tya
|
||||||
|
@@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
; char ReadByte (void);
|
; char ReadByte (void);
|
||||||
|
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
.export _ReadByte
|
.export _ReadByte
|
||||||
|
|
||||||
.include "jumptab.inc"
|
.include "jumptab.inc"
|
||||||
|
|
||||||
_ReadByte:
|
_ReadByte:
|
||||||
jsr ReadByte
|
jsr ReadByte
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
ldx #0
|
ldx #0
|
||||||
rts
|
rts
|
||||||
|
@@ -3,16 +3,16 @@
|
|||||||
; GEOS port: Maciej 'YTM/Elysium' Witkowiak
|
; GEOS port: Maciej 'YTM/Elysium' Witkowiak
|
||||||
; 2.7.2001
|
; 2.7.2001
|
||||||
;
|
;
|
||||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
; /* Map a system specific error into a system independent code */
|
; /* Map a system specific error into a system independent code */
|
||||||
;
|
;
|
||||||
|
|
||||||
.export __osmaperrno
|
.export ___osmaperrno
|
||||||
|
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
.include "const.inc"
|
.include "const.inc"
|
||||||
|
|
||||||
__osmaperrno:
|
___osmaperrno:
|
||||||
ldx #ErrTabSize
|
ldx #ErrTabSize
|
||||||
@L1: cmp ErrTab-2,x ; Search for the error code
|
@L1: cmp ErrTab-2,x ; Search for the error code
|
||||||
beq @L2 ; Jump if found
|
beq @L2 ; Jump if found
|
||||||
|
@@ -5,10 +5,10 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.export setoserror
|
.export setoserror
|
||||||
.import __oserror
|
.import ___oserror
|
||||||
|
|
||||||
setoserror:
|
setoserror:
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
txa
|
txa
|
||||||
ldx #0 ; X is cleared (high byte for promoting char to int)
|
ldx #0 ; X is cleared (high byte for promoting char to int)
|
||||||
tay ; Y register is used just to save flags state
|
tay ; Y register is used just to save flags state
|
||||||
|
@@ -66,7 +66,7 @@ parmok: jsr popax
|
|||||||
beq flagsok
|
beq flagsok
|
||||||
jsr popax
|
jsr popax
|
||||||
lda #EINVAL
|
lda #EINVAL
|
||||||
jmp __directerrno
|
jmp ___directerrno
|
||||||
|
|
||||||
flagsok:
|
flagsok:
|
||||||
jsr popax
|
jsr popax
|
||||||
@@ -74,7 +74,7 @@ flagsok:
|
|||||||
jsr _openn
|
jsr _openn
|
||||||
ldx #$00
|
ldx #$00
|
||||||
lda #$01
|
lda #$01
|
||||||
stx __oserror
|
stx ___oserror
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
;
|
;
|
||||||
; Karri Kaksonen, 2010
|
; Karri Kaksonen, 2010
|
||||||
;
|
;
|
||||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
; /* Map a system specific error into a system independent code */
|
; /* Map a system specific error into a system independent code */
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -9,6 +9,6 @@
|
|||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
__osmaperrno:
|
___osmaperrno:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@@ -4,14 +4,14 @@
|
|||||||
; original by
|
; original by
|
||||||
; Stefan Haubenthal, 2011-04-18
|
; Stefan Haubenthal, 2011-04-18
|
||||||
;
|
;
|
||||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
; /* Map a system specific error into a system independent code */
|
; /* Map a system specific error into a system independent code */
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
.export __osmaperrno
|
.export ___osmaperrno
|
||||||
|
|
||||||
.proc __osmaperrno
|
.proc ___osmaperrno
|
||||||
|
|
||||||
lda #<EUNKNOWN
|
lda #<EUNKNOWN
|
||||||
ldx #>EUNKNOWN
|
ldx #>EUNKNOWN
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
;
|
;
|
||||||
; Jede, 2017-10-27
|
; Jede, 2017-10-27
|
||||||
;
|
;
|
||||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
; int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
; /* Map a system specific error into a system independent code */
|
; /* Map a system specific error into a system independent code */
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
.export __osmaperrno
|
.export ___osmaperrno
|
||||||
|
|
||||||
.proc __osmaperrno
|
.proc ___osmaperrno
|
||||||
|
|
||||||
lda #<EUNKNOWN
|
lda #<EUNKNOWN
|
||||||
ldx #>EUNKNOWN
|
ldx #>EUNKNOWN
|
||||||
|
Reference in New Issue
Block a user