initial support for Mega65 extra ROM

This commit is contained in:
FeralChild64 committed 2020-01-10 22:03:10 +01:00
1 parent 7539c6b072
commit 4d56864327
333 files changed
+1747 -289

No files matched your search

+4
View File
@@ -1,3 +1,4 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Common part of CHKIN and CKOUT
@@ -16,3 +17,6 @@ chkinout_file_not_open:
ply_trash_a
pla
jmp kernalerror_FILE_NOT_OPEN
#endif // ROM layout
+6 -3
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 281
// - [CM64] Compute's Mapping the Commodore 64 - page 230
// - [RG64] C64 Programmers Reference Guide - page 281
// - [CM64] Computes Mapping the Commodore 64 - page 230
//
// CPU registers that has to be preserved (see [RG64]): .Y
//
@@ -16,7 +17,7 @@ clall_real:
// Original routine probably just sets LDTND to 0, but this is not really safe,
// so we actually close all the channels; at least IDE64 does the same for
// it's channels, see CLALL description in the IDE64 User's Guide
// its channels, see CLALL description in the IDE64 Users Guide
!:
ldy LDTND
beq !+
@@ -34,3 +35,5 @@ clall_real:
// Not sure whether original Kernal does so, but it seems sane to also clear possible errors
jmp kernalstatus_reset
#endif // ROM layout
+6 -2
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 283
// - [CM64] Compute's Mapping the Commodore 64 - page 227/228
// - [RG64] C64 Programmers Reference Guide - page 283
// - [CM64] Computes Mapping the Commodore 64 - page 227/228
//
// CPU registers that has to be preserved (see [RG64]): for RS-232: .X, .Y
//
@@ -11,3 +12,6 @@
GETIN:
jmp getin_real
#endif // ROM layout
+6 -2
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 277/278
// - [CM64] Compute's Mapping the Commodore 64 - page 228
// - [RG64] C64 Programmers Reference Guide - page 277/278
// - [CM64] Computes Mapping the Commodore 64 - page 228
//
// CPU registers that has to be preserved (see [RG64]): .Y
//
@@ -46,3 +47,6 @@ chrin_getin: // jump entry for GETIN
// Not a supported device
jmp lvs_device_not_found_error
#endif // ROM layout
+7 -3
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 278/279
// - [CM64] Compute's Mapping the Commodore 64 - page 228
// - [RG64] C64 Programmers Reference Guide - page 278/279
// - [CM64] Computes Mapping the Commodore 64 - page 228
//
// CPU registers that has to be preserved (see [RG64]): .Y
// Additionally we have to preserve .X for out CHRIN and implementation
@@ -15,7 +16,7 @@ CHROUT:
// Save X and Y values
// (Confirmed by writing a test program that X and Y
// don't get modified, in agreement with C64 PRG's
// do not get modified, in agreement with C64 PRG
// description of CHROUT)
phx_trash_a
@@ -74,3 +75,6 @@ chrout_done_success:
lda SCHAR
clc // indicate success
rts
#endif // ROM layout
+6 -2
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routines, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 275
// - [CM64] Compute's Mapping the Commodore 64 - page 229
// - [RG64] C64 Programmers Reference Guide - page 275
// - [CM64] Computes Mapping the Commodore 64 - page 229
//
// CPU registers that has to be preserved (see [RG64]): .Y, .A (see [CM64], page 213)
//
@@ -67,3 +68,6 @@ chkin_file_not_input:
ply_trash_a
pla
jmp kernalerror_FILE_NOT_INPUT
#endif // ROM layout
+4 -14
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routines, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 276
// - [CM64] Compute's Mapping the Commodore 64 - page 229
// - [RG64] C64 Programmers Reference Guide - page 276
// - [CM64] Computes Mapping the Commodore 64 - page 229
//
// CPU registers that has to be preserved (see [RG64]): .Y, .A (see [CM64], page 213)
//
@@ -62,15 +63,4 @@ ckout_file_not_output:
jmp kernalerror_FILE_NOT_OUTPUT
#endif // ROM layout
+7 -3
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 281/282
// - [CM64] Compute's Mapping the Commodore 64 - page 229/230
// - [RG64] C64 Programmers Reference Guide - page 281/282
// - [CM64] Computes Mapping the Commodore 64 - page 229/230
// - https://www.pagetable.com/?p=1031, https://github.com/mist64/cbmbus_doc (IEC command)
//
// CPU registers that has to be preserved (see [RG64]): none
@@ -51,7 +52,10 @@ close_remove_from_table:
// Decrement the list size variable
dec LDTND
clc // report success - not sure if original CLOSE does this, but it's nevertheless a good practice
clc // report success - not sure if original CLOSE does this, but it is nevertheless a good practice
close_end:
rts
#endif // ROM layout
+5
View File
@@ -1,6 +1,11 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
// Our implementation is longer than the original one,
// placing it here would cause a collision with CLRCHN
CLALL:
jmp clall_real
#endif // ROM layout
+6 -2
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 282
// - [CM64] Compute's Mapping the Commodore 64 - page 230
// - [RG64] C64 Programmers Reference Guide - page 282
// - [CM64] Computes Mapping the Commodore 64 - page 230
//
// CPU registers that has to be preserved (see [RG64]): .Y
//
@@ -30,3 +31,6 @@ clrchn_reset: // entry needed by setup_vicii
sta DFLTO
rts
#endif // ROM layout
+7 -3
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 289
// - [CM64] Compute's Mapping the Commodore 64 - page 230/231
// - [RG64] C64 Programmers Reference Guide - page 289
// - [CM64] Computes Mapping the Commodore 64 - page 230/231
//
// CPU registers that has to be preserved (see [RG64]): none
//
@@ -42,7 +43,7 @@ open_has_space:
// Update the tables
// LAT / FAT / SAT support implemented according to
// 'Compute's Mapping the Commodore 64', page 52
// 'Computes Mapping the Commodore 64', page 52
lda LA
sta LAT, y
@@ -76,3 +77,6 @@ open_done_success:
clc
rts
#endif // ROM layout
+4
View File
@@ -1,3 +1,4 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// LOAD preparation routine
@@ -21,3 +22,6 @@ LOAD_PREP:
sty MEMUSS+1
stx MEMUSS+0
jmp (ILOAD)
#endif // ROM layout
+7 -2
View File
@@ -1,8 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 286
// - [CM64] Compute's Mapping the Commodore 64 - page 231
// - [RG64] C64 Programmers Reference Guide - page 286
// - [CM64] Computes Mapping the Commodore 64 - page 231
// - IEC reference at http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
//
// CPU registers that has to be preserved (see [RG64]): none
@@ -55,3 +57,6 @@ LOAD:
#endif
jmp lvs_illegal_device_number
#endif // ROM layout
+4
View File
@@ -1,3 +1,4 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// SAVE preparation routine
@@ -27,3 +28,6 @@ SAVE_PREP:
sta STAL+0
jmp (ISAVE)
#endif // ROM layout
+6 -2
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 293/294
// - [CM64] Compute's Mapping the Commodore 64 - page 231/232
// - [RG64] C64 Programmers Reference Guide - page 293/294
// - [CM64] Computes Mapping the Commodore 64 - page 231/232
// - IEC reference at http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf
//
// CPU registers that has to be preserved (see [RG64]): none
@@ -28,3 +29,6 @@ SAVE:
#endif
jmp lvs_illegal_device_number
#endif // ROM layout
+3
View File
@@ -1,3 +1,4 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
// Just a helper routine
@@ -21,3 +22,5 @@ find_fls_not_found:
sec
rts
#endif // ROM layout
+6 -2
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 283
// - [CM64] Compute's Mapping the Commodore 64 - page 227/228
// - [RG64] C64 Programmers Reference Guide - page 283
// - [CM64] Computes Mapping the Commodore 64 - page 227/228
//
// CPU registers that has to be preserved (see [RG64]): for RS-232: .X, .Y
//
@@ -26,3 +27,6 @@ getin_real:
#endif // HAS_RS232
jmp chrin_getin
#endif // ROM layout
+5 -1
View File
@@ -1,3 +1,4 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Helper functions for various LOAD/VERIFY/SAVE routine variants (IEC / U64 / etc.)
@@ -231,7 +232,7 @@ lvs_error_end:
lvs_return_last_address:
// Return last address - Compute's Mapping the 64 says without the '+1',
// Return last address - Computes Mapping the 64 says without the '+1',
// checked (short test program) on original ROMs that this is really the case
ldx EAL+0
ldy EAL+1
@@ -264,3 +265,6 @@ lvs_verify_error:
lda #B_ERR_VERIFY
sec
rts
#endif // ROM layout
+8 -4
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 292
// - [CM64] Compute's Mapping the Commodore 64 - page 239
// - [RG64] C64 Programmers Reference Guide - page 292
// - [CM64] Computes Mapping the Commodore 64 - page 239
//
// CPU registers that has to be preserved (see [RG64]): .X, .Y
//
@@ -16,16 +17,19 @@ READST:
cmp #$02
bne !+
// This is RS-232 device - according to 'Compute's Mapping the Commodore 64' page 239
// This is RS-232 device - according to 'Computes Mapping the Commodore 64' page 239
// it reads status from RSSTAT
// XXX 'lda RSSTAT' not possible due to extended scnkey, fix it!
lda #$FF
rts
!:
// According to 'Compute's Mapping the Commodore 64' page 239, it usually retrieves
// According to 'Computes Mapping the Commodore 64' page 239, it usually retrieves
// status from IOSTATUS
// XXX is it always the case if device is not RS-232 ?
lda IOSTATUS
rts
#endif // ROM layout
+7 -3
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 297
// - [CM64] Compute's Mapping the Commodore 64 - page 238
// - [RG64] C64 Programmers Reference Guide - page 297
// - [CM64] Computes Mapping the Commodore 64 - page 238
//
// CPU registers that has to be preserved (see [RG64]): .A, .X, .Y
//
@@ -11,10 +12,13 @@
SETFLS:
// There are 6 sane ways to implement this routine,
// I hope this one won't cause similarity to CBM code
// I hope this one will not cause similarity to CBM code
sta LA
sty SA
stx FA
rts
#endif // ROM layout
+6 -2
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 298
// - [CM64] Compute's Mapping the Commodore 64 - page 239
// - [RG64] C64 Programmers Reference Guide - page 298
// - [CM64] Computes Mapping the Commodore 64 - page 239
//
// CPU registers that has to be preserved (see [RG64]): .A, .X, .Y
//
@@ -11,3 +12,6 @@
SETMSG:
sta MSGFLG
rts
#endif // ROM layout
+7 -3
View File
@@ -1,9 +1,10 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 298/299
// - [CM64] Compute's Mapping the Commodore 64 - page 238
// - [RG64] C64 Programmers Reference Guide - page 298/299
// - [CM64] Computes Mapping the Commodore 64 - page 238
//
// CPU registers that has to be preserved (see [RG64]): .A, .X, .Y
//
@@ -11,10 +12,13 @@
SETNAM:
// There are 6 sane ways to implement this routine,
// I hope this one won't cause similarity to CBM code
// I hope this one will not cause similarity to CBM code
sta FNLEN
sty FNADDR + 1
stx FNADDR + 0
rts
#endif // ROM layout
+7 -2
View File
@@ -1,13 +1,18 @@
#if ROM_LAYOUT_STD || (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
//
// Official Kernal routine, described in:
//
// - [RG64] C64 Programmer's Reference Guide - page 300
// - [CM64] Compute's Mapping the Commodore 64 - page 239
// - [RG64] C64 Programmers Reference Guide - page 300
// - [CM64] Computes Mapping the Commodore 64 - page 239
//
// CPU registers that has to be preserved (see [RG64]): .A, .X, .Y
//
SETTMO:
sta TIMOUT
rts
#endif // ROM layout