size optimization of the IEC support
This commit is contained in:
1 parent
ef183a6cb1
commit
ee499b6b21
2 files changed
+13
-21
No files matched your search
@@ -19,17 +19,10 @@ iec_tx_command:
|
||||
;; and it is going to be a command (pulled ATN)
|
||||
jsr iec_pull_atn_clk_release_data
|
||||
|
||||
;; Give devices time to respond (response is mandatory!)
|
||||
jsr iec_wait1ms
|
||||
;; Give devices time to respond (response is mandatory!) by pulling DATA
|
||||
jsr iec_wait1ms_for_data
|
||||
bmi iec_tx_command_dev_not_found
|
||||
|
||||
;; Did at least one device respond by pulling DATA?
|
||||
lda CIA2_PRA
|
||||
and #BIT_CIA2_PRA_DAT_IN ; XXX try to optimize this, move to separate routine
|
||||
beq +
|
||||
|
||||
;; No devices present on the bus, so we can immediately return with device not found
|
||||
jmp iec_return_DEVICE_NOT_FOUND
|
||||
*
|
||||
;; At least one device responded, but they are still allowed to stall
|
||||
;; (can be busy processing something), we have to wait till they are all
|
||||
;; ready (or bored with DOS attack...)
|
||||
@@ -46,17 +39,14 @@ iec_tx_command:
|
||||
;; According to https://www.pagetable.com/?p=1135 there is some complicated and dangerous
|
||||
;; flow here, but http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 6)
|
||||
;; advices to just wait 1ms and check the DATA status
|
||||
jsr iec_wait1ms
|
||||
lda CIA2_PRA
|
||||
and #BIT_CIA2_PRA_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 iec_wait1ms_for_data
|
||||
bmi iec_tx_command_dev_not_found
|
||||
|
||||
jmp iec_return_DEVICE_NOT_FOUND
|
||||
*
|
||||
;; Done
|
||||
|
||||
jmp iec_return_success
|
||||
|
||||
iec_tx_command_dev_not_found:
|
||||
|
||||
jmp iec_return_DEVICE_NOT_FOUND
|
||||
Reference in new issue
Block a user