1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

improved chk_supp: only do the test on SpartaDOS and only if the SDOS version

is below 4 (4 is SpartaDOS-X and supports seeking on all file systems)


git-svn-id: svn://svn.cc65.org/cc65/trunk@1362 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cpg 2002-07-16 19:27:51 +00:00
parent 3fd58b9068
commit 2d7f755c32

View File

@ -10,7 +10,7 @@
.export _lseek
.import incsp6,__oserror
.import __inviocb,ldax0sp,ldaxysp,fdtoiocb
.import __seterrno
.import __seterrno,__dos_type
.import fd_table
.importzp sreg,ptr1,ptr2,ptr3,ptr4
.importzp tmp1,tmp2,tmp3
@ -179,8 +179,9 @@ seek: jsr ldax0sp ; get lower word of new offset
; tmp3: iocb
; X: index into fd_table
;
; On non-SpartaDOS, seeking is not supported.
; We check, whether CIO function 39 (get file size) returns OK.
; If yes, NOTE and POINT work with real file offset. @@@ check out more DOS versions @@@
; If yes, NOTE and POINT work with real file offset.
; If not, NOTE and POINT work with the standard ScNum/Offset values.
; We remember a successful check in fd_table.ft_flag, bit 3.
@ -190,8 +191,14 @@ chk_supp:
bne supp
; do the test
unkn: txa
lda __dos_type
cmp #SPARTADOS
bne ns1
txa
pha
lda DOS+1 ; get SpartaDOS version
cmp #$40
bcs supp1 ; SD-X (ver 4.xx) supports seeking on all disks
ldx tmp3 ; iocb to use
lda #39 ; get file size
sta ICCOM,x
@ -200,7 +207,7 @@ unkn: txa
; seeking is supported on this DOS/Disk combination
pla
supp1: pla
tax
lda #8
ora fd_table+ft_flag,x
@ -209,6 +216,6 @@ supp: sec
rts
notsupp:pla
clc
ns1: clc
rts