CPCWiki forum

General Category => Technical Support => Software related => Topic started by: Audronic on 11:53, 12 July 19

Title: Where do I patch a Rom to adjust the Checksum ? (Sorted OK)
Post by: Audronic on 11:53, 12 July 19
Hi All


I Have a Rom file OS6128.ROM That has a checksum of 4C40 and it should be 4C00.

Where do I patch the file to restore the checksum ?.

Thanks Ray
Title: Re: Where do I patch a Rom to adjust the Checksum ?
Post by: GUNHED on 12:35, 12 July 19
Regular expansion ROMs (NOT the lower/OS or BASIC ROM!!!) do this:

Addresses from &C000 up to &FFFE are added, and the result is put in one byte.

This means as soon as the checksum is bigger than 255 then you just subtract 256, so the result is always something between 0 and 255

Finally the Checksum is written to the ROM address &FFFF


BASIC example

w=0
for a=&4000 to &7FFE
w=w+peek(a)
if w>255 then w=w-256
next
poke &7FFF,w
end

This works for a ROM at address &4000







Title: Re: Where do I patch a Rom to adjust the Checksum ?
Post by: Audronic on 12:39, 12 July 19
@GUNHED (http://www.cpcwiki.eu/forum/index.php?action=profile;u=2029)


Thanks.  Ray
Title: Re: Where do I patch a Rom to adjust the Checksum ?
Post by: GUNHED on 12:40, 12 July 19
Always a pleasure!  :)  Looks like a productive weekend is coming up.  :) :)
Title: Re: Where do I patch a Rom to adjust the Checksum ?
Post by: Audronic on 13:29, 12 July 19
Hi Gunhed - EtAll


I have worked out a patch to the RedBox Modified OS6128 with 32 roms.


The checksum after the mods ended up being &4140 instead of &4100 I have made a patch to the file and burned a rom.
I have done a checksum of various system roms and they all look like this & xx00 h so when saw the xx40 that alerted me. (I need to be alert)
Put it in my trusty CPC464 and it BOOTS -- Yeahhhh  -- the previous version would NOT Boot (&4140).


I will continue on tomorrow and find a better place to alter the checksum in some of the Link Names Solavox AWA etc That won't get used


Ray