Jump to content
IGNORED

vidak's Blog - Guerrilla Game #5.3 -- The Final Puzzle Piece


RSS Bot

Recommended Posts

Okay! So I think I have mastered how to draw the kernel that SpiceWare outlined in StayFrosty. If make sure you read all of the blog posts under the #5 heading so you understand what I am talking about.

Remember this his how the main player character is drawn in the kernel:

I     The "Heights" Variable

I asked SpiceWare for some help in understanding how the Heights variable worked. It turned out my analysis was more or less correct, despite some small errors. This is how the Heights variable is set:
II     Preparing the Pointers for Sections 1 to 4

It was easy enough to understand how the pointers for the graphics were set up for Section 0 of the screen. This is because the bottom of the screen is the designated origin of the Y position of the main player character. But we need to adjust the Y positions of all the copies of the main player character up the screen. We will mask out all but one image of the main player character, but we still need to make the kernel attempt to draw the image 5 times up the screen before we mask it out.

So this is how we prepare the pointers for the above purpose:
We are adding a 1 byte number to a 2 byte number. The process for doing this requires you to add the 1 byte number to the lower byte of the 2 byte number, and add any overflow to the higher byte. I did not realise this was happening! So if Heights (1 bytes) + ImagePtr(Lower byte) = 256, we add the carry put in the Program Counter to ImagePtr (Highter Byte).So, what the code achieves overall is this:

 

 

III     The Final Component of the Kernel: (.SEC*2)

The final element of drawing the main player character in the kernel is understanding what .SEC*2 does in the following code:
.SEC is the argument passed into the kernel macro.This argument is converted into a pseudo-variable in the code.It is not a real variable because .SEC is not a piece of memory that contains data. .SEC is a set of characters that are mapped into the code depending on the value of the argument passed into the macro..SEC therefore specifies a number between 0 and 4 - which tells the kernel to draw a specific band of graphics up and down the screen.What does " *2 " achieve though? This is simple. The image pointer is a 2 byte variable, so we need to tell the macro to specify in the code that the variable we want to specify in the final code is a 2 byte memory location. Simple.

IV But What About the Mask and the Colour?

The colour pointer works in exactly the same way as the image pointer. It is like a second part of the image pointer that needs to be set up separately with its own code. The process of setting a colour pointer for a multi-band screen is perfectly isomorphic with setting the graphics pointer.

This is the data in ROM which sets out the mask used to let the main player character graphics through onto the correct band of the screen:
V     The End

That's it! Now I can get to writing my own kernel!


http://atariage.com/forums/blog/703/entry-14394-guerrilla-game-53-the-final-puzzle-piece/
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...