Thursday, March 13, 2014

Progress towards booting C65 ROM

After working on getting the kickstart ROM (which should probably be more correctly called a bootstrap ROM), I have been able to load the C65 ROM into slow RAM on the C65GS for a couple of weeks now.

Efforts have been turning to getting the C65 ROM to actually start up properly.  This has been a bit slow, as I have chased CPU bugs of various sorts, and dealt with a subtle issues in the bank switching side of things.  For example, the $0000/$0001 CPU register only appears in bank 0, and the MAP and $D030 methods of banking take precedence over it, except for controlling the appearance of IO at $D000.  Or at least that's what seems to be the case.  I will need to get a C65 owner to verify some of this for me at some point.

Anyway, I had it working to the point where it would select 80-column output (and have the VIC-IV actually switch to the right mode to drive it) for a while, but there was no visible text, just the 2nd half of the screen filled with blinking @ characters because the colour RAM was presumably not being initialised.

After bashing my head on that for a while, I discovered that the start message was in the screen memory, but not visible. I tracked the problem down to the palette being set incorrectly: the high and low nybls of the palette needed to be reversed, as the C65 only uses the lower nybl in palette entries.

After fixing that, suddenly I had a visible and correctly coloured startup display.  Well sort of. As you can see there are some rather glaring problems.


Most obviously, the screen is largely full of @ characters.  This is because the C65 clears the screen lines (filling them with spaces) using the DMAgic chip to make this process quite a bit quicker than using the CPU alone.  I haven't implemented the DMAgic chip yet.

Also, the 2nd kilo-byte of colour RAM doesn't seem to be getting initialised.  But that could also be related to DMA, as the kickstart ROM initialises the first KB of colour RAM.

One funny thing I need to debug is that the ROM only displays the startup message if IRQs are initially disabled.  It is pure luck that I had IRQs physically disabled (I have an override hardware switch on the FPGA board to disable IRQs as it makes single-stepping the CPU easier if IRQs aren't being triggered all the time).  Otherwise I would have just seen a blue screen full of @ characters.  However, the ROM still doesn't display a READY prompt. This might be due to a ROM mapping bug that I just discovered, that is likely messing up the 1581 DOS, and preventing it from returning after looking for the disk drive.

Finally, the colour bars on the left of the screen are missing, with just the sloped graphic character visible, but nicely in the right colour. Looking at the colour RAM, the correct colour is set for the other characters, but the reverse video bit is not set, and only a space character is being written there. I will need to dig to find out what the problem is here. It might again be that DMA is used to fill the colour RAM bytes with the reverse-attributed colour.  So there is probably little point in trying to figure out the cause until I get the DMAgic chip implemented.  DMAgic is also need for the BASIC ROM, so that really is the priority.  The DMAgic chip will be fairly easy to implement when I get the chance.

So while not quite there yet, it is progress.

EDIT: I couldn't resist fixing the @'s, colour memory values and reverse attributes on the running machine, just to see what it would look like.  Screen grab below:


Ah. That's better.  While I had to hand-doctor the display memory, this is being run in the real C65GS (FPGA) hardware, with a real 8-bit computer inside, and a real, if rather incomplete and imperfect VIC-IV video controller generating it in real time.

Note that 80-column mode has no side-borders, because 640 pixels * 3 = 1920, the native resolution of the C65GS. There are some vertical borders.  They could be stretched out if desired, or left in to keep the more 8-bit feel, which is my preference.

Anyway, onward and upward to get this display happening without hand-tweaking of memory after boot ...

2 comments:

  1. Beautiful work, the last screen grab is a great milestone, awaiting the arrival of my nex4 this coming week!

    ReplyDelete
  2. Aah, seeing that colourful rainbow must have been a very rewarding moment :D

    ReplyDelete