mipslabwork.c
void labwork( void )
{
  int t60hz = 0, emuclock = 0;

  if (IFS(0) & (1 << 8)) {
    t60hz = 1;
    IFSCLR(0) = 1 << 8;
  }

  if (IFS(0) & (1 << 16)) {
    emuclock = 1;
    IFSCLR(0) = 1 << 16;
  }

  if (emuclock) {
    unsigned char keys[16];

    kypd_read(keys);

    for (int i = 0; i < 16; i++)
      vm.keys[prog->keymap[i]] = keys[i];

    c8_step(&vm);
  }

  if (t60hz)
    c8_tick(&vm);

  if (prog->syncpoint == 0 && t60hz
      || prog->syncpoint == vm.pc) {
    unsigned char dbuf[32*128];
    unsigned char image[4*128];
    int dmode = DMODE_RAW;

    if (debug_enabled())
      debug_keys(dbuf, DWIDTH * 2, vm.keys);

    if (PORTD & (1 << 10))
      dmode = DMODE_TILT;

    dbuf_blit(dbuf, vm.display, dmode);
    disp_convert(image, dbuf);
    disp_draw(image);
  }
}
/* This function is called repetitively from the main program */
This function is called repetitively from the main program
This function is called repetitively from the main program
void labwork( void )
{
  int t60hz = 0, emuclock = 0;
  if (IFS(0) & (1 << 8)) {
    t60hz = 1;
    IFSCLR(0) = 1 << 8;
  }
  if (IFS(0) & (1 << 16)) {
    emuclock = 1;
    IFSCLR(0) = 1 << 16;
  }
  if (emuclock) {
    unsigned char keys[16];
    kypd_read(keys);
    for (int i = 0; i < 16; i++)
      vm.keys[prog->keymap[i]] = keys[i];
    c8_step(&vm);
  }
  if (t60hz)
    c8_tick(&vm);
  if (prog->syncpoint == 0 && t60hz
      || prog->syncpoint == vm.pc) {
    unsigned char dbuf[32*128];
    unsigned char image[4*128];
    int dmode = DMODE_RAW;
    if (debug_enabled())
      debug_keys(dbuf, DWIDTH * 2, vm.keys);
    if (PORTD & (1 << 10))
      dmode = DMODE_TILT;
    dbuf_blit(dbuf, vm.display, dmode);
    disp_convert(image, dbuf);
    disp_draw(image);
  }
}
void labwork ( void ) { int t60hz = 0 , emuclock = 0 ; if ( IFS ( 0 ) & ( 1 << 8 ) ) { t60hz = 1 ; IFSCLR ( 0 ) = 1 << 8 ; } if ( IFS ( 0 ) & ( 1 << 16 ) ) { emuclock = 1 ; IFSCLR ( 0 ) = 1 << 16 ; } if ( emuclock ) { unsigned char keys [ 16 ] ; kypd_read ( keys ) ; for ( int i = 0 ; i < 16 ; i ++ ) vm . keys [ prog -> keymap [ i ] ] = keys [ i ] ; c8_step ( & vm ) ; } if ( t60hz ) c8_tick ( & vm ) ; if ( prog -> syncpoint == 0 && t60hz || prog -> syncpoint == vm . pc ) { unsigned char dbuf [ 32 * 128 ] ; unsigned char image [ 4 * 128 ] ; int dmode = DMODE_RAW ; if ( debug_enabled ( ) ) debug_keys ( dbuf , DWIDTH * 2 , vm . keys ) ; if ( PORTD & ( 1 << 10 ) ) dmode = DMODE_TILT ; dbuf_blit ( dbuf , vm . display , dmode ) ; disp_convert ( image , dbuf ) ; disp_draw ( image ) ; } }
This function is called repetitively from the main program
This function is called repetitively from the main program