• Please review our updated Terms and Rules here

Commodore PET Kernel Source

hexsane

Experienced Member
Joined
Mar 4, 2009
Messages
385
Location
Omaha, NE USA
Anyone know if this has been reverse engineered and is floating around somewhere? I need to see the feasibility of doing a few modifications.

-Matt
 

cosam

Veteran Member
Joined
Dec 21, 2008
Messages
594
Location
Netherlands
One thing that may aid your search: the Commodore crowd like to spell it "kernal" (with an "a"). Google will try to "correct" your spelling, but you will get some different results.

Are you aiming to patch the original ROM? It may be easier (and more elegant) to put your modifications into a separate expansion chip.
 

hexsane

Experienced Member
Joined
Mar 4, 2009
Messages
385
Location
Omaha, NE USA
One thing that may aid your search: the Commodore crowd like to spell it "kernal" (with an "a"). Google will try to "correct" your spelling, but you will get some different results.

Are you aiming to patch the original ROM? It may be easier (and more elegant) to put your modifications into a separate expansion chip.

For compatibility reasons (kernAl calls from ML) I will have to jump out of the kernel and run my own code (if needed) then return.

BASIC extensions I can do. But any direct ML calls will kill compatibility and I'd like to be as compatible as possible.

-Matt
 

track18

Experienced Member
Joined
Mar 12, 2009
Messages
51
Location
Hannover, Germany
Matt,

Yes. But a non-commented listing would do. ;) Basically I'm trying to save myself a few steps if possible.

-Matt

in order to obtain a raw version of an undocumented PET kernal disassembly, you might be able to use the VICE emulator's built-in monitor, which also features a disassembler. Haven't found out how to write its output to file, though.

Regards --
 

carlsson

Veteran Member
Joined
Jul 30, 2003
Messages
6,275
Location
Västerås, Sweden
There is a Perl tool called recomment which I highly recommend. You take a binary dump and it outputs assembly source code that you can massage to a form you easily can re-assemble again using a cross assembler. This tool tries to distinguish data from code (but sometimes it fails) and makes references to iNNNN and xNNNN so you more easily can relocate, add stuff etc. I think it may be the closest you will get to a commented, disassembled listing unless you find someone who has already done that.

By the way, which PET Kernal version are you working with? I think there are a couple, so you should determine that first.
 

MikeS

Veteran Member
Joined
Dec 23, 2005
Messages
7,493
Location
Toronto ON Canada
For compatibility reasons (kernAl calls from ML) I will have to jump out of the kernel and run my own code (if needed) then return.

BASIC extensions I can do. But any direct ML calls will kill compatibility and I'd like to be as compatible as possible.

-Matt
You probably know this, but many kernal functions go through a vector in RAM which can easily be redirected, so for those functions it's not necessary to change the kernal itself in order to jump out and back in; there are memory maps out there which may help you.
 

hexsane

Experienced Member
Joined
Mar 4, 2009
Messages
385
Location
Omaha, NE USA
There is a Perl tool called recomment which I highly recommend. You take a binary dump and it outputs assembly source code that you can massage to a form you easily can re-assemble again using ... <snip>

By the way, which PET Kernal version are you working with? I think there are a couple, so you should determine that first.

I've found a disassembler that can take a memory map and raw bin and do that same. Haven't played with that yet.

I know I have a BASIC 4.0 4032 - but not sure about the kernel. If its a 40 column kernel from a BASIC 4.0 machine it should still work though, right?

At some point I'll need all the newest kernels but I can only work with what I have. :)

-Matt
 

hexsane

Experienced Member
Joined
Mar 4, 2009
Messages
385
Location
Omaha, NE USA
You probably know this, but many kernal functions go through a vector in RAM which can easily be redirected, so for those functions it's not necessary to change the kernal itself in order to jump out and back in; there are memory maps out there which may help you.

No. I didn't know that. Thanks for the tip. :)

-Matt
 

sjgray

Experienced Member
Joined
Feb 3, 2009
Messages
467
Location
Markham, Ontario, Canada
I've found a disassembler that can take a memory map and raw bin and do that same. Haven't played with that yet.

I know I have a BASIC 4.0 4032 - but not sure about the kernel. If its a 40 column kernel from a BASIC 4.0 machine it should still work though, right?

At some point I'll need all the newest kernels but I can only work with what I have. :)

-Matt

Just for clarification, in the later PETs there is the Kernal ROM and there is an EDITOR rom. The EDITOR rom is responsible for supporting the screen and keyboard, so technically you have a "40-column EDITOR ROM" and not a "40-column KERNAL". The BASIC and KERNAL roms stay the same and the EDITOR rom is selected according to 50/60 Hz, 40/80 columns, and Business/Graphic keyboard options.

Steve
 
Top