From 6972583ba8a6ef5f949891e283b3a1061d580434 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 31 Oct 2022 19:14:13 -0400 Subject: Update README, close IOCB before open, "Saved OK" prompt. --- dla.s | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'dla.s') 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, 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 + 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 -- cgit v1.2.3