ACPTR now preserves registers, changed IEC temporary byte storage
This commit is contained in:
1 parent
504f0ffb81
commit
a2c02bde97
12 files changed
+55
-28
No files matched your search
@@ -79,7 +79,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on
|
||||
| $FF9C | MEMBOT | DONE | |
|
||||
| $FF9F | SCNKEY | DONE | could be better integrated with ROM (aliases) |
|
||||
| $FFA2 | SETTMO | NOT DONE | |
|
||||
| $FFA5 | ACPTR | PARTIAL | * work in progress |
|
||||
| $FFA5 | ACPTR | DONE | |
|
||||
| $FFA8 | CIOUT | DONE | |
|
||||
| $FFAB | UNTLK | DONE | |
|
||||
| $FFAE | UNLSN | DONE | |
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
|
||||
.alias TIME $A0 ; $A0-$A2, jiffy clock
|
||||
|
||||
.alias IEC_TMP1 $A3 ; temporary variable for tape and IEC
|
||||
.alias IEC_TMP2 $A4 ; temporary variable for tape and IEC
|
||||
|
||||
;; 2-byte location below seems to be a good place for temporary storage,
|
||||
;; it seems used for timing during tape reads only - see:
|
||||
;; - 'C64 Programmer's Reference Guide', page 314
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
;; CPU registers that has to be preserved (see [RG64]): .Y
|
||||
;;
|
||||
|
||||
;; XXX preserve register Y!
|
||||
|
||||
acptr:
|
||||
;; XXX temporary implementation
|
||||
jsr kernalstatus_reset
|
||||
jmp iec_rx_byte
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ close:
|
||||
*
|
||||
lda SAT, y ; get secondary address
|
||||
ora $E0 ; CLOSE command
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
jsr iec_tx_command
|
||||
bcs close_remove_from_table
|
||||
jsr iec_tx_command_finalize
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
;; Receive a byte from the IEC bus.
|
||||
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc,
|
||||
;; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 11)
|
||||
;; Receive a byte from the IEC bus.
|
||||
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc,
|
||||
;; http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 11)
|
||||
;;
|
||||
;; Preserves .X and .Y registers
|
||||
|
||||
iec_rx_byte:
|
||||
|
||||
;; Store .X and .Y on the stack - preserve them
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
|
||||
;; Timing is critical here - execute on disabled IRQs
|
||||
php
|
||||
sei
|
||||
@@ -96,12 +104,19 @@ iec_rx_clk_wait2:
|
||||
dey ; 2 cycles
|
||||
bne iec_rx_clk_wait2 ; 3 cycles if jumped
|
||||
|
||||
;; Timeout
|
||||
jsr kernalstatus_EOI
|
||||
pla
|
||||
plp
|
||||
sec ; XXX confirm that sec is really a way to report timeout here
|
||||
rts
|
||||
;; Timeout
|
||||
jsr kernalstatus_EOI
|
||||
pla
|
||||
plp
|
||||
|
||||
;; Restore registers
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
|
||||
sec ; XXX confirm that sec is really a way to report timeout here
|
||||
rts
|
||||
*
|
||||
;; More bits?
|
||||
dex
|
||||
@@ -118,6 +133,15 @@ iec_rx_clk_wait2:
|
||||
|
||||
;; Return no-error
|
||||
plp
|
||||
|
||||
;; Restore registers
|
||||
sta IEC_TMP2 ; $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
lda IEC_TMP2
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
|
||||
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
|
||||
;; Expects byte to send in BSOUR; Carry flag set = signal EOI
|
||||
;; Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
|
||||
;; Carry flag set = signal EOI
|
||||
;;
|
||||
;; Preserves .X and .Y registers
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
|
||||
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
|
||||
;; Expects command to send in BSOUR; Carry flag set = signal EOI
|
||||
;; Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
|
||||
;; Carry flag set = signal EOI
|
||||
;;
|
||||
;; Preserves .X and .Y registers
|
||||
|
||||
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
|
||||
;; and http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
|
||||
|
||||
;; Expects byte to send in BSOUR; Carry flag set = signal EOI
|
||||
|
||||
;; XXX is it OK to use BSOUR for data exchange? Maybe there is a better way?
|
||||
;; Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html)
|
||||
;; Carry flag set = signal EOI
|
||||
|
||||
iec_tx_common:
|
||||
|
||||
@@ -42,11 +41,10 @@ iec_tx_common:
|
||||
|
||||
iec_tx_common_sendbit:
|
||||
;; Is next bit 0 or 1?
|
||||
lda BSOUR
|
||||
lda IEC_TMP2
|
||||
lsr
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
bcs +
|
||||
;; XXX we are actually destroying BSOUR here... is it allowed?
|
||||
|
||||
;; Bit is 0
|
||||
jsr iec_release_clk_pull_data
|
||||
|
||||
+4
-4
@@ -64,7 +64,7 @@ load:
|
||||
|
||||
;; Open channel #0 (p16)
|
||||
lda #$F0 ; $F0 for TKSA + 0 for channel number
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
jsr iec_tx_command
|
||||
bcs lvs_load_verify_error
|
||||
jsr iec_tx_command_finalize
|
||||
@@ -89,7 +89,7 @@ load_send_filename:
|
||||
sec
|
||||
*
|
||||
;; Transmit one character
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
jsr iec_tx_byte
|
||||
|
||||
jmp load_send_filename
|
||||
@@ -106,7 +106,7 @@ load_filename_sent:
|
||||
bcs lvs_load_verify_error
|
||||
|
||||
lda #$60 ; open channel / data (p3) , required according to p13
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
jsr iec_tx_command
|
||||
bcs lvs_load_verify_error
|
||||
|
||||
@@ -161,7 +161,7 @@ load_loop:
|
||||
jsr listen
|
||||
|
||||
lda #$E0
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
jsr iec_tx_command
|
||||
jsr iec_tx_command_finalize
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ talk:
|
||||
|
||||
common_talk_listen: ; common part of TALK and LISTEN
|
||||
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
jmp iec_tx_command
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ unlsn:
|
||||
|
||||
common_unlsn_second: ; common part of UNSLS and SECOND
|
||||
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
jsr iec_tx_command
|
||||
bcs + ; branch if error
|
||||
jmp iec_tx_command_finalize
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ untlk:
|
||||
|
||||
common_untlk_tksa: ; common part of UNTLK and TKSA
|
||||
|
||||
sta BSOUR
|
||||
sta IEC_TMP2
|
||||
jsr iec_tx_command
|
||||
bcs + ; branch if error
|
||||
;; XXX - for TKSA, is it really the right place to do a turnaround? I've got some doubts
|
||||
|
||||
Reference in new issue
Block a user