various IEC optimizations
This commit is contained in:
1 parent
601f1adea4
commit
6aa6e568a1
4 files changed
+17
-15
No files matched your search
@@ -7,17 +7,20 @@ iec_rx_check_eoi:
|
|||||||
|
|
||||||
// Wait for talker to pull CLK.
|
// Wait for talker to pull CLK.
|
||||||
// If over 200 usec (205 cycles on NTSC machine) , then it is EOI.
|
// If over 200 usec (205 cycles on NTSC machine) , then it is EOI.
|
||||||
// Loop iteraction takes 13 cycles, 17 full iterations are enough
|
// Loop iteraction takes 11 cycles, 19 full iterations are enough
|
||||||
|
|
||||||
ldx #$11 // 2 cycles
|
ldx #$13 // 2 cycles
|
||||||
|
|
||||||
!:
|
!:
|
||||||
lda CIA2_PRA // 4 cycles
|
bit CIA2_PRA // 4 cycles
|
||||||
rol // 2 cycles, to put CLK in as the last bit
|
bvc iec_rx_check_eoi_done // 2 cycles if not jumped
|
||||||
bpl iec_rx_check_eoi_done // 2 cycles if not jumped
|
|
||||||
dex // 2 cycles
|
dex // 2 cycles
|
||||||
bne !- // 3 cycles if jumped
|
bne !- // 3 cycles if jumped
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
iec_rx_check_eoi_confirm:
|
||||||
|
|
||||||
// Timeout - either this is the last byte of stream, or the stream is empty at all.
|
// Timeout - either this is the last byte of stream, or the stream is empty at all.
|
||||||
// Mark end of stream in IOSTATUS
|
// Mark end of stream in IOSTATUS
|
||||||
jsr kernalstatus_EOI
|
jsr kernalstatus_EOI
|
||||||
|
|||||||
@@ -7,10 +7,9 @@
|
|||||||
#if (CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS) && !CONFIG_MEMORY_MODEL_60K
|
#if (CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS) && !CONFIG_MEMORY_MODEL_60K
|
||||||
|
|
||||||
|
|
||||||
iec_update_EAL_by_Y:
|
iec_update_EAL_by_Y: // note: Carry has to be set by caller!
|
||||||
|
|
||||||
tya
|
tya
|
||||||
sec
|
|
||||||
adc EAL+0
|
adc EAL+0
|
||||||
sta EAL+0
|
sta EAL+0
|
||||||
bcc !+
|
bcc !+
|
||||||
|
|||||||
@@ -13,16 +13,15 @@ load_dolphindos:
|
|||||||
sei
|
sei
|
||||||
|
|
||||||
// A trick to shorten EAL update time
|
// A trick to shorten EAL update time
|
||||||
ldy #$FF
|
ldy #$00
|
||||||
|
|
||||||
// FALLTROUGH
|
// FALLTROUGH
|
||||||
|
|
||||||
load_dolphindos_loop:
|
load_dolphindos_loop:
|
||||||
|
|
||||||
// Check if this was EOI
|
// Check if this was EOI
|
||||||
lda IOSTATUS
|
bit IOSTATUS
|
||||||
and #K_STS_EOI
|
bvs load_dolphindos_end
|
||||||
bne load_dolphindos_end
|
|
||||||
|
|
||||||
// Wait for the talker to release the CLK line
|
// Wait for the talker to release the CLK line
|
||||||
!:
|
!:
|
||||||
@@ -34,9 +33,9 @@ load_dolphindos_loop:
|
|||||||
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
and #$FF - BIT_CIA2_PRA_DAT_OUT // release
|
||||||
sta CIA2_PRA
|
sta CIA2_PRA
|
||||||
|
|
||||||
// Wait till data line is released (someone else might be holding it)
|
// Wait till DATA line is released (someone else might be holding it)
|
||||||
!:
|
!:
|
||||||
lda CIA2_PRA
|
bit CIA2_PRA
|
||||||
bpl !-
|
bpl !-
|
||||||
|
|
||||||
// Check if EOI - routine can damage .X, but this is safe
|
// Check if EOI - routine can damage .X, but this is safe
|
||||||
@@ -44,7 +43,6 @@ load_dolphindos_loop:
|
|||||||
|
|
||||||
// Retrieve and store byte
|
// Retrieve and store byte
|
||||||
lda CIA2_PRB
|
lda CIA2_PRB
|
||||||
iny
|
|
||||||
sta (EAL),y
|
sta (EAL),y
|
||||||
|
|
||||||
// Pull DATA to acknowledge
|
// Pull DATA to acknowledge
|
||||||
@@ -53,7 +51,7 @@ load_dolphindos_loop:
|
|||||||
sta CIA2_PRA
|
sta CIA2_PRA
|
||||||
|
|
||||||
// Handle EAL
|
// Handle EAL
|
||||||
cpy #$FF
|
iny
|
||||||
bne load_dolphindos_loop
|
bne load_dolphindos_loop
|
||||||
inc EAL+1
|
inc EAL+1
|
||||||
jmp load_dolphindos_loop
|
jmp load_dolphindos_loop
|
||||||
@@ -61,6 +59,7 @@ load_dolphindos_loop:
|
|||||||
load_dolphindos_end:
|
load_dolphindos_end:
|
||||||
|
|
||||||
// Update EAL
|
// Update EAL
|
||||||
|
clc
|
||||||
jsr iec_update_EAL_by_Y
|
jsr iec_update_EAL_by_Y
|
||||||
|
|
||||||
// End of load loop
|
// End of load loop
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ load_jiffydos_end:
|
|||||||
tax
|
tax
|
||||||
|
|
||||||
// Update EAL
|
// Update EAL
|
||||||
|
sec
|
||||||
jsr iec_update_EAL_by_Y
|
jsr iec_update_EAL_by_Y
|
||||||
|
|
||||||
// Indicate that no byte waits in output buffer
|
// Indicate that no byte waits in output buffer
|
||||||
|
|||||||
Reference in new issue
Block a user