new files of 0.5.2
authordrdani <drdani@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 16 Jul 2004 16:32:30 +0000 (16:32 +0000)
committerdrdani <drdani@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 16 Jul 2004 16:32:30 +0000 (16:32 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3382 4a8a32a2-be11-0410-ad9d-d568d2c75423

18 files changed:
sim/ucsim/cmd.src/cmdlex.cc [new file with mode: 0644]
sim/ucsim/cmd.src/cmdlex.l [new file with mode: 0644]
sim/ucsim/cmd.src/cmdlexcl.h [new file with mode: 0644]
sim/ucsim/cmd.src/cmdmem.cc [new file with mode: 0644]
sim/ucsim/cmd.src/cmdmemcl.h [new file with mode: 0644]
sim/ucsim/cmd.src/cmdpars.cc [new file with mode: 0644]
sim/ucsim/cmd.src/cmdpars.h [new file with mode: 0644]
sim/ucsim/cmd.src/cmdpars.y [new file with mode: 0644]
sim/ucsim/doc/chip.fig [new file with mode: 0644]
sim/ucsim/doc/cmd.txt [new file with mode: 0644]
sim/ucsim/doc/cmd_memory.html [new file with mode: 0644]
sim/ucsim/doc/cpu-mem.fig [new file with mode: 0644]
sim/ucsim/doc/decoded.fig [new file with mode: 0644]
sim/ucsim/doc/memory.html [new file with mode: 0644]
sim/ucsim/doc/share-chip.fig [new file with mode: 0644]
sim/ucsim/doc/ucsim.1 [new file with mode: 0644]
sim/ucsim/sim.src/obsolete.cc [new file with mode: 0644]
sim/ucsim/sim.src/obsolete.h [new file with mode: 0644]

diff --git a/sim/ucsim/cmd.src/cmdlex.cc b/sim/ucsim/cmd.src/cmdlex.cc
new file mode 100644 (file)
index 0000000..b567b98
--- /dev/null
@@ -0,0 +1,1659 @@
+#line 2 "cmdlex.cc"
+
+#line 4 "cmdlex.cc"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 31
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+     * following macro.
+     */
+    #define yyFlexLexer yyFlexLexer
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+/* begin standard C++ headers. */
+#include <iostream> 
+#include <errno.h>
+#include <cstdlib>
+#include <cstring>
+/* end standard C++ headers. */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else  /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin  )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int yyleng;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    #define YY_LESS_LINENO(n)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+       do \
+               { \
+               /* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+               *yy_cp = (yy_hold_char); \
+               YY_RESTORE_YY_MORE_OFFSET \
+               (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+               YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+               } \
+       while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr)  )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef unsigned int yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+       {
+
+       std::istream* yy_input_file;
+
+       char *yy_ch_buf;                /* input buffer */
+       char *yy_buf_pos;               /* current position in input buffer */
+
+       /* Size of input buffer in bytes, not including room for EOB
+        * characters.
+        */
+       yy_size_t yy_buf_size;
+
+       /* Number of characters read into yy_ch_buf, not including EOB
+        * characters.
+        */
+       int yy_n_chars;
+
+       /* Whether we "own" the buffer - i.e., we know we created it,
+        * and can realloc() it to grow it, and should free() it to
+        * delete it.
+        */
+       int yy_is_our_buffer;
+
+       /* Whether this is an "interactive" input source; if so, and
+        * if we're using stdio for input, then we want to use getc()
+        * instead of fread(), to make sure we stop fetching input after
+        * each newline.
+        */
+       int yy_is_interactive;
+
+       /* Whether we're considered to be at the beginning of a line.
+        * If so, '^' rules will be active on the next match, otherwise
+        * not.
+        */
+       int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+       /* Whether to try to fill the input buffer when we reach the
+        * end of it.
+        */
+       int yy_fill_buffer;
+
+       int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+       /* When an EOF's been seen but there's still some text to process
+        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+        * shouldn't try reading from the input source any more.  We might
+        * still have a bunch of tokens to match, though, because of
+        * possible backing-up.
+        *
+        * When we actually see the EOF, we change the status to "new"
+        * (via yyrestart()), so that the user can continue scanning by
+        * just pointing yyin at a new input file.
+        */
+#define YY_BUFFER_EOF_PENDING 2
+
+       };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+void *yyalloc (yy_size_t  );
+void *yyrealloc (void *,yy_size_t  );
+void yyfree (void *  );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+       { \
+       if ( ! YY_CURRENT_BUFFER ){ \
+        yyensure_buffer_stack (); \
+               YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer( yyin, YY_BUF_SIZE ); \
+       } \
+       YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+       }
+
+#define yy_set_bol(at_bol) \
+       { \
+       if ( ! YY_CURRENT_BUFFER ){\
+        yyensure_buffer_stack (); \
+               YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer( yyin, YY_BUF_SIZE ); \
+       } \
+       YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+       }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+typedef unsigned char YY_CHAR;
+
+#define yytext_ptr yytext
+#define YY_INTERACTIVE
+
+#include <FlexLexer.h>
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+       (yytext_ptr) = yy_bp; \
+       yyleng = (size_t) (yy_cp - yy_bp); \
+       (yy_hold_char) = *yy_cp; \
+       *yy_cp = '\0'; \
+       (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 16
+#define YY_END_OF_BUFFER 17
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+       {
+       flex_int32_t yy_verify;
+       flex_int32_t yy_nxt;
+       };
+static yyconst flex_int16_t yy_accept[27] =
+    {   0,
+        1,    1,   17,   15,    1,   16,   12,    6,    7,    4,
+        2,    3,   11,    5,   13,   13,   10,   14,    8,    9,
+        1,   13,    0,   14,   13,    0
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    1,    1,    1,    1,    1,    4,    1,    5,
+        6,    7,    8,    1,    9,   10,   11,   12,   13,   13,
+       13,   13,   13,   13,   13,   13,   13,    1,    1,    1,
+       14,    1,    1,    1,   15,   15,   15,   15,   15,   15,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       17,    1,   18,    1,   16,    1,   15,   15,   15,   15,
+
+       15,   15,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   19,
+       16,   16,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[20] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    2,    1,    3,    4,    1,    1,    5
+    } ;
+
+static yyconst flex_int16_t yy_base[30] =
+    {   0,
+        0,    0,   35,   36,   32,   36,   36,   36,   36,   36,
+       36,   36,   36,   36,    7,    8,   36,    0,   36,   36,
+       23,   10,    0,    0,    0,   36,   22,   26,   30
+    } ;
+
+static yyconst flex_int16_t yy_def[30] =
+    {   0,
+       26,    1,   26,   26,   26,   26,   26,   26,   26,   26,
+       26,   26,   26,   26,   27,   26,   26,   28,   26,   26,
+       26,   26,   29,   28,   29,    0,   26,   26,   26
+    } ;
+
+static yyconst flex_int16_t yy_nxt[56] =
+    {   0,
+        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+       14,   15,   16,   17,   18,   18,   19,   20,   18,   22,
+       22,   22,   22,   22,   21,   23,   22,   24,   24,   24,
+       24,   25,   25,   21,   26,    3,   26,   26,   26,   26,
+       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
+       26,   26,   26,   26,   26
+    } ;
+
+static yyconst flex_int16_t yy_chk[56] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,   16,
+       16,   22,   22,   27,   21,   15,   27,   28,   28,   28,
+       28,   29,   29,    5,    3,   26,   26,   26,   26,   26,
+       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
+       26,   26,   26,   26,   26
+    } ;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#line 1 "cmdlex.l"
+#line 2 "cmdlex.l"
+#include "cmdlexcl.h"
+#include "cmdpars.h"
+
+static YY_cl_ucsim_parser_STYPE *yylval;
+
+int yywrap(void);
+
+#define tok(x) (YY_cl_ucsim_parser_CLASS::x)
+#define lexer_obj (dynamic_cast<class cl_ucsim_lexer *>(this))
+
+#line 421 "cmdlex.cc"
+
+#define INITIAL 0
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+#define ECHO LexerOutput( yytext, yyleng )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+\
+       if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
+               YY_FATAL_ERROR( "input in flex scanner failed" );
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) LexerError( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+#define YY_DECL int yyFlexLexer::yylex()
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+       YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+       register yy_state_type yy_current_state;
+       register char *yy_cp, *yy_bp;
+       register int yy_act;
+    
+#line 14 "cmdlex.l"
+
+
+#line 524 "cmdlex.cc"
+
+       if ( (yy_init) )
+               {
+               (yy_init) = 0;
+
+#ifdef YY_USER_INIT
+               YY_USER_INIT;
+#endif
+
+               if ( ! (yy_start) )
+                       (yy_start) = 1; /* first start state */
+
+               if ( ! yyin )
+                       yyin = & std::cin;
+
+               if ( ! yyout )
+                       yyout = & std::cout;
+
+               if ( ! YY_CURRENT_BUFFER ) {
+                       yyensure_buffer_stack ();
+                       YY_CURRENT_BUFFER_LVALUE =
+                               yy_create_buffer( yyin, YY_BUF_SIZE );
+               }
+
+               yy_load_buffer_state(  );
+               }
+
+       while ( 1 )             /* loops until end-of-file is reached */
+               {
+               yy_cp = (yy_c_buf_p);
+
+               /* Support of yytext. */
+               *yy_cp = (yy_hold_char);
+
+               /* yy_bp points to the position in yy_ch_buf of the start of
+                * the current run.
+                */
+               yy_bp = yy_cp;
+
+               yy_current_state = (yy_start);
+yy_match:
+               do
+                       {
+                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+                       if ( yy_accept[yy_current_state] )
+                               {
+                               (yy_last_accepting_state) = yy_current_state;
+                               (yy_last_accepting_cpos) = yy_cp;
+                               }
+                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                               {
+                               yy_current_state = (int) yy_def[yy_current_state];
+                               if ( yy_current_state >= 27 )
+                                       yy_c = yy_meta[(unsigned int) yy_c];
+                               }
+                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+                       ++yy_cp;
+                       }
+               while ( yy_base[yy_current_state] != 36 );
+
+yy_find_action:
+               yy_act = yy_accept[yy_current_state];
+               if ( yy_act == 0 )
+                       { /* have to back up */
+                       yy_cp = (yy_last_accepting_cpos);
+                       yy_current_state = (yy_last_accepting_state);
+                       yy_act = yy_accept[yy_current_state];
+                       }
+
+               YY_DO_BEFORE_ACTION;
+
+do_action:     /* This label is used only to access EOF actions. */
+
+               switch ( yy_act )
+       { /* beginning of action switch */
+                       case 0: /* must back up */
+                       /* undo the effects of YY_DO_BEFORE_ACTION */
+                       *yy_cp = (yy_hold_char);
+                       yy_cp = (yy_last_accepting_cpos);
+                       yy_current_state = (yy_last_accepting_state);
+                       goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 16 "cmdlex.l"
+;
+       YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 18 "cmdlex.l"
+return(tok(PTOK_PLUS));
+       YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 19 "cmdlex.l"
+return(tok(PTOK_MINUS));
+       YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 20 "cmdlex.l"
+return(tok(PTOK_ASTERIX));
+       YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 21 "cmdlex.l"
+return(tok(PTOK_SLASH));
+       YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 22 "cmdlex.l"
+return(tok(PTOK_LEFT_PAREN));
+       YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 23 "cmdlex.l"
+return(tok(PTOK_RIGHT_PAREN));
+       YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 24 "cmdlex.l"
+return(tok(PTOK_LEFT_BRACKET));
+       YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 25 "cmdlex.l"
+return(tok(PTOK_RIGHT_BRACKET));
+       YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 26 "cmdlex.l"
+return(tok(PTOK_EQUAL));
+       YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 27 "cmdlex.l"
+return(tok(PTOK_DOT));
+       YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 28 "cmdlex.l"
+return(tok(PTOK_AMPERSAND));
+       YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 30 "cmdlex.l"
+{
+  yylval->number= strtol(yytext, 0, 0);
+  return(YY_cl_ucsim_parser_CLASS::PTOK_NUMBER);
+}
+       YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 35 "cmdlex.l"
+return(lexer_obj->check_id(yytext));
+       YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 37 "cmdlex.l"
+;
+       YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 39 "cmdlex.l"
+ECHO;
+       YY_BREAK
+#line 690 "cmdlex.cc"
+case YY_STATE_EOF(INITIAL):
+       yyterminate();
+
+       case YY_END_OF_BUFFER:
+               {
+               /* Amount of text matched not including the EOB char. */
+               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+               /* Undo the effects of YY_DO_BEFORE_ACTION. */
+               *yy_cp = (yy_hold_char);
+               YY_RESTORE_YY_MORE_OFFSET
+
+               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+                       {
+                       /* We're scanning a new file or input source.  It's
+                        * possible that this happened because the user
+                        * just pointed yyin at a new source and called
+                        * yylex().  If so, then we have to assure
+                        * consistency between YY_CURRENT_BUFFER and our
+                        * globals.  Here is the right place to do so, because
+                        * this is the first action (other than possibly a
+                        * back-up) that will match for the new input source.
+                        */
+                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+                       }
+
+               /* Note that here we test for yy_c_buf_p "<=" to the position
+                * of the first EOB in the buffer, since yy_c_buf_p will
+                * already have been incremented past the NUL character
+                * (since all states make transitions on EOB to the
+                * end-of-buffer state).  Contrast this with the test
+                * in input().
+                */
+               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+                       { /* This was really a NUL. */
+                       yy_state_type yy_next_state;
+
+                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+                       yy_current_state = yy_get_previous_state(  );
+
+                       /* Okay, we're now positioned to make the NUL
+                        * transition.  We couldn't have
+                        * yy_get_previous_state() go ahead and do it
+                        * for us because it doesn't know how to deal
+                        * with the possibility of jamming (and we don't
+                        * want to build jamming into it because then it
+                        * will run more slowly).
+                        */
+
+                       yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+                       if ( yy_next_state )
+                               {
+                               /* Consume the NUL. */
+                               yy_cp = ++(yy_c_buf_p);
+                               yy_current_state = yy_next_state;
+                               goto yy_match;
+                               }
+
+                       else
+                               {
+                               yy_cp = (yy_c_buf_p);
+                               goto yy_find_action;
+                               }
+                       }
+
+               else switch ( yy_get_next_buffer(  ) )
+                       {
+                       case EOB_ACT_END_OF_FILE:
+                               {
+                               (yy_did_buffer_switch_on_eof) = 0;
+
+                               if ( yywrap(  ) )
+                                       {
+                                       /* Note: because we've taken care in
+                                        * yy_get_next_buffer() to have set up
+                                        * yytext, we can now set up
+                                        * yy_c_buf_p so that if some total
+                                        * hoser (like flex itself) wants to
+                                        * call the scanner after we return the
+                                        * YY_NULL, it'll still work - another
+                                        * YY_NULL will get returned.
+                                        */
+                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+                                       yy_act = YY_STATE_EOF(YY_START);
+                                       goto do_action;
+                                       }
+
+                               else
+                                       {
+                                       if ( ! (yy_did_buffer_switch_on_eof) )
+                                               YY_NEW_FILE;
+                                       }
+                               break;
+                               }
+
+                       case EOB_ACT_CONTINUE_SCAN:
+                               (yy_c_buf_p) =
+                                       (yytext_ptr) + yy_amount_of_matched_text;
+
+                               yy_current_state = yy_get_previous_state(  );
+
+                               yy_cp = (yy_c_buf_p);
+                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+                               goto yy_match;
+
+                       case EOB_ACT_LAST_MATCH:
+                               (yy_c_buf_p) =
+                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+                               yy_current_state = yy_get_previous_state(  );
+
+                               yy_cp = (yy_c_buf_p);
+                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+                               goto yy_find_action;
+                       }
+               break;
+               }
+
+       default:
+               YY_FATAL_ERROR(
+                       "fatal flex scanner internal error--no action found" );
+       } /* end of action switch */
+               } /* end of scanning one token */
+} /* end of yylex */
+
+yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
+{
+       yyin = arg_yyin;
+       yyout = arg_yyout;
+       yy_c_buf_p = 0;
+       yy_init = 1;
+       yy_start = 0;
+       yy_flex_debug = 0;
+       yylineno = 1;   // this will only get updated if %option yylineno
+
+       yy_did_buffer_switch_on_eof = 0;
+
+       yy_looking_for_trail_begin = 0;
+       yy_more_flag = 0;
+       yy_more_len = 0;
+       yy_more_offset = yy_prev_more_offset = 0;
+
+       yy_start_stack_ptr = yy_start_stack_depth = 0;
+       yy_start_stack = 0;
+
+    (yy_buffer_stack) = 0;
+    (yy_buffer_stack_top) = 0;
+    (yy_buffer_stack_max) = 0;
+
+       yy_state_buf = 0;
+
+}
+
+yyFlexLexer::~yyFlexLexer()
+{
+       delete [] yy_state_buf;
+       yyfree(yy_start_stack  );
+       yy_delete_buffer( YY_CURRENT_BUFFER );
+}
+
+void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
+{
+       if ( new_in )
+               {
+               yy_delete_buffer( YY_CURRENT_BUFFER );
+               yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
+               }
+
+       if ( new_out )
+               yyout = new_out;
+}
+
+#ifdef YY_INTERACTIVE
+int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+#else
+int yyFlexLexer::LexerInput( char* buf, int max_size )
+#endif
+{
+       if ( yyin->eof() || yyin->fail() )
+               return 0;
+
+#ifdef YY_INTERACTIVE
+       yyin->get( buf[0] );
+
+       if ( yyin->eof() )
+               return 0;
+
+       if ( yyin->bad() )
+               return -1;
+
+       return 1;
+
+#else
+       (void) yyin->read( buf, max_size );
+
+       if ( yyin->bad() )
+               return -1;
+       else
+               return yyin->gcount();
+#endif
+}
+
+void yyFlexLexer::LexerOutput( const char* buf, int size )
+{
+       (void) yyout->write( buf, size );
+}
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *     EOB_ACT_LAST_MATCH -
+ *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *     EOB_ACT_END_OF_FILE - end of file
+ */
+int yyFlexLexer::yy_get_next_buffer()
+{
+       register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+       register char *source = (yytext_ptr);
+       register int number_to_move, i;
+       int ret_val;
+
+       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+               YY_FATAL_ERROR(
+               "fatal flex scanner internal error--end of buffer missed" );
+
+       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+               { /* Don't try to fill the buffer, so this is an EOF. */
+               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+                       {
+                       /* We matched a single character, the EOB, so
+                        * treat this as a final EOF.
+                        */
+                       return EOB_ACT_END_OF_FILE;
+                       }
+
+               else
+                       {
+                       /* We matched some text prior to the EOB, first
+                        * process it.
+                        */
+                       return EOB_ACT_LAST_MATCH;
+                       }
+               }
+
+       /* Try to read more data. */
+
+       /* First move last chars to start of buffer. */
+       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+       for ( i = 0; i < number_to_move; ++i )
+               *(dest++) = *(source++);
+
+       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+               /* don't do the read, it's not guaranteed to return an EOF,
+                * just force an EOF
+                */
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+       else
+               {
+                       size_t num_to_read =
+                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+               while ( num_to_read <= 0 )
+                       { /* Not enough room in the buffer - grow it. */
+
+                       /* just a shorter name for the current buffer */
+                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+                       int yy_c_buf_p_offset =
+                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+                       if ( b->yy_is_our_buffer )
+                               {
+                               int new_size = b->yy_buf_size * 2;
+
+                               if ( new_size <= 0 )
+                                       b->yy_buf_size += b->yy_buf_size / 8;
+                               else
+                                       b->yy_buf_size *= 2;
+
+                               b->yy_ch_buf = (char *)
+                                       /* Include room in for 2 EOB chars. */
+                                       yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
+                               }
+                       else
+                               /* Can't grow it, we don't own it. */
+                               b->yy_ch_buf = 0;
+
+                       if ( ! b->yy_ch_buf )
+                               YY_FATAL_ERROR(
+                               "fatal error - scanner input buffer overflow" );
+
+                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+                                               number_to_move - 1;
+
+                       }
+
+               if ( num_to_read > YY_READ_BUF_SIZE )
+                       num_to_read = YY_READ_BUF_SIZE;
+
+               /* Read in more data. */
+               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+                       (yy_n_chars), num_to_read );
+
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+               }
+
+       if ( (yy_n_chars) == 0 )
+               {
+               if ( number_to_move == YY_MORE_ADJ )
+                       {
+                       ret_val = EOB_ACT_END_OF_FILE;
+                       yyrestart( yyin  );
+                       }
+
+               else
+                       {
+                       ret_val = EOB_ACT_LAST_MATCH;
+                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+                               YY_BUFFER_EOF_PENDING;
+                       }
+               }
+
+       else
+               ret_val = EOB_ACT_CONTINUE_SCAN;
+
+       (yy_n_chars) += number_to_move;
+       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+       return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    yy_state_type yyFlexLexer::yy_get_previous_state()
+{
+       register yy_state_type yy_current_state;
+       register char *yy_cp;
+    
+       yy_current_state = (yy_start);
+
+       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+               {
+               register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+               if ( yy_accept[yy_current_state] )
+                       {
+                       (yy_last_accepting_state) = yy_current_state;
+                       (yy_last_accepting_cpos) = yy_cp;
+                       }
+               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                       {
+                       yy_current_state = (int) yy_def[yy_current_state];
+                       if ( yy_current_state >= 27 )
+                               yy_c = yy_meta[(unsigned int) yy_c];
+                       }
+               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+               }
+
+       return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *     next_state = yy_try_NUL_trans( current_state );
+ */
+    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+{
+       register int yy_is_jam;
+       register char *yy_cp = (yy_c_buf_p);
+
+       register YY_CHAR yy_c = 1;
+       if ( yy_accept[yy_current_state] )
+               {
+               (yy_last_accepting_state) = yy_current_state;
+               (yy_last_accepting_cpos) = yy_cp;
+               }
+       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+               {
+               yy_current_state = (int) yy_def[yy_current_state];
+               if ( yy_current_state >= 27 )
+                       yy_c = yy_meta[(unsigned int) yy_c];
+               }
+       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+       yy_is_jam = (yy_current_state == 26);
+
+       return yy_is_jam ? 0 : yy_current_state;
+}
+
+    void yyFlexLexer::yyunput( int c, register char* yy_bp)
+{
+       register char *yy_cp;
+    
+    yy_cp = (yy_c_buf_p);
+
+       /* undo effects of setting up yytext */
+       *yy_cp = (yy_hold_char);
+
+       if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+               { /* need to shift things up to make room */
+               /* +2 for EOB chars. */
+               register int number_to_move = (yy_n_chars) + 2;
+               register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+                                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+               register char *source =
+                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+               while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       *--dest = *--source;
+
+               yy_cp += (int) (dest - source);
+               yy_bp += (int) (dest - source);
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+               if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+                       YY_FATAL_ERROR( "flex scanner push-back overflow" );
+               }
+
+       *--yy_cp = (char) c;
+
+       (yytext_ptr) = yy_bp;
+       (yy_hold_char) = *yy_cp;
+       (yy_c_buf_p) = yy_cp;
+}
+
+    int yyFlexLexer::yyinput()
+{
+       int c;
+    
+       *(yy_c_buf_p) = (yy_hold_char);
+
+       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+               {
+               /* yy_c_buf_p now points to the character we want to return.
+                * If this occurs *before* the EOB characters, then it's a
+                * valid NUL; if not, then we've hit the end of the buffer.
+                */
+               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+                       /* This was really a NUL. */
+                       *(yy_c_buf_p) = '\0';
+
+               else
+                       { /* need more input */
+                       int offset = (yy_c_buf_p) - (yytext_ptr);
+                       ++(yy_c_buf_p);
+
+                       switch ( yy_get_next_buffer(  ) )
+                               {
+                               case EOB_ACT_LAST_MATCH:
+                                       /* This happens because yy_g_n_b()
+                                        * sees that we've accumulated a
+                                        * token and flags that we need to
+                                        * try matching the token before
+                                        * proceeding.  But for input(),
+                                        * there's no matching to consider.
+                                        * So convert the EOB_ACT_LAST_MATCH
+                                        * to EOB_ACT_END_OF_FILE.
+                                        */
+
+                                       /* Reset buffer status. */
+                                       yyrestart( yyin );
+
+                                       /*FALLTHROUGH*/
+
+                               case EOB_ACT_END_OF_FILE:
+                                       {
+                                       if ( yywrap(  ) )
+                                               return EOF;
+
+                                       if ( ! (yy_did_buffer_switch_on_eof) )
+                                               YY_NEW_FILE;
+#ifdef __cplusplus
+                                       return yyinput();
+#else
+                                       return input();
+#endif
+                                       }
+
+                               case EOB_ACT_CONTINUE_SCAN:
+                                       (yy_c_buf_p) = (yytext_ptr) + offset;
+                                       break;
+                               }
+                       }
+               }
+
+       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
+       *(yy_c_buf_p) = '\0';   /* preserve yytext */
+       (yy_hold_char) = *++(yy_c_buf_p);
+
+       return c;
+}
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * 
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void yyFlexLexer::yyrestart( std::istream* input_file )
+{
+    
+       if ( ! YY_CURRENT_BUFFER ){
+        yyensure_buffer_stack ();
+               YY_CURRENT_BUFFER_LVALUE =
+            yy_create_buffer( yyin, YY_BUF_SIZE );
+       }
+
+       yy_init_buffer( YY_CURRENT_BUFFER, input_file );
+       yy_load_buffer_state(  );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * 
+ */
+    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+{
+    
+       /* TODO. We should be able to replace this entire function body
+        * with
+        *              yypop_buffer_state();
+        *              yypush_buffer_state(new_buffer);
+     */
+       yyensure_buffer_stack ();
+       if ( YY_CURRENT_BUFFER == new_buffer )
+               return;
+
+       if ( YY_CURRENT_BUFFER )
+               {
+               /* Flush out information for old buffer. */
+               *(yy_c_buf_p) = (yy_hold_char);
+               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+               }
+
+       YY_CURRENT_BUFFER_LVALUE = new_buffer;
+       yy_load_buffer_state(  );
+
+       /* We don't actually know whether we did this switch during
+        * EOF (yywrap()) processing, but the only time this flag
+        * is looked at is after yywrap() is called, so it's safe
+        * to go ahead and always set it.
+        */
+       (yy_did_buffer_switch_on_eof) = 1;
+}
+
+    void yyFlexLexer::yy_load_buffer_state()
+{
+       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+       yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+       (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * 
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+{
+       YY_BUFFER_STATE b;
+    
+       b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
+       if ( ! b )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+       b->yy_buf_size = size;
+
+       /* yy_ch_buf has to be 2 characters longer than the size given because
+        * we need to put in 2 end-of-buffer characters.
+        */
+       b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
+       if ( ! b->yy_ch_buf )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+       b->yy_is_our_buffer = 1;
+
+       yy_init_buffer( b, file );
+
+       return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * 
+ */
+    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+{
+    
+       if ( ! b )
+               return;
+
+       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+       if ( b->yy_is_our_buffer )
+               yyfree((void *) b->yy_ch_buf  );
+
+       yyfree((void *) b  );
+}
+
+extern "C" int isatty (int );
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
+
+{
+       int oerrno = errno;
+    
+       yy_flush_buffer( b );
+
+       b->yy_input_file = file;
+       b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then yy_init_buffer was _probably_
+     * called from yyrestart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+       b->yy_is_interactive = 0;
+       errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * 
+ */
+    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+{
+       if ( ! b )
+               return;
+
+       b->yy_n_chars = 0;
+
+       /* We always need two end-of-buffer characters.  The first causes
+        * a transition to the end-of-buffer state.  The second causes
+        * a jam in that state.
+        */
+       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+       b->yy_buf_pos = &b->yy_ch_buf[0];
+
+       b->yy_at_bol = 1;
+       b->yy_buffer_status = YY_BUFFER_NEW;
+
+       if ( b == YY_CURRENT_BUFFER )
+               yy_load_buffer_state(  );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  
+ */
+void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
+{
+       if (new_buffer == NULL)
+               return;
+
+       yyensure_buffer_stack();
+
+       /* This block is copied from yy_switch_to_buffer. */
+       if ( YY_CURRENT_BUFFER )
+               {
+               /* Flush out information for old buffer. */
+               *(yy_c_buf_p) = (yy_hold_char);
+               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+               }
+
+       /* Only push if top exists. Otherwise, replace top. */
+       if (YY_CURRENT_BUFFER)
+               (yy_buffer_stack_top)++;
+       YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+       /* copied from yy_switch_to_buffer. */
+       yy_load_buffer_state(  );
+       (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  
+ */
+void yyFlexLexer::yypop_buffer_state (void)
+{
+       if (!YY_CURRENT_BUFFER)
+               return;
+
+       yy_delete_buffer(YY_CURRENT_BUFFER );
+       YY_CURRENT_BUFFER_LVALUE = NULL;
+       if ((yy_buffer_stack_top) > 0)
+               --(yy_buffer_stack_top);
+
+       if (YY_CURRENT_BUFFER) {
+               yy_load_buffer_state(  );
+               (yy_did_buffer_switch_on_eof) = 1;
+       }
+}
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+void yyFlexLexer::yyensure_buffer_stack(void)
+{
+       int num_to_alloc;
+    
+       if (!(yy_buffer_stack)) {
+
+               /* First allocation is just for 2 elements, since we don't know if this
+                * scanner will even need a stack. We use 2 instead of 1 to avoid an
+                * immediate realloc on the next call.
+         */
+               num_to_alloc = 1;
+               (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
+                                                               );
+               
+               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+                               
+               (yy_buffer_stack_max) = num_to_alloc;
+               (yy_buffer_stack_top) = 0;
+               return;
+       }
+
+       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+               /* Increase the buffer to prepare for a possible push. */
+               int grow_size = 8 /* arbitrary grow size */;
+
+               num_to_alloc = (yy_buffer_stack_max) + grow_size;
+               (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+                                                               ((yy_buffer_stack),
+                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
+                                                               );
+
+               /* zero only the new slots.*/
+               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+               (yy_buffer_stack_max) = num_to_alloc;
+       }
+}
+
+    void yyFlexLexer::yy_push_state( int new_state )
+{
+       if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
+               {
+               yy_size_t new_size;
+
+               (yy_start_stack_depth) += YY_START_STACK_INCR;
+               new_size = (yy_start_stack_depth) * sizeof( int );
+
+               if ( ! (yy_start_stack) )
+                       (yy_start_stack) = (int *) yyalloc(new_size  );
+
+               else
+                       (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size  );
+
+               if ( ! (yy_start_stack) )
+                       YY_FATAL_ERROR(
+                       "out of memory expanding start-condition stack" );
+               }
+
+       (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+
+       BEGIN(new_state);
+}
+
+    void yyFlexLexer::yy_pop_state()
+{
+       if ( --(yy_start_stack_ptr) < 0 )
+               YY_FATAL_ERROR( "start-condition stack underflow" );
+
+       BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+}
+
+    int yyFlexLexer::yy_top_state()
+{
+       return (yy_start_stack)[(yy_start_stack_ptr) - 1];
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+void yyFlexLexer::LexerError( yyconst char msg[] )
+{
+       std::cerr << msg << std::endl;
+       exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+       do \
+               { \
+               /* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+               yytext[yyleng] = (yy_hold_char); \
+               (yy_c_buf_p) = yytext + yyless_macro_arg; \
+               (yy_hold_char) = *(yy_c_buf_p); \
+               *(yy_c_buf_p) = '\0'; \
+               yyleng = yyless_macro_arg; \
+               } \
+       while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+       register int i;
+       for ( i = 0; i < n; ++i )
+               s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+       register int n;
+       for ( n = 0; s[n]; ++n )
+               ;
+
+       return n;
+}
+#endif
+
+void *yyalloc (yy_size_t  size )
+{
+       return (void *) malloc( size );
+}
+
+void *yyrealloc  (void * ptr, yy_size_t  size )
+{
+       /* The cast to (char *) in the following accommodates both
+        * implementations that use char* generic pointers, and those
+        * that use void* generic pointers.  It works with the latter
+        * because both ANSI C and C++ allow castless assignment from
+        * any pointer type to void*, and deal with argument conversions
+        * as though doing an assignment.
+        */
+       return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+       free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef yytext_ptr
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
+#line 39 "cmdlex.l"
+
+
+
+#undef lexer_obj
+
+int
+yywrap(void)
+{
+  return(1);
+}
+
+#include "cmdlexcl.h"
+#include "globals.h"
+
+int
+cl_ucsim_lexer::LexerInput(char *buf, int max_size)
+{
+  if (!string_to_parse)
+    return(yyFlexLexer::LexerInput(buf, max_size));
+  int lrem= strlen(string_ptr);
+  int n= max_size;
+  if (lrem < max_size)
+    n= lrem;
+  strncpy(buf, string_ptr, n);
+  string_ptr+= n;
+  return(n);
+}
+
+void
+cl_ucsim_lexer::activate_lexer_to_parse_into(void *yylv)
+{
+  yylval= (YY_cl_ucsim_parser_STYPE *)yylv;
+}
+
+int
+cl_ucsim_lexer::check_id(char *token)
+{
+  class cl_uc *uc= application->get_uc();
+  //printf("checking id=\"%s\"\n",token);
+
+  if (uc)
+    {
+      class cl_memory *mem= uc->memory(token);
+      if (mem)
+       {
+         yylval->memory_object= mem;
+         return(tok(PTOK_MEMORY_OBJECT));
+       }
+      
+      t_addr addr;
+      bool found= uc->symbol2address(yytext, uc->sfr_tbl(), &addr);
+      if (found)
+       {
+         /*yylval->number= addr;
+           return(tok(PTOK_NUMBER));*/
+         yylval->memory.memory= uc->address_space(MEM_SFR_ID);
+         yylval->memory.address= addr;
+         return(tok(PTOK_MEMORY));
+       }
+
+      found= uc->symbol2address(yytext, uc->bit_tbl(), &addr);
+      if (found)
+       {
+         t_addr memaddr;
+         t_mem mask;
+         yylval->bit.memory= uc->bit2mem(addr, &memaddr, &mask);
+         yylval->bit.mem_address= memaddr;
+         yylval->bit.bit_address= addr;
+         yylval->bit.mask= mask;
+         return(tok(PTOK_BIT));
+       }
+    }
+
+  return(0);
+}
+
diff --git a/sim/ucsim/cmd.src/cmdlex.l b/sim/ucsim/cmd.src/cmdlex.l
new file mode 100644 (file)
index 0000000..4522fab
--- /dev/null
@@ -0,0 +1,112 @@
+%{
+#include "cmdlexcl.h"
+#include "cmdpars.h"
+
+static YY_cl_ucsim_parser_STYPE *yylval;
+
+int yywrap(void);
+
+#define tok(x) (YY_cl_ucsim_parser_CLASS::x)
+#define lexer_obj (dynamic_cast<class cl_ucsim_lexer *>(this))
+
+%}
+
+%%
+
+[ \t]*                 ;
+
+"+"                    return(tok(PTOK_PLUS));
+"-"                    return(tok(PTOK_MINUS));
+"*"                    return(tok(PTOK_ASTERIX));
+"/"                    return(tok(PTOK_SLASH));
+"("                    return(tok(PTOK_LEFT_PAREN));
+")"                    return(tok(PTOK_RIGHT_PAREN));
+"["                    return(tok(PTOK_LEFT_BRACKET));
+"]"                    return(tok(PTOK_RIGHT_BRACKET));
+"="                    return(tok(PTOK_EQUAL));
+"."                    return(tok(PTOK_DOT));
+"&"                    return(tok(PTOK_AMPERSAND));
+
+([0-9]+)|(0x[0-9a-fA-F]+) {
+  yylval->number= strtol(yytext, 0, 0);
+  return(YY_cl_ucsim_parser_CLASS::PTOK_NUMBER);
+}
+
+[a-zA-Z_][0-9a-zA-Z_]* return(lexer_obj->check_id(yytext));
+
+.                      ;
+
+%%
+
+#undef lexer_obj
+
+int
+yywrap(void)
+{
+  return(1);
+}
+
+#include "cmdlexcl.h"
+#include "globals.h"
+
+int
+cl_ucsim_lexer::LexerInput(char *buf, int max_size)
+{
+  if (!string_to_parse)
+    return(yyFlexLexer::LexerInput(buf, max_size));
+  int lrem= strlen(string_ptr);
+  int n= max_size;
+  if (lrem < max_size)
+    n= lrem;
+  strncpy(buf, string_ptr, n);
+  string_ptr+= n;
+  return(n);
+}
+
+void
+cl_ucsim_lexer::activate_lexer_to_parse_into(void *yylv)
+{
+  yylval= (YY_cl_ucsim_parser_STYPE *)yylv;
+}
+
+int
+cl_ucsim_lexer::check_id(char *token)
+{
+  class cl_uc *uc= application->get_uc();
+  //printf("checking id=\"%s\"\n",token);
+
+  if (uc)
+    {
+      class cl_memory *mem= uc->memory(token);
+      if (mem)
+       {
+         yylval->memory_object= mem;
+         return(tok(PTOK_MEMORY_OBJECT));
+       }
+      
+      t_addr addr;
+      bool found= uc->symbol2address(yytext, uc->sfr_tbl(), &addr);
+      if (found)
+       {
+         /*yylval->number= addr;
+           return(tok(PTOK_NUMBER));*/
+         yylval->memory.memory= uc->address_space(MEM_SFR_ID);
+         yylval->memory.address= addr;
+         return(tok(PTOK_MEMORY));
+       }
+
+      found= uc->symbol2address(yytext, uc->bit_tbl(), &addr);
+      if (found)
+       {
+         t_addr memaddr;
+         t_mem mask;
+         yylval->bit.memory= uc->bit2mem(addr, &memaddr, &mask);
+         yylval->bit.mem_address= memaddr;
+         yylval->bit.bit_address= addr;
+         yylval->bit.mask= mask;
+         return(tok(PTOK_BIT));
+       }
+    }
+
+  return(0);
+}
diff --git a/sim/ucsim/cmd.src/cmdlexcl.h b/sim/ucsim/cmd.src/cmdlexcl.h
new file mode 100644 (file)
index 0000000..1ac023b
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef CMDLEXCL_HEADER
+#define CMDLEXCL_HEADER
+
+#ifndef __FLEX_LEXER_H
+#include <FlexLexer.h>
+#endif
+
+#include "pobjcl.h"
+
+
+class cl_ucsim_lexer: public yyFlexLexer
+{
+protected:
+  char *string_to_parse;
+  char *string_ptr;
+public:
+  cl_ucsim_lexer(void): yyFlexLexer()
+  {
+    string_to_parse= string_ptr= 0;
+  }
+  cl_ucsim_lexer(char *str): yyFlexLexer()
+  {
+    string_to_parse= string_ptr= strdup(str);
+  }
+  virtual ~cl_ucsim_lexer(void)
+  {
+    if (string_to_parse)
+      {
+       free(string_to_parse);
+       string_to_parse= 0;
+      }
+  }
+  void activate_lexer_to_parse_into(void *yylv);
+protected:
+  int LexerInput(char *buf, int max_size);
+public:
+  int check_id(char *token);
+};
+
+
+#endif
diff --git a/sim/ucsim/cmd.src/cmdmem.cc b/sim/ucsim/cmd.src/cmdmem.cc
new file mode 100644 (file)
index 0000000..79666e1
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * Simulator of microcontrollers (cmd.src/cmdmem.cc)
+ *
+ * Copyright (C) 2001,01 Drotos Daniel, Talker Bt.
+ * 
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+UCSIM is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with UCSIM; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+// prj
+#include "globals.h"
+#include "utils.h"
+
+// sim
+#include "simcl.h"
+
+// local
+#include "cmdmemcl.h"
+
+
+/*
+ * Command: memory createchip
+ *----------------------------------------------------------------------------
+ */
+
+//int
+//cl_conf_addmem_cmd::do_work(class cl_sim *sim,
+//                         class cl_cmdline *cmdline, class cl_console *con)
+COMMAND_DO_WORK_UC(cl_memory_createchip_cmd)
+{
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+  char *memid= NULL;
+  int size= -1;
+  int width= 8;
+
+  if (cmdline->syntax_match(uc, STRING NUMBER)) {
+    memid= params[0]->value.string.string;
+    size= params[1]->value.number;
+  }
+  else if (cmdline->syntax_match(uc, STRING NUMBER NUMBER)) {
+    memid= params[0]->value.string.string;
+    size= params[1]->value.number;
+    width= params[2]->value.number;
+  }
+  else
+    con->dd_printf("Syntax error.\n");
+
+  if (!memid ||
+      !*memid)
+    con->dd_printf("Wrong id\n");
+  else if (size < 1)
+    con->dd_printf("Wrong size\n");
+  else
+    {
+      class cl_memory *mem= new cl_memory_chip(memid, size, width);
+      mem->init();
+      uc->memchips->add(mem);
+      mem->set_uc(uc);
+    }
+  return(DD_FALSE);
+}
+
+
+/*
+ * Command: memory createaddressspace
+ *----------------------------------------------------------------------------
+ */
+
+//int
+//cl_conf_addmem_cmd::do_work(class cl_sim *sim,
+//                         class cl_cmdline *cmdline, class cl_console *con)
+COMMAND_DO_WORK_UC(cl_memory_createaddressspace_cmd)
+{
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+  char *memid= NULL;
+  int start= 0, size= -1, width= 8;
+
+  if (cmdline->syntax_match(uc, STRING NUMBER)) {
+    memid= params[0]->value.string.string;
+    size= params[1]->value.number;
+  }
+  else if (cmdline->syntax_match(uc, STRING NUMBER NUMBER)) {
+    memid= params[0]->value.string.string;
+    start= params[1]->value.number;
+    size= params[2]->value.number;
+  }
+  else if (cmdline->syntax_match(uc, STRING NUMBER NUMBER NUMBER)) {
+    memid= params[0]->value.string.string;
+    start= params[1]->value.number;
+    size= params[2]->value.number;
+    width= params[3]->value.number;
+  }
+  else
+    con->dd_printf("Syntax error.\n");
+
+  if (!memid ||
+      !*memid)
+    con->dd_printf("Wrong id\n");
+  else if (size < 1)
+    con->dd_printf("Wrong size\n");
+  else
+    {
+      class cl_address_space *mem=
+       new cl_address_space(memid, start, size, width);
+      mem->init();
+      uc->address_spaces->add(mem);
+      mem->set_uc(uc);
+    }
+  return(DD_FALSE);
+}
+
+
+/*
+ * Command: memory createaddressdecoder
+ *----------------------------------------------------------------------------
+ */
+
+//int
+//cl_conf_addmem_cmd::do_work(class cl_sim *sim,
+//                         class cl_cmdline *cmdline, class cl_console *con)
+COMMAND_DO_WORK_UC(cl_memory_createaddressdecoder_cmd)
+{
+  class cl_cmd_arg *params[5]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3),
+                                cmdline->param(4) };
+  class cl_memory *as= 0, *chip= 0;
+  t_addr as_begin= 0, as_end= 0, chip_begin= 0;
+  
+  if (cmdline->syntax_match(uc, MEMORY MEMORY)) {
+    as= params[0]->value.memory.memory;
+    as_end= as->highest_valid_address();
+    chip= params[1]->value.memory.memory;
+  }
+  else if (cmdline->syntax_match(uc, MEMORY MEMORY NUMBER)) {
+    as= params[0]->value.memory.memory;
+    as_end= as->highest_valid_address();
+    chip= params[1]->value.memory.memory;
+    chip_begin= params[2]->value.number;
+  }
+  else if (cmdline->syntax_match(uc, MEMORY NUMBER MEMORY)) {
+    as= params[0]->value.memory.memory;
+    as_begin= params[1]->value.number;
+    as_end= as->highest_valid_address();
+    chip= params[2]->value.memory.memory;
+  }
+  else if (cmdline->syntax_match(uc, MEMORY NUMBER MEMORY NUMBER)) {
+    as= params[0]->value.memory.memory;
+    as_begin= params[1]->value.number;
+    as_end= as->highest_valid_address();
+    chip= params[2]->value.memory.memory;
+    chip_begin= params[3]->value.number;
+  }
+  else if (cmdline->syntax_match(uc, MEMORY NUMBER NUMBER MEMORY)) {
+    as= params[0]->value.memory.memory;
+    as_begin= params[1]->value.number;
+    as_end= params[2]->value.number;
+    chip= params[3]->value.memory.memory;
+  }
+  else if (cmdline->syntax_match(uc, MEMORY NUMBER NUMBER MEMORY NUMBER)) {
+    as= params[0]->value.memory.memory;
+    as_begin= params[1]->value.number;
+    as_end= params[2]->value.number;
+    chip= params[3]->value.memory.memory;
+    chip_begin= params[4]->value.number;
+  }
+  else
+    con->dd_printf("Syntax error.\n");
+
+  if (!as->is_address_space())
+    con->dd_printf("%s is not an address space\n", as->get_name("unknown"));
+  else if (!chip->is_chip())
+    con->dd_printf("%s is not a memory chip\n", chip->get_name("unknown"));
+  else if (as_begin > as_end)
+    con->dd_printf("Wrong address area specification\n");
+  else if (chip_begin >= chip->get_size())
+    con->dd_printf("Wrong chip area specification\n");
+  else if (as_begin < as->start_address ||
+          as_end >= as->highest_valid_address())
+    con->dd_printf("Specified area is out of address space\n");
+  else if (as_end-as_begin > chip->get_size()-chip_begin)
+    con->dd_printf("Specified area is out of chip size\n");
+  else
+    {
+      class cl_address_decoder *d=
+       new cl_address_decoder(as, chip, as_begin, as_end, chip_begin);
+      ((class cl_address_space *)as)->decoders->add(d);
+      d->activate(con);
+    }
+  return(DD_FALSE);
+}
+
+
+/* End of cmd.src/cmdmem.cc */
diff --git a/sim/ucsim/cmd.src/cmdmemcl.h b/sim/ucsim/cmd.src/cmdmemcl.h
new file mode 100644 (file)
index 0000000..be18f97
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Simulator of microcontrollers (cmd.src/cmdmemcl.h)
+ *
+ * Copyright (C) 2001,01 Drotos Daniel, Talker Bt.
+ * 
+ * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
+ *
+ */
+
+/* This file is part of microcontroller simulator: ucsim.
+
+UCSIM is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+UCSIM is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with UCSIM; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+/*@1@*/
+
+#ifndef CMD_CMDMEM_HEADER
+#define CMD_CMDMEM_HEADER
+
+#include "newcmdcl.h"
+
+
+// MEMORY CREATECHIP
+COMMAND_ON(uc,cl_memory_createchip_cmd);
+
+// MEMORY CREATEADDRESSSPACE
+COMMAND_ON(uc,cl_memory_createaddressspace_cmd);
+
+// MEMORY CREATEADDRESSDECODER
+COMMAND_ON(uc,cl_memory_createaddressdecoder_cmd);
+
+
+#endif
+
+/* End of cmd.src/cmdmemcl.h */
diff --git a/sim/ucsim/cmd.src/cmdpars.cc b/sim/ucsim/cmd.src/cmdpars.cc
new file mode 100644 (file)
index 0000000..8087e4a
--- /dev/null
@@ -0,0 +1,1445 @@
+#define YY_cl_ucsim_parser_h_included
+#define YY_USE_CLASS
+
+/*  A Bison++ parser, made from cmdpars.y  */
+
+ /* with Bison++ version bison++ Version 1.21.9-1, adapted from GNU bison by coetmeur@icdc.fr
+Maintained by Magnus Ekdahl <magnus@debian.org>
+  */
+
+#define YY_USE_CLASS
+
+#line 1 "/usr/share/bison++/bison.cc"
+/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
+/* Skeleton output parser for bison,
+   Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 1, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
+
+   As a special exception, when this file is copied by Bison++ into a
+   Bison++ output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison, and has been in Bison++ since 1.21.9.  
+
+*/
+
+/* HEADER SECTION */
+#if defined( _MSDOS ) || defined(MSDOS) || defined(__MSDOS__) 
+ #define __MSDOS_AND_ALIKE
+#endif
+
+#if defined(_WINDOWS) && defined(_MSC_VER)
+ #define __HAVE_NO_ALLOCA
+ #define __MSDOS_AND_ALIKE
+#endif
+
+#ifndef alloca
+ #if defined( __GNUC__)
+  #define alloca __builtin_alloca
+
+ #elif (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc)  || defined (__sgi)
+  #include <alloca.h>
+
+ #elif defined (__MSDOS_AND_ALIKE)
+  #include <malloc.h>
+  #ifndef __TURBOC__
+   /* MS C runtime lib */
+   #define alloca _alloca
+  #endif
+
+ #elif defined(_AIX)
+  /* pragma must be put before any C/C++ instruction !! */
+  #pragma alloca
+  #include <malloc.h>
+
+ #elif defined(__hpux)
+  #ifdef __cplusplus
+   extern "C" {
+     void *alloca (unsigned int);
+   };
+  #else /* not __cplusplus */
+   void *alloca ();
+  #endif /* not __cplusplus */
+
+ #endif /* not _AIX  not MSDOS, or __TURBOC__ or _AIX, not sparc.  */
+#endif /* alloca not defined.  */
+
+#ifdef c_plusplus
+ #ifndef __cplusplus
+  #define __cplusplus
+ #endif
+#endif
+
+#ifdef __cplusplus
+ #ifndef YY_USE_CLASS
+/*#warning "For C++ its recomended to use bison++, otherwise classes won't be generated"*/
+ #endif
+#else
+ #ifndef __STDC__
+  #define const
+ #endif
+ #ifdef YY_USE_CLASS
+  #error "This is a C++ header generated by bison++, please use a C++ compiler!"
+ #endif
+#endif
+
+#include <stdio.h>
+#define YYBISON 1  
+
+ #line 88 "/usr/share/bison++/bison.cc"
+#line 3 "cmdpars.y"
+
+#include "cmdlexcl.h"
+#include "memcl.h"
+#include "globals.h"
+#include "stypes.h"
+#define YY_cl_ucsim_parser_INHERIT  : public cl_base
+#define YY_cl_ucsim_parser_MEMBERS  class cl_ucsim_lexer *lexer_object;\
+virtual ~YY_cl_ucsim_parser_CLASS(void) { delete lexer_object; }
+#define YY_cl_ucsim_parser_CONSTRUCTOR_PARAM  \
+class cl_ucsim_lexer *the_lexer
+#define YY_cl_ucsim_parser_CONSTRUCTOR_CODE  \
+lexer_object= the_lexer;
+
+#line 43 "cmdpars.y"
+typedef union {
+  long number;
+  class cl_memory *memory_object;
+  struct {
+    class cl_memory *memory;
+    long address;
+  } memory;
+  struct {
+    class cl_memory *memory;
+    long mem_address, bit_address;
+    long mask;
+  } bit;
+} yy_cl_ucsim_parser_stype;
+#define YY_cl_ucsim_parser_STYPE yy_cl_ucsim_parser_stype
+
+#line 88 "/usr/share/bison++/bison.cc"
+/* %{ and %header{ and %union, during decl */
+#define YY_cl_ucsim_parser_BISON 1
+
+#ifndef YY_cl_ucsim_parser_COMPATIBILITY
+ #ifndef YY_USE_CLASS
+  #define  YY_cl_ucsim_parser_COMPATIBILITY 1
+ #else
+  #define  YY_cl_ucsim_parser_COMPATIBILITY 0
+ #endif
+#endif
+
+#if YY_cl_ucsim_parser_COMPATIBILITY != 0
+ /* backward compatibility */
+ #ifdef YYLTYPE
+  #ifndef YY_cl_ucsim_parser_LTYPE
+   #define YY_cl_ucsim_parser_LTYPE YYLTYPE
+  #endif
+ #endif
+/* Testing alternative bison solution
+   /#ifdef YYSTYPE*/
+#ifndef YY_cl_ucsim_parser_STYPE 
+   #define YY_cl_ucsim_parser_STYPE YYSTYPE
+#endif
+/*#endif*/
+ #ifdef YYDEBUG
+  #ifndef YY_cl_ucsim_parser_DEBUG
+   #define  YY_cl_ucsim_parser_DEBUG YYDEBUG
+  #endif
+ #endif
+ /* use goto to be compatible */
+ #ifndef YY_cl_ucsim_parser_USE_GOTO
+  #define YY_cl_ucsim_parser_USE_GOTO 1
+ #endif
+#endif
+
+/* use no goto to be clean in C++ */
+#ifndef YY_cl_ucsim_parser_USE_GOTO
+ #define YY_cl_ucsim_parser_USE_GOTO 0
+#endif
+
+#ifndef YY_cl_ucsim_parser_PURE
+
+ #line 130 "/usr/share/bison++/bison.cc"
+#define YY_cl_ucsim_parser_PURE 1
+
+#line 130 "/usr/share/bison++/bison.cc"
+/*  YY_cl_ucsim_parser_PURE */
+#endif
+
+/* section apres lecture def, avant lecture grammaire S2 */
+
+ #line 134 "/usr/share/bison++/bison.cc"
+
+#line 134 "/usr/share/bison++/bison.cc"
+/* prefix */
+#ifndef YY_cl_ucsim_parser_DEBUG
+
+ #line 136 "/usr/share/bison++/bison.cc"
+
+#line 136 "/usr/share/bison++/bison.cc"
+/* YY_cl_ucsim_parser_DEBUG */
+#endif
+
+
+#ifndef YY_cl_ucsim_parser_LSP_NEEDED
+
+ #line 141 "/usr/share/bison++/bison.cc"
+
+#line 141 "/usr/share/bison++/bison.cc"
+ /* YY_cl_ucsim_parser_LSP_NEEDED*/
+#endif
+
+
+
+/* DEFAULT LTYPE*/
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+#ifndef YY_cl_ucsim_parser_LTYPE
+#ifndef BISON_YYLTYPE_ISDECLARED
+#define BISON_YYLTYPE_ISDECLARED
+typedef
+  struct yyltype
+    {
+      int timestamp;
+      int first_line;
+      int first_column;
+      int last_line;
+      int last_column;
+      char *text;
+   }
+  yyltype;
+
+#endif
+#define YY_cl_ucsim_parser_LTYPE yyltype
+#endif
+#endif
+/* DEFAULT STYPE*/
+      /* We used to use `unsigned long' as YY_cl_ucsim_parser_STYPE on MSDOS,
+        but it seems better to be consistent.
+        Most programs should declare their own type anyway.  */
+
+#ifndef YY_cl_ucsim_parser_STYPE
+#define YY_cl_ucsim_parser_STYPE int
+#endif
+/* DEFAULT MISCELANEOUS */
+#ifndef YY_cl_ucsim_parser_PARSE
+#define YY_cl_ucsim_parser_PARSE yyparse
+#endif
+#ifndef YY_cl_ucsim_parser_LEX
+#define YY_cl_ucsim_parser_LEX yylex
+#endif
+#ifndef YY_cl_ucsim_parser_LVAL
+#define YY_cl_ucsim_parser_LVAL yylval
+#endif
+#ifndef YY_cl_ucsim_parser_LLOC
+#define YY_cl_ucsim_parser_LLOC yylloc
+#endif
+#ifndef YY_cl_ucsim_parser_CHAR
+#define YY_cl_ucsim_parser_CHAR yychar
+#endif
+#ifndef YY_cl_ucsim_parser_NERRS
+#define YY_cl_ucsim_parser_NERRS yynerrs
+#endif
+#ifndef YY_cl_ucsim_parser_DEBUG_FLAG
+#define YY_cl_ucsim_parser_DEBUG_FLAG yydebug
+#endif
+#ifndef YY_cl_ucsim_parser_ERROR
+#define YY_cl_ucsim_parser_ERROR yyerror
+#endif
+
+#ifndef YY_cl_ucsim_parser_PARSE_PARAM
+ #ifndef YY_USE_CLASS
+  #ifdef YYPARSE_PARAM
+   #define YY_cl_ucsim_parser_PARSE_PARAM void* YYPARSE_PARAM 
+  #else
+   #ifndef __STDC__
+    #ifndef __cplusplus
+     #define YY_cl_ucsim_parser_PARSE_PARAM
+    #endif
+   #endif
+  #endif
+ #endif
+ #ifndef YY_cl_ucsim_parser_PARSE_PARAM
+  #define YY_cl_ucsim_parser_PARSE_PARAM void
+ #endif
+#endif
+
+#if YY_cl_ucsim_parser_COMPATIBILITY != 0
+/* backward compatibility */
+#ifdef YY_cl_ucsim_parser_LTYPE
+#ifndef YYLTYPE
+#define YYLTYPE YY_cl_ucsim_parser_LTYPE
+#else
+/* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */
+#endif
+#endif
+
+/* Removed due to bison compabilityproblems
+/#ifndef YYSTYPE
+/#define YYSTYPE YY_cl_ucsim_parser_STYPE
+/#else*/
+/* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */
+/*#endif*/
+
+#ifdef YY_cl_ucsim_parser_PURE
+#  ifndef YYPURE
+#    define YYPURE YY_cl_ucsim_parser_PURE
+#  endif
+#endif
+
+#ifdef YY_cl_ucsim_parser_DEBUG
+#  ifndef YYDEBUG
+#    define YYDEBUG YY_cl_ucsim_parser_DEBUG 
+#  endif
+#endif
+
+#ifndef YY_cl_ucsim_parser_ERROR_VERBOSE
+ #ifdef YYERROR_VERBOSE
+  #define YY_cl_ucsim_parser_ERROR_VERBOSE YYERROR_VERBOSE
+ #endif
+#endif
+
+#ifndef YY_cl_ucsim_parser_LSP_NEEDED
+#  ifdef YYLSP_NEEDED
+#    define YY_cl_ucsim_parser_LSP_NEEDED YYLSP_NEEDED
+#  endif
+#endif
+
+#endif
+
+#ifndef YY_USE_CLASS
+/* TOKEN C */
+
+ #line 263 "/usr/share/bison++/bison.cc"
+#define        PTOK_PLUS       258
+#define        PTOK_MINUS      259
+#define        PTOK_ASTERIX    260
+#define        PTOK_SLASH      261
+#define        PTOK_EQUAL      262
+#define        PTOK_LEFT_PAREN 263
+#define        PTOK_RIGHT_PAREN        264
+#define        PTOK_LEFT_BRACKET       265
+#define        PTOK_RIGHT_BRACKET      266
+#define        PTOK_DOT        267
+#define        PTOK_AMPERSAND  268
+#define        PTOK_MEMORY_OBJECT      269
+#define        PTOK_MEMORY     270
+#define        PTOK_NUMBER     271
+#define        PTOK_BIT        272
+#define        UNARYMINUS      273
+
+
+#line 263 "/usr/share/bison++/bison.cc"
+ /* #defines tokens */
+#else
+/* CLASS */
+#ifndef YY_cl_ucsim_parser_CLASS
+#define YY_cl_ucsim_parser_CLASS cl_ucsim_parser
+#endif
+#ifndef YY_cl_ucsim_parser_INHERIT
+#define YY_cl_ucsim_parser_INHERIT
+#endif
+#ifndef YY_cl_ucsim_parser_MEMBERS
+#define YY_cl_ucsim_parser_MEMBERS 
+#endif
+#ifndef YY_cl_ucsim_parser_LEX_BODY
+#define YY_cl_ucsim_parser_LEX_BODY  
+#endif
+#ifndef YY_cl_ucsim_parser_ERROR_BODY
+#define YY_cl_ucsim_parser_ERROR_BODY  
+#endif
+#ifndef YY_cl_ucsim_parser_CONSTRUCTOR_PARAM
+#define YY_cl_ucsim_parser_CONSTRUCTOR_PARAM
+#endif
+#ifndef YY_cl_ucsim_parser_CONSTRUCTOR_CODE
+#define YY_cl_ucsim_parser_CONSTRUCTOR_CODE
+#endif
+#ifndef YY_cl_ucsim_parser_CONSTRUCTOR_INIT
+#define YY_cl_ucsim_parser_CONSTRUCTOR_INIT
+#endif
+/* choose between enum and const */
+#ifndef YY_cl_ucsim_parser_USE_CONST_TOKEN
+#define YY_cl_ucsim_parser_USE_CONST_TOKEN 0
+/* yes enum is more compatible with flex,  */
+/* so by default we use it */ 
+#endif
+#if YY_cl_ucsim_parser_USE_CONST_TOKEN != 0
+#ifndef YY_cl_ucsim_parser_ENUM_TOKEN
+#define YY_cl_ucsim_parser_ENUM_TOKEN yy_cl_ucsim_parser_enum_token
+#endif
+#endif
+
+class YY_cl_ucsim_parser_CLASS YY_cl_ucsim_parser_INHERIT
+{
+public: 
+#if YY_cl_ucsim_parser_USE_CONST_TOKEN != 0
+/* static const int token ... */
+
+ #line 307 "/usr/share/bison++/bison.cc"
+static const int PTOK_PLUS;
+static const int PTOK_MINUS;
+static const int PTOK_ASTERIX;
+static const int PTOK_SLASH;
+static const int PTOK_EQUAL;
+static const int PTOK_LEFT_PAREN;
+static const int PTOK_RIGHT_PAREN;
+static const int PTOK_LEFT_BRACKET;
+static const int PTOK_RIGHT_BRACKET;
+static const int PTOK_DOT;
+static const int PTOK_AMPERSAND;
+static const int PTOK_MEMORY_OBJECT;
+static const int PTOK_MEMORY;
+static const int PTOK_NUMBER;
+static const int PTOK_BIT;
+static const int UNARYMINUS;
+
+
+#line 307 "/usr/share/bison++/bison.cc"
+ /* decl const */
+#else
+enum YY_cl_ucsim_parser_ENUM_TOKEN { YY_cl_ucsim_parser_NULL_TOKEN=0
+
+ #line 310 "/usr/share/bison++/bison.cc"
+       ,PTOK_PLUS=258
+       ,PTOK_MINUS=259
+       ,PTOK_ASTERIX=260
+       ,PTOK_SLASH=261
+       ,PTOK_EQUAL=262
+       ,PTOK_LEFT_PAREN=263
+       ,PTOK_RIGHT_PAREN=264
+       ,PTOK_LEFT_BRACKET=265
+       ,PTOK_RIGHT_BRACKET=266
+       ,PTOK_DOT=267
+       ,PTOK_AMPERSAND=268
+       ,PTOK_MEMORY_OBJECT=269
+       ,PTOK_MEMORY=270
+       ,PTOK_NUMBER=271
+       ,PTOK_BIT=272
+       ,UNARYMINUS=273
+
+
+#line 310 "/usr/share/bison++/bison.cc"
+ /* enum token */
+     }; /* end of enum declaration */
+#endif
+public:
+ int YY_cl_ucsim_parser_PARSE (YY_cl_ucsim_parser_PARSE_PARAM);
+ virtual void YY_cl_ucsim_parser_ERROR(char *msg) YY_cl_ucsim_parser_ERROR_BODY;
+#ifdef YY_cl_ucsim_parser_PURE
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+ virtual int  YY_cl_ucsim_parser_LEX (YY_cl_ucsim_parser_STYPE *YY_cl_ucsim_parser_LVAL,YY_cl_ucsim_parser_LTYPE *YY_cl_ucsim_parser_LLOC) YY_cl_ucsim_parser_LEX_BODY;
+#else
+ virtual int  YY_cl_ucsim_parser_LEX (YY_cl_ucsim_parser_STYPE *YY_cl_ucsim_parser_LVAL) YY_cl_ucsim_parser_LEX_BODY;
+#endif
+#else
+ virtual int YY_cl_ucsim_parser_LEX() YY_cl_ucsim_parser_LEX_BODY;
+ YY_cl_ucsim_parser_STYPE YY_cl_ucsim_parser_LVAL;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+ YY_cl_ucsim_parser_LTYPE YY_cl_ucsim_parser_LLOC;
+#endif
+ int   YY_cl_ucsim_parser_NERRS;
+ int    YY_cl_ucsim_parser_CHAR;
+#endif
+#if YY_cl_ucsim_parser_DEBUG != 0
+ int YY_cl_ucsim_parser_DEBUG_FLAG;   /*  nonzero means print parse trace     */
+#endif
+public:
+ YY_cl_ucsim_parser_CLASS(YY_cl_ucsim_parser_CONSTRUCTOR_PARAM);
+public:
+ YY_cl_ucsim_parser_MEMBERS 
+};
+/* other declare folow */
+#if YY_cl_ucsim_parser_USE_CONST_TOKEN != 0
+
+ #line 341 "/usr/share/bison++/bison.cc"
+const int YY_cl_ucsim_parser_CLASS::PTOK_PLUS=258;
+const int YY_cl_ucsim_parser_CLASS::PTOK_MINUS=259;
+const int YY_cl_ucsim_parser_CLASS::PTOK_ASTERIX=260;
+const int YY_cl_ucsim_parser_CLASS::PTOK_SLASH=261;
+const int YY_cl_ucsim_parser_CLASS::PTOK_EQUAL=262;
+const int YY_cl_ucsim_parser_CLASS::PTOK_LEFT_PAREN=263;
+const int YY_cl_ucsim_parser_CLASS::PTOK_RIGHT_PAREN=264;
+const int YY_cl_ucsim_parser_CLASS::PTOK_LEFT_BRACKET=265;
+const int YY_cl_ucsim_parser_CLASS::PTOK_RIGHT_BRACKET=266;
+const int YY_cl_ucsim_parser_CLASS::PTOK_DOT=267;
+const int YY_cl_ucsim_parser_CLASS::PTOK_AMPERSAND=268;
+const int YY_cl_ucsim_parser_CLASS::PTOK_MEMORY_OBJECT=269;
+const int YY_cl_ucsim_parser_CLASS::PTOK_MEMORY=270;
+const int YY_cl_ucsim_parser_CLASS::PTOK_NUMBER=271;
+const int YY_cl_ucsim_parser_CLASS::PTOK_BIT=272;
+const int YY_cl_ucsim_parser_CLASS::UNARYMINUS=273;
+
+
+#line 341 "/usr/share/bison++/bison.cc"
+ /* const YY_cl_ucsim_parser_CLASS::token */
+#endif
+/*apres const  */
+YY_cl_ucsim_parser_CLASS::YY_cl_ucsim_parser_CLASS(YY_cl_ucsim_parser_CONSTRUCTOR_PARAM) YY_cl_ucsim_parser_CONSTRUCTOR_INIT
+{
+#if YY_cl_ucsim_parser_DEBUG != 0
+YY_cl_ucsim_parser_DEBUG_FLAG=0;
+#endif
+YY_cl_ucsim_parser_CONSTRUCTOR_CODE;
+};
+#endif
+
+ #line 352 "/usr/share/bison++/bison.cc"
+
+
+#define        YYFINAL         37
+#define        YYFLAG          -32768
+#define        YYNTBASE        19
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 273 ? yytranslate[x] : 25)
+
+static const char yytranslate[] = {     0,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
+     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
+    16,    17,    18
+};
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+static const short yyprhs[] = {     0,
+     0,     2,     6,    10,    12,    16,    20,    24,    28,    31,
+    33,    37,    39,    41,    43,    46,    49,    51,    56,    58
+};
+
+static const short yyrhs[] = {    21,
+     0,    23,     7,    21,     0,    24,     7,    21,     0,    20,
+     0,    21,     3,    21,     0,    21,     4,    21,     0,    21,
+     5,    21,     0,    21,     6,    21,     0,     4,    21,     0,
+    22,     0,     8,    21,     9,     0,    16,     0,    23,     0,
+    24,     0,    13,    23,     0,    13,    24,     0,    15,     0,
+    14,    10,    21,    11,     0,    17,     0,    23,    12,    21,
+     0
+};
+
+#endif
+
+#if (YY_cl_ucsim_parser_DEBUG != 0) || defined(YY_cl_ucsim_parser_ERROR_VERBOSE) 
+static const short yyrline[] = { 0,
+    59,    63,    69,    86,    88,    89,    90,    91,    98,    99,
+   100,   101,   102,   103,   106,   108,   119,   121,   127,   129
+};
+
+static const char * const yytname[] = {   "$","error","$illegal.","PTOK_PLUS",
+"PTOK_MINUS","PTOK_ASTERIX","PTOK_SLASH","PTOK_EQUAL","PTOK_LEFT_PAREN","PTOK_RIGHT_PAREN",
+"PTOK_LEFT_BRACKET","PTOK_RIGHT_BRACKET","PTOK_DOT","PTOK_AMPERSAND","PTOK_MEMORY_OBJECT",
+"PTOK_MEMORY","PTOK_NUMBER","PTOK_BIT","UNARYMINUS","ucsim_grammar","assignment",
+"expression","address_of_expression","memory","bit",""
+};
+#endif
+
+static const short yyr1[] = {     0,
+    19,    20,    20,    21,    21,    21,    21,    21,    21,    21,
+    21,    21,    21,    21,    22,    22,    23,    23,    24,    24
+};
+
+static const short yyr2[] = {     0,
+     1,     3,     3,     1,     3,     3,     3,     3,     2,     1,
+     3,     1,     1,     1,     2,     2,     1,     4,     1,     3
+};
+
+static const short yydefact[] = {     0,
+     0,     0,     0,     0,    17,    12,    19,     4,     1,    10,
+    13,    14,     9,     0,    15,    16,     0,     0,     0,     0,
+     0,     0,     0,     0,    11,     0,     5,     6,     7,     8,
+     2,    20,     3,    18,     0,     0,     0
+};
+
+static const short yydefgoto[] = {    35,
+     8,     9,    10,    11,    12
+};
+
+static const short yypact[] = {    -2,
+    -2,    -2,   -10,    23,-32768,-32768,-32768,-32768,    32,-32768,
+    -4,    33,-32768,    25,    27,-32768,    -2,    -2,    -2,    -2,
+    -2,    -2,    -2,    -2,-32768,    21,     4,     4,-32768,-32768,
+    32,    32,    32,-32768,    41,    42,-32768
+};
+
+static const short yypgoto[] = {-32768,
+-32768,    -1,-32768,    40,    43
+};
+
+
+#define        YYLAST          46
+
+
+static const short yytable[] = {    13,
+    14,     1,    22,     4,     5,     2,     7,    23,    20,    21,
+     3,     4,     5,     6,     7,    26,    27,    28,    29,    30,
+    31,    32,    33,    18,    19,    20,    21,    18,    19,    20,
+    21,    34,    17,    25,    18,    19,    20,    21,    23,    24,
+    36,    37,    15,     0,     0,    16
+};
+
+static const short yycheck[] = {     1,
+     2,     4,     7,    14,    15,     8,    17,    12,     5,     6,
+    13,    14,    15,    16,    17,    17,    18,    19,    20,    21,
+    22,    23,    24,     3,     4,     5,     6,     3,     4,     5,
+     6,    11,    10,     9,     3,     4,     5,     6,    12,     7,
+     0,     0,     3,    -1,    -1,     3
+};
+
+#line 352 "/usr/share/bison++/bison.cc"
+ /* fattrs + tables */
+
+/* parser code folow  */
+
+
+/* This is the parser code that is written into each bison parser
+  when the %semantic_parser declaration is not specified in the grammar.
+  It was written by Richard Stallman by simplifying the hairy parser
+  used when %semantic_parser is specified.  */
+
+/* Note: dollar marks section change
+   the next  is replaced by the list of actions, each action
+   as one case of the switch.  */ 
+
+#if YY_cl_ucsim_parser_USE_GOTO != 0
+/* 
+ SUPRESSION OF GOTO : on some C++ compiler (sun c++)
+  the goto is strictly forbidden if any constructor/destructor
+  is used in the whole function (very stupid isn't it ?)
+ so goto are to be replaced with a 'while/switch/case construct'
+ here are the macro to keep some apparent compatibility
+*/
+#define YYGOTO(lb) {yy_gotostate=lb;continue;}
+#define YYBEGINGOTO  enum yy_labels yy_gotostate=yygotostart; \
+                     for(;;) switch(yy_gotostate) { case yygotostart: {
+#define YYLABEL(lb) } case lb: {
+#define YYENDGOTO } } 
+#define YYBEGINDECLARELABEL enum yy_labels {yygotostart
+#define YYDECLARELABEL(lb) ,lb
+#define YYENDDECLARELABEL  };
+#else
+/* macro to keep goto */
+#define YYGOTO(lb) goto lb
+#define YYBEGINGOTO 
+#define YYLABEL(lb) lb:
+#define YYENDGOTO
+#define YYBEGINDECLARELABEL 
+#define YYDECLARELABEL(lb)
+#define YYENDDECLARELABEL 
+#endif
+/* LABEL DECLARATION */
+YYBEGINDECLARELABEL
+  YYDECLARELABEL(yynewstate)
+  YYDECLARELABEL(yybackup)
+/* YYDECLARELABEL(yyresume) */
+  YYDECLARELABEL(yydefault)
+  YYDECLARELABEL(yyreduce)
+  YYDECLARELABEL(yyerrlab)   /* here on detecting error */
+  YYDECLARELABEL(yyerrlab1)   /* here on error raised explicitly by an action */
+  YYDECLARELABEL(yyerrdefault)  /* current state does not do anything special for the error token. */
+  YYDECLARELABEL(yyerrpop)   /* pop the current state because it cannot handle the error token */
+  YYDECLARELABEL(yyerrhandle)  
+YYENDDECLARELABEL
+/* ALLOCA SIMULATION */
+/* __HAVE_NO_ALLOCA */
+#ifdef __HAVE_NO_ALLOCA
+int __alloca_free_ptr(char *ptr,char *ref)
+{if(ptr!=ref) free(ptr);
+ return 0;}
+
+#define __ALLOCA_alloca(size) malloc(size)
+#define __ALLOCA_free(ptr,ref) __alloca_free_ptr((char *)ptr,(char *)ref)
+
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+#define __ALLOCA_return(num) \
+            do { return( __ALLOCA_free(yyss,yyssa)+\
+                   __ALLOCA_free(yyvs,yyvsa)+\
+                   __ALLOCA_free(yyls,yylsa)+\
+                  (num)); } while(0)
+#else
+#define __ALLOCA_return(num) \
+            do { return( __ALLOCA_free(yyss,yyssa)+\
+                   __ALLOCA_free(yyvs,yyvsa)+\
+                  (num)); } while(0)
+#endif
+#else
+#define __ALLOCA_return(num) do { return(num); } while(0)
+#define __ALLOCA_alloca(size) alloca(size)
+#define __ALLOCA_free(ptr,ref) 
+#endif
+
+/* ENDALLOCA SIMULATION */
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (YY_cl_ucsim_parser_CHAR = YYEMPTY)
+#define YYEMPTY         -2
+#define YYEOF           0
+#define YYACCEPT        __ALLOCA_return(0)
+#define YYABORT         __ALLOCA_return(1)
+#define YYERROR         YYGOTO(yyerrlab1)
+/* Like YYERROR except do call yyerror.
+   This remains here temporarily to ease the
+   transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  */
+#define YYFAIL          YYGOTO(yyerrlab)
+#define YYRECOVERING()  (!!yyerrstatus)
+#define YYBACKUP(token, value) \
+do                                                              \
+  if (YY_cl_ucsim_parser_CHAR == YYEMPTY && yylen == 1)                               \
+    { YY_cl_ucsim_parser_CHAR = (token), YY_cl_ucsim_parser_LVAL = (value);                 \
+      yychar1 = YYTRANSLATE (YY_cl_ucsim_parser_CHAR);                                \
+      YYPOPSTACK;                                               \
+      YYGOTO(yybackup);                                            \
+    }                                                           \
+  else                                                          \
+    { YY_cl_ucsim_parser_ERROR ("syntax error: cannot back up"); YYERROR; }   \
+while (0)
+
+#define YYTERROR        1
+#define YYERRCODE       256
+
+#ifndef YY_cl_ucsim_parser_PURE
+/* UNPURE */
+#define YYLEX           YY_cl_ucsim_parser_LEX()
+#ifndef YY_USE_CLASS
+/* If nonreentrant, and not class , generate the variables here */
+int     YY_cl_ucsim_parser_CHAR;                      /*  the lookahead symbol        */
+YY_cl_ucsim_parser_STYPE      YY_cl_ucsim_parser_LVAL;              /*  the semantic value of the */
+                               /*  lookahead symbol    */
+int YY_cl_ucsim_parser_NERRS;                 /*  number of parse errors so far */
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+YY_cl_ucsim_parser_LTYPE YY_cl_ucsim_parser_LLOC;   /*  location data for the lookahead     */
+                       /*  symbol                              */
+#endif
+#endif
+
+
+#else
+/* PURE */
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+#define YYLEX           YY_cl_ucsim_parser_LEX(&YY_cl_ucsim_parser_LVAL, &YY_cl_ucsim_parser_LLOC)
+#else
+#define YYLEX           YY_cl_ucsim_parser_LEX(&YY_cl_ucsim_parser_LVAL)
+#endif
+#endif
+#ifndef YY_USE_CLASS
+#if YY_cl_ucsim_parser_DEBUG != 0
+int YY_cl_ucsim_parser_DEBUG_FLAG;                    /*  nonzero means print parse trace     */
+/* Since this is uninitialized, it does not stop multiple parsers
+   from coexisting.  */
+#endif
+#endif
+
+
+
+/*  YYINITDEPTH indicates the initial size of the parser's stacks       */
+
+#ifndef YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/*  YYMAXDEPTH is the maximum size the stacks can grow to
+    (effective only if the built-in stack extension method is used).  */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+
+
+#if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
+#define __yy_bcopy(FROM,TO,COUNT)       __builtin_memcpy(TO,FROM,COUNT)
+#else                           /* not GNU C or C++ */
+
+/* This is the most reliable way to avoid incompatibilities
+   in available built-in functions on various systems.  */
+
+#ifdef __cplusplus
+static void __yy_bcopy (char *from, char *to, int count)
+#else
+#ifdef __STDC__
+static void __yy_bcopy (char *from, char *to, int count)
+#else
+static void __yy_bcopy (from, to, count)
+     char *from;
+     char *to;
+     int count;
+#endif
+#endif
+{
+  register char *f = from;
+  register char *t = to;
+  register int i = count;
+
+  while (i-- > 0)
+    *t++ = *f++;
+}
+#endif
+
+
+int
+#ifdef YY_USE_CLASS
+ YY_cl_ucsim_parser_CLASS::
+#endif
+     YY_cl_ucsim_parser_PARSE(YY_cl_ucsim_parser_PARSE_PARAM)
+#ifndef __STDC__
+#ifndef __cplusplus
+#ifndef YY_USE_CLASS
+/* parameter definition without protypes */
+YY_cl_ucsim_parser_PARSE_PARAM_DEF
+#endif
+#endif
+#endif
+{
+  register int yystate;
+  register int yyn;
+  register short *yyssp;
+  register YY_cl_ucsim_parser_STYPE *yyvsp;
+  int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
+  int yychar1=0;          /*  lookahead token as an internal (translated) token number */
+
+  short yyssa[YYINITDEPTH];     /*  the state stack                     */
+  YY_cl_ucsim_parser_STYPE yyvsa[YYINITDEPTH];        /*  the semantic value stack            */
+
+  short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
+  YY_cl_ucsim_parser_STYPE *yyvs = yyvsa;     /*  to allow yyoverflow to reallocate them elsewhere */
+
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+  YY_cl_ucsim_parser_LTYPE yylsa[YYINITDEPTH];        /*  the location stack                  */
+  YY_cl_ucsim_parser_LTYPE *yyls = yylsa;
+  YY_cl_ucsim_parser_LTYPE *yylsp;
+
+#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
+#else
+#define YYPOPSTACK   (yyvsp--, yyssp--)
+#endif
+
+  int yystacksize = YYINITDEPTH;
+
+#ifdef YY_cl_ucsim_parser_PURE
+  int YY_cl_ucsim_parser_CHAR;
+  YY_cl_ucsim_parser_STYPE YY_cl_ucsim_parser_LVAL;
+  int YY_cl_ucsim_parser_NERRS;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+  YY_cl_ucsim_parser_LTYPE YY_cl_ucsim_parser_LLOC;
+#endif
+#endif
+
+  YY_cl_ucsim_parser_STYPE yyval;             /*  the variable used to return         */
+                               /*  semantic values from the action     */
+                               /*  routines                            */
+
+  int yylen;
+/* start loop, in which YYGOTO may be used. */
+YYBEGINGOTO
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+  if (YY_cl_ucsim_parser_DEBUG_FLAG)
+    fprintf(stderr, "Starting parse\n");
+#endif
+  yystate = 0;
+  yyerrstatus = 0;
+  YY_cl_ucsim_parser_NERRS = 0;
+  YY_cl_ucsim_parser_CHAR = YYEMPTY;          /* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+
+  yyssp = yyss - 1;
+  yyvsp = yyvs;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+  yylsp = yyls;
+#endif
+
+/* Push a new state, which is found in  yystate  .  */
+/* In all cases, when you get here, the value and location stacks
+   have just been pushed. so pushing a state here evens the stacks.  */
+YYLABEL(yynewstate)
+
+  *++yyssp = yystate;
+
+  if (yyssp >= yyss + yystacksize - 1)
+    {
+      /* Give user a chance to reallocate the stack */
+      /* Use copies of these so that the &'s don't force the real ones into memory. */
+      YY_cl_ucsim_parser_STYPE *yyvs1 = yyvs;
+      short *yyss1 = yyss;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+      YY_cl_ucsim_parser_LTYPE *yyls1 = yyls;
+#endif
+
+      /* Get the current used size of the three stacks, in elements.  */
+      int size = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      /* Each stack pointer address is followed by the size of
+        the data in use in that stack, in bytes.  */
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+      /* This used to be a conditional around just the two extra args,
+        but that might be undefined if yyoverflow is a macro.  */
+      yyoverflow("parser stack overflow",
+                &yyss1, size * sizeof (*yyssp),
+                &yyvs1, size * sizeof (*yyvsp),
+                &yyls1, size * sizeof (*yylsp),
+                &yystacksize);
+#else
+      yyoverflow("parser stack overflow",
+                &yyss1, size * sizeof (*yyssp),
+                &yyvs1, size * sizeof (*yyvsp),
+                &yystacksize);
+#endif
+
+      yyss = yyss1; yyvs = yyvs1;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+      yyls = yyls1;
+#endif
+#else /* no yyoverflow */
+      /* Extend the stack our own way.  */
+      if (yystacksize >= YYMAXDEPTH)
+       {
+         YY_cl_ucsim_parser_ERROR("parser stack overflow");
+         __ALLOCA_return(2);
+       }
+      yystacksize *= 2;
+      if (yystacksize > YYMAXDEPTH)
+       yystacksize = YYMAXDEPTH;
+      yyss = (short *) __ALLOCA_alloca (yystacksize * sizeof (*yyssp));
+      __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
+      __ALLOCA_free(yyss1,yyssa);
+      yyvs = (YY_cl_ucsim_parser_STYPE *) __ALLOCA_alloca (yystacksize * sizeof (*yyvsp));
+      __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
+      __ALLOCA_free(yyvs1,yyvsa);
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+      yyls = (YY_cl_ucsim_parser_LTYPE *) __ALLOCA_alloca (yystacksize * sizeof (*yylsp));
+      __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
+      __ALLOCA_free(yyls1,yylsa);
+#endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + size - 1;
+      yyvsp = yyvs + size - 1;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+      yylsp = yyls + size - 1;
+#endif
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+      if (YY_cl_ucsim_parser_DEBUG_FLAG)
+       fprintf(stderr, "Stack size increased to %d\n", yystacksize);
+#endif
+
+      if (yyssp >= yyss + yystacksize - 1)
+       YYABORT;
+    }
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+  if (YY_cl_ucsim_parser_DEBUG_FLAG)
+    fprintf(stderr, "Entering state %d\n", yystate);
+#endif
+
+  YYGOTO(yybackup);
+YYLABEL(yybackup)
+
+/* Do appropriate processing given the current state.  */
+/* Read a lookahead token if we need one and don't already have one.  */
+/* YYLABEL(yyresume) */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+
+  yyn = yypact[yystate];
+  if (yyn == YYFLAG)
+    YYGOTO(yydefault);
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* yychar is either YYEMPTY or YYEOF
+     or a valid token in external form.  */
+
+  if (YY_cl_ucsim_parser_CHAR == YYEMPTY)
+    {
+#if YY_cl_ucsim_parser_DEBUG != 0
+      if (YY_cl_ucsim_parser_DEBUG_FLAG)
+       fprintf(stderr, "Reading a token: ");
+#endif
+      YY_cl_ucsim_parser_CHAR = YYLEX;
+    }
+
+  /* Convert token to internal form (in yychar1) for indexing tables with */
+
+  if (YY_cl_ucsim_parser_CHAR <= 0)           /* This means end of input. */
+    {
+      yychar1 = 0;
+      YY_cl_ucsim_parser_CHAR = YYEOF;                /* Don't call YYLEX any more */
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+      if (YY_cl_ucsim_parser_DEBUG_FLAG)
+       fprintf(stderr, "Now at end of input.\n");
+#endif
+    }
+  else
+    {
+      yychar1 = YYTRANSLATE(YY_cl_ucsim_parser_CHAR);
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+      if (YY_cl_ucsim_parser_DEBUG_FLAG)
+       {
+         fprintf (stderr, "Next token is %d (%s", YY_cl_ucsim_parser_CHAR, yytname[yychar1]);
+         /* Give the individual parser a way to print the precise meaning
+            of a token, for further debugging info.  */
+#ifdef YYPRINT
+         YYPRINT (stderr, YY_cl_ucsim_parser_CHAR, YY_cl_ucsim_parser_LVAL);
+#endif
+         fprintf (stderr, ")\n");
+       }
+#endif
+    }
+
+  yyn += yychar1;
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+    YYGOTO(yydefault);
+
+  yyn = yytable[yyn];
+
+  /* yyn is what to do for this token type in this state.
+     Negative => reduce, -yyn is rule number.
+     Positive => shift, yyn is new state.
+       New state is final state => don't bother to shift,
+       just return success.
+     0, or most negative number => error.  */
+
+  if (yyn < 0)
+    {
+      if (yyn == YYFLAG)
+       YYGOTO(yyerrlab);
+      yyn = -yyn;
+      YYGOTO(yyreduce);
+    }
+  else if (yyn == 0)
+    YYGOTO(yyerrlab);
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  /* Shift the lookahead token.  */
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+  if (YY_cl_ucsim_parser_DEBUG_FLAG)
+    fprintf(stderr, "Shifting token %d (%s), ", YY_cl_ucsim_parser_CHAR, yytname[yychar1]);
+#endif
+
+  /* Discard the token being shifted unless it is eof.  */
+  if (YY_cl_ucsim_parser_CHAR != YYEOF)
+    YY_cl_ucsim_parser_CHAR = YYEMPTY;
+
+  *++yyvsp = YY_cl_ucsim_parser_LVAL;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+  *++yylsp = YY_cl_ucsim_parser_LLOC;
+#endif
+
+  /* count tokens shifted since error; after three, turn off error status.  */
+  if (yyerrstatus) yyerrstatus--;
+
+  yystate = yyn;
+  YYGOTO(yynewstate);
+
+/* Do the default action for the current state.  */
+YYLABEL(yydefault)
+
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    YYGOTO(yyerrlab);
+
+/* Do a reduction.  yyn is the number of a rule to reduce with.  */
+YYLABEL(yyreduce)
+  yylen = yyr2[yyn];
+  if (yylen > 0)
+    yyval = yyvsp[1-yylen]; /* implement default value of the action */
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+  if (YY_cl_ucsim_parser_DEBUG_FLAG)
+    {
+      int i;
+
+      fprintf (stderr, "Reducing via rule %d (line %d), ",
+              yyn, yyrline[yyn]);
+
+      /* Print the symbols being reduced, and their result.  */
+      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
+       fprintf (stderr, "%s ", yytname[yyrhs[i]]);
+      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+    }
+#endif
+
+
+ #line 839 "/usr/share/bison++/bison.cc"
+
+  switch (yyn) {
+
+case 1:
+#line 60 "cmdpars.y"
+{ application->dd_printf("%d\n", yyvsp[0].number); ;
+    break;}
+case 2:
+#line 65 "cmdpars.y"
+{
+           yyvsp[-2].memory.memory->write(yyvsp[-2].memory.address, yyvsp[0].number);
+           yyval.number= yyvsp[0].number;
+         ;
+    break;}
+case 3:
+#line 70 "cmdpars.y"
+{
+           if (yyvsp[0].number)
+             {
+               yyvsp[-2].bit.memory->write(yyvsp[-2].bit.mem_address,
+                                yyvsp[-2].bit.memory->read(yyvsp[-2].bit.mem_address) | yyvsp[-2].bit.mask);
+               yyval.number= 1;
+             }
+           else
+             {
+               yyvsp[-2].bit.memory->write(yyvsp[-2].bit.mem_address,
+                                yyvsp[-2].bit.memory->read(yyvsp[-2].bit.mem_address) & ~(yyvsp[-2].bit.mask));
+               yyval.number= 0;
+             }
+         ;
+    break;}
+case 4:
+#line 87 "cmdpars.y"
+{ yyval.number= yyvsp[0].number; ;
+    break;}
+case 5:
+#line 88 "cmdpars.y"
+{ yyval.number= yyvsp[-2].number + yyvsp[0].number; ;
+    break;}
+case 6:
+#line 89 "cmdpars.y"
+{ yyval.number= yyvsp[-2].number - yyvsp[0].number; ;
+    break;}
+case 7:
+#line 90 "cmdpars.y"
+{ yyval.number= yyvsp[-2].number * yyvsp[0].number; ;
+    break;}
+case 8:
+#line 92 "cmdpars.y"
+{
+           if (yyvsp[0].number == 0)
+             yyerror("Divide by zero");
+           else
+             yyval.number= yyvsp[-2].number / yyvsp[0].number;
+         ;
+    break;}
+case 9:
+#line 98 "cmdpars.y"
+{ yyval.number= -yyvsp[0].number; ;
+    break;}
+case 10:
+#line 99 "cmdpars.y"
+{ yyval.number= yyvsp[0].number; ;
+    break;}
+case 11:
+#line 100 "cmdpars.y"
+{ yyval.number= yyvsp[-1].number; ;
+    break;}
+case 12:
+#line 101 "cmdpars.y"
+{ yyval.number= yyvsp[0].number; ;
+    break;}
+case 13:
+#line 102 "cmdpars.y"
+{ yyval.number= yyvsp[0].memory.memory->read(yyvsp[0].memory.address); ;
+    break;}
+case 14:
+#line 103 "cmdpars.y"
+{ yyval.number= (yyvsp[0].bit.memory->read(yyvsp[0].bit.mem_address) & yyvsp[0].bit.mask)?1:0; ;
+    break;}
+case 15:
+#line 107 "cmdpars.y"
+{ yyval.number= yyvsp[0].memory.address; ;
+    break;}
+case 16:
+#line 109 "cmdpars.y"
+{
+         yyval.number= yyvsp[0].bit.bit_address;
+         if (yyval.number < 0)
+           {
+             yyerror("Bit has no address.");
+             yyval.number= 0;
+           }
+       ;
+    break;}
+case 18:
+#line 122 "cmdpars.y"
+{
+           yyval.memory.memory= yyvsp[-3].memory_object;
+           yyval.memory.address= yyvsp[-1].number;
+         ;
+    break;}
+case 20:
+#line 130 "cmdpars.y"
+{
+           yyval.bit.memory= yyvsp[-2].memory.memory;
+           yyval.bit.mem_address= yyvsp[-2].memory.address;
+           yyval.bit.mask= 1 << yyvsp[0].number;
+           yyval.bit.bit_address= -1;
+           class cl_uc *uc= application->get_uc();
+           if (uc)
+             yyval.bit.bit_address= uc->bit_address(yyvsp[-2].memory.memory, yyvsp[-2].memory.address, yyvsp[0].number);
+         ;
+    break;}
+}
+
+#line 839 "/usr/share/bison++/bison.cc"
+   /* the action file gets copied in in place of this dollarsign  */
+  yyvsp -= yylen;
+  yyssp -= yylen;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+  yylsp -= yylen;
+#endif
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+  if (YY_cl_ucsim_parser_DEBUG_FLAG)
+    {
+      short *ssp1 = yyss - 1;
+      fprintf (stderr, "state stack now");
+      while (ssp1 != yyssp)
+       fprintf (stderr, " %d", *++ssp1);
+      fprintf (stderr, "\n");
+    }
+#endif
+
+  *++yyvsp = yyval;
+
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+  yylsp++;
+  if (yylen == 0)
+    {
+      yylsp->first_line = YY_cl_ucsim_parser_LLOC.first_line;
+      yylsp->first_column = YY_cl_ucsim_parser_LLOC.first_column;
+      yylsp->last_line = (yylsp-1)->last_line;
+      yylsp->last_column = (yylsp-1)->last_column;
+      yylsp->text = 0;
+    }
+  else
+    {
+      yylsp->last_line = (yylsp+yylen-1)->last_line;
+      yylsp->last_column = (yylsp+yylen-1)->last_column;
+    }
+#endif
+
+  /* Now "shift" the result of the reduction.
+     Determine what state that goes to,
+     based on the state we popped back to
+     and the rule number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTBASE];
+
+  YYGOTO(yynewstate);
+
+YYLABEL(yyerrlab)   /* here on detecting error */
+
+  if (! yyerrstatus)
+    /* If not already recovering from an error, report this error.  */
+    {
+      ++YY_cl_ucsim_parser_NERRS;
+
+#ifdef YY_cl_ucsim_parser_ERROR_VERBOSE
+      yyn = yypact[yystate];
+
+      if (yyn > YYFLAG && yyn < YYLAST)
+       {
+         int size = 0;
+         char *msg;
+         int x, count;
+
+         count = 0;
+         /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
+         for (x = (yyn < 0 ? -yyn : 0);
+              x < (sizeof(yytname) / sizeof(char *)); x++)
+           if (yycheck[x + yyn] == x)
+             size += strlen(yytname[x]) + 15, count++;
+         msg = (char *) malloc(size + 15);
+         if (msg != 0)
+           {
+             strcpy(msg, "parse error");
+
+             if (count < 5)
+               {
+                 count = 0;
+                 for (x = (yyn < 0 ? -yyn : 0);
+                      x < (sizeof(yytname) / sizeof(char *)); x++)
+                   if (yycheck[x + yyn] == x)
+                     {
+                       strcat(msg, count == 0 ? ", expecting `" : " or `");
+                       strcat(msg, yytname[x]);
+                       strcat(msg, "'");
+                       count++;
+                     }
+               }
+             YY_cl_ucsim_parser_ERROR(msg);
+             free(msg);
+           }
+         else
+           YY_cl_ucsim_parser_ERROR ("parse error; also virtual memory exceeded");
+       }
+      else
+#endif /* YY_cl_ucsim_parser_ERROR_VERBOSE */
+       YY_cl_ucsim_parser_ERROR("parse error");
+    }
+
+  YYGOTO(yyerrlab1);
+YYLABEL(yyerrlab1)   /* here on error raised explicitly by an action */
+
+  if (yyerrstatus == 3)
+    {
+      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
+
+      /* return failure if at end of input */
+      if (YY_cl_ucsim_parser_CHAR == YYEOF)
+       YYABORT;
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+      if (YY_cl_ucsim_parser_DEBUG_FLAG)
+       fprintf(stderr, "Discarding token %d (%s).\n", YY_cl_ucsim_parser_CHAR, yytname[yychar1]);
+#endif
+
+      YY_cl_ucsim_parser_CHAR = YYEMPTY;
+    }
+
+  /* Else will try to reuse lookahead token
+     after shifting the error token.  */
+
+  yyerrstatus = 3;              /* Each real token shifted decrements this */
+
+  YYGOTO(yyerrhandle);
+
+YYLABEL(yyerrdefault)  /* current state does not do anything special for the error token. */
+
+#if 0
+  /* This is wrong; only states that explicitly want error tokens
+     should shift them.  */
+  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
+  if (yyn) YYGOTO(yydefault);
+#endif
+
+YYLABEL(yyerrpop)   /* pop the current state because it cannot handle the error token */
+
+  if (yyssp == yyss) YYABORT;
+  yyvsp--;
+  yystate = *--yyssp;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+  yylsp--;
+#endif
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+  if (YY_cl_ucsim_parser_DEBUG_FLAG)
+    {
+      short *ssp1 = yyss - 1;
+      fprintf (stderr, "Error: state stack now");
+      while (ssp1 != yyssp)
+       fprintf (stderr, " %d", *++ssp1);
+      fprintf (stderr, "\n");
+    }
+#endif
+
+YYLABEL(yyerrhandle)
+
+  yyn = yypact[yystate];
+  if (yyn == YYFLAG)
+    YYGOTO(yyerrdefault);
+
+  yyn += YYTERROR;
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+    YYGOTO(yyerrdefault);
+
+  yyn = yytable[yyn];
+  if (yyn < 0)
+    {
+      if (yyn == YYFLAG)
+       YYGOTO(yyerrpop);
+      yyn = -yyn;
+      YYGOTO(yyreduce);
+    }
+  else if (yyn == 0)
+    YYGOTO(yyerrpop);
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+#if YY_cl_ucsim_parser_DEBUG != 0
+  if (YY_cl_ucsim_parser_DEBUG_FLAG)
+    fprintf(stderr, "Shifting error token, ");
+#endif
+
+  *++yyvsp = YY_cl_ucsim_parser_LVAL;
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+  *++yylsp = YY_cl_ucsim_parser_LLOC;
+#endif
+
+  yystate = yyn;
+  YYGOTO(yynewstate);
+/* end loop, in which YYGOTO may be used. */
+  YYENDGOTO
+}
+
+/* END */
+
+ #line 1038 "/usr/share/bison++/bison.cc"
+#line 141 "cmdpars.y"
+
+
+int
+YY_cl_ucsim_parser_CLASS::yylex(YY_cl_ucsim_parser_STYPE *yylval)
+{
+  lexer_object->activate_lexer_to_parse_into(yylval);
+  return(lexer_object->yylex());
+}
+
+void
+YY_cl_ucsim_parser_CLASS::yyerror(char *msg)
+{
+  application->dd_printf("Parser error: %s\n", msg);
+}
diff --git a/sim/ucsim/cmd.src/cmdpars.h b/sim/ucsim/cmd.src/cmdpars.h
new file mode 100644 (file)
index 0000000..20ca525
--- /dev/null
@@ -0,0 +1,369 @@
+#ifndef YY_cl_ucsim_parser_h_included
+#define YY_cl_ucsim_parser_h_included
+#define YY_USE_CLASS
+
+#line 1 "/usr/share/bison++/bison.h"
+/* before anything */
+#ifdef c_plusplus
+ #ifndef __cplusplus
+  #define __cplusplus
+ #endif
+#endif
+
+
+ #line 8 "/usr/share/bison++/bison.h"
+#define YY_cl_ucsim_parser_INHERIT  : public cl_base
+#define YY_cl_ucsim_parser_MEMBERS  class cl_ucsim_lexer *lexer_object;\
+virtual ~YY_cl_ucsim_parser_CLASS(void) { delete lexer_object; }
+#define YY_cl_ucsim_parser_CONSTRUCTOR_PARAM  \
+class cl_ucsim_lexer *the_lexer
+#define YY_cl_ucsim_parser_CONSTRUCTOR_CODE  \
+lexer_object= the_lexer;
+
+#line 43 "cmdpars.y"
+typedef union {
+  long number;
+  class cl_memory *memory_object;
+  struct {
+    class cl_memory *memory;
+    long address;
+  } memory;
+  struct {
+    class cl_memory *memory;
+    long mem_address, bit_address;
+    long mask;
+  } bit;
+} yy_cl_ucsim_parser_stype;
+#define YY_cl_ucsim_parser_STYPE yy_cl_ucsim_parser_stype
+
+#line 21 "/usr/share/bison++/bison.h"
+ /* %{ and %header{ and %union, during decl */
+#ifndef YY_cl_ucsim_parser_COMPATIBILITY
+ #ifndef YY_USE_CLASS
+  #define  YY_cl_ucsim_parser_COMPATIBILITY 1
+ #else
+  #define  YY_cl_ucsim_parser_COMPATIBILITY 0
+ #endif
+#endif
+
+#if YY_cl_ucsim_parser_COMPATIBILITY != 0
+/* backward compatibility */
+ #ifdef YYLTYPE
+  #ifndef YY_cl_ucsim_parser_LTYPE
+   #define YY_cl_ucsim_parser_LTYPE YYLTYPE
+/* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */
+/* use %define LTYPE */
+  #endif
+ #endif
+/*#ifdef YYSTYPE*/
+  #ifndef YY_cl_ucsim_parser_STYPE
+   #define YY_cl_ucsim_parser_STYPE YYSTYPE
+  /* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */
+   /* use %define STYPE */
+  #endif
+/*#endif*/
+ #ifdef YYDEBUG
+  #ifndef YY_cl_ucsim_parser_DEBUG
+   #define  YY_cl_ucsim_parser_DEBUG YYDEBUG
+   /* WARNING obsolete !!! user defined YYDEBUG not reported into generated header */
+   /* use %define DEBUG */
+  #endif
+ #endif 
+ /* use goto to be compatible */
+ #ifndef YY_cl_ucsim_parser_USE_GOTO
+  #define YY_cl_ucsim_parser_USE_GOTO 1
+ #endif
+#endif
+
+/* use no goto to be clean in C++ */
+#ifndef YY_cl_ucsim_parser_USE_GOTO
+ #define YY_cl_ucsim_parser_USE_GOTO 0
+#endif
+
+#ifndef YY_cl_ucsim_parser_PURE
+
+ #line 65 "/usr/share/bison++/bison.h"
+#define YY_cl_ucsim_parser_PURE 1
+
+
+#line 65 "/usr/share/bison++/bison.h"
+/* YY_cl_ucsim_parser_PURE */
+#endif
+
+
+ #line 68 "/usr/share/bison++/bison.h"
+
+#line 68 "/usr/share/bison++/bison.h"
+/* prefix */
+
+#ifndef YY_cl_ucsim_parser_DEBUG
+
+ #line 71 "/usr/share/bison++/bison.h"
+
+#line 71 "/usr/share/bison++/bison.h"
+/* YY_cl_ucsim_parser_DEBUG */
+#endif
+
+#ifndef YY_cl_ucsim_parser_LSP_NEEDED
+
+ #line 75 "/usr/share/bison++/bison.h"
+
+#line 75 "/usr/share/bison++/bison.h"
+ /* YY_cl_ucsim_parser_LSP_NEEDED*/
+#endif
+
+/* DEFAULT LTYPE*/
+#ifdef YY_cl_ucsim_parser_LSP_NEEDED
+ #ifndef YY_cl_ucsim_parser_LTYPE
+  #ifndef BISON_YYLTYPE_ISDECLARED
+   #define BISON_YYLTYPE_ISDECLARED
+typedef
+  struct yyltype
+    {
+      int timestamp;
+      int first_line;
+      int first_column;
+      int last_line;
+      int last_column;
+      char *text;
+   }
+  yyltype;
+  #endif
+
+  #define YY_cl_ucsim_parser_LTYPE yyltype
+ #endif
+#endif
+
+/* DEFAULT STYPE*/
+#ifndef YY_cl_ucsim_parser_STYPE
+ #define YY_cl_ucsim_parser_STYPE int
+#endif
+
+/* DEFAULT MISCELANEOUS */
+#ifndef YY_cl_ucsim_parser_PARSE
+ #define YY_cl_ucsim_parser_PARSE yyparse
+#endif
+
+#ifndef YY_cl_ucsim_parser_LEX
+ #define YY_cl_ucsim_parser_LEX yylex
+#endif
+
+#ifndef YY_cl_ucsim_parser_LVAL
+ #define YY_cl_ucsim_parser_LVAL yylval
+#endif
+
+#ifndef YY_cl_ucsim_parser_LLOC
+ #define YY_cl_ucsim_parser_LLOC yylloc
+#endif
+
+#ifndef YY_cl_ucsim_parser_CHAR
+ #define YY_cl_ucsim_parser_CHAR yychar
+#endif
+
+#ifndef YY_cl_ucsim_parser_NERRS
+ #define YY_cl_ucsim_parser_NERRS yynerrs
+#endif
+
+#ifndef YY_cl_ucsim_parser_DEBUG_FLAG
+ #define YY_cl_ucsim_parser_DEBUG_FLAG yydebug
+#endif
+
+#ifndef YY_cl_ucsim_parser_ERROR
+ #define YY_cl_ucsim_parser_ERROR yyerror
+#endif
+
+#ifndef YY_cl_ucsim_parser_PARSE_PARAM
+ #ifndef __STDC__
+  #ifndef __cplusplus
+   #ifndef YY_USE_CLASS
+    #define YY_cl_ucsim_parser_PARSE_PARAM
+    #ifndef YY_cl_ucsim_parser_PARSE_PARAM_DEF
+     #define YY_cl_ucsim_parser_PARSE_PARAM_DEF
+    #endif
+   #endif
+  #endif
+ #endif
+ #ifndef YY_cl_ucsim_parser_PARSE_PARAM
+  #define YY_cl_ucsim_parser_PARSE_PARAM void
+ #endif
+#endif
+
+/* TOKEN C */
+#ifndef YY_USE_CLASS
+
+ #ifndef YY_cl_ucsim_parser_PURE
+  #ifndef yylval
+   extern YY_cl_ucsim_parser_STYPE YY_cl_ucsim_parser_LVAL;
+  #else
+   #if yylval != YY_cl_ucsim_parser_LVAL
+    extern YY_cl_ucsim_parser_STYPE YY_cl_ucsim_parser_LVAL;
+   #else
+    #warning "Namespace conflict, disabling some functionality (bison++ only)"
+   #endif
+  #endif
+ #endif
+
+
+ #line 169 "/usr/share/bison++/bison.h"
+#define        PTOK_PLUS       258
+#define        PTOK_MINUS      259
+#define        PTOK_ASTERIX    260
+#define        PTOK_SLASH      261
+#define        PTOK_EQUAL      262
+#define        PTOK_LEFT_PAREN 263
+#define        PTOK_RIGHT_PAREN        264
+#define        PTOK_LEFT_BRACKET       265
+#define        PTOK_RIGHT_BRACKET      266
+#define        PTOK_DOT        267
+#define        PTOK_AMPERSAND  268
+#define        PTOK_MEMORY_OBJECT      269
+#define        PTOK_MEMORY     270
+#define        PTOK_NUMBER     271
+#define        PTOK_BIT        272
+#define        UNARYMINUS      273
+
+
+#line 169 "/usr/share/bison++/bison.h"
+ /* #defines token */
+/* after #define tokens, before const tokens S5*/
+#else
+ #ifndef YY_cl_ucsim_parser_CLASS
+  #define YY_cl_ucsim_parser_CLASS cl_ucsim_parser
+ #endif
+
+ #ifndef YY_cl_ucsim_parser_INHERIT
+  #define YY_cl_ucsim_parser_INHERIT
+ #endif
+
+ #ifndef YY_cl_ucsim_parser_MEMBERS
+  #define YY_cl_ucsim_parser_MEMBERS 
+ #endif
+
+ #ifndef YY_cl_ucsim_parser_LEX_BODY
+  #define YY_cl_ucsim_parser_LEX_BODY  
+ #endif
+
+ #ifndef YY_cl_ucsim_parser_ERROR_BODY
+  #define YY_cl_ucsim_parser_ERROR_BODY  
+ #endif
+
+ #ifndef YY_cl_ucsim_parser_CONSTRUCTOR_PARAM
+  #define YY_cl_ucsim_parser_CONSTRUCTOR_PARAM
+ #endif
+ /* choose between enum and const */
+ #ifndef YY_cl_ucsim_parser_USE_CONST_TOKEN
+  #define YY_cl_ucsim_parser_USE_CONST_TOKEN 0
+  /* yes enum is more compatible with flex,  */
+  /* so by default we use it */ 
+ #endif
+ #if YY_cl_ucsim_parser_USE_CONST_TOKEN != 0
+  #ifndef YY_cl_ucsim_parser_ENUM_TOKEN
+   #define YY_cl_ucsim_parser_ENUM_TOKEN yy_cl_ucsim_parser_enum_token
+  #endif
+ #endif
+
+class YY_cl_ucsim_parser_CLASS YY_cl_ucsim_parser_INHERIT
+{
+public: 
+ #if YY_cl_ucsim_parser_USE_CONST_TOKEN != 0
+  /* static const int token ... */
+  
+ #line 212 "/usr/share/bison++/bison.h"
+static const int PTOK_PLUS;
+static const int PTOK_MINUS;
+static const int PTOK_ASTERIX;
+static const int PTOK_SLASH;
+static const int PTOK_EQUAL;
+static const int PTOK_LEFT_PAREN;
+static const int PTOK_RIGHT_PAREN;
+static const int PTOK_LEFT_BRACKET;
+static const int PTOK_RIGHT_BRACKET;
+static const int PTOK_DOT;
+static const int PTOK_AMPERSAND;
+static const int PTOK_MEMORY_OBJECT;
+static const int PTOK_MEMORY;
+static const int PTOK_NUMBER;
+static const int PTOK_BIT;
+static const int UNARYMINUS;
+
+
+#line 212 "/usr/share/bison++/bison.h"
+ /* decl const */
+ #else
+  enum YY_cl_ucsim_parser_ENUM_TOKEN { YY_cl_ucsim_parser_NULL_TOKEN=0
+  
+ #line 215 "/usr/share/bison++/bison.h"
+       ,PTOK_PLUS=258
+       ,PTOK_MINUS=259
+       ,PTOK_ASTERIX=260
+       ,PTOK_SLASH=261
+       ,PTOK_EQUAL=262
+       ,PTOK_LEFT_PAREN=263
+       ,PTOK_RIGHT_PAREN=264
+       ,PTOK_LEFT_BRACKET=265
+       ,PTOK_RIGHT_BRACKET=266
+       ,PTOK_DOT=267
+       ,PTOK_AMPERSAND=268
+       ,PTOK_MEMORY_OBJECT=269
+       ,PTOK_MEMORY=270
+       ,PTOK_NUMBER=271
+       ,PTOK_BIT=272
+       ,UNARYMINUS=273
+
+
+#line 215 "/usr/share/bison++/bison.h"
+ /* enum token */
+     }; /* end of enum declaration */
+ #endif
+public:
+ int YY_cl_ucsim_parser_PARSE(YY_cl_ucsim_parser_PARSE_PARAM);
+ virtual void YY_cl_ucsim_parser_ERROR(char *msg) YY_cl_ucsim_parser_ERROR_BODY;
+ #ifdef YY_cl_ucsim_parser_PURE
+  #ifdef YY_cl_ucsim_parser_LSP_NEEDED
+   virtual int  YY_cl_ucsim_parser_LEX(YY_cl_ucsim_parser_STYPE *YY_cl_ucsim_parser_LVAL,YY_cl_ucsim_parser_LTYPE *YY_cl_ucsim_parser_LLOC) YY_cl_ucsim_parser_LEX_BODY;
+  #else
+   virtual int  YY_cl_ucsim_parser_LEX(YY_cl_ucsim_parser_STYPE *YY_cl_ucsim_parser_LVAL) YY_cl_ucsim_parser_LEX_BODY;
+  #endif
+ #else
+  virtual int YY_cl_ucsim_parser_LEX() YY_cl_ucsim_parser_LEX_BODY;
+  YY_cl_ucsim_parser_STYPE YY_cl_ucsim_parser_LVAL;
+  #ifdef YY_cl_ucsim_parser_LSP_NEEDED
+   YY_cl_ucsim_parser_LTYPE YY_cl_ucsim_parser_LLOC;
+  #endif
+  int YY_cl_ucsim_parser_NERRS;
+  int YY_cl_ucsim_parser_CHAR;
+ #endif
+ #if YY_cl_ucsim_parser_DEBUG != 0
+  public:
+   int YY_cl_ucsim_parser_DEBUG_FLAG;  /*  nonzero means print parse trace     */
+ #endif
+public:
+ YY_cl_ucsim_parser_CLASS(YY_cl_ucsim_parser_CONSTRUCTOR_PARAM);
+public:
+ YY_cl_ucsim_parser_MEMBERS 
+};
+/* other declare folow */
+#endif
+
+
+#if YY_cl_ucsim_parser_COMPATIBILITY != 0
+ /* backward compatibility */
+ /* Removed due to bison problems
+ /#ifndef YYSTYPE
+ / #define YYSTYPE YY_cl_ucsim_parser_STYPE
+ /#endif*/
+
+ #ifndef YYLTYPE
+  #define YYLTYPE YY_cl_ucsim_parser_LTYPE
+ #endif
+ #ifndef YYDEBUG
+  #ifdef YY_cl_ucsim_parser_DEBUG 
+   #define YYDEBUG YY_cl_ucsim_parser_DEBUG
+  #endif
+ #endif
+
+#endif
+/* END */
+
+ #line 267 "/usr/share/bison++/bison.h"
+#endif
diff --git a/sim/ucsim/cmd.src/cmdpars.y b/sim/ucsim/cmd.src/cmdpars.y
new file mode 100644 (file)
index 0000000..2b106ac
--- /dev/null
@@ -0,0 +1,154 @@
+%name cl_ucsim_parser
+
+%{
+#include "cmdlexcl.h"
+#include "memcl.h"
+#include "globals.h"
+#include "stypes.h"
+%}
+
+%pure_parser
+
+%define INHERIT : public cl_base
+
+%define MEMBERS class cl_ucsim_lexer *lexer_object;\
+virtual ~YY_cl_ucsim_parser_CLASS(void) { delete lexer_object; }
+
+%define CONSTRUCTOR_PARAM \
+class cl_ucsim_lexer *the_lexer
+
+%define CONSTRUCTOR_CODE \
+lexer_object= the_lexer;
+
+%token PTOK_PLUS PTOK_MINUS PTOK_ASTERIX PTOK_SLASH PTOK_EQUAL
+%token PTOK_LEFT_PAREN PTOK_RIGHT_PAREN
+%token PTOK_LEFT_BRACKET PTOK_RIGHT_BRACKET
+%token PTOK_DOT PTOK_AMPERSAND
+
+%token <memory_object> PTOK_MEMORY_OBJECT
+%token <memory> PTOK_MEMORY
+%token <number> PTOK_NUMBER
+%token <bit> PTOK_BIT
+
+%right PTOK_EQUAL
+%left PTOK_MINUS PTOK_PLUS
+%left PTOK_ASTERIX PTOK_SLASH
+%nonassoc UNARYMINUS PTOK_AMPERSAND
+%nonassoc PTOK_LEFT_PAREN PTOK_RIGHT_PAREN
+
+%type <number> ucsim_grammar assignment expression address_of_expression
+%type <memory> memory
+%type <bit> bit
+
+%union {
+  long number;
+  class cl_memory *memory_object;
+  struct {
+    class cl_memory *memory;
+    long address;
+  } memory;
+  struct {
+    class cl_memory *memory;
+    long mem_address, bit_address;
+    long mask;
+  } bit;
+}
+
+%%
+
+ucsim_grammar:
+       expression { application->dd_printf("%d\n", $1); }
+       ;
+
+assignment:
+         memory PTOK_EQUAL expression
+         {
+           $1.memory->write($1.address, $3);
+           $$= $3;
+         }
+       | bit PTOK_EQUAL expression
+         {
+           if ($3)
+             {
+               $1.memory->write($1.mem_address,
+                                $1.memory->read($1.mem_address) | $1.mask);
+               $$= 1;
+             }
+           else
+             {
+               $1.memory->write($1.mem_address,
+                                $1.memory->read($1.mem_address) & ~($1.mask));
+               $$= 0;
+             }
+         }
+       ;
+
+expression:
+         assignment { $$= $1; }
+       | expression PTOK_PLUS expression { $$= $1 + $3; }
+       | expression PTOK_MINUS expression { $$= $1 - $3; }
+       | expression PTOK_ASTERIX expression { $$= $1 * $3; }
+       | expression PTOK_SLASH expression
+         {
+           if ($3 == 0)
+             yyerror("Divide by zero");
+           else
+             $$= $1 / $3;
+         }
+       | PTOK_MINUS expression %prec UNARYMINUS { $$= -$2; }
+       | address_of_expression { $$= $1; }
+       | PTOK_LEFT_PAREN expression PTOK_RIGHT_PAREN { $$= $2; }
+       | PTOK_NUMBER { $$= $1; }
+       | memory { $$= $1.memory->read($1.address); }
+       | bit { $$= ($1.memory->read($1.mem_address) & $1.mask)?1:0; }
+       ;
+
+address_of_expression:
+         PTOK_AMPERSAND memory { $$= $2.address; }
+       | PTOK_AMPERSAND bit
+       {
+         $$= $2.bit_address;
+         if ($$ < 0)
+           {
+             yyerror("Bit has no address.");
+             $$= 0;
+           }
+       }
+       ;
+
+memory:
+         PTOK_MEMORY
+       | PTOK_MEMORY_OBJECT PTOK_LEFT_BRACKET expression PTOK_RIGHT_BRACKET
+         {
+           $$.memory= $1;
+           $$.address= $3;
+         }
+
+bit:
+         PTOK_BIT
+       | memory PTOK_DOT expression
+         {
+           $$.memory= $1.memory;
+           $$.mem_address= $1.address;
+           $$.mask= 1 << $3;
+           $$.bit_address= -1;
+           class cl_uc *uc= application->get_uc();
+           if (uc)
+             $$.bit_address= uc->bit_address($1.memory, $1.address, $3);
+         }
+       ;
+
+%%
+
+int
+YY_cl_ucsim_parser_CLASS::yylex(YY_cl_ucsim_parser_STYPE *yylval)
+{
+  lexer_object->activate_lexer_to_parse_into(yylval);
+  return(lexer_object->yylex());
+}
+
+void
+YY_cl_ucsim_parser_CLASS::yyerror(char *msg)
+{
+  application->dd_printf("Parser error: %s\n", msg);
+}
diff --git a/sim/ucsim/doc/chip.fig b/sim/ucsim/doc/chip.fig
new file mode 100644 (file)
index 0000000..49e0d02
--- /dev/null
@@ -0,0 +1,108 @@
+#FIG 3.2
+Landscape
+Center
+Metric
+A4      
+100.00
+Single
+-2
+1200 2
+6 3375 2610 5130 2925
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+        3375 2610 5130 2610 5130 2925 3375 2925 3375 2610
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3600 2925 3600 2790
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3825 2925 3825 2790
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4050 2925 4050 2790
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4905 2925 4905 2790
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4680 2925 4680 2790
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4230 2790
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4365 2790 4365 2790
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4500 2790
+-6
+6 3375 2295 5130 2610
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+        3375 2295 5130 2295 5130 2610 3375 2610 3375 2295
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3600 2610 3600 2475
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3825 2610 3825 2475
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4050 2610 4050 2475
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4905 2610 4905 2475
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4680 2610 4680 2475
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4230 2475
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4365 2475 4365 2475
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4500 2475
+-6
+6 3375 2925 5130 3240
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+        3375 2925 5130 2925 5130 3240 3375 3240 3375 2925
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3600 3240 3600 3105
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3825 3240 3825 3105
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4050 3240 4050 3105
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4905 3240 4905 3105
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4680 3240 4680 3105
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4230 3105
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4365 3105 4365 3105
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4500 3105
+-6
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 1 2
+       0 0 1.00 60.00 120.00
+       0 0 1.00 60.00 120.00
+        3375 3600 5130 3600
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+        3375 1215 5130 1215 5130 1530 3375 1530 3375 1215
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3600 1530 3600 1395
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3825 1530 3825 1395
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4050 1530 4050 1395
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4905 1530 4905 1395
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4680 1530 4680 1395
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4230 1395
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        4365 1395 4365 1395
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4500 1395
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4230 1710
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4230 1890
+2 1 0 3 0 7 50 -1 -1 0.000 0 0 -1 0 0 1
+        4230 2070
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 1 2
+       0 0 1.00 60.00 120.00
+       0 0 1.00 60.00 120.00
+        5445 3240 5445 1215
+4 1 0 50 -1 16 12 0.0000 4 180 885 4230 3555 width (bits)\001
+4 0 0 50 -1 16 12 0.0000 4 180 870 5535 2295 size (cells)\001
+4 2 0 50 -1 16 12 0.0000 4 120 150 3285 3195 0.\001
+4 2 0 50 -1 16 12 0.0000 4 120 150 3285 2475 2.\001
+4 2 0 50 -1 16 12 0.0000 4 135 150 3285 2835 1.\001
+4 2 0 50 -1 16 12 0.0000 4 135 540 3285 1440 size-1.\001
+4 1 0 50 -1 16 12 0.0000 4 180 735 4230 3825 (cellsize)\001
diff --git a/sim/ucsim/doc/cmd.txt b/sim/ucsim/doc/cmd.txt
new file mode 100644 (file)
index 0000000..7239007
--- /dev/null
@@ -0,0 +1,69 @@
+app
+G      conf
+G      conf objects
+G      help,?
+G      quit
+G      kill
+ G     exec file
+ G     expression,let expr
+G      show copying
+G      show warranty
+G      show option [name]
+G      show error
+G      get option [name]
+G      set option name|nr value
+G      set error error_name on|off|unset
+
+sim
+E      run,go,r [start [stop]]
+E      stop
+E      step,s
+E      next,n
+       gui start
+       gui stop
+
+uc
+G      state
+       statistic [mem [startaddr [endaddr]]
+ GM    file "file"
+ GM    download,dl
+E      pc [addr]
+G      reset
+D      dump mem_type [start [stop [bytes_per_line]]
+D      dump bitname...
+D      dch [start [stop]]
+D      dc [start [stop]]
+D      disassemble [start [offset [lines]]]
+ GM    fill mem_type start end data
+ GM    where mem_type data...
+ GM    Where mem_type data...
+B      break addr [hit]
+B      break mem_type r|w addr [hit]
+B      tbreak addr [hit]
+B      tbreak mem_type r|w addr [hit]
+B      clear [addr...]
+B      delete [nr...]
+G      get sfr addr...
+G      set memory mem_type addr data...
+G      set bit addr 0|1
+G      set hardware,hw cath params...
+G      info breakpoints
+G      info registers
+G      info hardware,hw cath
+G      info stack
+G      info memory
+G      timer add,create,make id [direction [in_isr]]
+G      timer delete,remove id
+G      timer get [id]
+G      timer run,start id
+G      timer stop id
+G      timer value,set id value
+       memory createchip,cchip id size cellsize
+       memory createaddressspace,createaddrspace,createaspace,caddressspace,caddrspace,caspace id startaddr size
+       memory createaddressdecoder,createaddrdecoder,createadecoder,caddressdecoder,caddrdecoder,cadecoder addressspace begin end chip begin
+
+       s51
+       
+D              di [start [stop]]
+D              dx [start [stop]]
+D              ds [start [stop]]
diff --git a/sim/ucsim/doc/cmd_memory.html b/sim/ucsim/doc/cmd_memory.html
new file mode 100644 (file)
index 0000000..f06abb5
--- /dev/null
@@ -0,0 +1,284 @@
+<html>
+<head>
+<title>Memory manipulation commands of &micro;Csim</title>
+</head>
+
+<body bgcolor="white">
+
+<h2>Memory manipulation commands of &micro;Csim</h2>
+
+Every command which changes content of ROM area such as <b><a
+href="#dl">dl</a></b> or <b><a href="cmd_set#set_memory">set
+memory</a></b> deletes result of <a href="analyzer.html">code
+analyzer</a> and causes to re-analyze the code.
+
+<hr>
+
+
+<a name="file"><h3>file,load <i>"FILE"</i></h3></a>
+
+Loads file named FILE into the simulated code memory. File must
+contain data in Intel HEX format.
+
+<pre>
+> <font color="#118811">file "../../remo.hex"</font>
+55470 words read from ../../remo.hex
+> 
+</pre>
+
+Don't forget to enclose file name in quotes to make the parameter to
+be a string.
+
+<hr>
+
+
+<a name="dl"><h3>download,dl</h3></a>
+
+Download command. It is same as <a href="#l">load</a> above but it
+reads information from command console which is standard input by
+default. This command stops read records when it detects an "END"
+record which is normaly the last record. This command has two
+equivalent forms <b>download</b> and <b>dl</b>.
+
+<pre>
+$ <font color="#118811">s51 -V</font>
+ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+> <font color="#118811">do
+:03000000020003F8
+:1000030075812078207600D8FC900000AE83AF8203
+:100013009000001200416005E4F0A380F690009F79
+:1000230012004A9000A312004A9000A712006890A1
+:1000330000AD12006875D0001200B50200B3EF6581
+:10004300827003EE658322E493F8740193F97402DA
+:1000530093FE740393F5828E83E869700122E4931F
+:10006300F6A30880F4E493FC740193FD740293FEF9
+:10007300740393FF740493F8740593F582888312D1
+:100083000041700122E493A3A883A9828C838D820B
+:10009300F0A3AC83AD828883898280E3212100B5FC
+:1000A300212100B5000000B500B5000000B500B582
+:0200B30080FECD
+:1000B5007520117501AA850120750102850120228F
+:00000001FF</font>
+197 bytes loaded
+> </pre>
+
+<hr>
+
+
+<a name="fill"><h3>fill <i>memory_type start end data</i></h3></a>
+
+Fill memory region with specified data. First parameter specifies
+memory. Name of the memory must be used, it can be checked using <a
+href="cmd_general.html#info_memory">info memory</a> command which
+lists size and name of all available memories.
+
+<p><b>start</b> and <b>end</b> parameters specify first and last
+address of the memory region to be filled.
+
+<p><b>data</b> parameter specifies the data which is used to fill the
+memory region.
+
+<pre>
+$ <font color="#118811">s51</font> 
+ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+> <font color="#118811">fill xram 12 0x12 0x56</font>
+> <font color="#118811">dump xram 0 0x20</font>
+0x0000 00 00 00 00 00 00 00 00 ........
+0x0008 00 00 00 00 56 56 56 56 ....VVVV
+0x0010 56 56 56 00 00 00 00 00 VVV.....
+0x0018 00 00 00 00 00 00 00 00 ........
+0x0020 00                      .
+> </pre>
+
+
+<hr>
+
+
+<a name="where"><h3>where,Where <i>memory_type data...</i></h3></a>
+
+Searching for some data in memory. First parameter specifies
+memory. Name of the memory must be used, it can be checked using <a
+href="cmd_general.html#info_memory">info memory</a> command which
+lists size and name of all available memories.
+
+<p>Other parameters can be mixed list of strings (characters between "
+and ") and numbers. Strings can contain escape sequencies. &micro;Csim
+merges all parameters together and will search for megred list of
+values in specified memory.
+
+<p><b>where</b> command do case unsensitive search while <b>Where</b>
+command is for case sensitive search.
+
+<p>Search is done in whole memory and all matches are dumped out.
+
+<pre>
+$ <font color="#118811">/s51</font>
+ucsim 0.2.38-pre2, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+> <font color="#118811">set mem xram 20 "Dani d ani D ani dani Dani"</font>
+0x0014 44 61 6e 69 20 64 20 61 Dani d a
+0x001c 6e 69 20 44 20 61 6e 69 ni D ani
+0x0024 20 64 61 6e 69 20 44 61  dani Da
+0x002c 6e 69                   ni
+> <font color="#118811">where xram "dani"</font>
+0x0014 44 61 6e 69             Dani
+0x0025 64 61 6e 69             dani
+0x002a 44 61 6e 69             Dani
+> <font color="#118811">Where xram "d ani"</font>
+0x0019 64 20 61 6e 69          d ani
+> </pre>
+
+<hr>
+
+
+<a name="memory"><h3>memory</h3></a>
+
+This set of commands can be used to manipulate <a
+href="memory.html">memory system</a> including <a
+href="memory.html#chip">chips</a>, <a
+href="memory.html#address_space">address spaces</a> and <a
+href="memory.html#address_decoder">address decoders</a>.
+
+<p>Subcommands are:
+
+<p>memory <a href="#memory_createchip">createchip</a>
+<br>memory <a href="#memory_createaddressspace">createaddressspace</a>
+<br>memory <a href="#memory_createaddressdecoder">createaddressdecoder</a>
+
+
+<blockquote>
+
+<a name="memory_createchip"><h4>memory createchip|cchip <i>id size
+cellsize</i></h4></a>
+
+This command creates a chip (array of storage elements). <b>id</b>
+must be a unique name which will be used to identify the chip in other
+commands. <b>size</b> is number of storage elements, <b>cellsize</b>
+is number of bits stored in one element.
+
+<hr>
+
+
+<a name="memory_createaddressspace"><h4>memory
+createaddressspace|caddressspace|caddrspace|caspace|createaddrspace|createaspace
+<i>id startaddr size</i></h4></a>
+
+This command should never be used. It defines an adress space, names
+it as <b>id</b> sets its starting address and size. Simulator programs
+(<b>s51</b>, <b>savr</b>, etc.) define necessary address spaces for
+themself, so this command is not needed.
+
+<hr>
+
+
+<a name="memory_createaddressdecoder"><h4>memory
+createaddressdecoder|caddrdecoder|caddressdecoder|cadecoder|createaddrdecoder|createadecoder
+<i>addressspace begin end chip begin</i></h4></a>
+
+Address decoder maps a part of the address space to a chip
+area. <b>addressspace</b> parameter is name of the address space,
+<b>begin</b> and <b>end</b> specify address range of the address space
+to be mapped. <b>chip</b> parameter is name of the memory chip and
+the second <b>begin</b> parameter is the (start of the) chip address
+where the area is mapped to.
+
+<p>Address space will be split if a "middle" are is mapped:
+
+<pre>
+$ <font color="#118811">s51</font>
+uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+0> <font color="#118811">i m</font>
+Memory chips:
+  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
+  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
+  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
+  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
+Address spaces:
+  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
+  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
+  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
+  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
+Address decoders:
+ 0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
+ 0 iram 0x00 0x7f -> iram_chip 0x00 activated
+ 0 sfr 0x80 0xff -> sfr_chip 0x00 activated
+ 0 xram 0x0000 0xffff -> xram_chip 0x0000 activated
+0> <font color="#118811">mem cchip myram 0x1000 8</font>
+0> <font color="#118811">mem createaddressdecoder xram 1234 2000 myram 15</font>
+0> <font color="#118811">i m</font>
+Memory chips:
+  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
+  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
+  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
+  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
+  0x000000-0x000fff     4096 myram (8,%02x,0x%03x)
+Address spaces:
+  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
+  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
+  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
+  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
+Address decoders:
+ 0 rom 0x0000 0xffff -> rom_chip 0x0000 activated
+ 0 iram 0x00 0x7f -> iram_chip 0x00 activated
+ 0 sfr 0x80 0xff -> sfr_chip 0x00 activated
+ 0 xram 0x0000 0x04d1 -> xram_chip 0x0000 activated
+ 1 xram 0x04d2 0x07d0 -> myram 0x00f activated
+ 2 xram 0x07d1 0xffff -> xram_chip 0x07d1 activated
+0> 
+</pre>
+
+It is easy to share chip area between address spaces:
+
+<pre>
+$ <font color="#118811">s51</font>
+uCsim 0.5.0-pre3, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+0> <font color="#118811">mem createaddressdecoder rom 0 0xfff xram_chip 0xf000</font>
+0> <font color="#118811">i m</font>
+Memory chips:
+  0x000000-0x00ffff    65536 rom_chip (8,%02x,0x%04x)
+  0x000000-0x00007f      128 iram_chip (8,%02x,0x%02x)
+  0x000000-0x00ffff    65536 xram_chip (8,%02x,0x%04x)
+  0x000000-0x00007f      128 sfr_chip (8,%02x,0x%02x)
+Address spaces:
+  0x000000-0x00ffff    65536 rom (8,%02x,0x%04x)
+  0x000000-0x00007f      128 iram (8,%02x,0x%02x)
+  0x000080-0x0000ff      128 sfr (8,%02x,0x%02x)
+  0x000000-0x00ffff    65536 xram (8,%02x,0x%04x)
+Address decoders:
+ 0 rom 0x0000 0x0fff -> xram_chip 0xf000 activated
+ 1 rom 0x1000 0xffff -> rom_chip 0x1000 activated
+ 0 iram 0x00 0x7f -> iram_chip 0x00 activated
+ 0 sfr 0x80 0xff -> sfr_chip 0x00 activated
+ 0 xram 0x0000 0xffff -> xram_chip 0x0000 activated
+0> <font color="#118811">rom[0]=0xab</font>
+171
+0> <font color="#118811">xram[0xf000]</font>
+171
+0> 
+</pre>
+
+
+<hr>
+
+
+</blockquote>
+
+<hr>
+
+
+</body>
+</html>
diff --git a/sim/ucsim/doc/cpu-mem.fig b/sim/ucsim/doc/cpu-mem.fig
new file mode 100644 (file)
index 0000000..20753bd
--- /dev/null
@@ -0,0 +1,93 @@
+#FIG 3.2
+Landscape
+Center
+Metric
+A4      
+100.00
+Single
+-2
+1200 2
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 1 0 3
+       0 0 1.00 60.00 120.00
+        4320 2160 6660 2160 6660 2430
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 1 0 3
+       0 0 1.00 60.00 120.00
+        4320 2025 6840 2025 6840 2430
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 0 1 2
+       0 0 1.00 60.00 120.00
+        5175 2430 5175 2160
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 0 1 2
+       0 0 1.00 60.00 120.00
+        5355 2430 5355 2025
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 1 0 3
+       0 0 1.00 60.00 120.00
+        4320 1845 8460 1845 8460 2430
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 0 1 3
+       0 0 1.00 60.00 120.00
+        8640 2430 8640 1710 4320 1710
+2 3 0 1 0 1 51 -1 20 0.000 0 0 -1 0 0 11
+        5580 3375 5490 3375 5670 3195 5850 3375 5760 3375 5760 3555
+        5850 3555 5670 3735 5490 3555 5580 3555 5580 3375
+2 3 0 1 0 1 51 -1 20 0.000 0 0 -1 0 0 11
+        7020 3375 6930 3375 7110 3195 7290 3375 7200 3375 7200 3555
+        7290 3555 7110 3735 6930 3555 7020 3555 7020 3375
+2 3 0 1 0 1 51 -1 20 0.000 0 0 -1 0 0 11
+        8775 3375 8685 3375 8865 3195 9045 3375 8955 3375 8955 3555
+        9045 3555 8865 3735 8685 3555 8775 3555 8775 3375
+2 2 0 1 0 1 50 -1 20 0.000 0 0 -1 0 0 5
+        9090 3735 4320 3735 4320 3915 9090 3915 9090 3735
+2 2 0 1 0 26 50 -1 20 0.000 0 0 -1 0 0 5
+        3150 1575 4320 1575 4320 4815 3150 4815 3150 1575
+2 2 0 1 0 13 48 -1 20 0.000 0 0 -1 0 0 5
+        4995 4635 6210 4635 6210 5400 4995 5400 4995 4635
+2 2 0 1 -1 17 50 -1 20 0.000 0 0 -1 0 0 5
+        5085 2430 6120 2430 6120 3195 5085 3195 5085 2430
+2 2 0 1 0 17 50 -1 20 0.000 0 0 -1 0 0 5
+        6525 2430 7560 2430 7560 3195 6525 3195 6525 2430
+2 2 0 1 0 15 50 -1 20 0.000 0 0 -1 0 0 5
+        8280 2430 9315 2430 9315 3195 8280 3195 8280 2430
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 0 0 7
+        5130 1440 5220 1350 6210 1350 6300 1260 6390 1350 7380 1350
+        7470 1440
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 0 0 7
+        8280 1440 8370 1350 8730 1350 8820 1260 8910 1350 9270 1350
+        9360 1440
+2 1 0 1 0 7 53 -1 -1 0.000 0 0 -1 0 1 2
+       0 0 1.00 60.00 120.00
+        5985 3195 5985 4635
+2 1 0 1 0 7 53 -1 -1 0.000 0 0 -1 0 1 3
+       0 0 1.00 60.00 120.00
+        7425 3195 7425 4815 6210 4815
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 1 3
+       0 0 1.00 60.00 120.00
+        9180 3195 9180 4950 6210 4950
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 1 0 4
+       0 0 1.00 60.00 120.00
+        4410 1710 4455 1755 4455 5265 4995 5265
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 2
+        4410 1845 4455 1890
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 2
+        4410 2025 4455 2070
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 2
+        4410 2160 4455 2205
+2 1 0 1 0 2 50 -1 20 0.000 0 0 -1 0 0 31
+        8460 3195 8640 3375 8550 3375 8550 4410 4680 4410 4860 4725
+        4860 4635 4995 4860 4860 5085 4860 4995 4590 4590 4320 4590
+        4320 4095 5175 4095 5175 3375 5085 3375 5265 3195 5445 3375
+        5355 3375 5355 4095 6615 4095 6615 3375 6525 3375 6705 3195
+        6885 3375 6795 3375 6795 4095 8370 4095 8370 3375 8280 3375
+        8460 3195
+4 1 0 49 -1 16 12 0.0000 4 135 1035 7650 2070 Control lines\001
+4 1 0 49 -1 16 12 0.0000 4 180 465 7650 2295 (R/W)\001
+4 1 0 47 -1 16 12 0.0000 4 135 390 3690 3060 CPU\001
+4 1 0 49 -1 16 12 0.0000 4 135 735 7920 3690 Data bus\001
+4 1 0 49 -1 16 12 0.0000 4 135 1020 6480 4320 Address bus\001
+4 1 0 46 -1 16 12 0.0000 4 135 705 5580 5220 Decoder\001
+4 1 0 46 -1 16 12 0.0000 4 135 675 5580 4995 Address\001
+4 1 0 48 -1 16 12 0.0000 4 135 510 5625 2880 Mem1\001
+4 1 0 48 -1 16 12 0.0000 4 135 510 7065 2880 Mem2\001
+4 1 0 48 -1 16 12 0.0000 4 135 510 8775 2880 Mem3\001
+4 1 0 49 -1 16 12 0.0000 4 180 1380 6300 1125 Address Space I.\001
+4 1 0 49 -1 16 12 0.0000 4 180 705 8820 1125 Space II.\001
+4 1 0 49 -1 16 12 0.0000 4 135 675 8820 900 Address\001
+4 1 0 46 -1 16 12 0.0000 4 180 1350 7695 5220 Chip select lines\001
diff --git a/sim/ucsim/doc/decoded.fig b/sim/ucsim/doc/decoded.fig
new file mode 100644 (file)
index 0000000..77d98bf
--- /dev/null
@@ -0,0 +1,116 @@
+#FIG 3.2  Produced by xfig version 3.2.5-alpha4
+Landscape
+Center
+Metric
+A4      
+100.00
+Single
+-2
+1200 2
+2 1 0 3 0 15 46 -1 20 0.000 0 0 -1 0 0 2
+        3285 1080 3465 1080
+2 1 0 3 0 15 46 -1 20 0.000 0 0 -1 0 0 2
+        3285 4140 3465 4140
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 7
+        3375 3870 3465 3780 3465 3465 3555 3375 3465 3285 3465 2970
+        3375 2880
+2 2 0 1 0 17 50 -1 20 0.000 0 0 -1 0 0 5
+        3870 1350 4410 1350 4410 2520 3870 2520 3870 1350
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 7
+        3375 2520 3465 2430 3465 1980 3555 1890 3465 1800 3465 1440
+        3375 1350
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 0 0 2
+        3375 3870 3870 3870
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 0 0 2
+        3375 2520 3870 2520
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        3690 2520 3690 1350
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        3690 3870 3690 2880
+2 1 0 3 0 15 46 -1 20 0.000 0 0 -1 0 0 2
+        3375 2925 3375 3870
+2 2 0 1 0 17 50 -1 20 0.000 0 0 -1 0 0 5
+        3870 2880 4410 2880 4410 3870 3870 3870 3870 2880
+2 1 0 3 0 15 46 -1 20 0.000 0 0 -1 0 0 2
+        3375 1350 3375 2520
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3375 1080 3375 4140
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        5715 1350 5895 1350
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        5715 3375 5895 3375
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 7
+        5805 2970 5895 2880 5895 2565 5985 2475 5895 2385 5895 2070
+        5805 1980
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 0 0 2
+        5805 2970 6300 2970
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        6075 2970 6075 1980
+2 2 0 1 0 15 50 -1 20 0.000 0 0 -1 0 0 5
+        6300 1980 6840 1980 6840 2970 6300 2970 6300 1980
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        5805 1980 5805 2970
+2 1 0 1 8 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        5805 1350 5805 3375
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        8280 1350 8460 1350
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        8280 3375 8460 3375
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 7
+        8370 2970 8460 2880 8460 2745 8550 2655 8460 2565 8460 2385
+        8370 2295
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 0 0 2
+        8370 2970 8865 2970
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        8640 2970 8640 2295
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        8370 2295 8370 2970
+2 1 0 1 8 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        8370 1350 8370 3375
+2 2 0 1 0 15 50 -1 20 0.000 0 0 -1 0 0 5
+        8865 2295 9405 2295 9405 2970 8865 2970 8865 2295
+2 2 0 1 -1 7 60 -1 20 0.000 0 0 -1 0 0 5
+        8865 2295 9405 2295 9405 1980 8865 1980 8865 2295
+2 1 0 1 0 7 58 -1 -1 0.000 0 0 -1 0 0 2
+        9000 1710 9180 2025
+2 1 0 1 0 7 60 -1 -1 0.000 0 0 -1 0 0 2
+        5805 3105 6525 3555
+2 1 0 1 0 7 60 -1 -1 0.000 0 0 -1 0 0 2
+        6390 1530 5805 2250
+2 1 0 1 0 7 60 -1 -1 0.000 0 0 -1 0 0 2
+        6930 1530 8370 2475
+4 1 0 46 -1 16 12 0.0000 4 135 465 4140 1530 size2\001
+4 1 0 46 -1 16 12 0.0000 4 135 540 4140 2025 Mem2\001
+4 2 0 46 -1 16 12 0.0000 4 165 1035 3285 2520 mem2_start\001
+4 2 0 46 -1 16 12 0.0000 4 180 1035 3285 3870 mem1_start\001
+4 1 0 46 -1 16 12 0.0000 4 195 885 2835 4185 begin_as1\001
+4 1 0 46 -1 16 12 0.0000 4 180 735 2880 1125 end_as1\001
+4 1 0 46 -1 16 12 0.0000 4 180 1515 2790 810 Address Space I.\001
+4 1 0 46 -1 16 12 0.0000 4 180 1575 5220 1080 Address Space II.\001
+4 1 0 46 -1 16 12 0.0000 4 150 465 4140 3060 size1\001
+4 1 0 46 -1 16 12 0.0000 4 150 540 4140 3465 Mem1\001
+4 1 0 46 -1 16 12 0.0000 4 135 105 4140 2430 0\001
+4 1 0 46 -1 16 12 0.0000 4 135 105 4140 3780 0\001
+4 1 0 46 -1 16 12 0.0000 4 135 105 6570 2925 0\001
+4 1 0 46 -1 16 12 0.0000 4 135 465 6570 2160 size3\001
+4 1 0 46 -1 16 12 0.0000 4 135 540 6570 2520 Mem3\001
+4 1 0 46 -1 16 12 0.0000 4 165 735 5310 1395 end_as2\001
+4 1 0 46 -1 16 12 0.0000 4 180 885 5220 3420 begin_as2\001
+4 2 0 46 -1 16 12 0.0000 4 165 1035 5715 2970 mem3_start\001
+4 1 0 46 -1 16 12 0.0000 4 135 105 9135 2925 0\001
+4 1 0 46 -1 16 12 0.0000 4 135 360 9135 2160 size\001
+4 1 0 46 -1 16 12 0.0000 4 135 435 9135 2520 Mem\001
+4 1 0 46 -1 16 12 0.0000 4 165 630 7875 1395 end_as\001
+4 1 0 46 -1 16 12 0.0000 4 180 780 7785 3420 begin_as\001
+4 2 0 46 -1 16 12 0.0000 4 165 930 8280 2970 mem_start\001
+4 0 0 60 -1 16 12 0.0000 4 135 1140 8865 1170 Non-decoded\001
+4 0 0 60 -1 16 12 0.0000 4 150 705 8865 1395 memory\001
+4 0 0 60 -1 16 12 0.0000 4 135 405 8865 1620 cells\001
+4 0 0 60 -1 16 12 0.0000 4 135 1140 6165 3735 Non-decoded\001
+4 0 0 60 -1 16 12 0.0000 4 135 900 6165 3960 addresses\001
+4 0 0 60 -1 16 12 0.0000 4 135 765 6255 1260 Decoded\001
+4 0 0 60 -1 16 12 0.0000 4 135 900 6255 1485 addresses\001
diff --git a/sim/ucsim/doc/memory.html b/sim/ucsim/doc/memory.html
new file mode 100644 (file)
index 0000000..f724037
--- /dev/null
@@ -0,0 +1,83 @@
+<html>
+<head>
+<title>Memory simulation in &micro;Csim</title>
+</head>
+
+<body>
+
+<h1>Memory simulation in &micro;Csim</h1>
+
+Typical microprocessor system can look like this:
+<p><img src="cpu-mem.gif" border="0" alt="[CPU-memory connection]">
+
+
+<a name="address_space"><h3>Address space</h3></a>
+
+In our terminilogy "<b>address space</b>" means a set of:
+
+<ul><li>address bus lines
+
+<li>data bus lines
+
+<li>control (read/write) lines</ul>
+
+Bus lines can be shared by address spaces, in this case number of
+control line sets specifies the address spaces.
+
+<p>Microcontrollers usually have more address spaces. Some is used
+inside only, some can be used for external memories.
+
+<p>Address space does not store any value. It just specifies range of
+addresses by <i>start address</i> (which is not necessarily zero) and
+<i>size</i> which the CPU can provide when it tries to access a memory
+location.
+
+
+<a name="chip"><h3>Memory chip</h3></a>
+
+"<b>Memory chip</b>" is a circuit which can hold values in
+cells. Cells are indexed from 0 up to size-1. Each cell stores some
+(usually 8) bits.
+
+<p><img src="chip.gif" border="0" alt="[Memory chip]">
+
+
+<a name="address_decoder"><h3>Address decoder</h3></a>
+
+Addresses coming from an address space via address bus must be routed
+to memory and translated to cell indexes. This is done by the
+"<b>address decoder</b>". It listens addresses on the bus and control
+lines and enables exactly one memory chip. This way cells of the
+memory chip appear in the address space.
+
+<p><img src="decoded.gif" boder="0" alt="[Decoded addresses]">
+
+<p>It is possible that some addresses are not decoded. Writing to such
+an address results data to be lost. Reading of a non-decoded address
+results random value. Pullup or pulldown resistors can be applied to
+data bus lines to provide a specific value for read operations.
+
+<p>As it shown above, it is also possible that some cells of a chip is
+not mapped to any address.
+
+
+<h3>Mixed address spaces (shared chips)</h3>
+
+Decoder connects an address of an address space to a cell of a memory
+chip. Only one cell can be connected to each addresses but same cell
+can be connected to more than one address spaces. This is done by
+routing different control lines to the same chip through logic <b>L</b>:
+
+<p><img src="share-chip.gif" border="0" alt="[Sharing memchip]">
+
+<p>Because each cell of a memory chip uses same read/write control, in
+real world it is not possible to share individual cells of a chip
+between address spaces. In &micro;Csim simulator we can define as many
+address decoders as we want so it is possible to map any cell to any
+address.
+
+<hr>
+
+</body>
+</html>
diff --git a/sim/ucsim/doc/share-chip.fig b/sim/ucsim/doc/share-chip.fig
new file mode 100644 (file)
index 0000000..05271aa
--- /dev/null
@@ -0,0 +1,145 @@
+#FIG 3.2
+Landscape
+Center
+Metric
+A4      
+100.00
+Single
+-2
+1200 2
+2 1 0 3 0 15 46 -1 20 0.000 0 0 -1 0 0 2
+        3240 4725 3420 4725
+2 1 0 3 0 15 46 -1 20 0.000 0 0 -1 0 0 2
+        3240 7785 3420 7785
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 7
+        3330 7515 3420 7425 3420 7110 3510 7020 3420 6930 3420 6615
+        3330 6525
+2 2 0 1 0 17 50 -1 20 0.000 0 0 -1 0 0 5
+        3825 4995 4365 4995 4365 6165 3825 6165 3825 4995
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 7
+        3330 6165 3420 6075 3420 5625 3510 5535 3420 5445 3420 5085
+        3330 4995
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 0 0 2
+        3330 7515 3825 7515
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 0 0 2
+        3330 6165 3825 6165
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        3645 6165 3645 4995
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        3645 7515 3645 6525
+2 1 0 3 0 15 46 -1 20 0.000 0 0 -1 0 0 2
+        3330 6525 3330 7515
+2 2 0 1 0 17 50 -1 20 0.000 0 0 -1 0 0 5
+        3825 6525 4365 6525 4365 7515 3825 7515 3825 6525
+2 1 2 1 0 15 46 -1 -1 2.000 0 0 -1 0 0 3
+        5130 6615 4905 6615 4365 6165
+2 1 2 1 0 15 46 -1 20 2.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        4905 6615 4905 5445
+2 1 0 3 0 15 46 -1 20 0.000 0 0 -1 0 0 2
+        3330 4995 3330 6165
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        3330 4725 3330 7785
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        5130 5445 5130 6615
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        5040 4995 5220 4995
+2 1 0 3 8 15 46 -1 20 0.000 0 0 -1 0 0 2
+        5040 7020 5220 7020
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 7
+        5130 6615 5220 6525 5220 6075 5310 5985 5220 5895 5220 5535
+        5130 5445
+2 1 0 1 8 7 50 -1 -1 0.000 0 0 -1 0 0 2
+        5130 4995 5130 7020
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 0 1 2
+       0 0 1.00 60.00 120.00
+        3645 945 3645 675
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 0 1 2
+       0 0 1.00 60.00 120.00
+        3825 945 3825 540
+2 3 0 1 0 1 51 -1 20 0.000 0 0 -1 0 0 11
+        5490 1890 5400 1890 5580 1710 5760 1890 5670 1890 5670 2070
+        5760 2070 5580 2250 5400 2070 5490 2070 5490 1890
+2 2 0 1 0 26 50 -1 20 0.000 0 0 -1 0 0 5
+        1620 90 2790 90 2790 3330 1620 3330 1620 90
+2 2 0 1 0 13 48 -1 20 0.000 0 0 -1 0 0 5
+        3465 3150 4680 3150 4680 3915 3465 3915 3465 3150
+2 2 0 1 -1 17 50 -1 20 0.000 0 0 -1 0 0 5
+        3555 945 4590 945 4590 1710 3555 1710 3555 945
+2 2 0 1 0 17 50 -1 20 0.000 0 0 -1 0 0 5
+        4995 945 6030 945 6030 1710 4995 1710 4995 945
+2 1 0 1 0 7 53 -1 -1 0.000 0 0 -1 0 1 2
+       0 0 1.00 60.00 120.00
+        4455 1710 4455 3150
+2 1 0 1 0 7 53 -1 -1 0.000 0 0 -1 0 1 3
+       0 0 1.00 60.00 120.00
+        5895 1710 5895 3330 4680 3330
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 1 0 4
+       0 0 1.00 60.00 120.00
+        2880 225 2925 270 2925 3780 3465 3780
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 2
+        2880 360 2925 405
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 2
+        2880 540 2925 585
+2 1 0 1 0 7 46 -1 -1 0.000 0 0 -1 0 0 2
+        2880 675 2925 720
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        2790 675 4095 675
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        2790 540 4095 540
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 1 0 2
+       0 0 1.00 60.00 120.00
+        2790 360 4095 360
+2 1 0 1 0 7 49 -1 -1 0.000 0 0 -1 0 1 2
+       0 0 1.00 60.00 120.00
+        4095 225 2790 225
+2 2 0 1 0 1 50 -1 20 0.000 0 0 -1 0 0 5
+        5985 2250 2790 2250 2790 2430 5985 2430 5985 2250
+2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
+        4095 135 4410 135 4410 765 4095 765 4095 135
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3
+       0 0 1.00 60.00 120.00
+        4410 495 5130 495 5130 945
+2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3
+       0 0 1.00 60.00 120.00
+        4410 315 5310 315 5310 945
+2 1 0 1 0 2 50 -1 20 0.000 0 0 -1 0 0 24
+        5265 1890 5265 2925 3150 2925 3330 3240 3330 3150 3465 3375
+        3330 3600 3330 3510 3060 3105 2790 3105 2790 2610 3645 2610
+        3645 1890 3555 1890 3735 1710 3915 1890 3825 1890 3825 2610
+        5085 2610 5085 1890 4995 1890 5175 1710 5355 1890 5265 1890
+2 3 0 1 0 1 51 -1 20 0.000 0 0 -1 0 0 11
+        4050 1890 3960 1890 4140 1710 4320 1890 4230 1890 4230 2070
+        4320 2070 4140 2250 3960 2070 4050 2070 4050 1890
+4 1 0 46 -1 16 12 0.0000 4 135 435 4095 5175 size2\001
+4 1 0 46 -1 16 12 0.0000 4 135 510 4095 5670 Mem2\001
+4 2 0 46 -1 16 12 0.0000 4 150 960 3240 6165 mem2_start\001
+4 2 0 46 -1 16 12 0.0000 4 165 960 3240 7515 mem1_start\001
+4 1 0 46 -1 16 12 0.0000 4 180 870 2790 7830 begin_as1\001
+4 1 0 46 -1 16 12 0.0000 4 165 720 2835 4770 end_as1\001
+4 1 0 46 -1 16 12 0.0000 4 180 1380 2745 4455 Address Space I.\001
+4 1 0 46 -1 16 12 0.0000 4 180 1425 5175 4725 Address Space II.\001
+4 1 0 46 -1 16 12 0.0000 4 135 435 4095 6705 size1\001
+4 1 0 46 -1 16 12 0.0000 4 135 510 4095 7110 Mem1\001
+4 1 0 46 -1 16 12 0.0000 4 120 105 4095 6075 0\001
+4 1 0 46 -1 16 12 0.0000 4 120 105 4095 7425 0\001
+4 2 0 46 -1 16 12 0.0000 4 150 960 6210 6660 mem3_start\001
+4 1 0 46 -1 16 12 0.0000 4 180 870 5715 7065 begin_as2\001
+4 1 0 46 -1 16 12 0.0000 4 165 720 5670 5040 end_as2\001
+4 1 0 47 -1 16 12 0.0000 4 135 390 2160 1575 CPU\001
+4 1 0 46 -1 16 12 0.0000 4 135 705 4050 3735 Decoder\001
+4 1 0 46 -1 16 12 0.0000 4 135 675 4050 3510 Address\001
+4 1 0 48 -1 16 12 0.0000 4 135 510 4095 1395 Mem1\001
+4 1 0 48 -1 16 12 0.0000 4 135 510 5535 1395 Mem2\001
+4 1 0 49 -1 16 12 0.0000 4 135 1020 4275 2835 Address bus\001
+4 1 0 49 -1 16 12 0.0000 4 135 735 6435 2430 Data bus\001
+4 1 0 50 -1 16 20 0.0000 4 225 165 4275 540 L\001
+4 1 0 49 -1 16 12 0.0000 4 135 1035 5940 405 Control lines\001
+4 1 0 49 -1 16 12 0.0000 4 180 465 5940 630 (R/W)\001
+4 0 0 50 -1 16 12 0.0000 4 135 600 6120 1170 Shared\001
+4 0 0 50 -1 16 12 0.0000 4 135 660 6120 1395 memory\001
+4 0 0 50 -1 16 12 0.0000 4 180 345 6120 1620 chip\001
diff --git a/sim/ucsim/doc/ucsim.1 b/sim/ucsim/doc/ucsim.1
new file mode 100644 (file)
index 0000000..f7b8f67
--- /dev/null
@@ -0,0 +1,33 @@
+.TH UCSIM 1
+.SH NAME
+uCsim \- Micro\-controller simulator
+.SH SYNOPSIS
+.B s51|sz80|savr|sxa
+.RB \-t type
+.SH DESCRIPTION
+.I s51
+command is used to simulate MCS51 controller family
+.PP
+.B Options of the command
+.TP
+.B \-t type
+Specifies type of the controller.
+.PP
+.TP
+.B \-s file
+Serial file
+.SH EXAMPLES
+None yet.
+.SH FILES
+None.
+.SH "SEE ALSO"
+sdcc(1), sdcdb(1).
+.SH DIAGNOSTICS
+None.
+.SH BUGS
+Probably many.
+.SH AUTHORS
+xy
+.RS 0
+zc
+.RE 0
\ No newline at end of file
diff --git a/sim/ucsim/sim.src/obsolete.cc b/sim/ucsim/sim.src/obsolete.cc
new file mode 100644 (file)
index 0000000..2624a4c
--- /dev/null
@@ -0,0 +1,1359 @@
+/*
+ * Memory location handled specially by a hw element
+ */
+
+/*cl_memloc::cl_memloc(t_addr addr):
+  cl_base()
+{
+  address= addr;
+  hws= new cl_list(2, 2);
+  hws->init();
+}*/
+
+/*cl_memloc::~cl_memloc(void)
+{
+  hws->disconn_all();
+  delete hws;
+}*/
+
+/*ulong
+cl_memloc::read(class cl_mem *mem)
+{
+  uchar ret= 0;
+  class cl_hw *hw;
+
+  if (!hws ||
+      hws->count == 0)
+    return(ret);
+  if ((hw= (class cl_hw *)(hws->at(0))))
+    ret= hw->read(mem, address);
+  return(ret);
+}*/
+
+/*void
+cl_memloc::write(class cl_mem *mem, t_addr addr, t_mem *val)
+{
+  class cl_hw *hw;
+  int i;
+
+  if (!hws)
+    return;
+  for (i= 0; i < hws->count; i++)
+    {
+      hw= (class cl_hw *)hws->at(0);
+      hw->write(mem, addr, val);
+    }
+}*/
+
+
+/* Sorted collection of memory locations */
+
+/*cl_memloc_coll::cl_memloc_coll(void):
+  cl_sorted_list(2, 2)
+{
+  Duplicates= DD_FALSE;
+}*/
+
+/*void *
+cl_memloc_coll::key_of(void *item)
+{
+  return(&(((class cl_memloc *)item)->address));
+}*/
+
+/*int
+cl_memloc_coll::compare(void *key1, void *key2)
+{
+  if (*(long*)key1 > *(long*)key2)
+    return(1);
+  else
+    if (*(long*)key1 < *(long*)key2)
+      return(-1);
+    else
+      return(0);
+}*/
+
+/*class cl_memloc *
+cl_memloc_coll::get_loc(t_addr address)
+{
+  t_index i;
+
+  if (search(&address, i))
+    return((class cl_memloc*)(at(i)));
+  return(0);
+}*/
+
+
+/*
+ * Memory
+ ******************************************************************************
+ */
+
+/*
+ * Bitmap
+ */
+
+/*cl_bitmap::cl_bitmap(t_addr asize):
+  cl_base()
+{
+  map= (uchar*)malloc(size= asize/(8*SIZEOF_CHAR));
+  memset(map, 0, size);
+}
+
+cl_bitmap::~cl_bitmap(void)
+{
+  free(map);
+}
+
+void
+cl_bitmap::set(t_addr pos)
+{
+  int i;
+
+  if ((i= pos/(8*SIZEOF_CHAR)) < size)
+    map[i]|= (1 << (pos & ((8*SIZEOF_CHAR)-1)));
+}
+
+void
+cl_bitmap::clear(t_addr pos)
+{
+  int i;
+
+  if ((i= pos/(8*SIZEOF_CHAR)) < size)
+    map[i]&= ~(1 << (pos & ((8*SIZEOF_CHAR)-1)));
+}
+
+bool
+cl_bitmap::get(t_addr pos)
+{
+  return(map[pos/(8*SIZEOF_CHAR)] & (1 << (pos & ((8*SIZEOF_CHAR)-1))));
+}
+
+bool
+cl_bitmap::empty(void)
+{
+  int i;
+
+  for (i= 0; i < size && map[i] == 0; i++) ;
+  return(i == size);
+}*/
+
+/*
+ * Special memory for code (ROM)
+ */
+
+/*cl_rom::cl_rom(t_addr asize, int awidth, class cl_uc *auc):
+  cl_mem(MEM_ROM, get_id_string(mem_classes, MEM_ROM), asize, awidth, auc)
+{
+  bp_map= new cl_bitmap(asize);
+  inst_map= new cl_bitmap(asize);
+}
+
+cl_rom::~cl_rom(void)
+{
+  delete bp_map;
+  delete inst_map;
+}*/
+
+
+cl_mem::cl_mem(enum mem_class atype, char *aclass_name,
+              t_addr asize, int awidth, class cl_uc *auc):
+  cl_guiobj()
+{
+  int i;
+  
+  uc= auc;
+  type= atype;
+  class_name= aclass_name;
+  width= awidth;
+  size= asize;
+  mem= 0;
+  for (i= width, mask= 0; i; i--)
+    mask= (mask<<1) | 1;
+  if (width == 0 ||
+      size == 0)
+    mem= 0;
+  else if (width <= 8)
+    mem= (TYPE_UBYTE *)malloc(size);
+  else if (width <= 16)
+    mem= (TYPE_UWORD *)malloc(size*sizeof(TYPE_WORD));
+  else
+    mem= (TYPE_UDWORD *)malloc(size*sizeof(TYPE_DWORD));
+  //read_locs= new cl_memloc_coll();
+  //write_locs= new cl_memloc_coll();
+  dump_finished= 0;
+  addr_format= data_format= 0;
+}
+
+cl_mem::~cl_mem(void)
+{
+  if (mem)
+    free(mem);
+  if (addr_format)
+    free(addr_format);
+  if (data_format)
+    free(data_format);
+  //delete read_locs;
+  //delete write_locs;
+}
+
+int
+cl_mem::init(void)
+{
+  t_addr i;
+
+  addr_format= (char *)malloc(10);
+  sprintf(addr_format, "0x%%0%dx",
+         size-1<=0xf?1:
+         (size-1<=0xff?2:
+          (size-1<=0xfff?3:
+           (size-1<=0xffff?4:
+            (size-1<=0xfffff?5:
+             (size-1<=0xffffff?6:12))))));
+  data_format= (char *)malloc(10);
+  sprintf(data_format, "%%0%dx", width/4+((width%4)?1:0));
+
+  for (i= 0; i < size; i++)
+    set(i, (type==MEM_ROM)?(-1):0);
+  return(0);
+}
+
+char *
+cl_mem::id_string(void)
+{
+  char *s= get_id_string(mem_ids, type);
+
+  return(s?s:(char*)"NONE");
+}
+
+t_mem
+cl_mem::read(t_addr addr)
+{
+  //class cl_memloc *loc;
+
+  if (addr >= size)
+    {
+      //FIXME
+      fprintf(stderr, "Address 0x%06"_A_"x is over 0x%06"_A_"x\n", addr, size);
+      return(0);
+    }
+  /*if ((loc= read_locs->get_loc(addr)))
+    return(loc->read(this));*/
+  if (width <= 8)
+    return((((TYPE_UBYTE*)mem)[addr])&mask);
+  else if (width <= 16)
+    return((((TYPE_UWORD*)mem)[addr])&mask);
+  else
+    return((((TYPE_UDWORD*)mem)[addr])&mask);
+}
+
+t_mem
+cl_mem::get(t_addr addr)
+{
+  if (addr >= size)
+    return(0);
+  if (width <= 8)
+    return((((TYPE_UBYTE*)mem)[addr])&mask);
+  else if (width <= 16)
+    return((((TYPE_UWORD*)mem)[addr])&mask);
+  else
+    return((((TYPE_UDWORD*)mem)[addr])&mask);
+}
+
+
+/*
+ * Modify memory location
+ */
+
+/* Write calls callbacks of HW elements */
+
+t_mem
+cl_mem::write(t_addr addr, t_mem val)
+{
+  /*  class cl_memloc *loc;
+
+  if (addr >= size)
+    return;
+  if ((loc= write_locs->get_loc(addr)))
+    loc->write(this, addr, val);
+  if (width <= 8)
+    ((TYPE_UBYTE*)mem)[addr]= (*val)&mask;
+  else if (width <= 16)
+    ((TYPE_UWORD*)mem)[addr]= (*val)&mask;
+  else
+  ((TYPE_UDWORD*)mem)[addr]= (*val)&mask;*/
+  fprintf(stderr, "FIXME cl_mem::write(0x%06"_A_"x, 0x%04"_M_"x)\n",
+         addr, val);
+  return(0);
+}
+
+/* Set doesn't call callbacks */
+
+void
+cl_mem::set(t_addr addr, t_mem val)
+{
+  if (addr >= size)
+    return;
+  if (width <= 8)
+    ((TYPE_UBYTE*)mem)[addr]= val&mask;
+  else if (width <= 16)
+    ((TYPE_UWORD*)mem)[addr]= val&mask;
+  else
+    ((TYPE_UDWORD*)mem)[addr]= val&mask;
+}
+
+t_mem
+cl_mem::add(t_addr addr, long what)
+{
+  if (addr >= size)
+    return(0);
+  if (width <= 8)
+    {
+      ((TYPE_UBYTE*)mem)[addr]= ((TYPE_UBYTE*)mem)[addr] + what;
+      return(((TYPE_UBYTE*)mem)[addr]);
+    }
+  else if (width <= 16)
+    {
+      ((TYPE_UWORD*)mem)[addr]= ((TYPE_UWORD*)mem)[addr] + what;
+      return(((TYPE_UWORD*)mem)[addr]);
+    }
+  else
+    {
+      ((TYPE_UDWORD*)mem)[addr]= ((TYPE_UDWORD*)mem)[addr] + what;
+      return(((TYPE_UDWORD*)mem)[addr]);
+    }
+}
+
+t_addr
+cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con)
+{
+  int i;
+
+  while ((start <= stop) &&
+        (start < size))
+    {
+      con->dd_printf(addr_format, start); con->dd_printf(" ");
+      for (i= 0;
+          (i < bpl) &&
+            (start+i < size) &&
+            (start+i <= stop);
+          i++)
+       {
+         con->dd_printf(data_format, /*read*/get(start+i)); con->dd_printf(" ");
+       }
+      while (i < bpl)
+       {
+         int j;
+         j= width/4 + ((width%4)?1:0) + 1;
+         while (j)
+           {
+             con->dd_printf(" ");
+             j--;
+           }
+         i++;
+       }
+      for (i= 0; (i < bpl) &&
+            (start+i < size) &&
+            (start+i <= stop);
+          i++)
+       {
+         long c= get(start+i);
+         con->dd_printf("%c", isprint(255&c)?(255&c):'.');
+         if (width > 8)
+           con->dd_printf("%c", isprint(255&(c>>8))?(255&(c>>8)):'.');
+         if (width > 16)
+           con->dd_printf("%c", isprint(255&(c>>16))?(255&(c>>16)):'.');
+         if (width > 24)
+           con->dd_printf("%c", isprint(255&(c>>24))?(255&(c>>24)):'.');
+       }
+      con->dd_printf("\n");
+      dump_finished= start+i;
+      start+= bpl;
+    }
+  return(dump_finished);
+}
+
+t_addr
+cl_mem::dump(class cl_console *con)
+{
+  return(dump(dump_finished, dump_finished+10*8-1, 8, con));
+}
+
+
+
+/*
+ */
+/*
+cl_mapped_cell::cl_mapped_cell(class cl_cell *realcell)
+{
+  real_cell= realcell;
+}
+
+cl_mapped_cell::~cl_mapped_cell(void)
+{}
+
+t_mem
+cl_mapped_cell::read(void)
+{
+  return(real_cell->read());
+}
+
+t_mem
+cl_mapped_cell::read(enum hw_cath skip)
+{
+  return(real_cell->read(skip));
+}
+
+t_mem
+cl_mapped_cell::get(void)
+{
+  return(real_cell->get());
+}
+
+t_mem
+cl_mapped_cell::write(t_mem val)
+{
+  return(real_cell->write(val));
+}
+
+t_mem
+cl_mapped_cell::set(t_mem val)
+{
+  return(real_cell->set(val));
+}
+
+t_mem
+cl_mapped_cell::add(long what)
+{
+  return(real_cell->add(what));
+}
+
+t_mem
+cl_mapped_cell::wadd(long what)
+{
+  return(real_cell->wadd(what));
+}
+
+void
+cl_mapped_cell::set_bit1(t_mem bits)
+{
+  return(real_cell->set_bit1(bits));
+}
+
+void
+cl_mapped_cell::set_bit0(t_mem bits)
+{
+  return(real_cell->set_bit0(bits));
+}
+
+class cl_cell *
+cl_mapped_cell::add_hw(class cl_hw *hw, int *ith)
+{
+  return(real_cell->add_hw(hw, ith));
+}
+
+class cl_hw *
+cl_mapped_cell::get_hw(int ith)
+{
+  return(real_cell->get_hw(ith));
+}
+
+class cl_event_handler *
+cl_mapped_cell::get_event_handler(void)
+{
+  return(real_cell->get_event_handler());
+}
+*/
+
+/*
+ */
+
+cl_m::cl_m(enum mem_class atype, char *aclass_name, t_addr asize, int awidth,
+          class cl_uc *auc):
+  cl_memory(aclass_name, asize, awidth)
+  //cl_mem(atype, aclass_name, 0, awidth, auc)
+{
+  t_addr a;
+
+  //size= asize;
+  width= awidth;
+  set_name(aclass_name);
+  uc= auc;
+  type= atype;
+
+  array= (class cl_cell **)calloc(size, sizeof(class cl_cell *));
+  for (a= 0; a < size; a++)
+    array[a]= new cl_normal_cell(width);
+  bus_mask= 0;
+  t_addr i;
+  for (i= 1; i < size; i<<=1)
+    bus_mask= (bus_mask<<1)|1;
+  dummy= new cl_normal_cell(width);
+  //mk_cell(size, 0);
+}
+
+cl_m::~cl_m(void)
+{
+  t_addr a;
+
+  for (a= 0; a < size; a++)
+    delete array[a];
+  free(array);
+  delete dummy;
+}
+
+int
+cl_m::init(void)
+{
+  t_addr i;
+
+  cl_memory::init();
+
+  for (i= 0; i < size; i++)
+    set(i, (type==MEM_ROM)?(-1):0);
+  return(0);
+}
+
+char *
+cl_m::id_string(void)
+{
+  char *s= get_id_string(mem_ids, type);
+
+  return(s?s:(char*)"NONE");
+}
+
+/*void
+cl_m::mk_cell(t_addr addr, class cl_cell *cell)
+{
+  if (!cell)
+    cell= new cl_cell(width);
+  class cl_cell *p;
+  if (addr >= size)
+    p= dummy;
+  else
+    p= array[addr];
+  if (p == 0)
+    {
+      p= (class cl_cell *)calloc(1, sizeof(*cell));
+    }
+  else
+    {
+      p->destroy();
+      p= (class cl_cell *)realloc(p, sizeof(cell));
+    }
+  memcpy(p, cell, sizeof(*cell));
+  cell->destroy();
+  delete cell;
+}*/
+
+t_mem
+cl_m::read(t_addr addr)
+{
+  //addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      return(dummy->read());
+    }
+  return(array[addr]->read());
+}
+
+t_mem
+cl_m::read(t_addr addr, enum hw_cath skip)
+{
+  //addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      return(dummy->read(skip));
+    }
+  return(array[addr]->read(skip));
+}
+
+t_mem
+cl_m::get(t_addr addr)
+{
+  addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      return(dummy->get());
+    }
+  return(array[addr]->get());
+}
+
+t_mem
+cl_m::write(t_addr addr, t_mem val)
+{
+  //addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      return(dummy->write(val));
+    }
+  return(array[addr]->write(val));
+}
+
+void
+cl_m::set(t_addr addr, t_mem val)
+{
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      //addr&= bus_mask;
+      dummy->set(val);
+      return;
+    }
+  //addr&= bus_mask;
+  array[addr]->set(val);
+}
+
+class cl_cell *
+cl_m::get_cell(t_addr addr)
+{
+  //addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      return(dummy);
+    }
+  return(array[addr]);
+}
+
+
+/* Set or clear bits, without callbacks */
+
+void
+cl_m::set_bit1(t_addr addr, t_mem bits)
+{
+  class cl_cell *cell;
+
+  addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      cell= dummy;
+    }
+  else
+    cell= array[addr];
+  bits&= cell->get_mask();
+  cell->set(cell->get() | bits);
+}
+
+void
+cl_m::write_bit1(t_addr addr, t_mem bits)
+{
+  class cl_cell *cell;
+
+  addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      cell= dummy;
+    }
+  else
+    cell= array[addr];
+  bits&= cell->get_mask();
+  cell->write(cell->get() | bits);
+}
+
+void
+cl_m::set_bit0(t_addr addr, t_mem bits)
+{
+  class cl_cell *cell;
+
+  addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      cell= dummy;
+    }
+  else
+    cell= array[addr];
+  bits&= cell->get_mask();
+  cell->set(cell->get() & ~bits);
+}
+
+void
+cl_m::write_bit0(t_addr addr, t_mem bits)
+{
+  class cl_cell *cell;
+
+  addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      cell =dummy;
+    }
+  else
+    cell= array[addr];
+  bits&= cell->get_mask();
+  cell->write(cell->get() & ~bits);
+}
+
+t_mem
+cl_m::add(t_addr addr, long what)
+{
+  addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      return(dummy->add(what));
+    }
+  return(array[addr]->add(what));
+}
+
+t_mem
+cl_m::wadd(t_addr addr, long what)
+{
+  addr&= bus_mask;
+  if (addr >= size)
+    {
+      err_inv_addr(addr);
+      return(dummy->wadd(what));
+    }
+  return(array[addr]->wadd(what));
+}
+
+bool
+cl_m::search_next(bool case_sensitive, t_mem *array, int len, t_addr *addr)
+{
+  t_addr a;
+  int i;
+  bool found;
+
+  if (addr == NULL)
+    a= 0;
+  else
+    a= *addr;
+  
+  if (a+len > size)
+    return(DD_FALSE);
+
+  found= DD_FALSE;
+  while (!found &&
+        a+len <= size)
+    {
+      bool match= DD_TRUE;
+      for (i= 0; i < len && match; i++)
+       {
+         t_mem d1, d2;
+         d1= get(a+i);
+         d2= array[i];
+         if (!case_sensitive)
+           {
+             if (/*d1 < 128*/isalpha(d1))
+               d1= toupper(d1);
+             if (/*d2 < 128*/isalpha(d2))
+               d2= toupper(d2);
+           }
+         match= d1 == d2;
+       }
+      found= match;
+      if (!found)
+       a++;
+    }
+
+  if (addr)
+    *addr= a;
+  return(found);
+}
+
+class cl_cell *
+cl_m::register_hw(t_addr addr, class cl_hw *hw, int *ith, bool announce)
+{
+  class cl_cell *cell, *nc;
+
+  addr&= bus_mask;
+  if (addr >= size)
+    cell= dummy;
+  else
+    cell= array[addr];
+
+  if (cell->get_type() & (CELL_HW_READ | CELL_HW_WRITE))
+    {
+      /* Already registered */
+      return(cell->add_hw(hw, ith));
+    }
+  else if (cell->get_type() & (CELL_READ_BRK | CELL_WRITE_BRK))
+    {
+      /* Event break is set on it, now register hw */
+      nc= new cl_ev_reg_cell(width, uc);
+      nc->set(cell->get());
+      nc->set_type(nc->get_type() &
+                  ~(CELL_GENERAL|CELL_READ_BRK|CELL_WRITE_BRK));
+      nc->set_type(nc->get_type() | (cell->get_type() & CELL_GENERAL));
+      class cl_event_handler *eh= nc->get_event_handler();
+      if (eh)
+       nc->set_type(nc->get_type() | eh->copy_from(cell->get_event_handler()));
+      nc->add_hw(hw, ith);
+    }
+  else
+    {
+      /* Normal cell, register hw */
+      nc= new cl_registered_cell(width);
+      nc->set(cell->get());
+      nc->set_type(nc->get_type() & ~CELL_GENERAL);
+      nc->set_type(nc->get_type() | (cell->get_type() & CELL_GENERAL));
+      nc->add_hw(hw, ith);
+    }
+
+  if (addr >= size)
+    {
+      delete dummy;
+      dummy= nc;  
+    }
+  else
+    {
+      delete array[addr];
+      array[addr]= nc;
+    }
+  if (announce)
+    uc->sim->/*app->*/mem_cell_changed(this, addr);
+  return(nc);
+}
+
+void
+cl_m::set_brk(t_addr addr, class cl_brk *brk)
+{
+  class cl_cell *cell, *nc;
+  char e= '_';
+
+  addr&= bus_mask;
+  if (addr >= size)
+    cell= dummy;
+  else
+    cell= array[addr];
+
+  switch (brk->get_event())
+    {
+    case brkWRITE: case brkWXRAM: case brkWIRAM: case brkWSFR:
+      e= 'W';
+      break;
+    case brkREAD: case brkRXRAM: case brkRCODE: case brkRIRAM: case brkRSFR:
+      e= 'R';
+      break;
+    case brkNONE:
+      set_cell_flag(addr, DD_TRUE, CELL_FETCH_BRK);
+      return;
+      break;
+    default: e= '.'; break;      
+    }
+  
+  if (cell->get_type() & (CELL_HW_READ | CELL_HW_WRITE))
+    {
+      /* Hw is registered on it, now set event break */
+      nc= new cl_ev_reg_cell(width, uc);
+      nc->set(cell->get());
+      nc->set_type(nc->get_type() & ~CELL_GENERAL);
+      nc->set_type(nc->get_type() | (cell->get_type() & CELL_GENERAL));
+      int i= 0;
+      class cl_hw *hw;
+      while ((hw= cell->get_hw(i)) != 0)
+       {
+         nc->add_hw(hw, 0);
+         i++;
+       }
+      if (((class cl_registered_cell *)cell)->hardwares)
+       {
+         free(((class cl_registered_cell *)cell)->hardwares);
+         ((class cl_registered_cell *)cell)->hardwares= 0;
+       }
+      class cl_event_handler *eh;
+      if ((eh= nc->get_event_handler()))
+       nc->set_type(nc->get_type() | eh->add_bp(brk));
+    }
+  else if (cell->get_type() & (CELL_READ_BRK | CELL_WRITE_BRK))
+    {
+      /* Break is already set on it */
+      class cl_event_handler *eh;
+      if ((eh= cell->get_event_handler()))
+       cell->set_type(cell->get_type() | eh->add_bp(brk));
+      return;
+    }
+  else
+    {
+      /* Normal cell, set event break */
+      nc= new cl_event_cell(width, uc);
+      nc->set(cell->get());
+      nc->set_type(nc->get_type() & ~CELL_GENERAL);
+      nc->set_type(nc->get_type() | (cell->get_type() & CELL_GENERAL));
+      class cl_event_handler *eh;
+      if ((eh= nc->get_event_handler()))
+       nc->set_type(nc->get_type() | eh->add_bp(brk));
+    }
+
+  if (addr >= size)
+    {
+      delete dummy;
+      dummy= nc;
+    }
+  else
+    {
+      delete array[addr];
+      array[addr]= nc;
+    }
+  uc->sim->/*app->*/mem_cell_changed(this, addr);
+}
+
+void
+cl_m::del_brk(t_addr addr, class cl_brk *brk)
+{
+  class cl_cell *cell, *nc;
+  char e= '_';
+
+  addr&= bus_mask;
+  if (addr >= size)
+    cell= dummy;
+  else
+    cell= array[addr];
+
+  switch (brk->get_event())
+    {
+    case brkWRITE: case brkWXRAM: case brkWIRAM: case brkWSFR: e= 'W'; break;
+    case brkREAD: case brkRXRAM: case brkRCODE: case brkRIRAM: case brkRSFR:
+      e= 'R';
+      break;
+    case brkNONE:
+      set_cell_flag(addr, DD_FALSE, CELL_FETCH_BRK);
+      return;
+      break;
+    default: e= '.'; break;
+    }
+  
+  if (cell->get_type() & (CELL_HW_READ | CELL_HW_WRITE))
+    {
+      /* Hw is registered on it, delete event break */
+      class cl_event_handler *eh;
+      int t= CELL_NORMAL;
+      if ((eh= cell->get_event_handler()))
+       t= eh->del_bp(brk);
+      if (t & (CELL_READ_BRK|CELL_WRITE_BRK))
+       {
+         cell->set_type(cell->get_type() & ~(CELL_READ_BRK|CELL_WRITE_BRK));
+         cell->set_type(cell->get_type() | t);
+         return;
+       }
+      nc= new cl_registered_cell(width);
+      nc->set(cell->get());
+      nc->set_type(cell->get_type() & ~CELL_GENERAL);
+      nc->set_type(cell->get_type() | (cell->get_type() & CELL_GENERAL));
+      int i= 0;
+      class cl_hw *hw;
+      while ((hw= cell->get_hw(i)) != 0)
+       {
+         nc->add_hw(hw, 0);
+         i++;
+       }
+      if (((class cl_registered_cell *)cell)->hardwares)
+       free(((class cl_registered_cell *)cell)->hardwares);
+    }
+  else if (cell->get_type() & (CELL_READ_BRK | CELL_WRITE_BRK))
+    {
+      /* Break already set on it, delete brk */
+      class cl_event_handler *eh;
+      int t= CELL_NORMAL;
+      if ((eh= cell->get_event_handler()))
+       t= eh->del_bp(brk);
+      if (t & (CELL_READ_BRK|CELL_WRITE_BRK))
+       {
+         cell->set_type(cell->get_type() & ~(CELL_READ_BRK|CELL_WRITE_BRK));
+         cell->set_type(cell->get_type() | t);
+         return;
+       }
+      nc= new cl_normal_cell(width);
+      nc->set(cell->get());
+      nc->set_type(cell->get_type() & ~CELL_GENERAL);
+      nc->set_type(cell->get_type() | (cell->get_type() & CELL_GENERAL));
+      return;
+    }
+  else
+    {
+      /* Normal cell */
+      return;
+    }
+
+  if (addr >= size)
+    {
+      delete dummy;
+      dummy= nc;
+    }
+  else
+    {
+      delete array[addr];
+      array[addr]= nc;
+    }
+  uc->sim->/*app->*/mem_cell_changed(this, addr);
+}
+
+
+#ifdef STATISTIC
+unsigned long
+cl_m::get_nuof_reads(void)
+{
+  unsigned long res= 0;
+  t_addr i;
+  for (i= 0; i < size; i++)
+    res+= array[i]->nuof_reads;
+  return(res);
+}
+
+unsigned long
+cl_m::get_nuof_writes(void)
+{
+  unsigned long res= 0;
+  t_addr i;
+  for (i= 0; i < size; i++)
+    res+= array[i]->nuof_writes;
+  return(res);
+}
+
+void
+cl_m::set_nuof_reads(unsigned long value)
+{
+  t_addr i;
+  for (i= 0; i < size; i++)
+    array[i]->nuof_reads= value;
+  dummy->nuof_reads= value;
+}
+
+void
+cl_m::set_nuof_writes(unsigned long value)
+{
+  t_addr i;
+  for (i= 0; i < size; i++)
+    array[i]->nuof_writes= value;
+  dummy->nuof_writes= value;
+}
+#endif
+
+
+cl_normal_cell::cl_normal_cell(uchar awidth):
+  cl_cell()
+{
+  type= CELL_NORMAL;
+  data= 0;
+  mask= 1;
+  width= awidth;
+  for (--awidth; awidth; awidth--)
+    {
+      mask<<= 1;
+      mask|= 1;
+    }
+}
+
+t_mem
+cl_normal_cell::add(long what)
+{
+  t_mem d;
+  
+  if (width <= 8)
+    d= TYPE_BYTE(data) + what;
+  else if (width <= 16)
+    d= TYPE_WORD(data) + what;
+  else
+    d= TYPE_DWORD(data) + what;
+  return(data= d & mask);
+}
+
+t_mem
+cl_normal_cell::wadd(long what)
+{
+  t_mem d;
+  
+  if (width <= 8)
+    d= TYPE_BYTE(data) + what;
+  else if (width <= 16)
+    d= TYPE_WORD(data) + what;
+  else
+    d= TYPE_DWORD(data) + what;
+  return(write(d));
+}
+
+void
+cl_normal_cell::set_bit1(t_mem bits)
+{
+  bits&= mask;
+  data|= bits;
+}
+
+void
+cl_normal_cell::set_bit0(t_mem bits)
+{
+  bits&= mask;
+  data&= ~bits;
+}
+
+
+/*
+ */
+
+cl_registered_cell::cl_registered_cell(uchar awidth):
+  cl_normal_cell(awidth)
+{
+  type= CELL_HW_READ | CELL_HW_WRITE;
+  //hws= new cl_list(1, 1);
+  hardwares= 0;
+  nuof_hws= 0;
+}
+
+cl_registered_cell::~cl_registered_cell(void)
+{
+  if (hardwares)
+    free(hardwares);
+}
+
+/*void
+cl_registered_cell::destroy(void)
+{
+  hardwares= 0;
+  nuof_hws= 0;
+}*/
+
+t_mem
+cl_registered_cell::read(void)
+{
+  int i;
+  t_mem d= data;
+
+  if (nuof_hws)
+    for (i= 0; i < nuof_hws; i++)
+      {
+       d= hardwares[i]->read(this);
+       ;
+      }
+#ifdef STATISTIC
+  nuof_reads++;
+#endif
+  return(d & mask);
+}
+
+t_mem
+cl_registered_cell::read(enum hw_cath skip)
+{
+  int i;
+  t_mem d= data;
+
+  if (nuof_hws)
+    for (i= 0; i < nuof_hws; i++)
+      {
+       if ((skip & hardwares[i]->cathegory) == 0)
+         d= hardwares[i]->read(this);
+       ;
+      }
+#ifdef STATISTIC
+  nuof_reads++;
+#endif
+  return(d & mask);
+}
+
+t_mem
+cl_registered_cell::write(t_mem val)
+{
+  int i;
+
+  val&= mask;
+  if (nuof_hws)
+    for (i= 0; i < nuof_hws; i++)
+      {
+       hardwares[i]->write(this, &val);
+       ;
+      }
+#ifdef STATISTIC
+  nuof_writes++;
+#endif
+  return(data= val & mask);
+}
+
+class cl_cell *
+cl_registered_cell::add_hw(class cl_hw *hw, int *ith)
+{
+  if (!hw)
+    {
+      /* Whatta hell!? */
+      return(0);
+    }
+  if (!hardwares)
+    hardwares= (class cl_hw **)malloc(sizeof(class cl_hw *));
+  else
+    hardwares= (class cl_hw **)realloc(hardwares,
+                                      sizeof(class c_hw *) * (nuof_hws+1));
+  hardwares[nuof_hws]= hw;
+  nuof_hws++;
+  if (ith)
+    *ith= nuof_hws-1;
+  return(this);
+}
+
+class cl_hw *
+cl_registered_cell::get_hw(int ith)
+{
+  if (ith >= nuof_hws)
+    return(0);
+  return(hardwares[ith]);
+}
+
+
+/*
+ */
+
+cl_event_cell::cl_event_cell(uchar awidth, class cl_uc *auc):
+  cl_normal_cell(awidth)
+{
+  eh= new cl_event_handler(auc);
+}
+
+cl_event_cell::~cl_event_cell(void)
+{
+  delete eh;
+}
+
+t_mem
+cl_event_cell::read(void)
+{
+  if (type & CELL_READ_BRK)
+    eh->read();
+  return(cl_normal_cell::read());
+}
+
+t_mem
+cl_event_cell::write(t_mem val)
+{
+  if (type & CELL_WRITE_BRK)
+    eh->write();
+  return(cl_normal_cell::write(val));
+}
+
+
+/*
+ */
+
+cl_ev_reg_cell::cl_ev_reg_cell(uchar awidth, class cl_uc *auc):
+  cl_registered_cell(awidth)
+{
+  eh= new cl_event_handler(auc);
+}
+
+cl_ev_reg_cell::~cl_ev_reg_cell(void)
+{}
+
+t_mem
+cl_ev_reg_cell::read(void)
+{
+  if (type & CELL_READ_BRK)
+    eh->read();
+  return(cl_registered_cell::read());
+}
+
+t_mem
+cl_ev_reg_cell::write(t_mem val)
+{
+  if (type & CELL_WRITE_BRK)
+    eh->write();
+  return(cl_registered_cell::write(val));
+}
+
+
+/*
+ */
+
+cl_event_handler::cl_event_handler(class cl_uc *auc):
+  cl_base()
+{
+  uc= auc;
+  read_bps= new cl_list(1, 1);
+  write_bps= new cl_list(1, 1);
+}
+
+cl_event_handler::~cl_event_handler(void)
+{
+  read_bps->disconn_all();
+  write_bps->disconn_all();
+  delete read_bps;
+  delete write_bps;
+}
+
+void
+cl_event_handler::write(void)
+{
+  int i;
+
+  for (i= 0; i < write_bps->count; i++)
+    {
+      class cl_brk *bp= (class cl_brk *)(write_bps->at(i));
+      uc->events->add(bp);
+    }
+}
+
+void
+cl_event_handler::read(void)
+{
+  int i;
+
+  for (i= 0; i < read_bps->count; i++)
+    {
+      class cl_brk *bp= (class cl_brk *)(read_bps->at(i));
+      uc->events->add(bp);
+    }
+}
+
+int
+cl_event_handler::add_bp(class cl_brk *bp)
+{
+  int t= CELL_NORMAL;
+
+  if (!bp)
+    return(CELL_NORMAL);
+  switch (bp->get_event())
+    {
+    case brkWRITE: case brkWXRAM: case brkWIRAM: case brkWSFR:
+      t|= CELL_WRITE_BRK;
+      write_bps->add(bp);
+      break;
+    case brkREAD: case brkRXRAM: case brkRCODE: case brkRIRAM: case brkRSFR:
+      t|= CELL_READ_BRK;
+      read_bps->add(bp);
+      break;
+    default:
+      t|= CELL_READ_BRK | CELL_WRITE_BRK;
+      read_bps->add(bp);
+      write_bps->add(bp);
+      break;
+    }
+  return(t);
+}
+
+int
+cl_event_handler::copy_from(class cl_event_handler *eh)
+{
+  int i, t= CELL_NORMAL;
+  
+  if (!eh)
+    return(t);
+  for (i= 0; i < eh->read_bps->count; i++)
+    {
+      class cl_brk *bp= (class cl_brk *)(eh->read_bps->at(i));
+      t|= add_bp(bp);
+    }
+  for (i= 0; i < eh->write_bps->count; i++)
+    {
+      class cl_brk *bp= (class cl_brk *)(eh->write_bps->at(i));
+      t|= add_bp(bp);
+    }
+  return(t);
+}
+
+int
+cl_event_handler::del_bp(class cl_brk *bp)
+{
+  int t= CELL_NORMAL;
+
+  write_bps->disconn(bp);
+  read_bps->disconn(bp);
+  if (write_bps->count)
+    t|= CELL_WRITE_BRK;
+  if (read_bps->count)
+    t|= CELL_READ_BRK;
+  return(t);
+}
+
+
diff --git a/sim/ucsim/sim.src/obsolete.h b/sim/ucsim/sim.src/obsolete.h
new file mode 100644 (file)
index 0000000..0acc1d1
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+class cl_mem: public cl_guiobj
+{
+public:
+  char *addr_format, *data_format;
+  ulong mask;
+  enum mem_class type;
+  char *class_name;
+  union {
+    void *mem;
+    uchar *umem8;
+  };
+  //class cl_memloc_coll *read_locs, *write_locs;
+  t_addr size;
+  int width; // in bits
+  class cl_uc *uc;
+  t_addr dump_finished;
+
+public:
+  cl_mem(enum mem_class atype, char *aclass_name, t_addr asize, int awidth,
+        class cl_uc *auc);
+  virtual ~cl_mem(void);
+  virtual int init(void);
+  virtual char *id_string(void);
+  virtual int get_cell_flag(t_addr //addr
+                           ) { return(CELL_NORMAL); }
+  virtual bool get_cell_flag(t_addr //addr
+                            , int //flag
+                            )
+  { return(DD_FALSE); }
+  virtual void set_cell_flag(t_addr addr, bool set_to, int flag) {}
+
+  virtual t_mem read(t_addr addr);
+  virtual t_mem read(t_addr addr, enum hw_cath //skip
+                    ) {return(read(addr));}
+  virtual t_mem get(t_addr addr);
+  virtual t_mem write(t_addr addr, t_mem val);
+  virtual void set(t_addr addr, t_mem val);
+  virtual void set_bit1(t_addr addr, t_mem bits);
+  virtual void set_bit0(t_addr addr, t_mem bits);
+  virtual void write_bit1(t_addr addr, t_mem bits) { set_bit1(addr, bits); }
+  virtual void write_bit0(t_addr addr, t_mem bits) { set_bit0(addr, bits); }
+  virtual t_mem add(t_addr addr, long what);
+  virtual t_mem wadd(t_addr addr, long what) { return(add(addr, what)); }
+  virtual t_addr dump(t_addr start, t_addr stop, int bpl,
+                     class cl_console *con);
+  virtual t_addr dump(class cl_console *con);
+  virtual bool search_next(bool case_sensitive,
+                          t_mem *array, int len, t_addr *addr);
+
+  virtual class cl_cell *get_cell(t_addr addr) {return(0);}
+  virtual class cl_cell *register_hw(t_addr addr, class cl_hw *hw, int *ith,
+                                    bool announce)
+  { return(0); }
+  virtual void set_brk(t_addr //addr
+                      , class cl_brk *//brk
+                      ) {}
+  virtual void del_brk(t_addr addr, class cl_brk *brk) {}
+#ifdef STATISTIC
+  virtual unsigned long get_nuof_reads(void) {return(0);}
+  virtual unsigned long get_nuof_writes(void) {return(0);}
+  virtual void set_nuof_reads(unsigned long value) {}
+  virtual void set_nuof_writes(unsigned long value) {}
+#endif
+};
+*/
+
+/*
+class cl_mapped_cell: public cl_cell
+{
+protected:
+  class cl_cell *real_cell;
+public:
+  cl_mapped_cell(class cl_cell *realcell);
+  virtual ~cl_mapped_cell(void);
+
+  virtual t_mem read(void);
+  virtual t_mem read(enum hw_cath skip);
+  virtual t_mem get(void);
+  virtual t_mem write(t_mem val);
+  virtual t_mem set(t_mem val);
+  virtual t_mem add(long what);
+  virtual t_mem wadd(long what);
+
+  virtual void set_bit1(t_mem bits);
+  virtual void set_bit0(t_mem bits);
+
+  virtual class cl_cell *add_hw(class cl_hw *hw, int *ith);
+  virtual class cl_hw *get_hw(int ith);
+  virtual class cl_event_handler *get_event_handler(void);
+};
+*/
+
+
+class cl_m: public cl_memory
+{
+protected:
+  class cl_cell **array;
+  class cl_cell *dummy;
+  t_addr bus_mask;
+public:
+  //t_addr size;
+  enum mem_class type;
+
+public:
+  cl_m(enum mem_class atype, char *aclass_name, t_addr asize, int awidth,
+       class cl_uc *auc);
+  cl_m(t_addr asize, int awidth);
+  virtual ~cl_m(void);
+  virtual int init(void);
+  virtual char *id_string(void);
+
+  virtual int get_cell_flag(t_addr addr);
+  virtual bool get_cell_flag(t_addr addr, int flag);
+  virtual void set_cell_flag(t_addr addr, bool set_to, int flag);
+
+  virtual t_mem read(t_addr addr);
+  virtual t_mem read(t_addr addr, enum hw_cath skip);
+  virtual t_mem get(t_addr addr);
+  virtual t_mem write(t_addr addr, t_mem val);
+  virtual void set(t_addr addr, t_mem val);
+  virtual class cl_cell *get_cell(t_addr addr);
+
+  virtual void set_bit1(t_addr addr, t_mem bits);
+  virtual void set_bit0(t_addr addr, t_mem bits);
+  virtual void write_bit1(t_addr addr, t_mem bits);
+  virtual void write_bit0(t_addr addr, t_mem bits);
+  virtual t_mem add(t_addr addr, long what);
+  virtual t_mem wadd(t_addr addr, long what);
+
+  virtual bool search_next(bool case_sensitive,
+                          t_mem *array, int len, t_addr *addr);
+
+  virtual class cl_cell *register_hw(t_addr addr, class cl_hw *hw, int *ith,
+                                    bool announce);
+  virtual void set_brk(t_addr addr, class cl_brk *brk);
+  virtual void del_brk(t_addr addr, class cl_brk *brk);
+
+#ifdef STATISTIC
+  virtual unsigned long get_nuof_reads(void);
+  virtual unsigned long get_nuof_writes(void);
+  virtual void set_nuof_reads(unsigned long value);
+  virtual void set_nuof_writes(unsigned long value);
+#endif
+};
+
+
+class cl_normal_cell: public cl_cell
+{
+public:
+  t_mem data;
+  TYPE_UBYTE type;     // See CELL_XXXX
+  //protected:
+
+public:
+  cl_normal_cell(uchar awidth);
+  //virtual void destroy(void) {}
+
+  virtual TYPE_UBYTE get_type(void) { return(type); }
+  virtual void set_type(TYPE_UBYTE what) { type= what; }
+
+  virtual t_mem read(void) {
+#ifdef STATISTIC
+    nuof_reads++;
+#endif
+    return(data);
+  }
+  virtual t_mem read(enum hw_cath skip) { return(data); }
+  virtual t_mem get(void)  { return(data); }
+  virtual t_mem write(t_mem val) {
+    data= val & mask;
+#ifdef STATISTIC
+    nuof_writes++;
+#endif
+    return(data);
+  }
+  virtual t_mem set(t_mem val) { return(data= val & mask); }
+  virtual t_mem add(long what);
+  virtual t_mem wadd(long what);
+
+  virtual void set_bit1(t_mem bits);
+  virtual void set_bit0(t_mem bits);
+
+  virtual class cl_cell *add_hw(class cl_hw *hw, int *ith)
+  { return(0); }
+  virtual class cl_hw *get_hw(int ith) { return(0); }
+  //virtual class cl_brk *get_brk(void) { return(0); }
+  virtual class cl_event_handler *get_event_handler(void) { return(0); }
+};
+
+class cl_registered_cell: public cl_memory_cell
+{
+public:
+  //class cl_list *hws;
+  class cl_hw **hardwares;
+  int nuof_hws;
+public:
+  cl_registered_cell(uchar awidth);
+  virtual ~cl_registered_cell(void);
+  //virtual void destroy(void);
+
+  virtual t_mem read(void);
+  virtual t_mem read(enum hw_cath skip);
+  virtual t_mem write(t_mem val);
+
+  virtual class cl_cell *add_hw(class cl_hw *hw, int *ith);
+  virtual class cl_hw *get_hw(int ith);
+};
+
+class cl_event_cell: public cl_normal_cell
+{
+protected:
+  class cl_event_handler *eh;
+public:
+  cl_event_cell(uchar awidth, class cl_uc *auc);
+  virtual ~cl_event_cell(void);
+
+  virtual t_mem read(void);
+  virtual t_mem write(t_mem val);
+  //virtual void event(void);
+
+  //virtual class cl_brk *get_brk(void) { return(brk); }
+  virtual class cl_event_handler *get_event_handler(void) { return(eh); }
+};
+
+class cl_ev_reg_cell: public cl_registered_cell
+{
+protected:
+  class cl_event_handler *eh;
+public:
+  cl_ev_reg_cell(uchar awidth, class cl_uc *auc);
+  virtual ~cl_ev_reg_cell(void);
+  virtual t_mem read(void);
+  virtual t_mem write(t_mem val);
+  //virtual void event(void);
+  
+  //virtual class cl_brk *get_brk(void) { return(brk); }
+  virtual class cl_event_handler *get_event_handler(void) { return(eh); }
+};
+
+/*
+ * 2nd version memory system
+ */
+class cl_cell: public cl_base
+{
+public:
+  cl_cell(void);
+public:
+
+  virtual t_mem read(void)= 0;
+  virtual t_mem read(enum hw_cath skip)=0;
+  virtual t_mem get(void)=0;
+  virtual t_mem write(t_mem val)=0;
+  virtual t_mem set(t_mem val)=0;
+  virtual t_mem add(long what)=0;
+  virtual t_mem wadd(long what)=0;
+
+  virtual void set_bit1(t_mem bits)=0;
+  virtual void set_bit0(t_mem bits)=0;
+
+  virtual class cl_cell *add_hw(class cl_hw *hw, int *ith)=0;
+  virtual class cl_hw *get_hw(int ith)=0;
+  virtual class cl_event_handler *get_event_handler(void)=0;
+};
+
+/*
+ */
+class cl_event_handler: public cl_base
+{
+public:
+  class cl_list *read_bps, *write_bps;
+  class cl_uc *uc;
+public:
+  cl_event_handler(class cl_uc *auc);
+  virtual ~cl_event_handler(void);
+
+  virtual void write(void);
+  virtual void read(void);
+
+  virtual int add_bp(class cl_brk *bp);
+  virtual int copy_from(class cl_event_handler *eh);
+  virtual bool del_bp(class cl_brk *bp);
+};
+
+