Re: LZ: Programming cells?
[Prev][Next][Index][Thread]
Okay, I'm gonna try to tell you this as precise as I can, but I haven't
done this before, so I'll just lay down the basics, I won't give out much
code.
First you need to correct the y value. I think it would be easier to
have your lower y values at the top, because that is how the screen is
set up.
(0,0) (15,0)
...
(7,0) (15,7)
Now if there are 16 bytes in a row(which there are), each block takes up
eight rows of 16 bytes. So...
y value 0 would be row 0, 0 bytes from beginning of screen memory
y value 1 would be row 8, 128 bytes from beginning of screen memory
y value 2 would be row 16, 256 bytes from beginning of screen memory
Pattern...this is where algebra comes into play P(y)=y*8*16
That gives you the correct byte, but nw you need to add the x value.
This is simple, cause each byte is a block...so
P(x,y)=(y*128)+x Now you've got the correct byte, so add that offset to
$FC00 and that's whree you should display it. Now the actual bitmaps of
the figures should be stored like this:
figure1:
.db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
figure2:
.db .....
Figure1 is 8 bytes, although it's easier to put it in %11111111 binary.
Load the first byte of the figure into the mem location(remember that?),
then add 16 to get to the next line and display the next byte.
I'll leave most of the code up to you, cause I think it's good to have
experience. But if you have any real hard questions, I'll answer them.
Mike Johnson wrote:
>
> ----------
> > From: Alan Bailey <bailala@mw.sisna.com>
> > To: list-zshell@lists.ticalc.org
> > Subject: Re: LZ: Programming cells?
> > Date: Friday, October 04, 1996 7:49 PM
> >
> >
> > I think you're talking about pictures that are spaced every 8 pixels,
> > right? Those are simple because you don't need a sprite routine to
> check
> > the bit number and display it bit by bit. So just have apointer to each
>
> > graphic you want. These should be 8 bytes for 8*8. Now if you wanted a
>
> > routine to have a x value(0-15) and y value(0-7), and convert it to the
> > correct vidmem pointer, that wouldn't be too hard. But then after that
> > it would be simple. (That's what you're talking about, right)
> > --
> > Compliments of:
> > _-_-_-_-_-_-_-_
> > Alan Bailey
> > mailto:bailala@mw.sisna.com
> > IRC:Abalone
> > Web:http://www.mw.sisna.com/users/bailala/home.htm
>
> Yes, that is basically what I am talking about. I want a small 8*8
> picture of a piece of wall which I display at different x values (0-15)
> and y values (0-7) to make full walls anywhere from 0-64 pixels long
> eventually drawing a level looking similar to those in Chris Busch's game
> Crunch. I cant just do one big picture for the walls because I need to
> change it for every level and that would get huge. I'm am not an
> experenced programmer but I think what you are saying would work. Any
> help would be greatly apreciated.
>
> Mike Johnson
> mj11749@cedarnet.org
<pre>
--
Compliments of:
_-_-_-_-_-_-_-_
Alan Bailey
mailto:bailala@mw.sisna.com
IRC:Abalone
Web:http://www.mw.sisna.com/users/bailala/home.htm
</pre>
References: