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

  1. /* STEPT.C
  2.  
  3.     Vrsn  Date   Comment
  4.     ----|-------|---------------------------------------------------------------
  5.     0.00 09nov94
  6.     0.01 14nov94 Start value of EP changed to avoid registers stored in low
  7.                  memory. Action of NEXT performed when initialising EP as per
  8.                  specification. Added check message at end.
  9.     0.02 18nov94 Made printing of EP use debug.h function.
  10.     0.03 28nov94 Changed reference to b_mem to one to M0.
  11.     0.03 30nov94 Modified so that testing is automatic, and can run with or
  12.                  without debugging information. Modified to give a return value
  13.                  from main.
  14.     0.04 17feb95 Modified to work with new version of storage.c, and use
  15.                  btests.h rather than bintern.h.
  16.     0.05 28feb95 Removed printf format error.
  17.     0.06 24mar95 Added code to test address alignment and bounds checking on EP.
  18.  
  19.     Reuben Thomas
  20.  
  21.  
  22.     Test that single_step works, and that address alignment and bounds
  23.     checking is properly performed on EP.
  24.  
  25. */
  26.  
  27.  
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include "beetle.h"     /* main header */
  31. #include "btests.h"    /* Beetle tests header */
  32. #include "debug.h"      /* debugging functions */
  33.  
  34.  
  35. int main(void)
  36. {
  37.     int i;
  38.  
  39.     i = init_beetle((BYTE *)NULL, 1, 1);
  40. #ifdef B_DEBUG
  41.     printf("init_beetle((BYTE *)NULL, 1, 1) should return 1; returns: %d\n", i);
  42. #endif
  43.     if (i != 1) {
  44.         printf("Error in StepT: init_beetle with invalid parameters "
  45.             "succeeded\n");
  46.         exit(1);
  47.     }
  48.     i = init_beetle((BYTE *)NULL, 1, 4);
  49. #ifdef B_DEBUG
  50.     printf("init_beetle((BYTE *)NULL, 1, 4) should return 1; returns: %d\n", i);
  51. #endif
  52.     if (i != 1) {
  53.         printf("Error in StepT: init_beetle with invalid parameters "
  54.             "succeeded\n");
  55.         exit(1);
  56.     }
  57.  
  58.     i = init_beetle((BYTE *)malloc(1024), 256, 16);
  59.     if (i != 0) {
  60.         printf("Error in StepT: init_beetle with valid parameters failed\n");
  61.         exit(1);
  62.     }
  63.     for (i = 0; i < 1024; i++) M0[i] = 0;
  64.  
  65.     NEXT;
  66.  
  67.     for (i = 0; i < 10; i++) {
  68. #ifdef B_DEBUG
  69.         printf("EP = %d\n", val_EP());
  70. #endif
  71.         single_step();
  72.     }
  73.  
  74. #ifdef B_DEBUG
  75.     printf("EP should now be 56\n");
  76. #endif
  77.     if (val_EP() != 60) {
  78.         printf("Error in StepT: EP = %ld\n", val_EP());
  79.         exit(1);
  80.     }
  81.  
  82.     printf("StepT ran OK\n");
  83.     return 0;
  84. }
  85.