fixes for sending file name to IEC in LOAD
This commit is contained in:
1 parent
1e7199fcd5
commit
f911eed0c3
6 files changed
+35
-22
No files matched your search
@@ -1,9 +1,12 @@
|
|||||||
|
|
||||||
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||||
|
|
||||||
|
;; Carry flag set = signal EOI
|
||||||
|
|
||||||
iec_tx_byte:
|
iec_tx_byte:
|
||||||
|
|
||||||
pha
|
pha
|
||||||
|
php
|
||||||
|
|
||||||
;; Notify all devices that we are going to send a byte
|
;; Notify all devices that we are going to send a byte
|
||||||
;; and it is going to be a data byte (released ATN)
|
;; and it is going to be a data byte (released ATN)
|
||||||
@@ -12,6 +15,7 @@ iec_tx_byte:
|
|||||||
;; Common part of iec_txbyte and iec_tx_common - waits for devices
|
;; Common part of iec_txbyte and iec_tx_common - waits for devices
|
||||||
;; and transmits a byte
|
;; and transmits a byte
|
||||||
|
|
||||||
|
plp
|
||||||
pla
|
pla
|
||||||
jsr iec_tx_common
|
jsr iec_tx_common
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ iec_tx_command:
|
|||||||
;; Common part of iec_txbyte and iec_tx_common - waits for devices
|
;; Common part of iec_txbyte and iec_tx_common - waits for devices
|
||||||
;; and transmits a byte
|
;; and transmits a byte
|
||||||
|
|
||||||
|
clc ; Carry flag set is used for EOI mark
|
||||||
pla
|
pla
|
||||||
jsr iec_tx_common
|
jsr iec_tx_common
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,34 @@
|
|||||||
|
|
||||||
iec_tx_common:
|
iec_tx_common:
|
||||||
|
|
||||||
;; Store the bye to send on a stack
|
;; Store the byte to send on a stack
|
||||||
pha
|
pha
|
||||||
|
|
||||||
|
;; Store the status register - carry flag is used to determine whether
|
||||||
|
;; this is the last byte of the stream
|
||||||
|
php
|
||||||
|
|
||||||
;; Wait till all receivers are ready, they should all release DATA
|
;; Wait till all receivers are ready, they should all release DATA
|
||||||
jsr iec_wait_for_data_release
|
jsr iec_wait_for_data_release
|
||||||
|
|
||||||
|
;; At this point a delay 256 usec or more is considered EOI - add waits if necessary
|
||||||
|
plp
|
||||||
|
bcc +
|
||||||
|
jsr iec_wait100us
|
||||||
|
jsr iec_wait100us
|
||||||
|
jsr iec_wait60us
|
||||||
|
|
||||||
|
;; XXX waits above should be enough - why do we need more waits???
|
||||||
|
jsr iec_wait100us
|
||||||
|
jsr iec_wait100us
|
||||||
|
jsr iec_wait100us
|
||||||
|
|
||||||
|
;; Receiver should now acknowledge EOI by pulling data for at least 60 usec
|
||||||
|
jsr iec_wait60us
|
||||||
|
jsr iec_wait_for_data_release
|
||||||
|
*
|
||||||
;; Pull CLK back to indicate that DATA is not valid, keep it for 60us
|
;; Pull CLK back to indicate that DATA is not valid, keep it for 60us
|
||||||
;; We can use this routine as we don't hold DATA anyway (and its state doesn't even matter)
|
;; We can use this routine as we don't hold DATA anyway (and its state doesn't even matter)
|
||||||
;; Don't wait too long, as 200us or more is considered EOI
|
|
||||||
|
|
||||||
jsr iec_pull_clk_release_data
|
jsr iec_pull_clk_release_data
|
||||||
jsr iec_wait60us
|
jsr iec_wait60us
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
iec_tx_eoi:
|
|
||||||
|
|
||||||
;; Releasing ATN needed due to current iec_tx_command implementation
|
|
||||||
jsr iec_release_atn
|
|
||||||
|
|
||||||
;; Wait at least 256 usec
|
|
||||||
jsr iec_wait100us
|
|
||||||
jsr iec_wait100us
|
|
||||||
jsr iec_wait60us
|
|
||||||
|
|
||||||
;; Restore the bus to idle state
|
|
||||||
jsr iec_set_idle
|
|
||||||
|
|
||||||
rts
|
|
||||||
@@ -8,9 +8,6 @@ iec_wait100us:
|
|||||||
;; NTSC:
|
;; NTSC:
|
||||||
;; - CPU frequency 1.022727 MHZ, we need to waste at least 103 cycles
|
;; - CPU frequency 1.022727 MHZ, we need to waste at least 103 cycles
|
||||||
|
|
||||||
;; Waste cycles by reading some unimportant memory location
|
|
||||||
;; (in a loop) in order not to clutter VICE debug logs
|
|
||||||
|
|
||||||
;; Waste cycles in a loop
|
;; Waste cycles in a loop
|
||||||
|
|
||||||
ldy #$12 ; 2 cycles
|
ldy #$12 ; 2 cycles
|
||||||
|
|||||||
+9
-2
@@ -76,21 +76,28 @@ send_filename:
|
|||||||
|
|
||||||
ldx #<current_filename_ptr
|
ldx #<current_filename_ptr
|
||||||
jsr peek_under_roms
|
jsr peek_under_roms
|
||||||
|
iny
|
||||||
|
|
||||||
;; Save Y because iec_tx_byte will corrupt it
|
;; Save Y because iec_tx_byte will corrupt it
|
||||||
tax
|
tax
|
||||||
tya
|
tya
|
||||||
pha
|
pha
|
||||||
txa
|
|
||||||
|
|
||||||
|
;; Set Carry flag on the last file name character, to mark EOI
|
||||||
|
cmp current_filename_length
|
||||||
|
clc
|
||||||
|
bne +
|
||||||
|
sec
|
||||||
|
*
|
||||||
|
txa
|
||||||
jsr iec_tx_byte
|
jsr iec_tx_byte
|
||||||
|
|
||||||
pla
|
pla
|
||||||
tay
|
tay
|
||||||
iny
|
|
||||||
jmp send_filename
|
jmp 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)
|
||||||
jsr unlsn
|
jsr unlsn
|
||||||
bcs load_error
|
bcs load_error
|
||||||
|
|||||||
Reference in new issue
Block a user