English Amiga Board Amiga Lore


Go Back   English Amiga Board > Support > New to Emulation or Amiga scene

 
 
Thread Tools
Old 06 July 2012, 02:43   #1
BlankVector
Registered User
 
Join Date: Jun 2012
Location: Paris, France
Posts: 150
Kickstart checksum algorithm ?

Hello.

I'm interested in building custom kickstart ROM alternatives, such as EmuTOS for Amiga.

It seems that kickstart ROMs have a 32-bit checksum at the end. For 256 kB ROMs, it is at offset $3ffe8.

Question 1: Is that long at offset $3ffe8 really is a checksum? I can't find any documentation about it.

Question 2: What is the algorithm to compute that checksum? It seems to be something like computing the sum of all the longs in the ROM, but I can't get the exact value...

Question 3: For a custom kickstart, it that checksum really important? A custom kickstart without checksum works fine with WinUAE. Does any components use that checksum, such as soft kicking tools, etc? I'm in the mood of not including such checksum in custom ROMs if it is not required.

Thanks in advance.
BlankVector is offline  
AdSense AdSense  
Old 06 July 2012, 04:04   #2
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,017
Just like in Amiga bootblocks there's no actual checksum stored, it's inferred, and the 32-bit word you're looking at is just used to correct the checksum.

At -20 bytes from the end of a Kickstart ROM there's a 32-bit word that holds the size of the ROM in bytes. I don't know if software cares about it, but maybe this is how the hardware can map ROMs so they always end at $100 0000 regardless of size.

Also, the Amiga 1000 only has a small boot ROM which loads the Kickstart from disk and verifies the checksum, so at least in this case the checksum must be correct. The checksum is the sum of all 32-bit words and the carry digits, and must be equal to -1.
Leffmann is offline  
Old 06 July 2012, 08:06   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,681
Size (end-20) is at least used by some reset routines to find start address of ROM.
Toni Wilen is online now  
Old 06 July 2012, 09:46   #4
BlankVector
Registered User
 
Join Date: Jun 2012
Location: Paris, France
Posts: 150
Quote:
Originally Posted by Leffmann View Post
At -20 bytes from the end of a Kickstart ROM there's a 32-bit word that holds the size of the ROM in bytes.
Ah, I didn't know that. This is a useful meta-information, I will add it.

Quote:
Originally Posted by Leffmann View Post
Also, the Amiga 1000 only has a small boot ROM which loads the Kickstart from disk and verifies the checksum, so at least in this case the checksum must be correct.
Ok, that makes sense.

Quote:
Originally Posted by Leffmann View Post
The checksum is the sum of all 32-bit words and the carry digits, and must be equal to -1.
Many thanks, this is exactly what I needed
I didn't add the carry bits, this is why my result was almost good, but not exactly.
BlankVector is offline  
Old 06 July 2012, 22:16   #5
BlankVector
Registered User
 
Join Date: Jun 2012
Location: Paris, France
Posts: 150
Quote:
Originally Posted by Leffmann View Post
The checksum is the sum of all 32-bit words and the carry digits, and must be equal to -1.
Good, I have fixed my routines, now my checksums are correct

Quote:
Originally Posted by Leffmann View Post
Also, the Amiga 1000 only has a small boot ROM which loads the Kickstart from disk and verifies the checksum, so at least in this case the checksum must be correct.
This seems to be wrong.
I made tests with WinUAE, and it still works fine when the kickstart on the floppy has invalid checksum.
BlankVector is offline  
Old 06 July 2012, 23:39   #6
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,017
Quote:
Originally Posted by BlankVector View Post
This seems to be wrong.
I made tests with WinUAE, and it still works fine when the kickstart on the floppy has invalid checksum.
Ok, good to know. I read this in Ralph Babel's Amiga Guru Book and some other book but never verified it myself, perhaps it only applies to some versions of the A1000 boot ROM.
Leffmann is offline  
Old 06 July 2012, 23:47   #7
BlankVector
Registered User
 
Join Date: Jun 2012
Location: Paris, France
Posts: 150
Quote:
Originally Posted by Leffmann View Post
Ok, good to know. I read this in Ralph Babel's Amiga Guru Book and some other book but never verified it myself,
Hehe, experimentation rulez

Quote:
Originally Posted by Leffmann View Post
perhaps it only applies to some versions of the A1000 boot ROM.
Yes, maybe.
BlankVector is offline  
Old 07 July 2012, 07:25   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,681
I remember getting red screen but only after first keyboard or software reset if loaded kickstart disk had bad checksum.
Toni Wilen is online now  
Old 07 July 2012, 11:18   #9
BlankVector
Registered User
 
Join Date: Jun 2012
Location: Paris, France
Posts: 150
I made further tests with WinUAE, Amiga1000 settings and Kickstart 1.3.
Indeed, the checksum makes a difference on reset (either LCtrl+Win+Win or WinUAE reset function).

- On startup, the kickstart is loaded from the floppy. Valid or invalid checksum makes no difference.

- On reset, if the checksum of the loaded kickstart was valid, it is reused from WOM and not reloaded from the floppy. It behaves just like a kickstart in ROM.

- On reset, if the checksum of the loaded kickstart was not valid, it is loaded again from the floppy, just like on cold boot.

I reproduced the same behavior with an EmuTOS floppy, no more mystery

NB: I never saw a red screen, maybe that function was introduced in later kickstarts...
BlankVector is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Name that algorithm swirlythingy Coders. General 3 07 March 2013 22:07
VICE PAL filter algorithm Leandro Jardim support.WinUAE 0 23 September 2012 00:27
Decoding algorithm(s) for encoded disk sectors (ADOS) andreas Coders. General 10 02 November 2009 22:18
C: Image rotation algorithm problem TikTok Coders. General 19 09 May 2007 19:31
Kickstart checksum incorrect Techx support.WinUAE 5 04 August 2005 04:43

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:07.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.14947 seconds with 11 queries