Sunday, 14 February 2016

More CPC analysis

Not much time on the weekends for sitting in front of a computer - except perhaps to print out weird and wonderfully random requests for colouring pages for my daughter - but I have done a little more analysis.

The two sprite entries that now point to NULL were both sprites used for the tree walls (2 of 3). I can only assume that they've been replaced by the two extra sprites at the end of the table. The ZX version of Knight Lore has a common update routine for all 3 wall sprites that is simply a fixed offset for rendering. Why didn't they simply didn't add an extra update routine for the aforementioned two? Time will tell.

The location tables for both versions are identical. I'm expecting differences in the background type table for the tree walls that of course point to the new sprite entries. Again, time will tell.

I'm hoping the differences are restricted to what I've seen thus far; would be nice to have a simple soft dipswitch setting on the Neo Geo for ZX or CPC graphics! I'm debating whether I should bother porting the CPC loading/title screen across too...

UPDATE: The foreground (block) type table is, as hoped, also identical. That just leaves the background type table which, as expected, differs. Thankfully only a little, though somewhat surprisingly at that.

What wasn't expected was a few sprites in the (brick) wall have slightly different Y & Z offsets. The update routines are the same (same pixel offset adjustments) so good news so far.

What was expected were differences in the tree wall. I did expect the walls to include the extra sprites at the end of the sprite table. Instead, the two missing sprites are simply replaced by flipped versions of the 1st sprite! Careful comparison of screen shots from CPC and other versions confirm this. I can't fathom why they would have deemed this necessary?

What this strongly suggests, however, is that the extra sprites aren't actually used without some behind-the-scenes hackery. Shortly I'll print the sprite table and see what they actually are. On that note, I'll also compare all the sprite dimensions to ensure that they're compatible with the ZX version.

One last difference; sprite #184 has its own update routine now, which copies some bytes into a RAM location I'm not familiar with and then falls through to the familiar ZX routine. What is interesting about this is that #184 is the sprite that the collapsing block changes to, leading to the bug I mentioned a few posts ago. Without further analysis I can't say whether this is a fix for the bug, but it certainly didn't look like it at first glance.

UPDATE #2: Quite a few sprites differ in height. A few differ in width. Hopefully it won't be an issue if I use the graphic data from the CPC version with the CPC sprites...

UPDATE #3: There don't appear to be any differences in the code for the different sprites. For the most part, the differences can be explained by the shaving off of the top/bottom line of the mask from various sprites.

The 2-tone sprites of Amstrad CPC Knight Lore
The sun/moon frame has been made wider, no doubt to mask the sun/moon at each end; this was accomplished by setting attributes to black on the ZX Spectrum and is currently still an issue in my C port. The scroll sprite has also been truncated.

The extra sprites comprise a number of blocks (purpose unknown) and the body and other end of the truncated scroll. Not really sure why this was necessary... wouldn't appear to me to save much - if any - memory.

It would seem that adding support for CPC graphics to my C port would be, for the most part, simply a matter of replacing a few tables. There would have to be some adjustments made for the frame and perhaps the scroll, at the least. Since both of these are part of the FIX layer on the Neo Geo, they could be all-but-ignored for that port, though I may have to tweak the data to allow me to set the CPC palette for the panel.

UPDATE #4: Got vflip implemented, but not hflip yet for CPC graphics.

CPC graphics WIP

No comments:

Post a Comment