work on LOAD routine
This commit is contained in:
1 parent
e42f63f190
commit
ac1fb40eb6
3 files changed
+23
-27
No files matched your search
@@ -11,6 +11,10 @@ cmd_load:
|
|||||||
;; middle of a program. For safety, we do.
|
;; middle of a program. For safety, we do.
|
||||||
jsr basic_do_clr
|
jsr basic_do_clr
|
||||||
|
|
||||||
|
;; XXX temporary, to set valid device number
|
||||||
|
lda #$08
|
||||||
|
sta current_device_number
|
||||||
|
|
||||||
;; Set filename and length
|
;; Set filename and length
|
||||||
lda #$00
|
lda #$00
|
||||||
sta current_filename_length
|
sta current_filename_length
|
||||||
|
|||||||
+18
-26
@@ -38,6 +38,7 @@ load:
|
|||||||
|
|
||||||
ldy #$00
|
ldy #$00
|
||||||
print_filename_loop:
|
print_filename_loop:
|
||||||
|
|
||||||
cpy current_filename_length
|
cpy current_filename_length
|
||||||
beq +
|
beq +
|
||||||
ldx #<current_filename_ptr
|
ldx #<current_filename_ptr
|
||||||
@@ -46,7 +47,6 @@ print_filename_loop:
|
|||||||
iny
|
iny
|
||||||
jmp print_filename_loop
|
jmp print_filename_loop
|
||||||
*
|
*
|
||||||
|
|
||||||
lda #$0d
|
lda #$0d
|
||||||
jsr $ffd2
|
jsr $ffd2
|
||||||
|
|
||||||
@@ -56,28 +56,21 @@ print_filename_loop:
|
|||||||
;; also p16 tells us this routine doesn't mess with the file table in the C64,
|
;; also p16 tells us this routine doesn't mess with the file table in the C64,
|
||||||
;; only in the drive.
|
;; only in the drive.
|
||||||
|
|
||||||
;; XXX - Use default device number
|
|
||||||
;; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
|
||||||
;; p13, 16.
|
|
||||||
;; also p16 tells us this routine doesn't mess with the file table in the C64,
|
|
||||||
;; only in the drive.
|
|
||||||
|
|
||||||
;; Call device to LISTEN (p16)
|
;; Call device to LISTEN (p16)
|
||||||
lda #$28
|
lda current_device_number
|
||||||
jsr iec_tx_command
|
jsr listen
|
||||||
bcs load_error
|
bcs load_error
|
||||||
|
|
||||||
;; Open channel #0 (p16)
|
;; Open channel #0 (p16)
|
||||||
lda #$f0
|
lda #$00
|
||||||
jsr iec_tx_command
|
jsr tksa
|
||||||
bcs load_error
|
bcs load_error
|
||||||
|
|
||||||
jsr iec_set_idle
|
|
||||||
|
|
||||||
;; Send filename (p16)
|
;; Send filename (p16)
|
||||||
ldy #0
|
ldy #0
|
||||||
|
|
||||||
send_filename:
|
send_filename:
|
||||||
|
|
||||||
cpy current_filename_length
|
cpy current_filename_length
|
||||||
beq sent_filename
|
beq sent_filename
|
||||||
|
|
||||||
@@ -99,14 +92,13 @@ send_filename:
|
|||||||
|
|
||||||
sent_filename:
|
sent_filename:
|
||||||
;; Command device to unlisten to indicate end of file name. (p16)
|
;; Command device to unlisten to indicate end of file name. (p16)
|
||||||
lda #$3f
|
jsr unlsn
|
||||||
jsr iec_tx_command
|
|
||||||
bcs load_error
|
bcs load_error
|
||||||
jsr iec_set_idle
|
jsr iec_set_idle
|
||||||
|
|
||||||
;; Now command device to talk (p16)
|
;; Now command device to talk (p16)
|
||||||
lda #$48
|
lda current_device_number
|
||||||
jsr iec_tx_command
|
jsr talk
|
||||||
bcs load_error
|
bcs load_error
|
||||||
|
|
||||||
lda #$60 ; open channel / data (p3) , required according to p13
|
lda #$60 ; open channel / data (p3) , required according to p13
|
||||||
@@ -116,9 +108,12 @@ sent_filename:
|
|||||||
;; We are currently talker, so do the IEC turn around so that we
|
;; We are currently talker, so do the IEC turn around so that we
|
||||||
;; are the listener (p16)
|
;; are the listener (p16)
|
||||||
;; An error here means FILE NOT FOUND ?
|
;; An error here means FILE NOT FOUND ?
|
||||||
;; XXX jsr iec_turnaround_to_listen
|
jsr iec_turnaround_to_listen
|
||||||
bcs load_error
|
bcs load_error
|
||||||
|
|
||||||
|
jsr printf
|
||||||
|
.byte "DBG: LOAD 1", $0D, 0
|
||||||
|
|
||||||
;; Get load address and store it if secondary address is zero
|
;; Get load address and store it if secondary address is zero
|
||||||
jsr iec_rx_byte
|
jsr iec_rx_byte
|
||||||
bcs file_not_found_error
|
bcs file_not_found_error
|
||||||
@@ -126,13 +121,12 @@ sent_filename:
|
|||||||
beq +
|
beq +
|
||||||
sta load_save_start_ptr+0
|
sta load_save_start_ptr+0
|
||||||
*
|
*
|
||||||
jsr iec_tx_command
|
jsr iec_rx_byte
|
||||||
bcs file_not_found_error
|
bcs file_not_found_error
|
||||||
ldx current_secondary_address
|
ldx current_secondary_address
|
||||||
beq +
|
beq +
|
||||||
sta load_save_start_ptr+1
|
sta load_save_start_ptr+1
|
||||||
*
|
*
|
||||||
|
|
||||||
jsr printf
|
jsr printf
|
||||||
.byte "LOADING",$0d,0
|
.byte "LOADING",$0d,0
|
||||||
|
|
||||||
@@ -171,15 +165,13 @@ load_done:
|
|||||||
;; Close file on drive
|
;; Close file on drive
|
||||||
|
|
||||||
;; Command drive to stop talking and to close the file
|
;; Command drive to stop talking and to close the file
|
||||||
lda #$5f
|
jsr untlk
|
||||||
jsr iec_tx_command
|
lda current_device_number
|
||||||
lda #$28
|
jsr listen
|
||||||
jsr iec_tx_command
|
|
||||||
lda #$e0
|
lda #$e0
|
||||||
jsr iec_tx_command
|
jsr iec_tx_command
|
||||||
;; Tell drive to unlisten
|
;; Tell drive to unlisten
|
||||||
lda #$3f
|
jsr unlsn
|
||||||
jsr iec_tx_command
|
|
||||||
|
|
||||||
;; Return last address written to +1
|
;; Return last address written to +1
|
||||||
;; (Even though Compute's Mapping the 64 says without the +1.
|
;; (Even though Compute's Mapping the 64 says without the +1.
|
||||||
|
|||||||
+1
-1
@@ -3,6 +3,6 @@
|
|||||||
unlsn:
|
unlsn:
|
||||||
|
|
||||||
;; This trivial routine is documented in 'Compute's Mapping the Commodore 64', page 224
|
;; This trivial routine is documented in 'Compute's Mapping the Commodore 64', page 224
|
||||||
lda #$5F
|
lda #$3F
|
||||||
jmp iec_tx_command
|
jmp iec_tx_command
|
||||||
|
|
||||||
Reference in new issue
Block a user