Friday, July 1, 2011

Programming in a new direction...

Hello everyone,
Well, since my last blog you all saw the movement test and can tell that this method is not functional for a game. So I've been testing some new code and it is working a lot faster than the last program. So far I'm able to draw a tree shape across 20 rows and 10 columns with almost instant draw time.  I’m basically storing each byte, of the 32 bytes that make up a set shape, directly into the memory region that make up the Hi-Res page 1 screen. So, it kind of works like this; you have a memory region that starts at address $2000 for the top-left corner of the screen in Hi-Res page 1 graphics. This address makes up [1] byte of screen memory. I store the first byte of the tree shape in address $2000 and then store the next byte of the tree shape in address $2400. This basically places each byte starting at $2000 and I go down a line to $2400, to the next line $2800, and so on... When I get to the 16th line I step to the right one byte and start drawing the rest of the shape in the next 16 lines. So I use 10 separate subroutines for each row and these 10 subroutines loop through for the 20 shapes.
Due to this new draw process I had to lay out the shape byte values in a different way from before.  They are now set so the first 16 bytes are for the first 16 address bytes of memory and the next 16 bytes are for the next 16 address bytes of memory.  So the first two addresses are $2000 and $2080… the next two are $2100 and $2180 then so on…



I was able to figure out a process where you use an address such as $2000,Y The Y is like an array that lets you increment one place to the right as you increase the value of Y. It works really cool!
I have this working but it only draws trees across the entire screen. I need it to draw separate shapes within the entire screen to make sure it works correctly. I will post this code and video soon to show just how fast the screen draw is.
I will work on the subroutines that draw separate shapes from the map section.
Talk to you soon,
Joe

No comments:

Post a Comment