ACPTR now preserves registers, changed IEC temporary byte storage

This commit is contained in:
FeralChild64 committed 2019-07-25 17:38:00 +02:00
1 parent 504f0ffb81
commit a2c02bde97
12 files changed
+55 -28

No files matched your search

+33 -9
View File
@@ -1,9 +1,17 @@
;; Receive a byte from the IEC bus.
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc,
;; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 11)
;; Receive a byte from the IEC bus.
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc,
;; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 11)
;;
;; Preserves .X and .Y registers
iec_rx_byte:
;; Store .X and .Y on the stack - preserve them
txa
pha
tya
pha
;; Timing is critical here - execute on disabled IRQs
php
sei
@@ -96,12 +104,19 @@ iec_rx_clk_wait2:
dey ; 2 cycles
bne iec_rx_clk_wait2 ; 3 cycles if jumped
;; Timeout
jsr kernalstatus_EOI
pla
plp
sec ; XXX confirm that sec is really a way to report timeout here
rts
;; Timeout
jsr kernalstatus_EOI
pla
plp
;; Restore registers
pla
tay
pla
tax
sec ; XXX confirm that sec is really a way to report timeout here
rts
*
;; More bits?
dex
@@ -118,6 +133,15 @@ iec_rx_clk_wait2:
;; Return no-error
plp
;; Restore registers
sta IEC_TMP2 ; $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html
pla
tay
pla
tax
lda IEC_TMP2
clc
rts
+3 -1
View File
@@ -1,7 +1,9 @@
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
;; Expects byte to send in BSOUR; Carry flag set = signal EOI
;; Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
;; Carry flag set = signal EOI
;;
;; Preserves .X and .Y registers
+3 -1
View File
@@ -1,7 +1,9 @@
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
;; Expects command to send in BSOUR; Carry flag set = signal EOI
;; Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
;; Carry flag set = signal EOI
;;
;; Preserves .X and .Y registers
+4 -6
View File
@@ -3,9 +3,8 @@
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
;; and http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
;; Expects byte to send in BSOUR; Carry flag set = signal EOI
;; XXX is it OK to use BSOUR for data exchange? Maybe there is a better way?
;; Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
;; Carry flag set = signal EOI
iec_tx_common:
@@ -42,11 +41,10 @@ iec_tx_common:
iec_tx_common_sendbit:
;; Is next bit 0 or 1?
lda BSOUR
lda IEC_TMP2
lsr
sta BSOUR
sta IEC_TMP2
bcs +
;; XXX we are actually destroying BSOUR here... is it allowed?
;; Bit is 0
jsr iec_release_clk_pull_data