A83: Re: Animation with _ILine


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

A83: Re: Animation with _ILine




On the TI-83, there is no way to get ILine to draw only to the graph buffer.
(On the 83 Plus, you could set the bufferonly flag, but no such flag exists
on the 83).  One possibility to fix your problem would be to use a different
line routine.  I've attached a line routine below.  Before anyone tells me,
yes I know it's messy and could be optimized, and yes I know there are
probably better ones on the net, but it works.  (Part of the reason it's so
messy is that the original routine could draw lines in black,white,xor or
any dot/bit pattern).

Hope this helps,
-Dan Englender

fastline:
     ;displays a line to the graphbuffer
     ;input
     ;hl=x1, y1
     ;de=x2, y2
     ;output
     ;line is drawn to the graphbuffer
 di
 ld a,1
 ld (xdir),a
 ld (ydir),a
 ld a,d
 sub h
 ld b,a
 jp nc,flokx
 neg
 ld b,a
 ld a,255
 ld (xdir),a
flokx:
 ld a,e
 sub l
 ld c,a
 jp nc,floky
 neg
 ld c,a
 ld a,255
 ld (ydir),a
floky:
 ld e,0 ;error
 ld a,b
 cp c
 jp c,fly
 ld d,b ;resx
 inc b
fllx:
 call pixelonfl
 ld a,(xdir)
 add a,h
 ld h,a
 ld a,e
 add a,c
 ld e,a
 cp d
 jp c,flxok
 sub d
 ld e,a
 ld a,(ydir)
 add a,l
 ld l,a
flxok:
 djnz fllx
 ret
fly:
 ld a,b
 ld b,c
 ld c,a
 ld d,b
 inc b
flly:
 call pixelonfl
 ld a,(ydir)
 add a,l
 ld l,a
 ld a,e
 add a,c
 ld e,a
 cp d
 jp c,flyok
 sub d
 ld e,a
 ld a,(xdir)
 add a,h
 ld h,a
flyok:
 djnz flly
 ret
pixelonfl:
 push hl
 exx
 pop de
  ld a,d
 call getpix        ;getpix == Ion get pixel routine
 or (hl)
 ld (hl),a
 exx
 ret


----- Original Message -----
From: "Name" <disaja@gmx.de>
To: "Assembly 83 TI-Calc" <assembly-83@lists.ticalc.org>
Sent: Wednesday, August 23, 2000 7:54 AM
Subject: A83: Animation with _ILine


>
> Hi!
>
> I've been watching this mailing list for some time and therefore I'm sure
> you will be able to help me. My problem is the following: I want to use
the
> built-in routine of the TI83 for drawing lines to make an animation of an
> rotating hexagon. I tried to do it like this: (who reads all this
> voluntarily??? skip the code and read on at the bottom of the mail)
>
> .NOLIST
> #define end .end
> #define END .end
> #define equ .equ
> #define EQU .equ
> #include "ti83asm.inc"
> #include "tokens.inc"
> .LIST
>
> .org 9327h  ;*** Hauptprogramm ***/main program
> MainLoop:
>   ld   a,18  ;Zähler auf 18 setzen/set counter to 18
>   ld   hl,Daten
> GLoop:
>   push af
>   push hl
>   ld   de,PLOTSSCREEN+1    ;clear display (OK, calling clrLCDFULL might do
> it as well)
>   ld   hl,PLOTSSCREEN
>   ld   (hl),0
>   ld   bc,768
>   ldir
>   call _GRBUFCPY_V ;buffer-->screen
>   ld   a,0FFh  ;* Tastaturabfrage * (Tastaturreset)/keyboard reset and
query
>   out  (1),a
>   ld   a,0FDh  ;Tastengruppe 2/key group 2
>   out  (1),a
>   in   a,(1)
>   cp   191  ;=Clear gedrückt/"clear" pressed
>   jr   z,Exit  ;-->Exit
>   ;Animation
>   pop  hl  ;Datenzeiger/data pointer
>   ld   d,(hl)  ;Koord. 1. Endpunkt nach DE
>   inc  hl
>   ld   e,(hl)
>   inc  hl
>   push hl  ;Datenzeiger präservieren
>   ld   bc,47*256+50 ;1. Startpunkt
>   call Linie  ;1. Linie
>   ld   d,b  ;2. Endpunkt: X bleibt gleich, Y=63-Ye1
>   ld   a,63  ;63-->A = A=63
>   sub  c  ;-C = A=63-Ye1
>   ld   e,a  ;A-->E = Ye2=63-Ye1
>   push de  ;Koordinaten brauchen wir nochmal
>    call Linie  ;2. Linie
>    ld   de,47*256+14 ;3. Endpunkt
>    call Linie  ;3. Linie
>   pop  de  ;4. Endpunkt: X=94-Xe1, Y bleibt gleich (d.h. Y=Ye2=63-Ye1)
>   ld   a,94    ;94-->A
>   sub  d  ;-D = A=94-Xe2
>   ld   d,a  ;A-->D = Xe4=94-Xe2
>   call Linie  ;4. Linie
>   ld   d,b  ;5. Endpunkt: X bleibt gleich, Y=63-Ye4
>   ld   a,63  ;63-->A = A=63
>   sub  c  ;-C = A=63-Ye4
>   ld   e,a  ;A-->E = Ye5=63-Ye4
>   call Linie  ;5. Linie
>   ld   de,47*256+50 ;1. Startpunkt = 6. Endpunkt
>   call Linie
>   pop  hl  ;fertig->Datenzeiger holen/get data pointer
>   pop  af
>   dec  a  ;A--
>   jr   nz,GLoop
>   xor  a
>   jr   MainLoop
> Exit:
>   pop  hl
>   pop  af
>   ret
>
> Linie:
>   ld   h,1
>   push de
>   call _ILine  ;zeichnet Linie von B,C nach D,E/draws a line from B,C to
D,E
>   pop  bc  ;n. Endpunkt = (n+1). Startpunkt/second point of line n=first
> point of line (n+1)
>   ret
>
> Daten:
>   .db  77,39, 75,39, 73,40, 70,40, 66,40, 62,40, 57,40, 52,40, 47,40
>   .db  42,40, 37,40, 37,40, 32,40, 28,40, 24,40, 21,40, 19,39, 17,39
>
> .end
> END
>
> Now, what it does is: It clears the display, checks for the "clear"-key
> being pressed and if not draws the next hexagon of the animation by
calling
> "Linie" six times (once for each line). The sub-routine "Linie" itself
calls
> "_ILine" to draw the line. The problem is that ILine not only draws the
line
> but also copies the graph buffer to the screen. On an emulator it may look
> quite OK, but because of the slow LCD display it flickers terribly on the
> TI.
> What I suppose is that it would look much better if one could find a
> possibility to make ILine not copying the buffer to the display after each
> line (which wastes a lot of time), but to do this manually after all the
six
> lines have been drawn. Then you could even add a little pause without
> slowing down the whole thing too much. I've tried this by setting the
flags
> "plotdisp,(iy+plotflags)" and "plotloc,(iy+plotflags)" but it didn't
change
> anything.
>
> Perhaps someone finds a solution. I'd be very glad if so.
>
> Alexander Mann
>
>




Follow-Ups: References: