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 -
|
||||
|
||||
;; Timeout
|
||||
jsr printf
|
||||
.byte "DBG: TURNAROUND FAILED",$0d,$00
|
||||
sec
|
||||
rts
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
iec_tx_byte:
|
||||
|
||||
;; Store byte to send on the stack
|
||||
pha
|
||||
php
|
||||
|
||||
;; Notify all devices that we are going to send a byte
|
||||
;; 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
|
||||
;; and transmits a byte
|
||||
|
||||
plp
|
||||
pla
|
||||
jsr iec_tx_common
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
iec_tx_command:
|
||||
|
||||
;; Store command to send on the stack
|
||||
pha
|
||||
|
||||
;; 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
|
||||
pla
|
||||
|
||||
jsr printf
|
||||
.byte "DBG: NO DEVICES AT ALL", $0D, 0
|
||||
|
||||
jsr iec_set_idle
|
||||
jmp kernalerror_DEVICE_NOT_FOUND
|
||||
*
|
||||
@@ -47,14 +45,11 @@ iec_tx_command:
|
||||
lda CI2PRA
|
||||
and #BIT_CI2PRA_DAT_IN ; XXX try to optimize this, move to separate routine
|
||||
beq +
|
||||
|
||||
|
||||
;; 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
|
||||
;; 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
|
||||
jmp kernalerror_DEVICE_NOT_FOUND
|
||||
*
|
||||
|
||||
@@ -7,16 +7,11 @@ iec_tx_common:
|
||||
|
||||
;; Store the byte to send on a stack
|
||||
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
|
||||
jsr iec_wait_for_data_release
|
||||
|
||||
;; At this point a delay 256 usec or more is considered EOI - add waits if necessary
|
||||
plp
|
||||
bcc +
|
||||
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
|
||||
;; $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)
|
||||
|
||||
|
||||
;; Save registers
|
||||
;; Sequence according to Compute's Mapping the 64 p73
|
||||
pha
|
||||
@@ -17,7 +17,7 @@ irq_handler:
|
||||
|
||||
;; Call interrupt routine
|
||||
;; (but only if initialised)
|
||||
lda $0314
|
||||
ora $0315
|
||||
lda CINV
|
||||
ora CINV+1
|
||||
beq default_irq_handler
|
||||
jmp ($0314)
|
||||
jmp (CINV)
|
||||
@@ -95,9 +95,6 @@ open_iec:
|
||||
jsr iec_turnaround_to_listen
|
||||
bcs open_iec_error
|
||||
|
||||
jsr printf
|
||||
.byte "DBG: TURNAROUND SUCCEEDED", $0D, 0
|
||||
|
||||
;; Indicate success
|
||||
lda #$00
|
||||
clc
|
||||
|
||||
+3
-3
@@ -61,9 +61,9 @@ vector_restore:
|
||||
;; XXX below we have quite a lot of data... should we decouple them?
|
||||
|
||||
vector_defaults:
|
||||
.word $0000 ;; CINV XXX implement this
|
||||
.word $0000 ;; CBINV XXX implement this
|
||||
.word $0000 ;; NMINV XXX implement this
|
||||
.word default_irq_handler ;; CINV
|
||||
.word $0000 ;; CBINV XXX implement this
|
||||
.word $0000 ;; NMINV XXX implement this
|
||||
|
||||
.word open ;; IOPEN
|
||||
.word close ;; ICLOSE
|
||||
|
||||
Reference in new issue
Block a user