begin implementing iec_rx_byte and rest of LOAD sequence
This commit is contained in:
1 parent
92ac67d6a7
commit
dec2714ba0
3 files changed
+59
-3
No files matched your search
@@ -0,0 +1,27 @@
|
|||||||
|
;; Receive a byte from the IEC bus.
|
||||||
|
;; reference http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||||
|
;; page 11.
|
||||||
|
|
||||||
|
|
||||||
|
iec_rx_byte:
|
||||||
|
|
||||||
|
;; First, we wait for the talker to release the CLK line.
|
||||||
|
jsr iec_wait_for_clock_release
|
||||||
|
|
||||||
|
;; We then release the data line
|
||||||
|
|
||||||
|
;; Wait for talker to assert CLK.
|
||||||
|
;; If >200usec, then it is EOI and we have to assert the
|
||||||
|
;; DATA line for 60 usec to tell the TALKER that we have
|
||||||
|
;; acknowledged the EOI.
|
||||||
|
|
||||||
|
|
||||||
|
;; CLK is now low. Latch input bits in on rising edge
|
||||||
|
;; of CLK, eight times for eight bits.
|
||||||
|
|
||||||
|
;; Then we must within 1000usec acknowledge the frame by
|
||||||
|
;; asserting DATA. At this point, CLK is asserted by the
|
||||||
|
;; talker and DATA by us, i.e., we are ready to receive
|
||||||
|
;; the next byte. (p11).
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
iec_wait_for_clock_release:
|
||||||
|
LDA $DD00
|
||||||
|
and #$80
|
||||||
|
beq iec_wait_for_clock_release
|
||||||
|
rts
|
||||||
+27
-3
@@ -38,29 +38,46 @@ load:
|
|||||||
bcs load_error
|
bcs load_error
|
||||||
jsr iec_release_atn
|
jsr iec_release_atn
|
||||||
|
|
||||||
|
inc $0608
|
||||||
|
|
||||||
;; Now command device to talk (p16)
|
;; Now command device to talk (p16)
|
||||||
jsr iec_assert_atn
|
jsr iec_assert_atn
|
||||||
lda #$48
|
lda #$48
|
||||||
jsr iec_tx_byte
|
jsr iec_tx_byte
|
||||||
bcs load_error
|
bcs load_error
|
||||||
|
|
||||||
|
inc $0609
|
||||||
|
|
||||||
lda #$60 ; open channel / data (p3) , required according to p13
|
lda #$60 ; open channel / data (p3) , required according to p13
|
||||||
jsr iec_tx_byte
|
jsr iec_tx_byte
|
||||||
bcs load_error
|
bcs load_error
|
||||||
jsr iec_release_atn
|
jsr iec_release_atn
|
||||||
|
|
||||||
|
inc $060a
|
||||||
|
|
||||||
;; 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)
|
||||||
jsr iec_turnaround_to_listen
|
jsr iec_turnaround_to_listen
|
||||||
bcs load_error
|
bcs load_error
|
||||||
|
|
||||||
;; We are now ready to receive bytes
|
inc $060b
|
||||||
;; jsr iec_rx_byte
|
|
||||||
;; bcs load_done
|
|
||||||
|
|
||||||
|
;; We are now ready to receive bytes
|
||||||
|
* jsr iec_rx_byte
|
||||||
|
php
|
||||||
|
;; Write read data to screen for now
|
||||||
|
inc $ff
|
||||||
|
ldx $ff
|
||||||
|
sta $0400,x
|
||||||
|
plp
|
||||||
|
bcs load_done
|
||||||
|
bcc -
|
||||||
|
|
||||||
load_done:
|
load_done:
|
||||||
;; Close file on drive
|
;; Close file on drive
|
||||||
|
|
||||||
|
inc $060c
|
||||||
|
|
||||||
|
|
||||||
;; Command drive to listen and to close the file
|
;; Command drive to listen and to close the file
|
||||||
jsr iec_assert_atn
|
jsr iec_assert_atn
|
||||||
@@ -70,15 +87,22 @@ load_done:
|
|||||||
jsr iec_tx_byte
|
jsr iec_tx_byte
|
||||||
jsr iec_release_atn
|
jsr iec_release_atn
|
||||||
|
|
||||||
|
inc $060d
|
||||||
|
|
||||||
;; Tell drive to unlisten
|
;; Tell drive to unlisten
|
||||||
jsr iec_assert_atn
|
jsr iec_assert_atn
|
||||||
lda #$3f
|
lda #$3f
|
||||||
jsr iec_tx_byte
|
jsr iec_tx_byte
|
||||||
jsr iec_release_atn
|
jsr iec_release_atn
|
||||||
|
|
||||||
|
inc $060e
|
||||||
|
|
||||||
;; FALL THROUGH
|
;; FALL THROUGH
|
||||||
|
|
||||||
load_error:
|
load_error:
|
||||||
|
|
||||||
|
inc $060f
|
||||||
|
|
||||||
;; Re-enable interrupts and return
|
;; Re-enable interrupts and return
|
||||||
cli
|
cli
|
||||||
;; (iec_tx_byte will have set/cleared C flag and put result code
|
;; (iec_tx_byte will have set/cleared C flag and put result code
|
||||||
|
|||||||
Reference in new issue
Block a user