Re: A86: Graphics


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

Re: A86: Graphics



In a message dated 97-10-23 15:30:08 EDT, you write:

> 
>  >, you need (usually) a findpixel routine,
>  >which you can find earlier on this list, or probably in ticalc.org's
source
>  >archive.  Basically, tho, you might try something like this:
>  >
>  >ld d,<y_coord>
>  >ld e,<x_coord>   ;i think this is right
>  >call FindPixel     ;points hl to pixel, with mask in a.
>  >or (hl)                 ;is this a valid opcode?  if not, improvise...
>  >ld (hl),a              ;put it back in (hl)
>  >
>  >If you already know the (x,y), you might just want to do something like 
> this:
>  >
>  >ld hl, $FC00+16*y+[x DIV 8]
>  >set 7-[x MOD 8],(hl)
>  >
>  >You probably should precalculate the #'s, tho...
>  
>  now, this is where you lost me.  i have no idea what you are talking
about.
>  could you explain this me, slowly, carefully, as if i have absolutely no
>  clue what any of those terms mean (which is pretty close to true)?  id
>  really appreciate it.  thanx
>  

Ummm...  The 1024 bytes from $FC00 on hold 8192 (i think) bits, each
representing a pixel (128x64=8192).  Therefore, each byte represents 8
pixels.  Do you understand bit masking?  If not, I believe Trent has a pretty
good tutorial on them (not sure of the URL)  When you call findpixel, it
reads in the coordinates (usually in DE, with x=E, y=D, i think), and then
makes (HL) be the location in the graph mem that has that pixel in one of its
it 8 bits.  In order to figure out which pixel, it returns a mask in A (this
is at least for the typical findpixel routine).  Say maybe the pixel is the
fourth from the left in its group of 8.  In that case, FindPixel should
return a bit mask of %00010000.  That way, if you do something like OR (HL),
it will put those 8 pixels in A, but no matter what the 4th one was, it will
be set.  You can then LD (HL),A to put it back in graphmem.  There are better
ways of putting multiple pixels all at once, usually, suach as in a
horizontal/vertical line.  Anyway, OR's, AND's, and XOR's can all be used
that way (except for AND, you should use the compliment accumulator opcode
(forgot the mneumonic - CCA maybe?) first, so that when you AND it, it will
keep everything BUT that pixel the same, and clear the selected one.)  Is
this making any more sense?  I sure hope so, because I can't think of any
clearer way of explaining it (I'm not good at explaining things...)

If anyone else can simplify/add to this so that it is more understandable,
please do, because I think that that was just about as incomprehensible as my
first response...
:-(

~Steve