A83: Animation with _ILine
[Prev][Next][Index][Thread]
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: