Re: VIC20 KERNAL Bug

From: Daniel Kahlin (tlr_at_stacken.kth.se)
Date: 2003-02-02 18:10:27

Hi,
the code is not for protection. :)

Well you can not just remove it...  It is the thing that makes
the readback work.  The routine you are talking about has two entry 
points in the kernal jumptable.   $ff8a (RESTOR) which points to $fd15 on 
the c64, and $ff8d (VECTOR) which points to $fd1a.

If VECTOR is called with carry=0 the vector table is copied from the 
adress you specify with X/Y.  If it is called with carry=1 the vector 
table is copied _to_ the adress you specify with X/Y.
If you just "nop" the code it will break.    

Note:  on the vic20 it didn't really matter that the code wrote to ROM 
locations, but when the code was ported to the c64 it started trashing 
memory...

Regards
/Daniel Kahlin

Below is a fix for the c64 rom, which I assume is easy to adapt for the 
vic20. 

;**************************************************************************
;*
;* bug: fd30-fd4f under rom gets trashed when setting up the vectors
;*      from rom.
;*
;******
;FD15 A2 30     LDX #$30
;FD17 A0 FD     LDY #$FD
;FD19 18        CLC
;FD1A 86 C3     STX $C3
;FD1C 84 C4     STY $C4
;FD1E A0 1F     LDY #$1F
;FD20 B9 14 03  LDA $0314,Y        FD20 B1 C3     LDA ($C3),Y
;FD24 B0 02     BCS $FD27    --->  FD22 90 05     BCC $FD29
;FD25 B1 C3     LDA ($C3),Y        FD24 B9 14 03  LDA $0314,Y
;FD27 91 C3     STA ($C3),Y
;FD29 99 14 03  STA $0314,Y
;FD2C 88        DEY
;FD2D 10 F1     BPL $FD20
;FD2F 60        RTS



On Sun, 2 Feb 2003, Christer Palm wrote:

> Nicolas Welte; address is valid for replies (Re:) only! wrote:
> > 
> > Can anyone think of problems that I could create when I patch this code
> > fragment?
> > 
> 
> As Groepaz points out, the C64 KERNAL has the same piece of code. Many 
> replacement ROMs (i.e. SpeedDOS and the like) already has it removed, so 
> it should be 100% safe to remove it.
> 
> It is indeed one of the major reasons to why many programs do not 
> survive a reset properly.
> 
> Its history would surely make a good piece of trivia. It was hardly put 
> in there by mistake and it couldn't be one of those "am I running from 
> ROM?" protection mechanisms as such a mechanism would surely write 
> something different than what's already there.
> 
> 


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.6.