RE: A82: Thanx.


[Prev][Next][Index][Thread]

RE: A82: Thanx.



On Tuesday, July 08, 1997 9:40 PM, Ryan N Gillespie[SMTP:ryan.gillespie@juno.com] wrote:
> Yup...substantial moving graphics. =) I understand what your showscreen
> header file does.(I thought it was writing to the buffer AND copying the
> Graph Mem to the LCD...but I haven't looked at it yet. =) ) Now I need to
> learn how to write to the buffer. If you don't feel like explaining it, I
> can probably find the info. myself. It's up to you.

Well the main structure of the video memory is quite simple... there are 64 rows  each with 12 columns of bytes.  Each bit in each byte stands for a pixel on the screen.  To change any point on the screen, you "simply" change the corresponding bit in the corresponding byte.  The order the bytes are stored is from left to right, then from top to bottom, so the first byte of the video buffer is the top left, the last is the bottom right.  Now, you could use FIND_PIXEL for each bit you want to change.  FIND_PIXEL will return the address of the byte that contains the bit you want, then you need to do a logical OR (if you don't know what that means, take some time to research a little digital logic) with that byte and another byte to turn one pixel on without affecting the others, or you use logical AND with a different byte to turn off specific pixels without affecting the other bits in the byte.
	But the hardest part about writing fast and efficient graphics code is that FIND_PIXEL isn't fast and efficient!  Most graphics routines (including sprite routines and the Daedalus raycaster) writes to the screen in certain patterns, making it easy to find the address of the next place to write without calling the slow FIND_PIXEL routine.  To write fast graphics routines, all I can say is to learn the important instructions in the Z80 instruction set, and know how to use them (I know that's a bit vague, but that's really what you need to do).  You can learn this by talking to other people (on the list or privately), or by looking at source code, or by simply reading through a Z80 instruction set reference (preferably a book with *all* the details, not that short text file that's on ticalc.)  Some instructions to pay attention to are the RL's, the SL's, the RR's, and the SR's, among many others!  It also helps to get an idea of the approximate timings of each of the instructio!
ns, so you can know which ones to avoid (ex: try to avoid pushes/pops as much as possible... they're pretty slow).
	Someone could always write a sprite scrolling routine for everyone, but that would be depriving everyone of the experience they could have gained by writing their own.  Plus, by writing their own, people can customize it to their own needs.  But it is always nice to have some other sprite routine source to compare yours to once you've finished.  Remember this is assembly language, the concept of "reusable code" does not exist.  Assembly programmers care only about the size and speed of their programs, and they will go to any lengths to acheive that. (well, I guess this is a *slight* exaggeration -- people will always 'borrow' other people's code -- but in a perfect world, this is how it would be :).  If any of you have a specific function in mind that you would like to program, I'd be more than happy to help, but you should try first on your own by looking at existing code (there's plenty in the 85 archives -- there's only slight differences if you're writing to a memory buff!
er -- it's very different if you're writing directly to the screen, but you don't need to do that with my routine (I know, I know, that would be reusing code, but I believe my code is the *fastest* the video driver can handle, but I'd love to be proven wrong!)
	I guess that's just the kind of mentality you get when trying to make a 6 mhz, 8-bit processor support a playable version of wolfenstein! :)


> Yes, I have played
> the amazing Davies, Ess creation. I'm going to make that for the 82 some
> day...don't know when, but some day. =)

Actually, I was thinking about porting Daedalus to the 82, but I'm not sure if I have the time, though it would be *really* cool! (I don't have an 83, that's why I didn't port it to that).  Well... I'll keep you guys updated if I ever get around to porting it...

> Andreas told me the book you got
> the raycasting engine from and I bought it myself. (The book is "Tricks
> of the Game Programming Gurus" and is $50 US) That book is really good.

Yep, it's a pretty good book covering the basics of ray-casting and a bunch of other things, as well... It's a nice references for programmers, even for non-PC ones (like us :)

> =) I've showed Daedalus to some people and I've received mixed reactions.
> Some say it's "okay," others say, "too slow," and most say, "Oh my God!
> It's Doom!....yeah, but uhhh, I'm not erasing everything on my calc. for
> this." Hehehehe. Still, in my books it reigns as the ultimate TI-8x game.

Well thank you very much :)
	Sam
-- 
Sam Davies <sdavies@mail.trilogy.net>