initial concept of ROM versioning, still needs quite some work

This commit is contained in:
FeralChild64 committed 2019-10-12 19:13:56 +02:00
1 parent 5b69467dc1
commit 890558213a
20 files changed
+191 -11

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 274
// - [CM64] Compute's Mapping the Commodore 64 - page 224/225
//
// CPU registers that has to be preserved (see [RG64]): .Y
//
ACPTR:
jsr kernalstatus_reset
jmp iec_rx_byte
+30
View File
@@ -0,0 +1,30 @@
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 285
// - [CM64] Compute's Mapping the Commodore 64 - page 223
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
// - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
//
// CPU registers that has to be preserved (see [RG64]): .X, .Y
//
LISTEN:
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
jsr iec_tx_flush
// Check whether device number is correct
jsr iec_check_devnum
bcc !+
jmp kernalerror_DEVICE_NOT_FOUND
!:
// Encode and execute the command
ora #$20
jmp common_talk_listen
+25
View File
@@ -0,0 +1,25 @@
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 296
// - [CM64] Compute's Mapping the Commodore 64 - page 223/224
// - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
//
// CPU registers that has to be preserved (see [RG64]): .X, .Y
//
SECOND:
// 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_DEVICE_NOT_FOUND // XXX find a better error message for wrong channel (create new one?)
!:
ora #$60
jmp common_open_close_unlsn_second
+32
View File
@@ -0,0 +1,32 @@
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 301/302
// - [CM64] Compute's Mapping the Commodore 64 - page 223
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
// - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
//
// CPU registers that has to be preserved (see [RG64]): .X, .Y
//
TALK:
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
jsr iec_tx_flush
// Check whether device number is correct
jsr iec_check_devnum
bcc !+
jmp kernalerror_DEVICE_NOT_FOUND
!:
// Encode and execute the command
ora #$40
common_talk_listen: // common part of TALK and LISTEN
sta TBTCNT
jmp iec_tx_command
+26
View File
@@ -0,0 +1,26 @@
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 302
// - [CM64] Compute's Mapping the Commodore 64 - page 224
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc
//
// CPU registers that has to be preserved (see [RG64]): .X, .Y
//
TKSA:
// 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_DEVICE_NOT_FOUND // XXX find a better error message for wrong channel (create new one?)
!:
ora #$F0
jmp common_untlk_tksa
+25
View File
@@ -0,0 +1,25 @@
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 303
// - [CM64] Compute's Mapping the Commodore 64 - page 224
// - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
// - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
//
// CPU registers that has to be preserved (see [RG64]): .X, .Y
//
UNLSN:
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
jsr iec_tx_flush
// Buffer empty, send the command
lda #$3F
jmp common_open_close_unlsn_second
+33
View File
@@ -0,0 +1,33 @@
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 304
// - [CM64] Compute's Mapping the Commodore 64 - page 224
// - https://www.pagetable.com/?p=1031, , https://github.com/mist64/cbmbus_doc
// - http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
//
// CPU registers that has to be preserved (see [RG64]): .X, .Y
//
UNTLK:
// According to serial-bus.pdf (page 15) this routine flushes the IEC out buffer
jsr iec_tx_flush
// Buffer empty, send the command
lda #$5F
common_untlk_tksa: // common part of UNTLK and TKSA
sta TBTCNT
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
// (it forces us to send the TKSA command 'manually' sometimes), but
// Luigi Di Fraia (https://luigidifraia.wordpress.com/2017/06/27/codebase64-on-the-kernal-behaviour/)
// claims TKSA Kernal routine actually does the turnaround
jmp iec_turnaround_to_listen
!:
rts