base:protecting_against_soft-resets
This is an old revision of the document!
Protecting against soft-resets
When the C64 gets a soft-reset signal, the first thing it does is check for an EPROM at $8000 (kernal routine $FD02). We can take advantage of this routine to redirect resets to our own code.
* = $0900 sei lda #$c3 ;the string "CBM80" at $8004 is used to check 8-ROM sta $8004 lda #$c2 sta $8005 lda #$cd sta $8006 lda #$38 sta $8007 lda #$30 sta $8008 lda #<reset ;redirect the vector at $8000 to our own code sta $8000 lda #>reset sta $8001 main inc $d020 ;just something to look at jmp *-3 reset lda #$2f ;reset data-direction register, otherwise the system won't start correctly sta $00 jmp main ;go back to main code
Now try soft-resetting. Instead of going back to the basic screen, instead you'll see the inc $d020 effect.
base/protecting_against_soft-resets.1454270626.txt.gz · Last modified: 2016-01-31 21:03 by karmic