more work on JiffyDOS byte reception

This commit is contained in:
FeralChild64 committed 2019-11-28 22:01:22 +01:00
1 parent 34d12e26ac
commit 36d803505e
3 files changed
+41 -16

No files matched your search

+32 -12
View File
@@ -3,7 +3,8 @@
// JiffyDOS protocol support for IEC // JiffyDOS protocol support for IEC
// //
// XXX finish this // XXX make it work
// XXX split into multiple files
@@ -85,7 +86,18 @@ iec_tx_byte_jiffydos_finalize:
ora #BIT_CIA2_PRA_CLK_OUT // pull CLK ora #BIT_CIA2_PRA_CLK_OUT // pull CLK
sta CIA2_PRA sta CIA2_PRA
bne jiffydos_return_success // branch always // Restore proper IECPROTO value
lda #$01
sta IECPROTO
// Re-enable sprites and interrupts
pla
sta VIC_SPENA
cli
// Return success
jmp iec_return_success
iec_tx_byte_jiffydos_wait_eoi: iec_tx_byte_jiffydos_wait_eoi:
@@ -154,26 +166,33 @@ iec_rx_byte_jiffydos:
eor C3PO eor C3PO
eor CIA2_PRA // bits 6 and 7 on CLK/DATA eor CIA2_PRA // bits 6 and 7 on CLK/DATA
// Preserve read byte
sta TBTCNT // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html
// Retrieve status bits
lda CIA2_PRA
tax tax
// XXX CLK and DATA active = EOI // Pull DATA at the end
lda CIA2_PRA ora #BIT_CIA2_PRA_DAT_OUT
sta CIA2_PRA
// FALLTROUGH
jiffydos_return_success:
// Check for EOI
txa
bmi !+
jsr kernalstatus_EOI
!:
// Restore proper IECPROTO value // Restore proper IECPROTO value
lda #$01 lda #$01
sta IECPROTO sta IECPROTO
// Re-enable sprites and interrupts // Re-enable sprites
pla pla
sta VIC_SPENA sta VIC_SPENA
cli
// Return success // End byte reception
jmp iec_return_success jmp iec_rx_end
jiffydos_wait_line: jiffydos_wait_line:
@@ -198,6 +217,7 @@ jiffydos_wait_line_done:
rts rts
jiffydos_prepare_for_transfer: jiffydos_prepare_for_transfer:
// We need to preserve 3 lowest bits of CIA2_PRA, they contain important // We need to preserve 3 lowest bits of CIA2_PRA, they contain important
+7 -4
View File
@@ -137,10 +137,13 @@ iec_rx_clk_wait2:
// Restore registers // Restore registers
sta TBTCNT // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html sta TBTCNT // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html
pla
tay // FALLTROUGH
pla
tax iec_rx_end:
ply_trash_a
plx_trash_a
lda TBTCNT lda TBTCNT
clc clc
+2
View File
@@ -26,6 +26,8 @@ TALK:
// Encode and execute the command // Encode and execute the command
ora #$40 ora #$40
// FALLTROUGH
common_talk_listen: // common part of TALK and LISTEN common_talk_listen: // common part of TALK and LISTEN
sta TBTCNT sta TBTCNT