diff --git a/c64/kernal/cartridge_check.s b/c64/kernal/cartridge_check.s new file mode 100644 index 00000000..8dabdcd7 --- /dev/null +++ b/c64/kernal/cartridge_check.s @@ -0,0 +1,13 @@ +; c64 prg p263 + +cartridge_check: + ldx #$04 +cartridge_check_l1: + lda $8002,x + cmp cartridge_signature,x + bne no_cartridge + dex + bpl cartridge_check_l1 + jmp ($8000) +cartridge_signature: + .byte $C3,$C2,$CD,$38,$30 diff --git a/c64/kernal/reset_entry.s b/c64/kernal/reset_entry.s index 31fde3d6..dbcf21c9 100644 --- a/c64/kernal/reset_entry.s +++ b/c64/kernal/reset_entry.s @@ -5,20 +5,26 @@ reset_entry: ; The GPL program at https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/6502_functional_test.a65 ; uses the following initial reset sequence + ; affirmed by c64 PRG p269 cld ldx #$ff txs sei + ; C64 PRG p269 + jsr cartridge_check ; The following routine is based on reading the public KERNAL jumptable routine ; list, and making unimaginative assumptions about what should be done on reset. - ; Initialising IO is obviously required. + ; Initialising IO is obviously required. also indicated by c64 prg p269. jsr ioinit - ; Setting up the screen is obviously required + ; Setting up the screen and testing ram is obviously required + ; also affirmed by p269 of c64 prg jsr ramtas ; Resetting IO vectors is obviously required, if we want interrupts to run + ; also affirmed by c64 prg p269 jsr restor ; What do we do when finished? A C64 jumps into the BASIC ROM + ; c64 prg p269 jmp ($a000)