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

  1. /* STEP.C
  2.  
  3.     Vrsn  Date   Comment
  4.     ----|-------|---------------------------------------------------------------
  5.     0.00 09nov94 Skeleton code.
  6.     0.01 10nov94 Now use opcodes.h.
  7.     0.02 11nov94 Added code for DUP.
  8.     0.03 14nov94 Added code for DROP, SWAP, OVER, ROT, -ROT, TUCK and NIP,
  9.                  and explicit case in I=A assignment.
  10.     0.04 16nov94 Added code for PICK and ROLL.
  11.     0.05 17nov94 Added code for ?DUP, >R, R>, R@, 0, 1, -1, CELL, -CELL, +, -,
  12.                  >-<, 1+, 1-, CELL+, CELL-, *.
  13.     0.06 19nov94 Added code for /, MOD, /MOD, 2/, CELLS, ABS, NEGATE, MAX, MIN,
  14.                  INVERT, AND, OR, XOR, LSHIFT, RSHIFT, 1LSHIFT, 1RSHIFT.
  15.     0.07 20nov94 Debugged MIN, and removed dummy entries for double-cell
  16.                  division instructions.
  17.     0.08 21nov94 Added code for (LITERAL) and (LITERAL)I.
  18.     0.09 22nov94 Added code for <, >, =, <>, 0<, 0>, 0=, U<, U>, @, !, C@, C!,
  19.                  +!, SP@, SP!, RP@ and RP!.
  20.     0.10 23nov94 Debugged !, C!, +!, SP@ and RP@, and changed SP! and RP! to
  21.                  match. Optimised memory access instructions. Added code for
  22.                  BRANCH, BRANCHI, ?BRANCH, ?BRANCHI, EXECUTE, @EXECUTE, CALL,
  23.                  CALLI and EXIT.
  24.     0.11 24nov94 Debugged ?BRANCHI. Added code for (DO), J and (CREATE).
  25.     0.12 25nov94 Supplied missing bracket in (CREATE). Added code for (THROW),
  26.                  HALT, LINK and LIB. Changed return type of single_step to long.
  27.                  Added the lib function, to provide the standard library
  28.                  accessed by LIB. Added exception -256 on invalid opcode.
  29.     0.13 26nov94 Added code for (LOOP), (LOOP)I, (LEAVE), (LEAVE)I and (LEAP).
  30.     0.14 27nov94 Changed J to match debugged specification. Added code for
  31.                  (+LOOP) and (+LOOP)I. temp's type changed to CELL, so that it
  32.                  can hold all the values which may be assigned to it.
  33.     0.15 29nov94 Added return value in normal case to match specification, and
  34.                  make the program correct. RSHIFT changed to be ANSI C.
  35.     0.16 30nov94 Debugged RSHIFT and 1RSHIFT.
  36.     0.17 01dec94 Changed return type of single_step to CELL. RSHIFT and 1RSHIFT
  37.                  cast their results to CELL before assignment. Increments and
  38.                  decrements applied to stack operators separated from
  39.                  expressions using their values more than once to guarantee
  40.                  correct evaluation. +, - and * made more efficient. LSHIFT and
  41.                  RSHIFT debugged. C@ and C! changed to comply with debugged
  42.                  specification.
  43.     0.18 11jan95 Added 0<>, U/MOD and S/REM; removed (LEAVE) and (LEAVE)I;
  44.                  changed (LEAP) to UNLOOP. i's type changed to CELL to
  45.                  correspond with assignments made to it.
  46.     0.19 13jan95 Debugged LINK.
  47.     0.20 05feb95 Changed return type of HALT instruction to CELL, which is what
  48.                  beetle.h says it should be. Altered LINK as specification
  49.                  changed.
  50.     0.21 23mar95 Added address checking.
  51.     0.22 24mar95 Removed contents of single_step to execute.c, and lib function
  52.                  to lib.c, which are now #included. lib.c now #included by
  53.                  execute.c.
  54.     0.23 25mar95 Removed unnecessary reference to bintern.h.
  55.     0.24 19apr95 Added inclusion of stdio.h.
  56.     0.25 30mar97 Added inclusion of lib.h.
  57.  
  58.     Reuben Thomas
  59.  
  60.  
  61.     The interface call single_step() : integer.
  62.  
  63. */
  64.  
  65.  
  66. #include <stdio.h>
  67. #include "beetle.h"     /* main header */
  68. #include "opcodes.h"    /* opcode enumeration */
  69. #include "lib.h"        /* lib function */
  70.  
  71.  
  72. CELL single_step(void)
  73. {
  74. #include "execute.c"    /* one pass of execution cycle */
  75.     return 0;    /* terminated OK */
  76. #include "excepts.c"    /* code for address exceptions */
  77. }
  78.