[A86] Re: Line Off


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

[A86] Re: Line Off




Thanks that's good. I'll just use the ROM routine.






Actually, you can only turn the line off by drawing over it if you XOR it to
the screen.  If you don't know much about assembly I would suggest leaving
lines alone (other than perfectly horizontal or vertical ones) until you get
to know the language better.  The only way to draw lines in assembly is to
create your own routine or to use the ROM routine that is already programmed
into the calculator.  Either way, they probably do the same thing:  they
calculate each point of the screen that the line passes through and turns
them on.  These points can be calculated before-hand or on the fly.  I made
my own line routine a little while back and this is how it worked:
1. Calculate "slope" by dividing the change in the vertical from start to 
end
by the change in horizontal from the start point to the end.  This was done
by subracting the smaller of each (x and y) component from the larger one to
find the change and dividing them.  I put the change in y into h and the
change in x into a and used the "hl divided by a" routine to divide them.

2.  The number that returned was the "slope". That is to say, each time you
add this number to a counter and it carries, you will change your other
component.  For a hoizontal line, you turn on pixels to the right until this
number carries and then you move up (or down) one pixel.

3. You continue to turn on pixels until you reach the end of your line.

Ok, that whole thing probably made no sense.  There is a lot of checking and
different things you have to do for vertical/horizontal/perfect diagonal
lines, along with what to do if you start out low and go higher or start 
high
and go lower...  The whole thing becomes a jumbled mess unless you reall 
know
what you are doing.  This is why I suggest you use the built-in line 
routine.
  According to Assembly Studio 86's help file, the routine is called 
"_ILine"
and you give it the starting point in bc (xy) and the ending point in de 
(xy)
and you put the type of line to draw in h.  A value of 0 turns the pixels
off, 1 turns them on, and 2 reverses them (XOR).

I hope you understand at least some of that, If not just look at the help
file in AS86.

Marc McG




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com