IEC/IRQ related cleanups
This commit is contained in:
1 parent
51dc3fabf4
commit
f4cb2a39b3
7 files changed
+11
-27
No files matched your search
@@ -17,8 +17,6 @@ iec_turnaround_to_listen:
|
|||||||
bne -
|
bne -
|
||||||
|
|
||||||
;; Timeout
|
;; Timeout
|
||||||
jsr printf
|
|
||||||
.byte "DBG: TURNAROUND FAILED",$0d,$00
|
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
iec_tx_byte:
|
iec_tx_byte:
|
||||||
|
|
||||||
|
;; Store byte to send on the stack
|
||||||
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)
|
||||||
@@ -15,7 +15,6 @@ 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
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
iec_tx_command:
|
iec_tx_command:
|
||||||
|
|
||||||
|
;; Store command to send on the stack
|
||||||
pha
|
pha
|
||||||
|
|
||||||
;; Notify all devices that we are going to send a byte
|
;; Notify all devices that we are going to send a byte
|
||||||
@@ -20,9 +21,6 @@ iec_tx_command:
|
|||||||
;; No devices present on the bus, so we can immediately return with device not found
|
;; No devices present on the bus, so we can immediately return with device not found
|
||||||
pla
|
pla
|
||||||
|
|
||||||
jsr printf
|
|
||||||
.byte "DBG: NO DEVICES AT ALL", $0D, 0
|
|
||||||
|
|
||||||
jsr iec_set_idle
|
jsr iec_set_idle
|
||||||
jmp kernalerror_DEVICE_NOT_FOUND
|
jmp kernalerror_DEVICE_NOT_FOUND
|
||||||
*
|
*
|
||||||
@@ -47,14 +45,11 @@ iec_tx_command:
|
|||||||
lda CI2PRA
|
lda CI2PRA
|
||||||
and #BIT_CI2PRA_DAT_IN ; XXX try to optimize this, move to separate routine
|
and #BIT_CI2PRA_DAT_IN ; XXX try to optimize this, move to separate routine
|
||||||
beq +
|
beq +
|
||||||
|
|
||||||
;; XXX possible optimization of the flow above: for many commands it is enough
|
;; XXX possible optimization of the flow above: for many commands it is enough
|
||||||
;; to wait for the DATA being pulled, as confirmation is expected from
|
;; to wait for the DATA being pulled, as confirmation is expected from
|
||||||
;; a single device only - but not sure if it's worth the trouble
|
;; a single device only - but not sure if it's worth the trouble
|
||||||
|
|
||||||
jsr printf
|
|
||||||
.byte "DBG: NO CONFIRMATION FROM DEVICE", $0D, 0
|
|
||||||
|
|
||||||
jsr iec_set_idle
|
jsr iec_set_idle
|
||||||
jmp kernalerror_DEVICE_NOT_FOUND
|
jmp kernalerror_DEVICE_NOT_FOUND
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,16 +7,11 @@ iec_tx_common:
|
|||||||
|
|
||||||
;; Store the byte 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
|
;; At this point a delay 256 usec or more is considered EOI - add waits if necessary
|
||||||
plp
|
|
||||||
bcc +
|
bcc +
|
||||||
jsr iec_wait100us
|
jsr iec_wait100us
|
||||||
jsr iec_wait100us
|
jsr iec_wait100us
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ irq_handler:
|
|||||||
;; $EA61 - Check keyboard, but don't update timer? https://github.com/cc65/cc65/issues/324
|
;; $EA61 - Check keyboard, but don't update timer? https://github.com/cc65/cc65/issues/324
|
||||||
;; $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
|
;; $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
|
||||||
;; Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
|
;; Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
|
||||||
|
|
||||||
;; Save registers
|
;; Save registers
|
||||||
;; Sequence according to Compute's Mapping the 64 p73
|
;; Sequence according to Compute's Mapping the 64 p73
|
||||||
pha
|
pha
|
||||||
@@ -17,7 +17,7 @@ irq_handler:
|
|||||||
|
|
||||||
;; Call interrupt routine
|
;; Call interrupt routine
|
||||||
;; (but only if initialised)
|
;; (but only if initialised)
|
||||||
lda $0314
|
lda CINV
|
||||||
ora $0315
|
ora CINV+1
|
||||||
beq default_irq_handler
|
beq default_irq_handler
|
||||||
jmp ($0314)
|
jmp (CINV)
|
||||||
@@ -95,9 +95,6 @@ open_iec:
|
|||||||
jsr iec_turnaround_to_listen
|
jsr iec_turnaround_to_listen
|
||||||
bcs open_iec_error
|
bcs open_iec_error
|
||||||
|
|
||||||
jsr printf
|
|
||||||
.byte "DBG: TURNAROUND SUCCEEDED", $0D, 0
|
|
||||||
|
|
||||||
;; Indicate success
|
;; Indicate success
|
||||||
lda #$00
|
lda #$00
|
||||||
clc
|
clc
|
||||||
|
|||||||
+3
-3
@@ -61,9 +61,9 @@ vector_restore:
|
|||||||
;; XXX below we have quite a lot of data... should we decouple them?
|
;; XXX below we have quite a lot of data... should we decouple them?
|
||||||
|
|
||||||
vector_defaults:
|
vector_defaults:
|
||||||
.word $0000 ;; CINV XXX implement this
|
.word default_irq_handler ;; CINV
|
||||||
.word $0000 ;; CBINV XXX implement this
|
.word $0000 ;; CBINV XXX implement this
|
||||||
.word $0000 ;; NMINV XXX implement this
|
.word $0000 ;; NMINV XXX implement this
|
||||||
|
|
||||||
.word open ;; IOPEN
|
.word open ;; IOPEN
|
||||||
.word close ;; ICLOSE
|
.word close ;; ICLOSE
|
||||||
|
|||||||
Reference in new issue
Block a user