Re: A83: Re: Two graphical problems to solve.
[Prev][Next][Index][Thread]
Re: A83: Re: Two graphical problems to solve.
> Do you need that exact same functionality? Finding the offset in the buffer
> is of course important, but imho the pixel mask is not always so useful.
> For me, when writing sprite routines, it's more useful to just know how many
> times to shift the mask, rather than knowing the pixel offset (which is
> generally irrelevant).
Agreed. Most users who program the TI83/+ display don't need the pixel
mask. It is also that part of a plot routine which is most likely to
stay the same, since 8 pixels represent exactly one byte of video memory
on black and white displays.
Given X and Y you would calculate the pixel mask and the byte in video
memory this way:
pixel within byte = (X modulo 8) --> to get a range of 0-7, with 7
corresponding to the left-most pixel
within one byte.
byte in Vid-Mem = y * (screen length) + (x/8)
However, the screen length differs on various systems. On the TI83/83+
it is 12 bytes long, on the TI86 16 bytes. Hercules graphics boards used
90 bytes, CGA b/w graphics used 80 bytes. This part of the calculation
has always been most difficult, especially on 8-bit processors, since it
involves multiplication. The question is whether you can simplify it by
morphing the part which remains constant into a bunch of additions
(which is executed the fastest on any processor).
Before you even can start to shift the mask, you have to position the
sprite within byte-boundaries, that is you have to calculate the byte in
Vid-mem.
I hope I presented my point of view well enough (given that it's about
3am right now) /-:
Bye,
Martin
References: