PageRenderTime 41ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/Classes/nsim.h

http://github.com/watmough/Calc41C
C Header | 58 lines | 23 code | 11 blank | 24 comment | 0 complexity | c77964b508a5f90d3dc3b5a2af1c67c1 MD5 | raw file
  1. /*
  2. NSIM is a simulator for the processor used in the HP-41 (Nut) and in the HP
  3. Series 10 (Voyager) calculators.
  4. Copyright 1995 Eric L. Smith
  5. NSIM is free software; you can redistribute it and/or modify it under the
  6. terms of the GNU General Public License version 2 as published by the Free
  7. Software Foundation. Note that I am not granting permission to redistribute
  8. or modify NSIM under the terms of any later version of the General Public
  9. License.
  10. This program is distributed in the hope that it will be useful (or at least
  11. amusing), but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  13. Public License for more details.
  14. You should have received a copy of the GNU General Public License along with
  15. this program (in the file "COPYING"); if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. $Header: /home/yl2/eric/hpcalc/nasm/RCS/nsim.h,v 1.4 1995/08/03 01:53:29 eric Exp eric $
  18. */
  19. typedef char cbool; /* 1-bit value */
  20. typedef unsigned char uchar; /* 8-bit unsigned */
  21. typedef unsigned short romword; /* 10-bit unsigned */
  22. typedef unsigned short address; /* 16-bit unsigned */
  23. #define WSIZE 14
  24. typedef uchar digit;
  25. typedef digit reg [WSIZE];
  26. extern reg c;
  27. extern void (* op_fcn [1024])(int);
  28. #define MAX_PFAD 256
  29. extern cbool pf_exists [MAX_PFAD];
  30. extern void (* rd_n_fcn [MAX_PFAD])(int);
  31. extern void (* wr_n_fcn [MAX_PFAD])(int);
  32. extern void (* wr_fcn [MAX_PFAD])(void);
  33. extern void (* save_fcn [MAX_PFAD])(FILE *f, char *prefix);
  34. extern cbool (* load_fcn [MAX_PFAD])(char *buf);
  35. extern int io_count;
  36. /* utility functions */
  37. void fatal (int ret, char *format, ...);
  38. void reg_copy (reg dest, reg src);
  39. void reg_zero (reg dest);
  40. cbool parse_hex (char **buf, int *v, int d);
  41. cbool parse_reg (char *buf, digit *r, int d);
  42. void write_reg (FILE *f, digit *r, int d);