Added check for disk in drive on chdir().

git-svn-id: svn://svn.cc65.org/cc65/trunk@5859 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
ol.sc
2012-10-17 20:24:43 +00:00
parent cb668eff63
commit 1a80cd1071
4 changed files with 76 additions and 48 deletions

View File

@@ -5,7 +5,7 @@
;
.export __syschdir
.import curunit, initcwd
.import diskinit, fnunit, curunit, initcwd
.importzp ptr1, tmp1, tmp2
;--------------------------------------------------------------------------
@@ -31,7 +31,7 @@
iny
lda (ptr1),y
beq done
beq init
jsr getdigit
bcs err
stx tmp1 ; First digit
@@ -60,13 +60,22 @@
lda (ptr1),y
bne err
; Check device readiness
init: txa
jsr diskinit
bne done
; Success, update cwd
done: stx curunit
lda fnunit ; Set by diskinit
sta curunit
jmp initcwd ; Returns with A = 0
; Return with error in A
err: lda #9 ; "Ilegal device"
rts
done: rts
.endproc