initial concept of ROM versioning, still needs quite some work
This commit is contained in:
1 parent
5b69467dc1
commit
890558213a
20 files changed
+191
-11
No files matched your search
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
.const CONFIG_ID = $00 // should be 1 byte, different for each config file!
|
||||||
|
|
||||||
//
|
//
|
||||||
// Please read CONFIG.md before modifying this file!
|
// Please read CONFIG.md before modifying this file!
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
.const CONFIG_ID = $01 // should be 1 byte, different for each config file!
|
||||||
|
|
||||||
//
|
//
|
||||||
// Please read CONFIG.md before modifying this file!
|
// Please read CONFIG.md before modifying this file!
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
.const CONFIG_ID = $02 // should be 1 byte, different for each config file!
|
||||||
|
|
||||||
//
|
//
|
||||||
// Please read CONFIG.md before modifying this file!
|
// Please read CONFIG.md before modifying this file!
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3,6 +3,17 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// This one is not for optimization - but to encourage proper usage of panic screen
|
||||||
|
//
|
||||||
|
|
||||||
|
.pseudocommand panic code
|
||||||
|
{
|
||||||
|
lda code
|
||||||
|
jmp (panic_vector)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Stack manipulation - some CPUs will leave .A unchanged, some will use it as temporary storage, so consider .A trashed
|
// Stack manipulation - some CPUs will leave .A unchanged, some will use it as temporary storage, so consider .A trashed
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
#import "KERNAL_combined.sym"
|
#import "KERNAL_combined.sym"
|
||||||
|
|
||||||
|
|
||||||
|
.label panic_vector = KERNAL.panic_vector
|
||||||
|
.label rom_revision_kernal = KERNAL.rom_revision_kernal
|
||||||
|
|
||||||
#if CONFIG_DBG_PRINTF
|
#if CONFIG_DBG_PRINTF
|
||||||
.label printf = KERNAL.printf
|
.label printf = KERNAL.printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,6 +3,16 @@
|
|||||||
|
|
||||||
basic_cold_start:
|
basic_cold_start:
|
||||||
|
|
||||||
|
// Before doing anything, check if we have a compatible Kernal
|
||||||
|
|
||||||
|
ldy #(__rom_revision_basic_end - rom_revision_basic - 1)
|
||||||
|
!:
|
||||||
|
lda rom_revision_basic, y
|
||||||
|
cmp rom_revision_kernal, y
|
||||||
|
bne basic_cold_start_rom_mismatch
|
||||||
|
dey
|
||||||
|
bpl !-
|
||||||
|
|
||||||
// Setup vectors at $300
|
// Setup vectors at $300
|
||||||
ldy #$0B
|
ldy #$0B
|
||||||
!:
|
!:
|
||||||
@@ -32,3 +42,7 @@ basic_cold_start:
|
|||||||
|
|
||||||
// jump into warm start loop
|
// jump into warm start loop
|
||||||
jmp basic_warm_start
|
jmp basic_warm_start
|
||||||
|
|
||||||
|
basic_cold_start_rom_mismatch:
|
||||||
|
|
||||||
|
panic #$01
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
Special case - we need a constant memory location where we can put an ID and a revision string. According to Compute's Mapping the Commodore 64 (page 117) this area is unused - so a perfect place.
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// !!! PROPOSAL ONLY !!! PROPOSAL ONLY !!! NOT FOR USING EXTERNALLY YET !!!
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Do not change! Locations of the following data should be constant - now and forever!
|
||||||
|
//
|
||||||
|
// If you want to integrate Open ROMs support in your emulator, FPGA ccomputer, etc. - this
|
||||||
|
// is the official way to recognize the ROM and it's revision.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
rom_revision_basic:
|
||||||
|
|
||||||
|
// $BF52
|
||||||
|
|
||||||
|
.text "OR" // Magic string, after "Open ROMs"
|
||||||
|
.byte CONFIG_ID // Config file ID, might change between revisions
|
||||||
|
|
||||||
|
rom_revision_basic_string:
|
||||||
|
|
||||||
|
.text "DEVEL SNAPSHOT" // Actual ROM revision string
|
||||||
|
.byte $00
|
||||||
|
|
||||||
|
__rom_revision_basic_end:
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Well-known BASIC routine, described in:
|
||||||
|
//
|
||||||
|
// - [CM64] Compute's Mapping the Commodore 64 - page 212
|
||||||
|
//
|
||||||
|
// Prints the start-up messages
|
||||||
|
//
|
||||||
|
|
||||||
|
INITMSG:
|
||||||
|
jmp initmsg_real
|
||||||
@@ -1,13 +1,8 @@
|
|||||||
|
|
||||||
//
|
// Routine is too long to fit in the original location
|
||||||
// Well-known BASIC routine, described in:
|
|
||||||
//
|
|
||||||
// - [CM64] Compute's Mapping the Commodore 64 - page 212
|
|
||||||
//
|
|
||||||
// Prints the start-up messages
|
|
||||||
//
|
|
||||||
|
|
||||||
INITMSG:
|
|
||||||
|
initmsg_real:
|
||||||
|
|
||||||
// Print startup banner, up to 255 characters
|
// Print startup banner, up to 255 characters
|
||||||
ldx #$00
|
ldx #$00
|
||||||
@@ -19,6 +14,10 @@ INITMSG:
|
|||||||
bne !-
|
bne !-
|
||||||
|
|
||||||
!:
|
!:
|
||||||
|
// Print ROM revision
|
||||||
|
lda #<rom_revision_basic_string
|
||||||
|
ldy #>rom_revision_basic_string
|
||||||
|
jsr STROUT
|
||||||
|
|
||||||
// Print PAL/NTSC, if configured
|
// Print PAL/NTSC, if configured
|
||||||
|
|
||||||
@@ -26,6 +25,9 @@ INITMSG:
|
|||||||
jsr print_pal_ntsc
|
jsr print_pal_ntsc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
jsr initmsg_double_return
|
||||||
|
jsr print_return
|
||||||
|
|
||||||
// Work out free bytes, display them
|
// Work out free bytes, display them
|
||||||
jsr basic_do_new
|
jsr basic_do_new
|
||||||
sec
|
sec
|
||||||
@@ -41,6 +43,6 @@ INITMSG:
|
|||||||
ldx #34
|
ldx #34
|
||||||
jsr print_packed_message
|
jsr print_packed_message
|
||||||
|
|
||||||
// XXX put them into packed message
|
initmsg_double_return:
|
||||||
jsr print_return
|
jsr print_return
|
||||||
jmp print_return
|
jmp print_return
|
||||||
@@ -17,6 +17,9 @@
|
|||||||
.label __MSG_KERNAL_NTSC = __kernal_message_ntsc - __kernal_messages_start
|
.label __MSG_KERNAL_NTSC = __kernal_message_ntsc - __kernal_messages_start
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
.label __MSG_KERNAL_PANIC = __kernal_message_panic - __kernal_messages_start
|
||||||
|
.label __MSG_KERNAL_PANIC_VERSION = __kernal_message_panic_version - __kernal_messages_start
|
||||||
|
|
||||||
|
|
||||||
__kernal_messages_start:
|
__kernal_messages_start:
|
||||||
|
|
||||||
@@ -51,11 +54,19 @@ __kernal_message_to_hex:
|
|||||||
#if CONFIG_BANNER_PAL_NTSC
|
#if CONFIG_BANNER_PAL_NTSC
|
||||||
|
|
||||||
__kernal_message_pal:
|
__kernal_message_pal:
|
||||||
.text "PAL,"
|
.text ", PAL"
|
||||||
.byte $80 + $20 // end of string mark + space
|
.byte $80 + $20 // end of string mark + space
|
||||||
|
|
||||||
__kernal_message_ntsc:
|
__kernal_message_ntsc:
|
||||||
.text "NTSC,"
|
.text ", NTSC"
|
||||||
.byte $80 + $20 // end of string mark + space
|
.byte $80 + $20 // end of string mark + space
|
||||||
|
|
||||||
#endif // CONFIG_BANNER_PAL_NTSC
|
#endif // CONFIG_BANNER_PAL_NTSC
|
||||||
|
|
||||||
|
__kernal_message_panic:
|
||||||
|
.text "KERNAL PANI"
|
||||||
|
.byte $80 + $43 // end of string mark + 'C'
|
||||||
|
|
||||||
|
__kernal_message_panic_version:
|
||||||
|
.text " - ROM MISMATC"
|
||||||
|
.byte $80 + $48 // end of string mark + 'H'
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Something terrible happened - show the panic screen
|
||||||
|
//
|
||||||
|
|
||||||
|
// .A = 0 - just panic, no extra message
|
||||||
|
// .A = 1 - ROM version mismatch
|
||||||
|
|
||||||
|
panic:
|
||||||
|
|
||||||
|
sei
|
||||||
|
pha
|
||||||
|
|
||||||
|
jsr IOINIT
|
||||||
|
jsr setup_vicii
|
||||||
|
jsr clear_screen
|
||||||
|
|
||||||
|
// XXX disable NMIs
|
||||||
|
|
||||||
|
ldx #$14
|
||||||
|
ldy #$0E
|
||||||
|
jsr plot_set
|
||||||
|
|
||||||
|
ldx #__MSG_KERNAL_PANIC
|
||||||
|
jsr print_kernal_message
|
||||||
|
|
||||||
|
pla
|
||||||
|
beq kernal_panic_infinite_loop
|
||||||
|
pha
|
||||||
|
|
||||||
|
ldx #$02
|
||||||
|
ldy #$02
|
||||||
|
jsr plot_set
|
||||||
|
|
||||||
|
pla
|
||||||
|
pha
|
||||||
|
jsr print_hex_byte
|
||||||
|
|
||||||
|
pla
|
||||||
|
cmp #$01
|
||||||
|
bne kernal_panic_infinite_loop
|
||||||
|
|
||||||
|
ldx #__MSG_KERNAL_PANIC_VERSION
|
||||||
|
jsr print_kernal_message
|
||||||
|
|
||||||
|
kernal_panic_infinite_loop:
|
||||||
|
ldx #$00
|
||||||
|
stx VIC_EXTCOL
|
||||||
|
|
||||||
|
ldx #$80
|
||||||
|
!:
|
||||||
|
dex
|
||||||
|
bne !-
|
||||||
|
|
||||||
|
ldx #$06
|
||||||
|
stx VIC_EXTCOL
|
||||||
|
!:
|
||||||
|
dex
|
||||||
|
bne !-
|
||||||
|
|
||||||
|
beq kernal_panic_infinite_loop // branch always
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// !!! PROPOSAL ONLY !!! PROPOSAL ONLY !!! NOT FOR USING EXTERNALLY YET !!!
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Do not change! Locations of the following data should be constant - now and forever!
|
||||||
|
//
|
||||||
|
// If you want to integrate Open ROMs support in your emulator, FPGA ccomputer, etc. - this
|
||||||
|
// is the official way to recognize the ROM and it's revision.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// XXX we need to find a safe address within $E4D3-$FFFF range, we need 20 bytes
|
||||||
|
|
||||||
|
|
||||||
|
panic_vector:
|
||||||
|
|
||||||
|
// This vector is to be used by non-Kernal ROMs, if they want to complain
|
||||||
|
// about incompatible ROM releases - jump via this vector with .A set to 1
|
||||||
|
|
||||||
|
.byte <panic
|
||||||
|
.byte >panic
|
||||||
|
|
||||||
|
rom_revision_kernal:
|
||||||
|
|
||||||
|
.text "OR" // Magic string, after "Open ROMs"
|
||||||
|
.byte CONFIG_ID // Config file ID, might change between revisions
|
||||||
|
|
||||||
|
rom_revision_kernal_string:
|
||||||
|
|
||||||
|
.text "DEVEL SNAPSHOT" // Actual ROM revision string
|
||||||
|
.byte $00
|
||||||
|
|
||||||
|
__rom_revision_kernal_end:
|
||||||
Reference in new issue
Block a user