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