[A83] Re: Graph Buffer


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

[A83] Re: Graph Buffer




The _IPoint and _ILine routines of the TI-OS are quite slow, compared to 
routines written by other programmers for the purpose of gaining speed. This 
is most likely achieved with optimized integer math and bit operations, since 
perhaps the TI-OS uses some floating point math for its point and line 
functions.
       ION's getpix routine will let you pass an x and y pixel coordinate for 
the screen as parameters in A and E, respectively, and return to you the byte 
on plotsscreen in HL, and the bit for that pixel, set in A. After getpix, you 
can do "or (hl) / ld (hl), a" to set the bit, "xor (hl) / ld (hl), a" to 
invert the bit, and "CPL / and (hl) / ld (hl), a" to clear the bit. If you 
don't want to program for ION at the moment, to access the library routine 
from there, I'm sure that you can borrow the short source code to the routine 
and put it in your program, with proper credit given. I always give credit 
for those library routines.
       There have been some Fastline routines written that are available, 
probably at ticalc somewhere. I don't really understand how they function 
internally, but usually the inputs are just HL and DE for (x1,y1) and 
(x2,y2), but don't quote me on that, and several of the routines may be 
different in their input. But the output is the same; it goes to plotsscreen 
directly. Some routines even do clipping of the lines at the edges of the 
screen. MirageOS has a nice fastline routine available for programmers, and 
I'm pretty sure than Dan borrowed that routine from somewhere else, and 
perhaps made a few alterations and extensions such as "fastlinewhite", 
"fastlinexor", stuff like that. Maybe he can tell you where it came from, or 
we can post the routine.
       I've written a nice filled rectangle routine that does bit shifting of 
bytes in several loops with byte masks and such; However, it is optimized for 
speed and not size, so its about 200 bytes; something that most programs 
might not want to include in their source directly, but that we had space for 
in MirageOS. This routine is made as an alternative to doing a loop of lines, 
so it works sequentially in bytes rightwards/downwards in the graph buffer, 
instead of doing individual pixels as fastline does. I've been told that it 
has a bug somewhere when using a particular coordinate, so I will have to 
solve that before MirageOS v2.0. But besides that I could post it if you 
want. Hope this info helps, cya.

-Jason Kovacs


In a message dated 8/16/01 11:48:24 AM Central Daylight Time, 
typerfuture@hotmail.com writes:


> AHA!!! I'll try that, thank you very very much !!!
> 
> Just a small question arises though, you say "...if you want the TI-OS to 
> draw points and lines..." implying there are other (better?) ways to 
> drawing 
> lines and points. Are there any ??? (I'm (currently) not using ION)
> 
> 
> 
> 
> 
> >From: Jkhum98@aol.com
> >Reply-To: assembly-83@lists.ticalc.org
> >To: assembly-83@lists.ticalc.org
> >Subject: [A83] Re: Graph Buffer
> >Date: Wed, 15 Aug 2001 15:00:56 EDT
> >
> >In a message dated 8/15/01 11:45:46 AM Central Daylight Time,
> >typerfuture@hotmail.com writes:
> >
> >
> > > I know that the _grbufcpy_v romcall copy's from the graph buffer to the
> > > screen, but how can I write to the Graph-buffer in the first place?
> > >
> > > After looking at a program in AsmGuru I thought it was a mode-flag with
> > > textwrite (don't know the exact syntax anymore) and I tried this but it
> > > didn't seem the make any difference to the program...
> >
> >When using Vputs-type romcalls, you can do "SET textwrite, (IY+sGrFlags)" 
> >to
> >have that small-font text be written to the graph buffer, and then copy
> >plotsscreen to the LCD with _grbufcpy_v (named _grbufcpy for the 83+).  If
> >you want to use TI-OS romcalls to draw points and lines with _IPoint and
> >_ILine and such, then you do "RES plotloc, (IY+plotflags)" to have those
> >pixels be set to plotsscreen also. You must Reset textwrite before 
> >returning
> >to the TI-OS or else it wont render correctly in some places, but plotloc
> >doesnt seem to matter if its Set/Reset upon leaving. If you are using 
> >common
> >routines like ION's putsprite, largesprite, and getpix, those will all work
> >with the buffer and not send any data to the LCD until you call _grbufcpy.
> >
> >-Jason Kovacs







Follow-Ups: