[comp.sys.atari.st] graf_mkstate

roland@tuvie (Inst.f.Allg.Elektrotechnik) (03/08/90)

A simple timing loop with graf_mkstate gives about 2500 microseconds
per call. The Turbo-C program is appended to the end of this message.
I use TOS 1.4 and the same result is obtained with Pascal.

However it takes at least 0.1 seconds before graf_mkstate recognizes 
any button state change. So we have at least 40 calls to this 
AES routine before the change is detected.

I cannot imagine any reason for this. 
If anybody knows, please give an explanation.

Roland Schreier         _                     Technical University of Vienna
Gusshausstrasse 27-29  |_)  _  |  _   _   _|  +43 (222) 58801 3838
A-1040 Wien            | \ (_) | (_| | | (_|  SCHREIER@EAECL1.UNA.AT
Oesterreich - Europe                          roland@tuvie.at

/* ---------------------------------------------------------------- */

/*    BWAIT       Button Wait                                       */
/*    author      Roland Schreier                                   */

#include <stdio.h>
#include <aes.h>
#include <time.h>

int main()
{
  int mx, my, mstate, kstate ;
  char s[128] ;
  long count ;
  clock_t time ;
  
  appl_init() ;
  count = 0 ; time = clock() ;
  do
  {
    count++ ;
    graf_mkstate(& mx, & my, & mstate, & kstate) ;
  } while (mstate == 0) ;
  time = clock() - time ;
  sprintf(s, "[0][mstate = %#.4x |%li ticks |%li calls |%li microseconds ][ OK ]",
             mstate, time, count, (time * 1000000L) / (CLK_TCK * count)) ;
  form_alert(1, s) ;
  appl_exit() ;
  return 0 ;
} /* main */

/* ---------------------------------------------------------------- */