Function ROM operation

Started by FMan, July 03, 2007, 05:00 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

FMan

Hello! I just joined the forum, as I have a question. :) I am making a Function ROM and I have been unable to find this specific information. Is the first JMP at the base address of the ROM the autostart entry point? If my ROM wasn't an autostarting one, what would I put there instead and is the second JMP then the one that gets called during BASIC's initialization or does the ROM get called at all in this case and is the second JMP for some other purpose?

I was able to find out a lot about the startup process from the Mapping the C128 book and examining the reset routine, and from the one Function ROM I could get from Funet. I trust there are more than one. ;) Can you give me download URLs to some others so that I can do some reverse-engineering on them? :D

Thanks for your upcoming replies!

hydrophilic

According to C128 PRG, the second jump is never called.  The first jump is called soon after reset (by the POLL routine, before I/O initialization) if the ROM is defined as an autostart (ID=1) or will be called later (by PHOENIX) otherwise.  You probably know that $x006 is the ID byte and $x007 must start the string 'CBM'.

After the KERNAL has intialized everything, it passes control to BASIC.  BASIC starts by calling PHOENIX.  PHOENIX will first call any function ROMs it finds and end by loading the boot sector from drive 8.  I hope that helps.

For ROMs, have your tried the ROM page of the download section.  I think BASIC 8, the Servant, and one of the GEOS files are for the function ROM.

FMan

Thank you! Actually I have no information regarding byte 6. Is that how I specify if my ROM is autostarting and gets called before IOINIT - set it to 1? And if it is 0, it gets called by PHOENIX? Those are the two allowed values?

I have the C128 Reference Guide for Programmers too, but I didn't find anything related to this in it... Generally, I disregard that book because it is no good IMHO. It lacks an awful lot and some stuff is explained in a horrible way. :P

Yes, I found the ROMs in the download section after I had posted my message above and came across BASIC8, which I saw was a Function ROM, but for some reason it does not run in VICE. The ROM appears in bank 4, but doesn't activate.

hydrophilic

Byte 6 is called the Physical ID, and should be a value of 2 to 255 for normal (late start by Phoenix) or 1 for auto-start (early before IOINIT).  A value of 0 is undefined.

Again, that's from the C128 PRG, since I don't have an EPROM burner to try such things myself :(

Good luck, and welcome ;)

8502

Quote from: FManYes, I found the ROMs in the download section after I had posted my message above and came across BASIC8, which I saw was a Function ROM, but for some reason it does not run in VICE. The ROM appears in bank 4, but doesn't activate.
On a real 128 the CONTROL key must be held down during the boot procedure until the BASIC8 splash screen appears.  You'll need to hold down whichever key is mapped to CONTROL in VICE (as it "boots") to get it to work.
c128dcr  |  1581  |  1750  |  1084s  |  1351  |  mmc64  |  super-g  |  competition pro