home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / RiscOS / APP / DEVS / FORTH / BEETLE / BEETLE.ZIP / Beetle / createt.c < prev    next >
C/C++ Source or Header  |  1997-04-22  |  2KB  |  67 lines

  1. /* CREATET.C
  2.  
  3.     Vrsn  Date   Comment
  4.     ----|-------|--------------------------------------------------------------
  5.     0.00 25nov94 Test (CREATE).
  6.     0.01 28nov94 Changed reference to b_mem to one to M0.
  7.     0.02 29nov94 Modified so that testing is automatic, and can run with or
  8.                  without debugging information.
  9.     0.03 30nov94 Modified to give a return value from main.
  10.     0.04 17feb95 Modified to work with new version of storage.c, and use
  11.                  btests.h rather than bintern.h.
  12.     0.05 28feb95 Removed printf format error.
  13.  
  14.     Reuben Thomas
  15.  
  16.  
  17.     Also uses NEXT.
  18.  
  19. */
  20.  
  21.  
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include "beetle.h"     /* main header */
  25. #include "btests.h"    /* Beetle tests header */
  26. #include "opcodes.h"    /* opcode enumeration */
  27. #include "debug.h"      /* debugging functions */
  28.  
  29.  
  30. int correct[] = { 20, 20, 20 };
  31.  
  32.  
  33. int main(void)
  34. {
  35.     int i;
  36.  
  37.     init_beetle((BYTE *)malloc(1024), 256, 16);
  38.     here = EP;
  39.     S0 = SP;    /* save base of stack */
  40.  
  41.     start_ass();
  42.     ass(O_CREATE);
  43.     end_ass();
  44.  
  45.     NEXT;   /* load first instruction word */
  46.  
  47.     for (i = 0; i <= instrs; i++) {
  48. #ifdef B_DEBUG
  49.         printf("EP = %d; should be %d\n\n", val_EP(), correct[i]);
  50. #endif
  51.         if (correct[i] != val_EP()) {
  52.             printf("Error in CreateT: EP = %ld\n", val_EP());
  53.             exit(1);
  54.         }
  55.         single_step();
  56. #ifdef B_DEBUG
  57.         printf("I = %s\n", disass(I));
  58. #endif
  59.     }
  60. #ifdef B_DEBUG
  61.     show_data_stack();  printf("Correct stack: %d\n\n", correct[i]);
  62. #endif
  63.  
  64.     printf("CreateT ran OK\n");
  65.     return 0;
  66. }
  67.