Replicating Spinrite Animation Effect in C

I would like to replicate the spinner effect that Spinrite displays in the upper-right corner of the screen to indicate that it's still running and hasn't frozen. You can see an example of this here at 2:18 - http://youtu.be/XRmDwVj5CRM

We could debate the efficacy of Spinrite until the cows come home but there's no denying that it has a decent UI considering what it runs on.

I'll be replicating the effect in C on an ARM platform but I'm looking for general advice rather than code, such as how to increment the steps of the animation.

Thanks in advance.

Answers


That's some old tech there, but it looks like Gibson has updated his UI a little. I remember his spinner being the /\|- characters... But I digress. :)

That is in text mode and most likely done by hooking the timer interrupt in DOS and drawing every other tick of the timer.

A standard DOS timer ticked roughly every 55 milliseconds.

You can draw directly to the screen in DOS on an X86 by writing to the pointer 0xA0000 using the goofy extended DOS character set.

(Note that this is from OLD memory, it's been 15+ years since I've done any of this stuff :) In other words, to draw the letter 'A' at the first row/column of the screen, you'd do the following.

    char *screen = 0xA0000;
    *screen = 'A';

To get a little bit more advanced, (no error or bounds checking.)

#define COLUMNS 80
#define ROWS    25
#define VIDMEM_BASE 0xA0000

// Row and column are 1 based
// Note that in a real implementation you would make sure row/column are within the screen bounds
// and if you were on the last row, you might scroll the screen up etc.
void writeScreen( char theChar, size_t row, size_t column )
{
    char *screenBase = VIDMEM_BASE;

    screenBase += ((row - 1) * COLUMNS) + column - 1;
    *screenBase = theChar;
}

With the above in mind, you'll have to figure out how that stuff works on your ARM system and replicate it. Looking at a port of ncurses or Borlands conio system for the ARM would probably give you a good head start. I know there was a port of Borland's Turbo Vision library to Linux but I'm not sure it was ever ported to ARM. Here's a link to the sourceforge page if you're interested. Turbo Vision was a nice text mode GUI in its day, for what it's worth.

Hope this helps.


Need Your Help

Apache htaccess mod rewrite

php regex apache .htaccess mod-rewrite

So, I am having some issues with my htacces file trying to do some re-write conditions.

Can't analyse the output (the profile file) of gperftools profiler

c profiling gperftools

I'm using gperftools for analysing my C code. An as a result I can't analyze the profile file using pprof application.