A89: Why does this slow down?


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

A89: Why does this slow down?




I wrote a simple DrawClipString routine and tested it by writing a scrolling
marquee program. It appears to scroll faster during the beginning and end
(in other words, when there is less text on the screen). Can anybody explain
why this is? I only tested it in VTI, not on a real calc. I'll probably make
an effort to increase the routine's efficiency later, and this info might be
useful. Source follows. Thanks.

-Kevin

#define SAVE_SCREEN           // Save/Restore LCD Contents

#include <tigcclib.h>         // Include All Header Files

short _ti89;                  // Produce .89Z File

void DrawClipString(short x, short y, char *s)
{
 SCR_RECT screen = {{0, 0, LCD_WIDTH-1, LCD_HEIGHT-1}};
 while (*s != '\0')
 {
  DrawClipChar(x, y, *s, &screen, A_NORMAL);
  x += FontCharWidth(*s++);
 }
}

// Main Function
void _main(void)
{
 int x = LCD_WIDTH-1;
 char str[] = "This is a scrolling marquee.";
 int pixelLength = DrawStrWidth(str, F_8x10);
 char virtual[3840];
 PortSet(virtual, 239, 127);
 FontSetSys(F_8x10);
 while (!kbhit())
 {
  if (x < -pixelLength)
  {
   x = LCD_WIDTH-1;
  }
  ClrScr();
  DrawClipString(x, 30, str);
  memcpy(LCD_MEM, virtual, LCD_SIZE);
  x--;
 }
 PortRestore();
 ngetchx();
}




Follow-Ups: