| /* This is a quickly-hacked-together test of some of the stuff in
 * c50lib.c. The idea is to test the things I'm least certain about.
 * At the moment, those are:
 *
 *   Branches, Interrupts, Pipeline Operation, Cycle Timing
 *
 * and also general stuff, i.e. did I get *any* of it right?
 */
#include 
#include 
#include "c50lib.h"
extern int program_rom[];
#define LACL     0xB900
#define CALL     0x7A80
#define CALLD    0x7E80
#define RET      0xEF00
#define RETD     0xFF00
#define NOP      0x8B00
#define RPTK     0xBB00
#define NEXT(n) program_rom[i++] = (n)
extern void step_with_printout (int newline);
void
main (void)
{
  int i, j;
  uint x;
  c50_reset ();
  mp_mc_mode = 1;
  arp = 2;
  ar[2] = 4;
  i = 0;
  NEXT (LACL + 0x00);
  NEXT (LACL + 0x01);
  NEXT (LACL + 0x02);
  NEXT (RPTK + 2);
  NEXT (0x8BA0);          /* mar *+ */
  NEXT (LACL + 0x03);
  NEXT (LACL + 0x04);
  NEXT (LACL + 0x05);
  NEXT (LACL + 0x06);
  NEXT (LACL + 0x07);
  NEXT (LACL + 0x08);
  for (i = 0; i < 15; i++)
    {
      step_with_printout (0);
      printf(" %04X\n", ar[2]);
    }
}
 |