From 3eb7d4ffbd1d79e5c679af664a5901948e648abe Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 30 May 2020 15:44:06 +0200 Subject: [PATCH] for Mega65 disable the extended stack on cold/warm restart --- c64/aliases/,aliases_cpu.s | 5 +++++ c64/kernal/init/fce2.hw_entry_reset.s | 12 +++++++++--- c64/kernal/interrupts/fe66.default_brk_handler.s | 10 ++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/c64/aliases/,aliases_cpu.s b/c64/aliases/,aliases_cpu.s index b45f73f3..755b6dda 100644 --- a/c64/aliases/,aliases_cpu.s +++ b/c64/aliases/,aliases_cpu.s @@ -69,6 +69,11 @@ #if HAS_OPCODES_65CE02 +// CPU flags support + +.pseudocommand cle { .byte $02 } +.pseudocommand see { .byte $03 } + // .B register support .pseudocommand tab { .byte $5B } diff --git a/c64/kernal/init/fce2.hw_entry_reset.s b/c64/kernal/init/fce2.hw_entry_reset.s index 0d36a2d6..2ada16d4 100644 --- a/c64/kernal/init/fce2.hw_entry_reset.s +++ b/c64/kernal/init/fce2.hw_entry_reset.s @@ -11,10 +11,16 @@ hw_entry_reset: // The GPL program at https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/6502_functional_test.a65 // uses the similar initial reset sequence, affirmed by c64 PRG p269 - sei // disable the interrupts, as fast as possible - they are disabled in case of HW reset, - // but this routine can be also called manually + sei // disable the interrupts, as fast as possible - they are disabled in case of HW reset, + // but this routine can be also called manually - cld // required for all CPUs - due to possibility of manual call + cld // required for all CPUs - due to possibility of manual call + +#if HAS_OPCODES_65CE02 + + see // disable extended stack + +#endif ldx #$FF txs diff --git a/c64/kernal/interrupts/fe66.default_brk_handler.s b/c64/kernal/interrupts/fe66.default_brk_handler.s index 668462f3..782a0d6b 100644 --- a/c64/kernal/interrupts/fe66.default_brk_handler.s +++ b/c64/kernal/interrupts/fe66.default_brk_handler.s @@ -12,11 +12,17 @@ default_brk_handler: #if CONFIG_PLATFORM_COMMODORE_64 ldx #$00 - sta VIC_SCROLX // turn the display off - we want as little screen artifacts as possible + sta VIC_SCROLX // turn the display off - we want as little screen artifacts as possible #endif - cld // make sure this dangerous flag is disabled + cld // make sure this dangerous flag is disabled + +#if HAS_OPCODES_65CE02 + + see // disable extended stack + +#endif jsr JRESTOR jsr JIOINIT