aboutsummaryrefslogtreecommitdiff
path: root/dla.s
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2022-10-31 19:14:13 -0400
committerB. Watson <urchlay@slackware.uk>2022-10-31 19:14:13 -0400
commit6972583ba8a6ef5f949891e283b3a1061d580434 (patch)
treee876fb9047a9683d41d368ddac764a53f94c8f7c /dla.s
parentcd88b74b498f8559c1eca20139e43543086c9c4c (diff)
downloaddla-asm-6972583ba8a6ef5f949891e283b3a1061d580434.tar.gz
Update README, close IOCB before open, "Saved OK" prompt.
Diffstat (limited to 'dla.s')
-rw-r--r--dla.s33
1 files changed, 25 insertions, 8 deletions
diff --git a/dla.s b/dla.s
index 3388f6a..c4aaaa9 100644
--- a/dla.s
+++ b/dla.s
@@ -293,6 +293,8 @@ saveimage:
jsr printmsg ; ...prompt for, and...
jsr readline ; ...let the user type a filename.
+ jsr close1 ; make sure the IOCB is closed before we open it!
+
; CIO is nice, but it's kind of a PITA to use...
; OPEN #1,8,0,<filename>
ldx #$10
@@ -312,10 +314,10 @@ saveimage:
lda #8
sta ICAX1,x
jsr CIOV
- cpy #1
+ cpy #1 ; CIO returns with Y=1 for success.
bne save_error
- ; write data to file
+ ; write data to the channel
ldx #$10
lda #$0b ; write binary record
sta ICCOM,x
@@ -331,15 +333,19 @@ saveimage:
cpy #1
bne save_error
- ; CLOSE #1
- ldx #$10
- lda #$0c ; close
- sta ICCOM,x
- jsr CIOV
+ ; close the channel
+ jsr close1
cpy #1
bne save_error
+
+ ; let the user know the save worked.
+ lda #<saveokmsg
+ ldx #>saveokmsg
+ jsr printmsg
+ jsr getchr ; any key
jmp getargs
+ ; print error message, prompt for retry.
save_error:
tya
pha
@@ -353,7 +359,7 @@ save_error:
jsr printmsg
get_retry_key:
jsr getchr
- cmp #$9b
+ cmp #$9b ; return = yes
beq jsaveimage
and #$5f ; ignore case
cmp #'Y'
@@ -705,6 +711,14 @@ restore_gr0:
sta SAVMSC+1
rts
+;;; Subroutine: close1
+;;; Closes IOCB 1, same as CLOSE #1 in BASIC.
+close1:
+ ldx #$10
+ lda #$0c ; close
+ sta ICCOM,x
+ jmp CIOV
+
;;;;; end of executable code, data tables from here on out.
; prompts.
@@ -727,6 +741,9 @@ seedprompt2:
saveprompt:
.byte $7d, "Save: Enter filename, including Dn:",$9b,"> ",$0
+saveokmsg:
+ .byte "Saved OK, press any key...",$0
+
diskerrmsg:
.byte "I/O Error ",$0