added panic screen, added versioning mechanism proposal

This commit is contained in:
FeralChild64 committed 2019-10-13 11:29:02 +02:00
1 parent 890558213a
commit 5a231c1847
40 files changed
+363 -182

No files matched your search

+14 -6
View File
@@ -105,25 +105,33 @@ Cause the system to support SIDs in `$D4xx` and `$D5xx` ranges, respectively.
Each of them needs a couple of bytes in KERNAL segment - but they can share some code, and `$D4xx` range support replaces the standard `$D400` address handling, so exact amount depends on the exact configuration.
## Software features
## Eye candy
### `CONFIG_BANNER_FANCY`
### `CONFIG_BANNER_SIMPLE`, `CONFIG_BANNER_FANCY`, `CONFIG_BANNER_VARIANT`
If enabled, prints more colorful startup banner. Eye candy only.
Select startup banner - either a simple one, or with some colorful elements. `CONFIG_BANNER_VARIANT` heavily depends on the selected hardware target, not all targets support it.
Needs some space in BASIC segment, varies between targets.
Richer banners need more BASIC segment, varies between hardware variants.
### `CONFIG_BANNER_PAL_NTSC`
If enabled, prints video system on startup banner. Eye candy only.
Feature needs 3 bytes in BASIC and 23 bytes in KERNAL segment.
Feature needs some bytes in BASIC (depending on banner type) and about 25 bytes in KERNAL segment.
## Software features
### `CONFIG_PANIC_SCREEN`
If enabled, certain fatal errors will produce a nice bluescreen instead of just resetting the machine.
Feature needs over 100 bytes in KERNAL segment. If unsure - enable.
### `CONFIG_DOS_WEDGE`
If enabled, a simple DOS wedge is available from the direct mode - supports `@<drive_number>`, `@<command>`, `@$`, `@$<params>` and `@` commands.
Feature needs about 330 bytes in BASIC segment.
Feature needs about 330 bytes in BASIC segment. If unsure - enable.
### `CONFIG_BCD_SAFE_INTERRUPTS`
+6 -1
View File
@@ -2,8 +2,13 @@
# Source files
SRCDIR_COMMON = c64/aliases
SRCDIR_BASIC = $(SRCDIR_COMMON) \
c64/basic
c64/basic \
c64/basic/commands \
c64/basic/init \
c64/basic/rom_revision
SRCDIR_KERNAL = $(SRCDIR_COMMON) \
c64/kernal \
c64/kernal/assets \
+9 -2
View File
@@ -41,10 +41,17 @@
// #define CONFIG_SID_D5XX
// Eye candy
// #define CONFIG_BANNER_SIMPLE
#define CONFIG_BANNER_FANCY
// #define CONFIG_BANNER_VARIANT
#define CONFIG_SHOW_PAL_NTSC
// Software features
#define CONFIG_BANNER_FANCY
#define CONFIG_BANNER_PAL_NTSC
#define CONFIG_PANIC_SCREEN
#define CONFIG_DOS_WEDGE
#define CONFIG_BCD_SAFE_INTERRUPTS
#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled
+9 -2
View File
@@ -41,10 +41,17 @@
// #define CONFIG_SID_D5XX
// Eye candy
// #define CONFIG_BANNER_SIMPLE
// #define CONFIG_BANNER_FANCY
#define CONFIG_BANNER_VARIANT
// #define CONFIG_SHOW_PAL_NTSC
// Software features
#define CONFIG_BANNER_FANCY
#define CONFIG_BANNER_PAL_NTSC
#define CONFIG_PANIC_SCREEN
#define CONFIG_DOS_WEDGE
#define CONFIG_BCD_SAFE_INTERRUPTS
#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled
+9 -2
View File
@@ -41,10 +41,17 @@
#define CONFIG_SID_D5XX
// Eye candy
// #define CONFIG_BANNER_SIMPLE
#define CONFIG_BANNER_FANCY
// #define CONFIG_BANNER_VARIANT
#define CONFIG_SHOW_PAL_NTSC
// Software features
#define CONFIG_BANNER_FANCY
#define CONFIG_BANNER_PAL_NTSC
#define CONFIG_PANIC_SCREEN
#define CONFIG_DOS_WEDGE
#define CONFIG_BCD_SAFE_INTERRUPTS
#define CONFIG_SCNKEY_TWW_CTR // for now has to be enabled
+29
View File
@@ -86,6 +86,35 @@
// Check that startup banner configuration is correct
{
.var selected = 0;
#if CONFIG_BANNER_SIMPLE
.eval selected++
#endif
#if CONFIG_BANNER_FANCY
.eval selected++
#endif
#if CONFIG_BANNER_VARIANT
.eval selected++
#endif
.if (selected != 1) .error "Please select exactly one CONFIG_MEMORY_MODEL_* option"
#if CONFIG_BANNER_VARIANT && !CONFIG_VARIANT_MEGA_65
.error "CONFIG_BANNER_VARIANT is not supported for your CONFIG_VARIANT_*"
#endif
#if CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65 && CONFIG_SHOW_PAL_NTSC
.error "MEGA65 variant banner does not support showing PAL/NTSC"
#endif
}
// Handle processor configuration
#if CONFIG_CPU_WDC_65C02 || CONFIG_CPU_CSG_65CE02 || CONFIG_CPU_WDC_65816
+5 -2
View File
@@ -4,13 +4,16 @@
//
// This one is not for optimization - but to encourage proper usage of panic screen
// These are not exactly for optimization - but to encourage proper usage of panic screen
//
.pseudocommand panic code
{
// If case no panic screen is used, we can skip providing error codes within Kernal
#if CONFIG_PANIC_SCREEN || !SEGMENT_KERNAL
lda code
jmp (panic_vector)
#endif
jmp ($E4B7)
}
+6
View File
@@ -1,4 +1,10 @@
// Error codes for 'panic' pseudocommand
.const P_ERR_NONE = $00
.const P_ERR_ROM_MISMATCH = $01 // this value has to be stable as long as possible
// Kernal error codes - returned in the A register
// Described in 'Commodore 64 Programmer's Reference Guide', page 306
+7 -3
View File
@@ -4,17 +4,21 @@
#import "KERNAL_combined.sym"
.label panic_vector = KERNAL.panic_vector
.label rom_revision_kernal = KERNAL.rom_revision_kernal
#if CONFIG_PANIC_SCREEN
.label panic = KERNAL.panic
#endif
.label hw_entry_reset = KERNAL.hw_entry_reset
#if CONFIG_DBG_PRINTF
.label printf = KERNAL.printf
#endif
.label plot_set = KERNAL.plot_set
.label print_hex_byte = KERNAL.print_hex_byte
.label print_return = KERNAL.print_return
.label print_space = KERNAL.print_space
#if CONFIG_BANNER_PAL_NTSC
#if CONFIG_SHOW_PAL_NTSC
.label print_pal_ntsc = KERNAL.print_pal_ntsc
#endif
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,17 +1,9 @@
// BASIC Cold start entry point
// Compute's Mapping the 64 p211
basic_cold_start:
//
// Continuation of the BASIC cold start routine
//
// 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 !-
basic_cold_start_internal:
// Setup vectors at $300
ldy #$0B
@@ -42,7 +34,3 @@ basic_cold_start:
// jump into warm start loop
jmp basic_warm_start
basic_cold_start_rom_mismatch:
panic #$01
+22
View File
@@ -0,0 +1,22 @@
// BASIC Cold start entry point
// Compute's Mapping the 64 p211
basic_cold_start:
// Before doing anything, check if we have a compatible BASIC/KERNAL pair
ldy #(__rom_revision_basic_end - rom_revision_basic - 1)
!:
lda rom_revision_basic, y
cmp rom_revision_kernal, y
beq !+
panic #P_ERR_ROM_MISMATCH
!:
dey
bpl !--
// Remaining part wouldn't fit here
jmp basic_cold_start_internal
+8
View File
@@ -0,0 +1,8 @@
The address of the BASIC cold start routine (see Compute's Mapping the Commodore 64, page 211) is well known, see for example here:
- https://www.lemon64.com/forum/viewtopic.php?t=70680&sid=3ff66caf7f5fdf2a3c2ff2ee31fc3fd8
Fixing this routine also has a great advantage for us - since it's address lies in the uppeer ROM region, it's easier to bailout
when someone tries to use our 'kernal.rom' with the original 'basic.rom'.
File renamed without changes.
File renamed without changes.
+21
View File
@@ -0,0 +1,21 @@
//
// Print out the amount of free bytes - for the startup banner
//
initmsg_bytes_free:
jsr basic_do_new
sec
lda MEMSIZ+0
sbc TXTTAB+0
tax
lda MEMSIZ+1
sbc TXTTAB+1
jsr print_integer
// Print rest of the start up message
ldx #34
jmp print_packed_message
+95
View File
@@ -0,0 +1,95 @@
// Routine is too long to fit in the original location
initmsg_real:
#if CONFIG_BANNER_SIMPLE
lda #<startup_banner
ldy #>startup_banner
jsr STROUT
ldx #$02
ldy #$02
jsr plot_set
lda #<rom_revision_basic_string
ldy #>rom_revision_basic_string
jsr STROUT
ldx #$04
ldy #$02
jsr plot_set
#if CONFIG_SHOW_PAL_NTSC
jsr print_pal_ntsc
#endif
jsr initmsg_bytes_free
ldx #$07
ldy #$00
jmp plot_set
#elif CONFIG_BANNER_FANCY
lda #<rainbow_logo
ldy #>rainbow_logo
jsr STROUT
ldx #$01
ldy #$0A
jsr plot_set
lda #<startup_banner
ldy #>startup_banner
jsr STROUT
ldx #$03
ldy #$0A
jsr plot_set
lda #<pre_revision_string
ldy #>pre_revision_string
jsr STROUT
lda #<rom_revision_basic_string
ldy #>rom_revision_basic_string
jsr STROUT
ldx #$05
ldy #$00
jsr plot_set
#if CONFIG_SHOW_PAL_NTSC
jsr print_pal_ntsc
#endif
jsr initmsg_bytes_free
ldx #$07
ldy #$00
jmp plot_set
#elif CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65
lda #<startup_banner
ldy #>startup_banner
jsr STROUT
lda #<rom_revision_basic_string
ldy #>rom_revision_basic_string
jsr STROUT
ldx #$03
ldy #$12
jsr plot_set
jsr initmsg_bytes_free
ldx #$05
ldy #$00
jmp plot_set
#endif
@@ -16,39 +16,33 @@
}
startup_banner:
#if !CONFIG_BANNER_FANCY
// Simple banner
#if CONFIG_BANNER_SIMPLE
.text " "
BANNER_TEXT()
.byte $0D, $0D
.text " "
.byte $00
#endif
#elif CONFIG_BANNER_FANCY
BANNER_TEXT()
.byte $00
#if CONFIG_BANNER_FANCY && !CONFIG_VARIANT_MEGA_65
rainbow_logo:
// Fancy banner
.byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $0D
.byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $0D
.byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $0D
.byte $9F, $12, $A4, $A4, $A4, $A4, $92
.byte $05, $00
.byte $1C, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $92, $0D
.byte $9E, $12, $A4, $A4, $A4, $A4, $A4, $A4, $92, $05, $20
.text " "
BANNER_TEXT()
.byte $0D
.byte $1E, $12, $A4, $A4, $A4, $A4, $A4, $92, $0D
.byte $9F, $12, $A4, $A4, $A4, $A4, $92, $20, $05, $20, $20
.text " "
pre_revision_string:
#endif
.text "RELEASE "
.byte $00
#if CONFIG_BANNER_FANCY && CONFIG_VARIANT_MEGA_65
#elif CONFIG_BANNER_VARIANT && CONFIG_VARIANT_MEGA_65
// Fancy Mega65 banner - from Retrofan
.byte $9a, $12, $20, $20, $7f, $a9, $20, $20, $1f, $20, $9a, $20, $20, $20
@@ -65,7 +59,7 @@ startup_banner:
.byte $12, $20, $20, $1f, $20, $20, $9a, $20, $20, $1f, $20, $9a, $20, $20, $20, $20
.byte $1f, $20, $9a, $20, $20, $20, $20, $20, $1f, $20, $9a, $20, $20, $1f, $20, $9a
.byte $20, $20, $1f, $20, $20, $96, $a3, $a3, $a3, $a3, $1f
.byte $92, $0D, $0D, $05
.byte $92, $0D, $0D, $05, $00
// Original Mega65 banner - supplied by Deft
// .byte $9A,$12,$A3,$A3,$A3,$A3,$A3,$A3,$DF,$9B,$92,$20,$05,$12,$A0,$A0
@@ -82,10 +76,6 @@ startup_banner:
// .byte $A3,$A3,$A3,$A3,$DF,$9A,$92,$7F,$12,$DF,$92,$7F,$9B,$20,$9A,$7F
// .byte $12,$A0,$A0,$9B,$92,$20,$9A,$7F,$12,$A0,$A0,$9B,$92,$20,$9A,$7F
// .byte $12,$DF,$92,$7F,$9B,$20,$9A,$20,$9B,"0.2.0.0",$0D
// .byte $0D,$05,$92
// .byte $0D,$05,$92,$00
#endif
.byte $00 // end of banner
-48
View File
@@ -1,48 +0,0 @@
// Routine is too long to fit in the original location
initmsg_real:
// Print startup banner, up to 255 characters
ldx #$00
!:
lda startup_banner, x
beq !+ // 0 means end of banner
jsr JCHROUT
inx
bne !-
!:
// Print ROM revision
lda #<rom_revision_basic_string
ldy #>rom_revision_basic_string
jsr STROUT
// Print PAL/NTSC, if configured
#if CONFIG_BANNER_PAL_NTSC
jsr print_pal_ntsc
#endif
jsr initmsg_double_return
jsr print_return
// Work out free bytes, display them
jsr basic_do_new
sec
lda MEMSIZ+0
sbc TXTTAB+0
tax
lda MEMSIZ+1
sbc TXTTAB+1
jsr print_integer
// Print rest of the start up message
ldx #34
jsr print_packed_message
initmsg_double_return:
jsr print_return
jmp print_return
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -14,12 +14,12 @@ rom_revision_basic:
// $BF52
.text "OR" // Magic string, after "Open ROMs"
.byte CONFIG_ID // Config file ID, might change between revisions
.text "OR" // project signature, 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
.text "(DEVEL SNAPSHOT)" // actual ROM revision string; up to 16 characters
.byte $00 // marks the end of string
__rom_revision_basic_end:
+2
View File
@@ -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 213) this area is unused - so a perfect place.
@@ -0,0 +1,39 @@
//
// !!! 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.
//
// $E4B7
// This vector is to be used by non-Kernal ROMs, if they want to
// complain about incompatible ROM releases - don't use it directly,
// use a 'panic' pseudocommand with error code (will be passed using .A)
// #P_ERR_ROM_MISMATCH - it should remain stable even between releases
#if CONFIG_PANIC_SCREEN
.word panic
#else
.word hw_entry_reset
#endif
rom_revision_kernal:
// $E4B9
.text "OR" // project signature, after "Open ROMs"
.byte CONFIG_ID // config file ID, might change between revisions
rom_revision_kernal_string:
.text "(DEVEL SNAPSHOT)" // actual ROM revision string; up to 16 characters
.byte $00 // marks the end of string
__rom_revision_kernal_end:
+32 -26
View File
@@ -5,68 +5,74 @@
// Double underscore prevents labels from being passed to VICE (would confuse monitor)
.label __MSG_KERNAL_SEARCHING_FOR = __kernal_message_searching_for - __kernal_messages_start
.label __MSG_KERNAL_LOADING = __kernal_message_loading - __kernal_messages_start
.label __MSG_KERNAL_VERIFYING = __kernal_message_verifying - __kernal_messages_start
.label __MSG_KERNAL_SAVING = __kernal_message_saving - __kernal_messages_start
.label __MSG_KERNAL_FROM_HEX = __kernal_message_from_hex - __kernal_messages_start
.label __MSG_KERNAL_TO_HEX = __kernal_message_to_hex - __kernal_messages_start
.label __MSG_KERNAL_SEARCHING_FOR = __msg_kernalsearching_for - __msg_kernal_first
.label __MSG_KERNAL_LOADING = __msg_kernalloading - __msg_kernal_first
.label __MSG_KERNAL_VERIFYING = __msg_kernalverifying - __msg_kernal_first
.label __MSG_KERNAL_SAVING = __msg_kernalsaving - __msg_kernal_first
.label __MSG_KERNAL_FROM_HEX = __msg_kernalfrom_hex - __msg_kernal_first
.label __MSG_KERNAL_TO_HEX = __msg_kernalto_hex - __msg_kernal_first
#if CONFIG_BANNER_PAL_NTSC
.label __MSG_KERNAL_PAL = __kernal_message_pal - __kernal_messages_start
.label __MSG_KERNAL_NTSC = __kernal_message_ntsc - __kernal_messages_start
#if CONFIG_SHOW_PAL_NTSC
.label __MSG_KERNAL_PAL = __msg_kernalpal - __msg_kernal_first
.label __MSG_KERNAL_NTSC = __msg_kernalntsc - __msg_kernal_first
#endif
.label __MSG_KERNAL_PANIC = __kernal_message_panic - __kernal_messages_start
.label __MSG_KERNAL_PANIC_VERSION = __kernal_message_panic_version - __kernal_messages_start
#if CONFIG_PANIC_SCREEN
.label __MSG_KERNAL_PANIC = __msg_kernalpanic - __msg_kernal_first
.label __MSG_KERNAL_PANIC_ROM_MISMATCH = __msg_kernalpanic_rom_mismatch - __msg_kernal_first
#endif
__kernal_messages_start:
__msg_kernal_first:
__kernal_message_searching_for:
__msg_kernalsearching_for:
.byte $0D
.text "SEARCHING FOR"
.byte $80 + $20 // end of string mark + space
__kernal_message_loading:
__msg_kernalloading:
.byte $0D
.text "LOADIN"
.byte $80 + $47 // end of string mark + 'G'
__kernal_message_verifying:
__msg_kernalverifying:
.byte $0D
.text "VERIFYIN"
.byte $80 + $47 // end of string mark + 'G'
__kernal_message_saving:
__msg_kernalsaving:
.byte $0D
.text "SAVIN"
.byte $80 + $47 // end of string mark + 'G'
__kernal_message_from_hex:
__msg_kernalfrom_hex:
.text " FROM "
.byte $80 + $24 // end of string mark + '$'
__kernal_message_to_hex:
__msg_kernalto_hex:
.text " TO "
.byte $80 + $24 // end of string mark + '$'
#if CONFIG_BANNER_PAL_NTSC
#if CONFIG_SHOW_PAL_NTSC
__kernal_message_pal:
.text ", PAL"
__msg_kernalpal:
.text "PAL,"
.byte $80 + $20 // end of string mark + space
__kernal_message_ntsc:
.text ", NTSC"
__msg_kernalntsc:
.text "NTSC,"
.byte $80 + $20 // end of string mark + space
#endif // CONFIG_BANNER_PAL_NTSC
#endif // CONFIG_SHOW_PAL_NTSC
__kernal_message_panic:
#if CONFIG_PANIC_SCREEN
__msg_kernalpanic:
.text "KERNAL PANI"
.byte $80 + $43 // end of string mark + 'C'
__kernal_message_panic_version:
__msg_kernalpanic_rom_mismatch:
.text " - ROM MISMATC"
.byte $80 + $48 // end of string mark + 'H'
#endif // CONFIG_PANIC_SCREEN
+1 -1
View File
@@ -5,7 +5,7 @@
// - [RG64] C64 Programmer's Reference Guide - page 275 (CHKIN) / 276 (CKOUT)
// - [CM64] Compute's Mapping the Commodore 64 - page 229
//
// CPU registers that has to be preserved (see [RG64]): .Y
// CPU registers that has to be preserved (see [RG64]): .Y, possibly .A (XXX - see [CM64], page 213)
//
+21 -5
View File
@@ -3,19 +3,29 @@
// Something terrible happened - show the panic screen
//
// .A = 0 - just panic, no extra message
// .A = 1 - ROM version mismatch
#if CONFIG_PANIC_SCREEN
panic:
// Disable interrupts, store error code on stack
sei
pha
// Reinitialize the hardware
jsr IOINIT
jsr setup_vicii
jsr clear_screen
// XXX disable NMIs
// Disable NMIs - our routine checks for NULL vector
lda #$00
sta NMINV+0
sta NMINV+1
// Display KERNAL PANIC message
ldx #$14
ldy #$0E
@@ -24,6 +34,8 @@ panic:
ldx #__MSG_KERNAL_PANIC
jsr print_kernal_message
// Display error code and message (if known)
pla
beq kernal_panic_infinite_loop
pha
@@ -37,12 +49,14 @@ panic:
jsr print_hex_byte
pla
cmp #$01
cmp #P_ERR_ROM_MISMATCH
bne kernal_panic_infinite_loop
ldx #__MSG_KERNAL_PANIC_VERSION
ldx #__MSG_KERNAL_PANIC_ROM_MISMATCH
jsr print_kernal_message
// Display some raster effect in the infinitew loop
kernal_panic_infinite_loop:
ldx #$00
stx VIC_EXTCOL
@@ -59,3 +73,5 @@ kernal_panic_infinite_loop:
bne !-
beq kernal_panic_infinite_loop // branch always
#endif // CONFIG_PANIC_SCREEN
+1 -1
View File
@@ -9,7 +9,7 @@
print_kernal_message:
lda __kernal_messages_start, x
lda __msg_kernal_first, x
bpl !- // 0 marks end of string
and #$7F
jmp JCHROUT
+2 -2
View File
@@ -3,7 +3,7 @@
// Print video system on startup banner
//
#if CONFIG_BANNER_PAL_NTSC
#if CONFIG_SHOW_PAL_NTSC
print_pal_ntsc:
@@ -14,4 +14,4 @@ print_pal_ntsc:
!:
jmp print_kernal_message
#endif // CONFIG_BANNER_PAL_NTSC
#endif // CONFIG_SHOW_PAL_NTSC
-34
View File
@@ -1,34 +0,0 @@
//
// !!! 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: