PDA

View Full Version : Commodore PET Kernel Source



hexsane
August 20th, 2009, 09:42 PM
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

pontus
August 20th, 2009, 11:53 PM
What does reverse engineered mean in this context? A commented assembly listing of ROM code?

cosam
August 21st, 2009, 12:25 AM
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
August 21st, 2009, 02:21 AM
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

hexsane
August 21st, 2009, 02:23 AM
What does reverse engineered mean in this context? A commented assembly listing of ROM code?

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

-Matt

track18
August 21st, 2009, 04:21 AM
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
August 21st, 2009, 06:23 AM
There is a Perl tool called recomment (http://www.zimmers.net/anonftp/pub/cbm/programming/unix/recomment-4.08.tar.gz) 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
August 21st, 2009, 08:17 AM
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.

dave_m
August 21st, 2009, 09:07 AM
Here is some good info on PET code

http://www.6502.org/users/andre/petindex/roms.html

hexsane
August 21st, 2009, 11:13 AM
There is a Perl tool called recomment (http://www.zimmers.net/anonftp/pub/cbm/programming/unix/recomment-4.08.tar.gz) 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
August 21st, 2009, 11:14 AM
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

hexsane
August 21st, 2009, 11:16 AM
Here is some good info on PET code

http://www.6502.org/users/andre/petindex/roms.html

That is what I'm looking for and I swear I looked on 6502.org but didn't see this. :confused:

-Matt

sjgray
August 29th, 2009, 03:36 AM
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