finished OPEN routine, some IEC cleanups

This commit is contained in:
FeralChild64 committed 2019-07-25 21:40:24 +02:00
1 parent 893371733b
commit 32fbed93f7
17 files changed
+169 -97

No files matched your search

@@ -1,22 +1,22 @@
;;
;; Checks whether device numbe (in .A) is a correct IEC device number
;; Checks whether device number (in .A) is a correct IEC device number
;;
;; Preserves .A, .X and .Y
;;
iec_devnum_check:
iec_check_devnum:
;; 0, 1, 2, or 3 are illegal - reserved for non-IEC devices on Commodore
cmp #$04
bcs +
;; FALLTROUGH
iec_devnum_check_failed:
iec_check_devnum_failed:
sec ; indicate non-IEC device
rts
*
;; 31 and above are illegal too, due to IEC command encoding scheme,
;; see https://www.pagetable.com/?p=1031
cmp #$1F
bcs iec_devnum_check_failed
bcs iec_check_devnum_failed
;; Carry is clear here - indicates IEC device
rts
+20
View File
@@ -0,0 +1,20 @@
;;
;; Kernal internal IEC routine
;;
;; - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
;;
iec_cmd_close:
jsr iec_tx_flush
;; Due to OPEN/CLOSE/TKSA/SECOND command encoding (see https://www.pagetable.com/?p=1031),
;; allowed channels are 0-15; report error if out of range
cmp #$10
bcc +
jmp kernalerror_FILE_NOT_INPUT
*
ora #$E0
jmp common_open_close_unlsn_second
+29
View File
@@ -0,0 +1,29 @@
;;
;; Kernal internal IEC routine
;;
;; - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
;;
iec_cmd_open: ; similar to TKSA, but without turnaround
;; Due to OPEN/CLOSE/TKSA/SECOND command encoding (see https://www.pagetable.com/?p=1031),
;; allowed channels are 0-15; report error if out of range
cmp #$10
bcc +
jmp kernalerror_FILE_NOT_INPUT
*
ora #$F0
;; FALLTROUGH
common_open_close_unlsn_second: ; common part of several commands
sta IEC_TMP2
jsr iec_tx_command
bcs + ; branch if error
jmp iec_tx_command_finalize
*
rts