small improvements for LOAD command and IEC routines

This commit is contained in:
FeralChild64 committed 2019-07-16 22:22:01 +02:00
1 parent 3cae7f7366
commit ecf1b3aa50
8 files changed
+96 -40

No files matched your search

+16
View File
@@ -1,3 +1,19 @@
; Function defined on pp272-273 of C64 Programmers Reference Guide
chkin:
;; Implemented according to 'C64 Programmers Reference Guide', page 277
;; First retrieve the FAT/LAT/SAT table index (and check if file is open)
; txa
; jsr find_fls
; bcs kernalerror_FILE_NOT_OPEN
;; Now we have table index in Y - check if file is open for reading
;; XXX continue implementation
rts
+14
View File
@@ -1,3 +1,17 @@
; Function defined on pp272-273 of C64 Programmers Reference Guide
chkout:
;; Implemented according to 'C64 Programmers Reference Guide', page 278
;; First retrieve the FAT/LAT/SAT table index (and check if file is open)
; txa
; jsr find_fls
; bcs kernalerror_FILE_NOT_OPEN
;; Now we have table index in Y - check if file is open for writing
;; XXX continue implementation
rts
+10 -15
View File
@@ -4,19 +4,14 @@ close:
;; Implemented accorging to 'C64 Programmers Reference Guide', page 281
;; XXX this needs more testing (opening 10 files at once, closing in various orders, etc) once the code is more mature
;; Find the LAT / SAT / FAT entry which LAT corresponds to A
ldy LDTND
beq close_error_not_found ; table empty
*
dey
bmi close_error_not_found ; no more entries
cmp LAT, y
bne - ; does not match, try the next one
jsr find_fls
bcs close_error_not_found ;; XXX can we report error in IOSTATUS here?
;; We have the entry index in Y
;; XXX some devices (like IEC) needs special support here, to free their internal resources!
;; Just make sure the Y register value is kept, or redo ldy DFTLN
*
@@ -33,9 +28,9 @@ close:
*
;; Decrement the list size variable
dec LDTND
;; FALLTHROUGH (for now) - success
;; FALLTHROUGH - success
close_error_not_found:
;; XXX it seems that this function can't report errors, am I right?
rts
+23
View File
@@ -0,0 +1,23 @@
;; Just a helper routine
;; Find the LAT / SAT / FAT entry index where LAT corresponds to A, returns index in Y
;; Carry flag set means not found
find_fls:
ldy LDTND
beq find_fls_not_found ; table empty
*
dey
bmi find_fls_not_found ; no more entries
cmp LAT, y
bne - ; does not match, try the next one
clc
rts
find_fls_not_found:
sec
rts
+4 -8
View File
@@ -54,9 +54,6 @@ print_filename_loop:
iny
jmp print_filename_loop
*
lda #$0d
jsr JCHROUT
;; XXX - Use default device number
;; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
;; p13, 16.
@@ -145,11 +142,11 @@ sent_filename:
lda kernal_load_or_verify_flag
beq +
jsr printf
.byte "VERIFYING", 0
.byte $0D, "VERIFYING", 0
jmp load_print_start_addr
*
jsr printf
.byte "LOADING", 0
.byte $0D, "LOADING", 0
load_print_start_addr:
jsr printf
.byte " FROM $",0
@@ -223,9 +220,8 @@ load_done:
;; Set IEC status back to idle
jsr iec_set_idle
;; Return last address written to +1
;; (Even though Compute's Mapping the 64 says without the +1.
;; I'm suspicious. Will have to check behavour on an original C64)
;; Return last address - Compute's Mapping the 64 says without the '+1',
;; checked on original ROMs that this is really the case
ldx load_save_start_ptr+0
ldy load_save_start_ptr+1