version 0.2.39: fix of arith insts and start of re-structure
authordrdani <drdani@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 2 Apr 2001 13:08:48 +0000 (13:08 +0000)
committerdrdani <drdani@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 2 Apr 2001 13:08:48 +0000 (13:08 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@725 4a8a32a2-be11-0410-ad9d-d568d2c75423

125 files changed:
sim/ucsim/.version
sim/ucsim/Makefile
sim/ucsim/README
sim/ucsim/avr.src/Makefile.in
sim/ucsim/avr.src/avr.cc
sim/ucsim/avr.src/avrcl.h
sim/ucsim/avr.src/clean.mk
sim/ucsim/avr.src/glob.cc
sim/ucsim/avr.src/savr.cc
sim/ucsim/clean.mk
sim/ucsim/cmd.src/Makefile.in
sim/ucsim/cmd.src/bp.cc
sim/ucsim/cmd.src/bpcl.h [new file with mode: 0644]
sim/ucsim/cmd.src/cmdconf.cc [new file with mode: 0644]
sim/ucsim/cmd.src/cmdconfcl.h [new file with mode: 0644]
sim/ucsim/cmd.src/cmdgui.cc [new file with mode: 0644]
sim/ucsim/cmd.src/cmdguicl.h [new file with mode: 0644]
sim/ucsim/cmd.src/cmdset.cc
sim/ucsim/cmd.src/cmdsetcl.h
sim/ucsim/cmd.src/cmdutil.cc
sim/ucsim/cmd.src/get.cc
sim/ucsim/cmd.src/getcl.h [new file with mode: 0644]
sim/ucsim/cmd.src/info.cc
sim/ucsim/cmd.src/infocl.h
sim/ucsim/cmd.src/newcmd.cc
sim/ucsim/cmd.src/newcmdcl.h
sim/ucsim/cmd.src/set.cc
sim/ucsim/cmd.src/setcl.h [new file with mode: 0644]
sim/ucsim/cmd.src/show.cc [new file with mode: 0644]
sim/ucsim/cmd.src/showcl.h [new file with mode: 0644]
sim/ucsim/cmd.src/timer.cc
sim/ucsim/conf.mk
sim/ucsim/configure
sim/ucsim/configure.in
sim/ucsim/ddconfig_in.h
sim/ucsim/doc/cmd.html
sim/ucsim/doc/cmd_bp.html
sim/ucsim/doc/cmd_dump.html
sim/ucsim/doc/cmd_exec.html
sim/ucsim/doc/cmd_general.html
sim/ucsim/doc/cmd_removed.html [new file with mode: 0644]
sim/ucsim/doc/cmd_set.html
sim/ucsim/doc/index.html
sim/ucsim/doc/invoke.html
sim/ucsim/doc/syntax.html [new file with mode: 0644]
sim/ucsim/globals.cc
sim/ucsim/globals.h
sim/ucsim/gui.src/Makefile.in
sim/ucsim/gui.src/clean.mk
sim/ucsim/gui.src/gui.cc [new file with mode: 0644]
sim/ucsim/gui.src/guicl.h [new file with mode: 0644]
sim/ucsim/gui.src/if.cc [new file with mode: 0644]
sim/ucsim/gui.src/ifcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/a.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/app.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/appcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/bg.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/bgcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/desk.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/deskcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/event.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/eventcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/frame.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/framecl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/group.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/groupcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/label.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/labelcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/palette.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/(c).1 [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/Makefile.in [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/clean.mk [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/conf.mk [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/pmapp.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/pmappcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/port.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/portcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/portmon.src/portmon.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/view.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/viewcl.h [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/win.cc [new file with mode: 0644]
sim/ucsim/gui.src/obsolete/wincl.h [new file with mode: 0644]
sim/ucsim/gui.src/rec.cc [new file with mode: 0644]
sim/ucsim/gui.src/reccl.h [new file with mode: 0644]
sim/ucsim/main_in.mk
sim/ucsim/pobj.cc
sim/ucsim/s51.src/Makefile.in
sim/ucsim/s51.src/arith.cc
sim/ucsim/s51.src/jmp.cc
sim/ucsim/s51.src/mov.cc
sim/ucsim/s51.src/s51.cc
sim/ucsim/s51.src/sim51.cc
sim/ucsim/s51.src/sim51cl.h
sim/ucsim/s51.src/uc51.cc
sim/ucsim/s51.src/uc51cl.h
sim/ucsim/s51.src/uc51r.cc
sim/ucsim/s51.src/uc52.cc
sim/ucsim/s51.src/uc89c51r.cc
sim/ucsim/sim.src/Makefile.in
sim/ucsim/sim.src/app.cc [new file with mode: 0644]
sim/ucsim/sim.src/appcl.h [new file with mode: 0644]
sim/ucsim/sim.src/arg.cc
sim/ucsim/sim.src/argcl.h
sim/ucsim/sim.src/brk.cc
sim/ucsim/sim.src/brkcl.h
sim/ucsim/sim.src/guiobj.cc [new file with mode: 0644]
sim/ucsim/sim.src/guiobjcl.h [new file with mode: 0644]
sim/ucsim/sim.src/hw.cc
sim/ucsim/sim.src/hwcl.h
sim/ucsim/sim.src/itsrccl.h
sim/ucsim/sim.src/mem.cc
sim/ucsim/sim.src/memcl.h
sim/ucsim/sim.src/optioncl.h
sim/ucsim/sim.src/sim.cc
sim/ucsim/sim.src/simcl.h
sim/ucsim/sim.src/stackcl.h
sim/ucsim/sim.src/uc.cc
sim/ucsim/sim.src/uccl.h
sim/ucsim/stypes.h
sim/ucsim/utils.cc
sim/ucsim/utils.h
sim/ucsim/z80.src/Makefile.in
sim/ucsim/z80.src/sz80.cc
sim/ucsim/z80.src/z80.cc
sim/ucsim/z80.src/z80cl.h

index 4381ddad7a48f443c246918459a2c302dadc2450..12ebfcf73fa86cc610dbf941477ba520f4b5a9dd 100644 (file)
@@ -1 +1 @@
-0.2.38-pre1
+0.2.39
index 8426e47e14f466fa2f6355c777eeac3fdee32b92..d59300c1053b3edb8ce5edc062b462dbc13af477 100644 (file)
@@ -9,15 +9,14 @@ STARTYEAR     = 1997
 SHELL          = /bin/sh
 
 PRJDIR         = .
-PKGS           = cmd.src sim.src s51.src avr.src z80.src doc
-#gui.src
+PKGS           = cmd.src sim.src gui.src s51.src avr.src z80.src doc
 
 srcdir          = .
 
 
 # Compiling entire program or any subproject
 # ------------------------------------------
-all: main.mk
+all: checkconf
        $(MAKE) -f main.mk all
        @for pkg in $(PKGS); do\
          cd $$pkg && $(MAKE) $$pkg ; cd ..;\
@@ -151,22 +150,29 @@ lines:
 # Remaking configuration
 # ----------------------
 configure: configure.in
-       $(SHELL) autoconf
-
-main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in config.status
-       $(SHELL) ./config.status
+       @echo "RE-CREATING CONFIGURE"
+       $(SHELL) autoconf configure.in >configure
+       chmod 755 configure
 
 config.status: configure
-       $(SHELL) ./config.status --recheck
+       @echo "RE-CHECKING CONFIGURATION"
+       ./config.status -recheck
+
+makefiles: config.status
+       @echo "RE-MAKING MAKEFILES"
+       $(SHELL) ./config.status
 
-makefiles:
+main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in
+       @echo "RE-MAKING MAIN.MK"
        $(SHELL) ./config.status
 
-freshconf: main.mk
+freshconf: echo_freshconf configure main.mk
+
+echo_freshconf:
+       @echo "FRESHCONF"
 
 checkconf:
-       @if [ -f devel ]; then\
-         $(MAKE) freshconf;\
-       fi
+       @echo "CHECKCONF"
+       @if [ -f devel ]; then $(MAKE) freshconf; fi
 
 # End of Makefile
index 390d1948d72e37f4ebe22fb9226b9f1b3cf9169d..bfbdefd54cc0ced660a1f30136ffda5bd6d9878d 100644 (file)
@@ -106,6 +106,7 @@ Timothy Hurman <ee62th@ee.surrey.ac.uk>
 Karl-Max Wagner <karlmax@oberland.net>
 Edmar Wienskoski Jr <edmar-w-jr@technologist.com>
 Alexandre Frey <Alexandre.Frey@trusted-logic.fr>
+Kaido Karner <kaido@tradenet.ee>
 
 Maintener of serialview: Timothy Hurman <ee62th@ee.surrey.ac.uk>
 Maintener of other parts: Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>
index d1cefecce866cd43ea2f048532c9a98cef962f4a..d24280a35a2cb3452856c33bd7ab5aaf8fe82c83 100644 (file)
@@ -17,12 +17,12 @@ PRJDIR              = ..
 
 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
 CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
-                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src
+                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src -I$(PRJDIR)/gui.src
 CFLAGS          = @CFLAGS@ -Wall
 CXXFLAGS        = @CXXFLAGS@ -Wall
 M_OR_MM         = @M_OR_MM@
 
-LIBS           = @LIBS@ -L$(PRJDIR) -lsim -lcmd -lutil
+LIBS           = @LIBS@ -L$(PRJDIR) -lsim -lcmd -lutil -lguiucsim
 
 prefix          = @prefix@
 exec_prefix     = @exec_prefix@
index 6e330f5bf0c2e352d6b8bc1ea04c5235b26b4a55..6e62f66aca8ac31fb9610e414c9ada6d3f412d07 100644 (file)
@@ -131,7 +131,7 @@ cl_avr::bit_tbl(void)
 }
 
 char *
-cl_avr::disass(uint addr, char *sep)
+cl_avr::disass(t_addr addr, char *sep)
 {
   char work[256], temp[20];
   char *buf, *p, *b, *t;
@@ -268,32 +268,6 @@ cl_avr::disass(uint addr, char *sep)
   return(buf);
 }
 
-void
-cl_avr::print_disass(uint addr, class cl_console *con)
-{
-  char *dis;
-  class cl_brk *b;
-  int i;
-
-  b  = fbrk_at(addr);
-  dis= disass(addr, NULL);
-  if (b)
-    con->printf("%c", (b->perm == brkFIX)?'F':'D');
-  else
-    con->printf(" ");
-  con->printf("%c %06x %04x",
-             inst_at(addr)?' ':'*',
-             addr, get_mem(MEM_ROM, addr));
-  for (i= 1; i < inst_length(get_mem(MEM_ROM, addr)); i++)
-    con->printf(" %04x", get_mem(MEM_ROM, addr+i));
-  while (i < 2)
-    {
-      con->printf("     ");
-      i++;
-    }
-  con->printf(" %s\n", dis);
-  free(dis);
-}
 
 void
 cl_avr::print_regs(class cl_console *con)
index 73e7f43f72a3cf0fc0bcf359332100d5784099e5..3572599e85bfa58fd592884b8500f9d4e4d6b272 100644 (file)
@@ -53,8 +53,7 @@ public:
   virtual struct dis_entry *dis_tbl(void);
   virtual struct name_entry *sfr_tbl(void);
   virtual struct name_entry *bit_tbl(void);
-  virtual char *disass(uint addr, char *sep);
-  virtual void print_disass(uint addr, class cl_console *con);
+  virtual char *disass(t_addr addr, char *sep);
   virtual void print_regs(class cl_console *con);
 
   virtual int exec_inst(void);
index ca50e5f47ee803412528e8fddef1419073b001c9..03429cbc66c8fc347e027fb4d6c9d3ed8d5007e1 100644 (file)
@@ -3,7 +3,7 @@
 # Deleting all files created by building the program
 # --------------------------------------------------
 clean:
-       rm -f *core *[%~] *.[oa]
+       rm -f *core *[%~] *.[oa] *.map
        rm -f .[a-z]*~
        rm -f savr
 
index 84bb4c60dc0f2ee61f824a365ab8a6ecc1520545..561275d41af84536a25e5536e5e2fd29723d18fc 100644 (file)
@@ -78,7 +78,7 @@ struct dis_entry disass_avr[]= {
   { 0xf000, 0xfc00, ' ', 1, "brbs %b,%k" },
   { 0x9408, 0xff8f, ' ', 1, "bset %s" },
   { 0xfa00, 0xfe00, ' ', 1, "bst %d,%b" },
-  { 0x940e, 0xfe0e, ' ', 2, "call %A" },
+  { 0x940e, 0xfe0e, 'l', 2, "call %A" },
   { 0x9800, 0xff00, ' ', 1, "cbi %P,%b" },
   { 0x9400, 0xfe0f, ' ', 1, "com %d" },
   { 0x1400, 0xfc00, ' ', 1, "cp %d,%r" },
index 9b3d7ca2532694abe368b450561a9aa6a21b1c75..6776fe395b23157f23340985f01ee999f37e4110 100644 (file)
@@ -35,10 +35,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 int
 main(int argc, char *argv[])
 {
-  simulator= new cl_simavr(argc, argv);
-  simulator->init();
-  simulator->main();
-  delete simulator;
+  class cl_sim *sim;
+  
+  sim= new cl_simavr(argc, argv);
+  sim->init();
+  sim->main();
+  delete sim;
   return(0);
 }
 
index 69efa57bbcd082c0a28cd11270469ca3bda0f373..26371f82db0ff28c5dc7d4fabcda431b51fa49a5 100644 (file)
@@ -1,7 +1,7 @@
 # Deleting all files created by building the program
 # --------------------------------------------------
 clean:
-       rm -f *core *[%~] *.[oa]
+       rm -f *core *[%~] *.[oa] *.so
        rm -f .[a-z]*~
 
 
index da32d8bb8ca28dc6acd1c14dfd078cb0635c3e82..89f0361d5b9da8bfaee3689265ec9d835b4a290d 100644 (file)
@@ -17,7 +17,7 @@ PRJDIR                = ..
 
 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
 CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
-                 -I$(PRJDIR)/sim.src
+                 -I$(PRJDIR)/sim.src -I$(PRJDIR)/gui.src
 CFLAGS          = @CFLAGS@ -Wall
 CXXFLAGS        = @CXXFLAGS@ -Wall
 M_OR_MM         = @M_OR_MM@
@@ -34,8 +34,8 @@ man2dir         = $(mandir)/man2
 infodir         = @infodir@
 srcdir          = @srcdir@
 
-OBJECTS                = newcmd.o cmdutil.o cmdset.o syntax.o \
-                 get.o set.o timer.o bp.o info.o
+OBJECTS                = cmdset.o newcmd.o cmdutil.o syntax.o \
+                 get.o set.o timer.o bp.o info.o show.o cmdgui.o cmdconf.o
 
 
 # Compiling entire program or any subproject
index 51c7ed68fd49a47140dc06ffab48fc6897e540d5..7318c6c8bd15186afa03f57a2d5f5e1912498ebf 100644 (file)
@@ -36,6 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 // cmd
 #include "cmdsetcl.h"
+#include "bpcl.h"
 
 
 /*
@@ -43,31 +44,64 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  */
 
 int
-cl_break_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_break_cmd::do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con)
 {
-  long addr;
-  int  hit= 1;
-  class cl_cmd_arg *params[2]= { cmdline->param(0),
-                                cmdline->param(1) };
-
-  if (params[0] == 0)
+  t_addr addr= 0;
+  int hit= 1;
+  char op;
+  class cl_mem *mem;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+
+  if (cmdline->syntax_match(sim, ADDRESS)) {
+    addr= params[0]->value.address;
+    hit= 1;
+    do_fetch(sim, addr, hit, con);
+  }
+  else if (cmdline->syntax_match(sim, ADDRESS NUMBER)) {
+    addr= params[0]->value.address;
+    hit= params[1]->value.number;
+    do_fetch(sim, addr, hit, con);
+  }
+  else if (cmdline->syntax_match(sim, MEMORY STRING ADDRESS)) {
+    mem= params[0]->value.memory;
+    op= *(params[1]->get_svalue());
+    addr= params[2]->value.address;
+    hit= 1;
+    do_event(sim, mem, op, addr, hit, con);
+  }
+  else if (cmdline->syntax_match(sim, MEMORY STRING ADDRESS NUMBER)) {
+    mem= params[0]->value.memory;
+    op= *(params[1]->get_svalue());
+    addr= params[2]->value.address;
+    hit= params[3]->value.number;
+    do_event(sim, mem, op, addr, hit, con);
+  }
+  else
     {
-      con->printf("Address is missing.\n");
+      con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
       return(DD_FALSE);
     }
-  addr= (params[0])->get_address();
-  if (params[1])
-    hit= (params[1])->get_ivalue();
+  return(DD_FALSE);
+}
+
+void
+cl_break_cmd::do_fetch(class cl_sim *sim,
+                      t_addr addr, int hit, class cl_console *con)
+{
   if (hit > 99999)
     {
       con->printf("Hit value %d is too big.\n", hit);
-      return(0);
+      return;
     }
   if (sim->uc->fbrk->bp_at(addr))
     con->printf("Breakpoint at 0x%06x is already set.\n", addr);
   else
     {
-      class cl_brk *b= new cl_fetch_brk(sim->uc->fbrk->make_new_nr(),
+      class cl_brk *b= new cl_fetch_brk(sim->uc->make_new_brknr(),
                                        addr, perm, hit);
       b->init();
       sim->uc->fbrk->add_bp(b);
@@ -75,7 +109,20 @@ cl_break_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
       con->printf("Breakpoint %d at 0x%06x: %s\n", b->nr, addr, s);
       free(s);
     }
-  return(0);
+}
+
+void
+cl_break_cmd::do_event(class cl_sim *sim,
+                      class cl_mem *mem, char op, t_addr addr, int hit,
+                      class cl_console *con)
+{
+  class cl_ev_brk *b= NULL;
+
+  b= sim->uc->mk_ebrk(perm, mem, op, addr, hit);
+  if (b)
+    sim->uc->ebrk->add_bp(b);
+  else
+    con->printf("Couldn't make event breakpoint\n");
 }
 
 
@@ -84,9 +131,9 @@ cl_break_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_clear_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_clear_cmd::do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con)
 {
-  uint addr;
   int idx;
   class cl_brk *brk= sim->uc->fbrk->get_bp(sim->uc->PC, &idx);
 
@@ -105,14 +152,45 @@ cl_clear_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
   class cl_cmd_arg *param;
   while ((param= cmdline->param(i++)))
     {
-      addr= param->get_ivalue();
+      t_addr addr;
+      if (!param->as_address())
+       return(DD_FALSE);
+      addr= param->value.address;
       if (sim->uc->fbrk->bp_at(addr) == 0)
        sim->cmd->printf("No breakpoint at 0x%06x\n", addr);
       else
        sim->uc->fbrk->del_bp(addr);
     }
 
-  return(0);
+  return(DD_FALSE);
+}
+
+
+/*
+ * DELETE nr nr ...
+ */
+
+int
+cl_delete_cmd::do_work(class cl_sim *sim,
+                      class cl_cmdline *cmdline, class cl_console *con)
+{
+  if (cmdline->param(0) == 0)
+    {
+      // delete all
+      sim->uc->remove_all_breaks();
+    }
+  else
+    {
+      int i= 0;
+      class cl_cmd_arg *param;
+      while ((param= cmdline->param(i++)))
+       {
+         long num;
+         if (param->get_ivalue(&num))
+           sim->uc->rm_brk(num);
+       }
+    }
+  return(DD_FALSE);
 }
 
 
diff --git a/sim/ucsim/cmd.src/bpcl.h b/sim/ucsim/cmd.src/bpcl.h
new file mode 100644 (file)
index 0000000..cc09bad
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Simulator of microcontrollers (cmd.src/bpcl.h)
+ *
+ * Copyright (C) 1999,99 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_BPCL_HEADER
+#define CMD_BPCL_HEADER
+
+#include "newcmdcl.h"
+
+
+// BREAK
+COMMAND_HEAD(cl_break_cmd)
+public:
+  enum brk_perm perm;
+COMMAND_METHODS(cl_break_cmd)
+  virtual void do_fetch(class cl_sim *sim,
+                       t_addr addr, int hit, class cl_console *con);
+  virtual void do_event(class cl_sim *sim,
+                       class cl_mem *mem, char op, t_addr addr, int hit,
+                       class cl_console *con);
+COMMAND_TAIL;
+
+// TBREAK
+class cl_tbreak_cmd: public cl_break_cmd
+{
+public:
+  cl_tbreak_cmd(char *aname,
+               int  can_rep,
+               char *short_hlp,
+               char *long_hlp):
+    cl_break_cmd(aname, can_rep, short_hlp, long_hlp) {perm=brkDYNAMIC;}
+};
+
+// CLEAR
+COMMAND(cl_clear_cmd);
+
+// DELETE
+COMMAND(cl_delete_cmd);
+
+
+#endif
+
+/* End of cmd.src/bpcl.h */
diff --git a/sim/ucsim/cmd.src/cmdconf.cc b/sim/ucsim/cmd.src/cmdconf.cc
new file mode 100644 (file)
index 0000000..6afd4ca
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Simulator of microcontrollers (cmd.src/cmdconf.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 "cmdconfcl.h"
+
+
+/*
+ * Command: conf
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_conf_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline *cmdline, class cl_console *con)
+{
+  int i;
+
+  con->printf("ucsim version %s\n", VERSIONSTR);
+  con->printf("Type of microcontroller: %s\n", sim->uc->id_string());
+  con->printf("Controller has %d hardware element(s).\n",
+             sim->uc->hws->count);
+  for (i= 0; i < sim->uc->hws->count; i++)
+    {
+      class cl_hw *hw= (class cl_hw *)(sim->uc->hws->at(i));
+      con->printf("  %s[%d]\n", hw->id_string, hw->id);
+    }
+  con->printf("Memories:\n");
+  for (i= MEM_ROM; i < MEM_TYPES; i++)
+    {
+      class cl_mem *mem= (class cl_mem *)(sim->uc->mems->at(i));
+      if (mem)
+       con->printf("  %s size= 0x%06x %6d width= %2d class= \"%s\"\n",
+                   mem->id_string(), mem->size, mem->size, mem->width,
+                   (mem->class_name)?(mem->class_name):"unknown");
+    }
+  return(0);
+}
+
+/*
+ * Command: conf addmem
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_conf_addmem_cmd::do_work(class cl_sim *sim,
+                           class cl_cmdline *cmdline, class cl_console *con)
+{
+  class cl_mem *mem= 0;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+  char *mem_class;
+
+  if (cmdline->syntax_match(sim, STRING)) {
+    mem_class= params[0]->value.string.string;
+    enum mem_class type;
+    type= (enum mem_class)get_string_id(mem_classes, mem_class, -1);
+    mem= sim->uc->mk_mem(type, mem_class);
+    if (mem)
+      {
+       class cl_mem *m= sim->uc->mem(type);
+       if (m)
+         delete m;
+       sim->uc->mems->put_at(type, mem);
+      }
+    else
+      con->printf("Can not make memory \"%s\"\n", mem_class);
+  }
+  return(DD_FALSE);
+}
+
+
+/* End of cmd.src/cmdconf.cc */
diff --git a/sim/ucsim/cmd.src/cmdconfcl.h b/sim/ucsim/cmd.src/cmdconfcl.h
new file mode 100644 (file)
index 0000000..7be0529
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Simulator of microcontrollers (cmd.src/cmdconfcl.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_CMDCONF_HEADER
+#define CMD_CMDCONF_HEADER
+
+#include "newcmdcl.h"
+
+
+// CONF
+COMMAND(cl_conf_cmd);
+
+// CONF ADDMEM
+COMMAND(cl_conf_addmem_cmd);
+
+
+#endif
+
+/* End of cmd.src/cmdconfcl.h */
diff --git a/sim/ucsim/cmd.src/cmdgui.cc b/sim/ucsim/cmd.src/cmdgui.cc
new file mode 100644 (file)
index 0000000..80eb0eb
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Simulator of microcontrollers (cmd.src/cmdgui.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "ddconfig.h"
+
+// prj
+#include "globals.h"
+
+// sim
+#include "simcl.h"
+
+// local
+#include "cmdguicl.h"
+
+
+/*
+ * Command: gui start
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_gui_start_cmd::do_work(class cl_sim *sim,
+                         class cl_cmdline *cmdline, class cl_console *con)
+{
+  class cl_hw *hw;
+  class cl_mem *mem;
+  t_addr start, end;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+
+  if (cmdline->syntax_match(sim, HW)) {
+    hw= params[0]->value.hw;
+  }
+  else if (cmdline->syntax_match(sim, MEMORY ADDRESS ADDRESS)) {
+    mem= params[0]->value.memory;
+    start= params[1]->value.address;
+    end= params[2]->value.address;
+  }
+  else
+    {
+      con->printf("Error: wrong syntax\n"
+                 "%s\n", short_help?short_help:"no help");
+    }
+
+  return(DD_FALSE);;
+}
+
+
+/*
+ * Command: gui stop
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_gui_stop_cmd::do_work(class cl_sim *sim,
+                        class cl_cmdline *cmdline, class cl_console *con)
+{
+  return(DD_FALSE);;
+}
+
+
+/* End of cmd.src/cmdgui.cc */
diff --git a/sim/ucsim/cmd.src/cmdguicl.h b/sim/ucsim/cmd.src/cmdguicl.h
new file mode 100644 (file)
index 0000000..f4c7fc9
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Simulator of microcontrollers (cmd.src/cmdguicl.h)
+ *
+ * Copyright (C) 1999,99 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_CMDGUICL_HEADER
+#define CMD_CMDGUICL_HEADER
+
+#include "newcmdcl.h"
+
+
+// GUI START
+COMMAND(cl_gui_start_cmd);
+
+// GUI STOP
+COMMAND(cl_gui_stop_cmd);
+
+
+#endif
+
+/* End of cmd.src/cmdguicl.h */
index d9496996032c04cf267fb92f313c126693ccd085..445e824dedc7f769a658c287c4738a9abc0037d1 100644 (file)
@@ -37,37 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 // local
 #include "cmdsetcl.h"
-
-
-/*
- * Command: conf
- *----------------------------------------------------------------------------
- */
-
-int
-cl_conf_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
-{
-  int i;
-
-  con->printf("ucsim version %s\n", VERSIONSTR);
-  con->printf("Type of microcontroller: %s\n", sim->uc->id_string());
-  con->printf("Controller has %d hardware element(s).\n",
-             sim->uc->hws->count);
-  for (i= 0; i < sim->uc->hws->count; i++)
-    {
-      class cl_hw *hw= (class cl_hw *)(sim->uc->hws->at(i));
-      con->printf("  %s[%d]\n", hw->id_string, hw->id);
-    }
-  con->printf("Memories:\n");
-  for (i= MEM_ROM; i < MEM_TYPES; i++)
-    {
-      class cl_mem *mem= (class cl_mem *)(sim->uc->mems->at(i));
-      if (mem)
-       con->printf("  %s size= 0x%06x %d\n",
-                   mem->id_string(), mem->size, mem->size);
-    }
-  return(0);
-}
+#include "cmdutil.h"
 
 
 /*
@@ -76,7 +46,8 @@ cl_conf_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_state_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_state_cmd::do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con)
 {
   //con->printf("sim state= %d\n", sim->state);
   con->printf("CPU state= %s PC= 0x%06x XTAL= %g\n",
@@ -109,7 +80,8 @@ cl_state_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_file_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_file_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline *cmdline, class cl_console *con)
 {
   char *fname= 0;
   long l;
@@ -133,7 +105,8 @@ cl_file_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_dl_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_dl_cmd::do_work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con)
 {
   long l;
   
@@ -145,95 +118,174 @@ cl_dl_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
 
 
 /*
- * Command: get
+ * Command: run
  *----------------------------------------------------------------------------
  */
 
 int
-cl_get_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_run_cmd::do_work(class cl_sim *sim,
+                   class cl_cmdline *cmdline, class cl_console *con)
 {
-  char *s;
+  class cl_brk *b;
+  t_addr start, end;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
 
-  if (cmdline->param(0) == 0)
-    {
-      con->printf("Get what?\n");
-      return(0);
-    }
-  if ((s= cmdline->param(0)->get_svalue()))
+  if (params[0])
+    if (!(params[0]->get_address(&start)))
+      {
+       con->printf("Error: wrong start address\n");
+       return(DD_FALSE);
+      }
+  if (params[1])
+    if (!(params[1]->get_address(&end)))
+      {
+       con->printf("Error: wromg end address\n");
+       return(DD_FALSE);
+      }
+  if (params[0])
     {
-      if (strstr(s, "t") == s)
-       return(timer(cmdline, con));
-      else
-       con->printf("Unknow keyword of get command\n");
+      if (!sim->uc->inst_at(start))
+       con->printf("Warning: maybe not instruction at 0x%06lx\n", start);
+      sim->uc->PC= start;
+      if (params[1])
+       {
+         if (start == end)
+           {
+             con->printf("Addresses must be different.\n");
+             return(DD_FALSE);
+           }
+         if ((b= sim->uc->fbrk_at(end)))
+           {
+           }
+         else
+           {
+             b= new cl_fetch_brk(sim->uc->make_new_brknr(), end,
+                                 brkDYNAMIC, 1);
+             sim->uc->fbrk->add_bp(b);
+           }
+       }
     }
-  return(0);
+  con->printf("Simulation started, PC=0x%06x\n", sim->uc->PC);
+  if (sim->uc->fbrk_at(start))
+    sim->uc->do_inst(1);
+  sim->start(con);
+  return(DD_FALSE);
 }
 
 
 /*
- * Command: set
+ * Command: stop
  *----------------------------------------------------------------------------
  */
 
-
 int
-cl_set_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_stop_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline *cmdline, class cl_console *con)
 {
-  char *s;
-
-  if (cmdline->param(0) == 0)
-    {
-      con->printf("Set what?\n");
-      return(0);
-    }
-  if ((s= cmdline->param(0)->get_svalue()))
-    {
-      if (strstr(s, "t") == s)
-       return(timer(cmdline, con));
-      else
-       con->printf("Unknow keyword of set command\n");
-    }
-  return(0);
+  sim->stop(resUSER);
+  sim->uc->print_disass(sim->uc->PC, con);
+  return(DD_FALSE);
 }
 
 
 /*
- * Command: run
+ * Command: step
  *----------------------------------------------------------------------------
  */
 
-
 int
-cl_run_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_step_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline *cmdline, class cl_console *con)
 {
-  sim->start(con);
+  sim->uc->do_inst(1);
+  sim->uc->print_regs(con);
   return(0);
 }
 
 
 /*
- * Command: step
+ * Command: next
  *----------------------------------------------------------------------------
  */
 
-
 int
-cl_step_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_next_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline *cmdline, class cl_console *con)
 {
-  sim->uc->do_inst(1);
+  class cl_brk *b;
+  t_addr next;
+  struct dis_entry *de;
+
+  t_mem code= sim->uc->get_mem(MEM_ROM, sim->uc->PC);
+  int i= 0;
+  de= &(sim->uc->dis_tbl()[i]);
+  while ((code & de->mask) != de->code &&
+        de->mnemonic)
+    {
+      i++;
+      de= &(sim->uc->dis_tbl()[i]);
+    }
+  if ((de->branch == 'a') ||
+      (de->branch == 'l'))
+    {
+      next= sim->uc->PC + de->length;
+      if (!sim->uc->fbrk_at(next))
+       {
+         b= new cl_fetch_brk(sim->uc->make_new_brknr(),
+                             next, brkDYNAMIC, 1);
+         sim->uc->fbrk->add(b);
+       }
+      sim->start(con);
+      //sim->uc->do_inst(-1);
+    }
+  else
+    sim->uc->do_inst(1);
   sim->uc->print_regs(con);
-  return(0);
+  return(DD_FALSE);
 }
 
 
 /*
- * Command: reset
+ * Command: pc
  *----------------------------------------------------------------------------
  */
 
+int
+cl_pc_cmd::do_work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con)
+{
+  t_addr addr;
+  class cl_cmd_arg *params[1]= { cmdline->param(0) };
+
+  if (params[0])
+    {
+      if (!(params[0]->get_address(&addr)))
+       {
+         con->printf("Error: wrong parameter\n");
+         return(DD_FALSE);
+       }
+      if (addr >= sim->uc->get_mem_size(MEM_ROM))
+       addr= 0;
+      if (!sim->uc->inst_at(addr))
+       con->printf("Warning: maybe not instruction at 0x%06x\n", addr);
+      sim->uc->PC= addr;
+    }
+  sim->uc->print_disass(sim->uc->PC, con);
+  return(DD_FALSE);
+}
+
+
+/*
+ * Command: reset
+ *----------------------------------------------------------------------------
+ */
 
 int
-cl_reset_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_reset_cmd::do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con)
 {
   sim->uc->reset();
   return(0);
@@ -246,75 +298,71 @@ cl_reset_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_dump_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_dump_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline *cmdline, class cl_console *con)
 {
-  class cl_mem *mem;
-  char *s;
-  long l, start= -1, end= 10*8-1, bpl= 8;
+  class cl_mem *mem= 0;
+  long bpl= 8;
+  t_addr start= 0, end;
   class cl_cmd_arg *params[4]= { cmdline->param(0),
                                 cmdline->param(1),
                                 cmdline->param(2),
                                 cmdline->param(3) };
 
-  if (params[0] == 0)
-    {
-      con->printf("Memory type missing\n");
-      return(0);
-    }
-  if ((s= params[0]->get_svalue()))
+  if (params[0] &&
+      params[0]->as_bit(sim->uc))
     {
-      if (strstr(s, "i") == s)
-       mem= sim->uc->mem(MEM_IRAM);
-      else if (strstr(s, "x") == s)
-       mem= sim->uc->mem(MEM_XRAM);
-      else if (strstr(s, "r") == s)
-       mem= sim->uc->mem(MEM_ROM);
-      else if (strstr(s, "s") == s)
-       mem= sim->uc->mem(MEM_SFR);
-      else
-       {
-         con->printf("Unknown memory type\n");
-         return(0);
-       }
-      if (!mem)
+      int i= 0;
+      while (params[0] &&
+            params[0]->as_bit(sim->uc))
        {
-         con->printf("No such memory\n");
-         return(0);
+         t_mem m;
+         mem= params[0]->value.bit.mem;
+         m= mem->read(params[0]->value.bit.mem_address);
+         char *sn=
+           sim->uc->symbolic_bit_name((t_addr)-1,
+                                      mem,
+                                      params[0]->value.bit.mem_address,
+                                      params[0]->value.bit.mask);
+         con->printf("%10s ", sn?sn:"");
+         con->printf(mem->addr_format, params[0]->value.bit.mem_address);
+         con->printf(" ");
+         con->printf(mem->data_format, m);
+         con->printf(" %c\n", (m&(params[0]->value.bit.mask))?'1':'0');
+         i++;
+         params[0]= cmdline->param(i);
        }
+      if (params[0])
+       con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
     }
-  else
+  else if (cmdline->syntax_match(sim, MEMORY))
     {
-      con->printf("Wrong memory type\n");
-      return(0);
+      mem= params[0]->value.memory;
+      mem->dump(con);
     }
+  else if (cmdline->syntax_match(sim, MEMORY ADDRESS)) {
+    mem  = params[0]->value.memory;
+    start= params[1]->value.address;
+    end  = start+10*8-1;
+    mem->dump(start, end, bpl, con);
+  }
+  else if (cmdline->syntax_match(sim, MEMORY ADDRESS ADDRESS)) {
+    mem  = params[0]->value.memory;
+    start= params[1]->value.address;
+    end  = params[2]->value.address;
+    mem->dump(start, end, bpl, con);
+  }
+  else if (cmdline->syntax_match(sim, MEMORY ADDRESS ADDRESS NUMBER)) {
+    mem  = params[0]->value.memory;
+    start= params[1]->value.address;
+    end  = params[2]->value.address;
+    bpl  = params[3]->value.number;
+    mem->dump(start, end, bpl, con);
+  }
+  else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
 
-  if (params[1])
-    {
-      if ((start= params[1]->get_address()) >= 0)
-       {
-         end+= start;
-         if (params[2])
-           {
-             if ((l= params[2]->get_address()) >= 0)
-               end= l;
-             else
-               {
-                 con->printf("End address is wrong\n");
-                 return(0);
-               }
-           }
-       }
-      else
-       {
-         con->printf("Start address is wrong\n");
-         return(0);
-       }
-    }
-  if (params[3] &&
-      (l= params[3]->get_address()) >= 0)
-    bpl= l;
-  mem->dump(start, end, bpl, con);
-  return(0);
+  return(DD_FALSE);;
 }
 
 
@@ -324,10 +372,11 @@ cl_dump_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_di_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_di_cmd::do_work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con)
 {
-  cmdline->insert_param(0, new cl_cmd_sym_arg("i"));
-  cl_dump_cmd::do_work(cmdline, con);
+  cmdline->insert_param(0, new cl_cmd_sym_arg(sim->uc, "i"));
+  cl_dump_cmd::do_work(sim, cmdline, con);
   return(0);
 }
 
@@ -338,10 +387,11 @@ cl_di_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_dx_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_dx_cmd::do_work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con)
 {
-  cmdline->insert_param(0, new cl_cmd_sym_arg("x"));
-  cl_dump_cmd::do_work(cmdline, con);
+  cmdline->insert_param(0, new cl_cmd_sym_arg(sim->uc, "x"));
+  cl_dump_cmd::do_work(sim, cmdline, con);
   return(0);
 }
 
@@ -352,10 +402,11 @@ cl_dx_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_dch_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_dch_cmd::do_work(class cl_sim *sim,
+                   class cl_cmdline *cmdline, class cl_console *con)
 {
-  cmdline->insert_param(0, new cl_cmd_sym_arg("r"));
-  cl_dump_cmd::do_work(cmdline, con);
+  cmdline->insert_param(0, new cl_cmd_sym_arg(sim->uc, "r"));
+  cl_dump_cmd::do_work(sim, cmdline, con);
   return(0);
 }
 
@@ -366,10 +417,11 @@ cl_dch_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_ds_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_ds_cmd::do_work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con)
 {
-  cmdline->insert_param(0, new cl_cmd_sym_arg("s"));
-  cl_dump_cmd::do_work(cmdline, con);
+  cmdline->insert_param(0, new cl_cmd_sym_arg(sim->uc, "s"));
+  cl_dump_cmd::do_work(sim, cmdline, con);
   return(0);
 }
 
@@ -380,40 +432,212 @@ cl_ds_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_dc_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_dc_cmd::do_work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con)
 {
-  long i, l, start= last, end= -1;
+  t_addr start= last, end= last+20;
   class cl_cmd_arg *params[2]= { cmdline->param(0),
                                 cmdline->param(1) };
+  class cl_mem *rom= sim->uc->mem(MEM_ROM);
 
-  if (params[0])
+  if (!rom)
+    return(DD_FALSE);
+  if (params[0] == 0)
+    ;
+  else if (cmdline->syntax_match(sim, ADDRESS)) {
+    start= params[0]->value.address;
+    end= start+20;
+  }
+  else if (cmdline->syntax_match(sim, ADDRESS ADDRESS)) {
+    start= params[0]->value.address;
+    end= params[1]->value.address;
+  }
+  if (start >= rom->size)
     {
-      if ((start= params[0]->get_address()) >= 0)
-       {
-         if (params[1])
-           {
-             if ((l= params[1]->get_address()) >= 0)
-               end= l;
-             else
-               {
-                 con->printf("End address is wrong\n");
-                 return(0);
-               }
-           }
-       }
-      else
+      con->printf("Error: start address is wrong\n");
+      return(DD_FALSE);
+    }
+  if (end >= rom->size)
+    {
+      con->printf("Error: end address is wrong\n");
+      return(DD_FALSE);
+    }
+
+  for (;
+       start <= end;
+       start+= sim->uc->inst_length(rom->get(start)))
+    sim->uc->print_disass(start, con);
+  last= start;
+  return(DD_FALSE);
+}
+
+
+/*
+ * Command: disassemble
+ *----------------------------------------------------------------------------
+ */
+
+static int disass_last_stop= 0;
+
+int
+cl_disassemble_cmd::do_work(class cl_sim *sim,
+                           class cl_cmdline *cmdline, class cl_console *con)
+{
+  t_addr start, realstart;
+  int offset= -1, dir, lines= 20;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+
+  start= disass_last_stop;
+  if (params[0] == 0) ;
+  else if (cmdline->syntax_match(sim, ADDRESS)) {
+    start= params[0]->value.address;
+  }
+  else if (cmdline->syntax_match(sim, ADDRESS NUMBER)) {
+    start= params[0]->value.address;
+    offset= params[1]->value.number;
+  }
+  else if (cmdline->syntax_match(sim, ADDRESS NUMBER NUMBER)) {
+    start= params[0]->value.address;
+    offset= params[1]->value.number;
+    lines= params[2]->value.number;
+  }
+  else
+    {
+      con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");    
+      return(DD_FALSE);
+    }
+
+  if (lines < 1)
+    {
+      con->printf("Error: wrong `lines' parameter\n");
+      return(DD_FALSE);
+    }
+  if (!sim->uc->there_is_inst())
+    return(DD_FALSE);
+  realstart= start;
+  class cl_mem *rom= sim->uc->mem(MEM_ROM);
+  if (!rom)
+    return(DD_FALSE);
+  while (realstart < rom->size &&
+        !sim->uc->inst_at(realstart))
+    realstart= realstart+1;
+  if (offset)
+    {
+      dir= (offset < 0)?-1:+1;
+      while (offset)
        {
-         con->printf("Start address is wrong\n");
-         return(0);
+         realstart= (realstart+dir) % rom->size;
+         while (!sim->uc->inst_at(realstart))
+           realstart= (realstart+dir) % rom->size;
+         offset+= -dir;
        }
     }
-  i= 0;
-  for (l= start;
-       (end < 0 && i < 20) || l <= end;
-       l+= sim->uc->inst_length(sim->uc->get_mem(MEM_ROM, l)), i++)
-    sim->uc->print_disass(l, con);
-  last= l;
-  return(0);
+  
+  while (lines)
+    {
+      sim->uc->print_disass(realstart, sim->cmd->actual_console);
+      realstart= (realstart+1) % rom->size;
+      while (!sim->uc->inst_at(realstart))
+       realstart= (realstart+1) % rom->size;
+      lines--;
+    }
+
+  disass_last_stop= realstart;
+
+  return(DD_FALSE);;
+}
+
+
+/*
+ * Command: fill
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_fill_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline *cmdline, class cl_console *con)
+{
+  class cl_mem *mem= 0;
+  t_mem what= 0;
+  t_addr start= 0, end;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+
+  if (cmdline->syntax_match(sim, MEMORY ADDRESS ADDRESS NUMBER)) {
+    mem  = params[0]->value.memory;
+    start= params[1]->value.address;
+    end  = params[2]->value.address;
+    what = params[3]->value.number;
+    t_addr i;
+    for (i= start; i <= end; i++)
+      {
+       t_mem d;
+       d= what;
+       mem->write(i, &d);
+      }
+  }
+  else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+
+  return(DD_FALSE);;
+}
+
+
+/*
+ * Command: where
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_where_cmd::do_real_work(class cl_sim *sim,
+                          class cl_cmdline *cmdline, class cl_console *con,
+                          bool case_sensitive)
+{
+  class cl_mem *mem= 0;
+  class cl_cmd_arg *params[2]= { cmdline->param(0),
+                                cmdline->param(1) };
+
+  if (cmdline->syntax_match(sim, MEMORY DATALIST)) {
+    mem= params[0]->value.memory;
+    t_mem *array= params[1]->value.data_list.array;
+    int len= params[1]->value.data_list.len;
+    if (!len)
+      {
+       con->printf("Error: nothing to search for\n");
+       return(DD_FALSE);
+      }
+    t_addr addr= 0;
+    bool found= mem->search_next(case_sensitive, array, len, &addr);
+    while (found)
+      {
+       mem->dump(addr, addr+len-1, 8, con);
+       addr++;
+       found= mem->search_next(case_sensitive, array, len, &addr);
+      }
+  }
+  else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+
+  return(DD_FALSE);
+}
+
+int
+cl_where_cmd::do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con)
+{
+  return(do_real_work(sim, cmdline, con, DD_FALSE));
+}
+
+int
+cl_Where_cmd::do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con)
+{
+  return(do_real_work(sim, cmdline, con, DD_TRUE));
 }
 
 
@@ -423,19 +647,68 @@ cl_dc_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_help_cmd::do_work(class cl_cmdline */*cmdline*/, class cl_console *con)
+cl_help_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline *cmdline, class cl_console *con)
 {
   class cl_cmd *c;
   int i;
+  class cl_cmd_arg *parm= cmdline->param(0);
+
+  if (!parm) {
+    for (i= 0; i < sim->cmd->cmdset->count; i++)
+      {
+       c= (class cl_cmd *)(sim->cmd->cmdset->at(i));
+       if (c->short_help)
+         con->printf("%s\n", c->short_help);
+       else
+         con->printf("%s\n", (char*)(c->names->at(0)));
+      }
+  }
+  else if (cmdline->syntax_match(sim, STRING)) {
+    int matches= 0;
+    for (i= 0; i < sim->cmd->cmdset->count; i++)
+      {
+       c= (class cl_cmd *)(sim->cmd->cmdset->at(i));
+       if (c->name_match(parm->value.string.string, DD_FALSE))
+         matches++;
+      }
+    if (!matches)
+      con->printf("No such command\n");
+    else if (matches > 1)
+      for (i= 0; i < sim->cmd->cmdset->count; i++)
+       {
+         c= (class cl_cmd *)(sim->cmd->cmdset->at(i));
+         if (!c->name_match(parm->value.string.string, DD_FALSE))
+           continue;
+         if (c->short_help)
+           con->printf("%s\n", c->short_help);
+         else
+           con->printf("%s\n", (char*)(c->names->at(0)));
+       }
+    else
+      for (i= 0; i < sim->cmd->cmdset->count; i++)
+       {
+         c= (class cl_cmd *)(sim->cmd->cmdset->at(i));
+         if (!c->name_match(parm->value.string.string, DD_FALSE))
+           continue;
+         if (c->short_help)
+           con->printf("%s\n", c->short_help);
+         else
+           con->printf("%s\n", (char*)(c->names->at(0)));
+         int names;
+         con->printf("Names of command:");
+         for (names= 0; names < c->names->count; names++)
+           con->printf(" %s", (char*)(c->names->at(names)));
+         con->printf("\n");
+         if (c->long_help)
+           con->printf("%s\n", c->long_help);
+         else
+           con->printf("%s\n", (char*)(c->names->at(0)));
+       }
+  }
+  else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax");
 
-  for (i= 0; i < sim->cmdset->count; i++)
-    {
-      c= (class cl_cmd *)(sim->cmdset->at(i));
-      if (c->short_help)
-       con->printf("%s\n", c->short_help);
-      else
-       con->printf("%s\n", (char*)(c->names->at(0)));
-    }
   return(0);
 }
 
@@ -446,18 +719,21 @@ cl_help_cmd::do_work(class cl_cmdline */*cmdline*/, class cl_console *con)
  */
 
 int
-cl_quit_cmd::do_work(class cl_cmdline */*cmdline*/, class cl_console */*con*/)
+cl_quit_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline */*cmdline*/, class cl_console */*con*/)
 {
   return(1);
 }
 
+
 /*
  * Command: kill
  *----------------------------------------------------------------------------
  */
 
 int
-cl_kill_cmd::do_work(class cl_cmdline */*cmdline*/, class cl_console */*con*/)
+cl_kill_cmd::do_work(class cl_sim *sim,
+                    class cl_cmdline */*cmdline*/, class cl_console */*con*/)
 {
   sim->state|= SIM_QUIT;
   return(1);
index fd2434323c26ef78feb0709a9a6e7fe8c5e09872..36beba0d625f25d90bfecfb21183d93a66f7ce29 100644 (file)
@@ -30,309 +30,57 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include "newcmdcl.h"
 
-
-// CONF
-class cl_conf_cmd: public cl_cmd
-{
-public:
-  cl_conf_cmd(class cl_sim *asim,
-             char *aname,
-             int  can_rep,
-             char *short_hlp,
-             char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
 // STATE
-class cl_state_cmd: public cl_cmd
-{
-public:
-  cl_state_cmd(class cl_sim *asim,
-              char *aname,
-              int  can_rep,
-              char *short_hlp,
-              char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// FILE
-class cl_file_cmd: public cl_cmd
-{
-public:
-  cl_file_cmd(class cl_sim *asim,
-             char *aname,
-             int  can_rep,
-             char *short_hlp,
-             char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// DOWNLOAD
-class cl_dl_cmd: public cl_cmd
-{
-public:
-  cl_dl_cmd(class cl_sim *asim,
-           char *aname,
-           int  can_rep,
-           char *short_hlp,
-           char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// GET
-class cl_get_cmd: public cl_cmd
-{
-public:
-  cl_get_cmd(class cl_sim *asim,
-            char *aname,
-            int  can_rep,
-            char *short_hlp,
-            char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-  virtual int timer(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// SET
-class cl_set_cmd: public cl_cmd
-{
-public:
-  cl_set_cmd(class cl_sim *asim,
-            char *aname,
-            int  can_rep,
-            char *short_hlp,
-            char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-  virtual int timer(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// TIMER
-class cl_timer_cmd: public cl_cmd
-{
+COMMAND(cl_state_cmd);
+COMMAND(cl_file_cmd);
+COMMAND(cl_dl_cmd);
+COMMAND(cl_run_cmd);
+COMMAND(cl_stop_cmd);
+COMMAND(cl_step_cmd);
+COMMAND(cl_next_cmd);
+COMMAND(cl_pc_cmd);
+COMMAND(cl_reset_cmd);
+COMMAND(cl_dump_cmd);
+COMMAND_ANCESTOR(cl_di_cmd,cl_dump_cmd);
+COMMAND_ANCESTOR(cl_dx_cmd,cl_dump_cmd);
+COMMAND_ANCESTOR(cl_dch_cmd,cl_dump_cmd);
+COMMAND_ANCESTOR(cl_ds_cmd,cl_dump_cmd);
+COMMAND_DATA(cl_dc_cmd, t_addr last);
+COMMAND_DATA(cl_disassemble_cmd,int last);
+COMMAND_DATA(cl_fill_cmd,int last);
+COMMAND_HEAD(cl_where_cmd)
+  public: int last;
+COMMAND_METHODS(cl_where_cmd)
+  virtual int do_real_work(class cl_sim *sim,
+                          class cl_cmdline *cmdline, class cl_console *con,
+                          bool case_sensitive);
+COMMAND_TAIL;
+COMMAND_DATA_ANCESTOR(cl_Where_cmd,cl_where_cmd,int last);
+COMMAND(cl_help_cmd);
+COMMAND(cl_quit_cmd);
+COMMAND(cl_kill_cmd);
+
+COMMAND_HEAD(cl_timer_cmd)
 public:
   class cl_ticker *ticker;
-  int what;
+  long what;
   char *name;
-
-  cl_timer_cmd(class cl_sim *asim,
-              char *aname,
-              int  can_rep,
-              char *short_hlp,
-              char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-  void set_ticker(class cl_cmd_arg *param);
-  virtual int add(class cl_cmdline *cmdline, class cl_console *con);
-  virtual int del(class cl_cmdline *cmdline, class cl_console *con);
-  virtual int get(class cl_cmdline *cmdline, class cl_console *con);
-  virtual int run(class cl_cmdline *cmdline, class cl_console *con);
-  virtual int stop(class cl_cmdline *cmdline, class cl_console *con);
-  virtual int val(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// RUN
-class cl_run_cmd: public cl_cmd
-{
-public:
-  cl_run_cmd(class cl_sim *asim,
-            char *aname,
-            int  can_rep,
-            char *short_hlp,
-            char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// STEP
-class cl_step_cmd: public cl_cmd
-{
-public:
-  cl_step_cmd(class cl_sim *asim,
-             char *aname,
-             int  can_rep,
-             char *short_hlp,
-             char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// RESET
-class cl_reset_cmd: public cl_cmd
-{
-public:
-  cl_reset_cmd(class cl_sim *asim,
-              char *aname,
-              int  can_rep,
-              char *short_hlp,
-              char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// DUMP
-class cl_dump_cmd: public cl_cmd
-{
-public:
-  cl_dump_cmd(class cl_sim *asim,
-             char *aname,
-             int  can_rep,
-             char *short_hlp,
-             char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  //cl_dump_cmd(class cl_sim *asim): cl_cmd(asim) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// DI
-class cl_di_cmd: public cl_dump_cmd
-{
-public:
-  cl_di_cmd(class cl_sim *asim,
-           char *aname,
-           int  can_rep,
-           char *short_hlp,
-           char *long_hlp):
-    cl_dump_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// DX
-class cl_dx_cmd: public cl_dump_cmd
-{
-public:
-  cl_dx_cmd(class cl_sim *asim,
-           char *aname,
-           int  can_rep,
-           char *short_hlp,
-           char *long_hlp):
-    cl_dump_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// DCH
-class cl_dch_cmd: public cl_dump_cmd
-{
-public:
-  cl_dch_cmd(class cl_sim *asim,
-            char *aname,
-            int  can_rep,
-            char *short_hlp,
-            char *long_hlp):
-    cl_dump_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// DS
-class cl_ds_cmd: public cl_dump_cmd
-{
-public:
-  cl_ds_cmd(class cl_sim *asim,
-           char *aname,
-           int  can_rep,
-           char *short_hlp,
-           char *long_hlp):
-    cl_dump_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// DC
-class cl_dc_cmd: public cl_cmd
-{
-public:
-  int last;
-public:
-  cl_dc_cmd(class cl_sim *asim,
-           char *aname,
-           int  can_rep,
-           char *short_hlp,
-           char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {last=0;}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// BREAK
-class cl_break_cmd: public cl_cmd
-{
-public:
-  enum brk_perm perm;
-public:
-  cl_break_cmd(class cl_sim *asim,
-              char *aname,
-              int  can_rep,
-              char *short_hlp,
-              char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) { perm= brkFIX; }
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// TBREAK
-class cl_tbreak_cmd: public cl_break_cmd
-{
-public:
-  cl_tbreak_cmd(class cl_sim *asim,
-               char *aname,
-               int  can_rep,
-               char *short_hlp,
-               char *long_hlp):
-    cl_break_cmd(asim, aname, can_rep, short_hlp, long_hlp) {perm=brkDYNAMIC;}
-};
-
-// CLEAR
-class cl_clear_cmd: public cl_cmd
-{
-public:
-  cl_clear_cmd(class cl_sim *asim,
-              char *aname,
-              int  can_rep,
-              char *short_hlp,
-              char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// HELP
-class cl_help_cmd: public cl_cmd
-{
-public:
-  cl_help_cmd(class cl_sim *asim,
-             char *aname,
-             int  can_rep,
-             char *short_hlp,
-             char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// QUIT
-class cl_quit_cmd: public cl_cmd
-{
-public:
-  cl_quit_cmd(class cl_sim *asim,
-             char *aname,
-             int  can_rep,
-             char *short_hlp,
-             char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
-
-// KILL
-class cl_kill_cmd: public cl_cmd
-{
-public:
-  cl_kill_cmd(class cl_sim *asim,
-             char *aname,
-             int  can_rep,
-             char *short_hlp,
-             char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
+COMMAND_METHODS(cl_timer_cmd)
+  void set_ticker(class cl_sim *sim,
+                 class cl_cmd_arg *param);
+  virtual int add(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con);
+  virtual int del(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con);
+  virtual int get(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con);
+  virtual int run(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con);
+  virtual int stop(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con);
+  virtual int val(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con);
+COMMAND_TAIL;
 
 
 #endif
index 84c2be54a540b587798906983f8f75f59c517b0e..c56bbe4c0302068deadca59461695b4e72310385 100644 (file)
@@ -110,6 +110,10 @@ get_name_entry(struct name_entry tabl[], char *name, class cl_uc *uc)
   int i= 0;
   char *p;
 
+  if (!tabl ||
+      !name ||
+      !(*name))
+    return(0);
   for (p= name; *p; *p= toupper(*p), p++);
   while (tabl[i].name &&
         (!(tabl[i].cpu_type & uc->type) ||
@@ -118,7 +122,7 @@ get_name_entry(struct name_entry tabl[], char *name, class cl_uc *uc)
   if (tabl[i].name != NULL)
     return(&tabl[i]);
   else
-    return(NULL);
+    return(0);
 }
 
 
@@ -227,8 +231,8 @@ interpret_bitname(char *name, class cl_uc *uc,
 char *
 proc_escape(char *string, int *len)
 {
-  char  spec_chars[]= "fnrtvab";
-  char  spec[]= "\f\n\r\t\v\a\b";
+  char  spec_chars[]= "fnrtvab\"";
+  char  spec[]= "\f\n\r\t\v\a\b\"";
   char  *s, *str, *p;
 
   s  = string;
index 8fa1bb278efa9cb97032ec7782607ff38467f776..34c995859f85ac6ae2966aa9a3d7cb65d479361f 100644 (file)
@@ -27,52 +27,85 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include "ddconfig.h"
 
+#include <ctype.h>
+
 // sim
 #include "simcl.h"
+#include "optioncl.h"
 
 // local
 #include "cmdsetcl.h"
+#include "getcl.h"
+#include "cmdutil.h"
 
 
 /*
- * GET TIMER
+ * Command: get sfr
+ *----------------------------------------------------------------------------
  */
 
 int
-cl_get_cmd::timer(class cl_cmdline *cmdline, class cl_console *con)
+cl_get_sfr_cmd::do_work(class cl_sim *sim,
+                       class cl_cmdline *cmdline, class cl_console *con)
 {
-  class cl_cmd_arg *params[4]= { cmdline->param(0),
-                                cmdline->param(1),
-                                cmdline->param(2),
-                                cmdline->param(3) };
-  int what;
-  class cl_ticker *ticker;
-  
-  if (params[1] != 0)
+  class cl_mem *mem= sim->uc->mem(MEM_SFR);
+  class cl_cmd_arg *parm;
+  int i;
+
+  if (!mem)
     {
-      what= (params[1])->get_ivalue();
-      if ((ticker= sim->uc->get_counter(what)) == 0)
-       {
-         con->printf("Timer %d does not exist\n", what);
-         return(0);
-       }
-      con->printf("timer #%d: %g sec (%lu clks)\n", what,
-                 ticker->get_rtime(sim->uc->xtal), ticker->ticks);
+      con->printf("Error: No SFR\n");
+      return(DD_FALSE);
     }
+  for (i= 0, parm= cmdline->param(i);
+       parm;
+       i++, parm= cmdline->param(i))
+    {
+      if (!parm->as_address())
+       con->printf("Warning: Invalid address %s\n",
+                   (char*)cmdline->tokens->at(i+1));
+      else
+       mem->dump(parm->value.address, parm->value.address, 1, con);
+    }
+
+  return(DD_FALSE);;
+}
+
+
+/*
+ * Command: get option
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_get_option_cmd::do_work(class cl_sim *sim,
+                          class cl_cmdline *cmdline, class cl_console *con)
+{
+  class cl_cmd_arg *parm= cmdline->param(0);
+  char *s= 0;
+
+  if (!parm)
+    ;
+  else if (cmdline->syntax_match(sim, STRING)) {
+    s= parm->value.string.string;
+  }
   else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+
+  int i;
+  for (i= 0; i < sim->uc->options->count; i++)
     {
-      con->printf("time: %g sec (%lu clks)\n",
-                 sim->uc->get_rtime(), sim->uc->ticks->ticks);
-      for (what= 0; what < sim->uc->counters->count; what++)
+      class cl_option *o= (class cl_option *)(sim->uc->options->at(i));
+      if (!s ||
+         !strcmp(s, o->id))
        {
-         ticker= sim->uc->get_counter(what);
-         if (ticker)
-           con->printf("timer #%d: %g sec (%lu clks)\n", what,
-                       ticker->get_rtime(sim->uc->xtal), ticker->ticks);
+         con->printf("%s ", o->id);
+         o->print(con);
+         con->printf(" %s\n", o->help);
        }
     }
-
-  return(0);
+  
+  return(DD_FALSE);;
 }
 
 
diff --git a/sim/ucsim/cmd.src/getcl.h b/sim/ucsim/cmd.src/getcl.h
new file mode 100644 (file)
index 0000000..cc4908b
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Simulator of microcontrollers (cmd.src/getcl.h)
+ *
+ * Copyright (C) 1999,99 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_GETCL_HEADER
+#define CMD_GETCL_HEADER
+
+#include "newcmdcl.h"
+
+
+// GET SFR
+class cl_get_sfr_cmd: public cl_cmd
+{
+public:
+  cl_get_sfr_cmd(//class cl_sim *asim,
+                char *aname,
+                int  can_rep,
+                char *short_hlp,
+                char *long_hlp):
+    cl_cmd(aname, can_rep, short_hlp, long_hlp) {}
+  virtual int do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con);
+};
+
+// GET OPTION
+class cl_get_option_cmd: public cl_cmd
+{
+public:
+  cl_get_option_cmd(//class cl_sim *asim,
+                   char *aname,
+                   int  can_rep,
+                   char *short_hlp,
+                   char *long_hlp):
+    cl_cmd(aname, can_rep, short_hlp, long_hlp) {}
+  virtual int do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con);
+};
+
+
+#endif
+
+/* End of cmd.src/getcl.h */
index f21fc9663c72b8760541a13d44c0aee57d913d3d..0b7561b79793ba464aeaea545c3a497cbc56a736 100644 (file)
@@ -40,7 +40,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  */
 
 int
-cl_info_bp_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_info_bp_cmd::do_work(class cl_sim *sim,
+                       class cl_cmdline *cmdline, class cl_console *con)
 {
   int i;
   char *s;
@@ -80,7 +81,8 @@ cl_info_bp_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_info_reg_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_info_reg_cmd::do_work(class cl_sim *sim,
+                        class cl_cmdline *cmdline, class cl_console *con)
 {
   sim->uc->print_regs(con);
   return(0);
@@ -92,64 +94,23 @@ cl_info_reg_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_info_hw_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_info_hw_cmd::do_work(class cl_sim *sim,
+                       class cl_cmdline *cmdline, class cl_console *con)
 {
+  class cl_hw *hw;
   class cl_cmd_arg *params[4]= { cmdline->param(0),
                                 cmdline->param(1),
                                 cmdline->param(2),
                                 cmdline->param(3) };
-  char *p0;
-  enum hw_cath cath;
-  class cl_hw *hw;
-  int i= 0;
 
-  if (params[0] == 0)
-    {
-      con->printf("Cathegory missing\n");
-      return(0);
-    }
-  p0= (params[0])->get_svalue();
-  if (strstr(p0, "t") == p0)
-    cath= HW_TIMER;
-  else if (strstr(p0, "u") == p0)
-    cath= HW_UART;
-  else if (strstr(p0, "po") == p0)
-    cath= HW_PORT;
-  else if (strstr(p0, "pc") == p0)
-    cath= HW_PCA;
-  else if (strstr(p0, "i") == p0)
-    cath= HW_INTERRUPT;
-  else if (strstr(p0, "w") == p0)
-    cath= HW_WDT;
+  if (cmdline->syntax_match(sim, HW)) {
+    hw= params[0]->value.hw;
+    hw->print_info(con);
+  }
   else
-    {
-      con->printf("Unknown cathegory\n");
-      return(0);
-    }
-  if (params[1] == 0)
-    {
-      // no ID
-      hw= sim->uc->get_hw(cath, &i);
-      while (hw)
-       {
-         hw->print_info(con);
-         i++;
-         hw= sim->uc->get_hw(cath, &i);
-       }
-    }
-  else
-    {
-      // ID given
-      int id= (params[1])->get_ivalue();
-      hw= sim->uc->get_hw(cath, id, &i);
-      while (hw)
-       {
-         hw->print_info(con);
-         i++;
-         hw= sim->uc->get_hw(cath, id, &i);
-       }      
-    }
-  return(0);
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+
+  return(DD_FALSE);
 }
 
 
index 87d6501535e77a0d9d5c9b0ea64a6d1b5ab5dfe3..bb0fa2c5142fd9a0e39547d0a60c129019490712 100644 (file)
@@ -31,41 +31,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "newcmdcl.h"
 
 
-class cl_info_bp_cmd: public cl_cmd
-{
-public:
-  cl_info_bp_cmd(class cl_sim *asim,
-                char *aname,
-                int  can_rep,
-                char *short_hlp,
-                char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
+// INFO BP
+COMMAND(cl_info_bp_cmd);
 
-class cl_info_reg_cmd: public cl_cmd
-{
-public:
-  cl_info_reg_cmd(class cl_sim *asim,
-                 char *aname,
-                 int  can_rep,
-                 char *short_hlp,
-                 char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
+// INFO REG
+COMMAND(cl_info_reg_cmd);
 
-class cl_info_hw_cmd: public cl_cmd
-{
-public:
-  cl_info_hw_cmd(class cl_sim *asim,
-                char *aname,
-                int  can_rep,
-                char *short_hlp,
-                char *long_hlp):
-    cl_cmd(asim, aname, can_rep, short_hlp, long_hlp) {}
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
-};
+// INFO HW
+COMMAND(cl_info_hw_cmd);
 
 
 #endif
index be85ad80a4c6812b773b93ee4b8130da4be15937..c1ca1db61f3281cb81d2a209f7b50f4f0ce422f0 100644 (file)
@@ -99,12 +99,14 @@ cmd_do_print(FILE *f, char *format, va_list ap)
  *____________________________________________________________________________
  */
 
-cl_cmdline::cl_cmdline(char *acmd)
+cl_cmdline::cl_cmdline(char *acmd, class cl_console *acon)
 {
   cmd= strdup(acmd);
   params= new cl_list(2, 2);
   tokens= new cl_ustrings(2, 2);
   name= 0;
+  matched_syntax= 0;
+  con= acon;
 }
 
 cl_cmdline::~cl_cmdline(void)
@@ -173,16 +175,25 @@ cl_cmdline::split(void)
          end= start;
          while (*end &&
                 *end != '"')
-           end++;
+           {
+             if (*end == '\\')
+               {
+                 end++;
+                 if (*end)
+                   end++;
+               }
+             else
+               end++;
+           }
          if (*end == '"')
            end--;
          else
-           simulator->cmd->printf("Unterminated string\n");
+           con->printf("Unterminated string\n");
          param_str= (char *)malloc(end-start+2);
          strncpy(param_str, start, 1+end-start);
          param_str[1+end-start]= '\0';
          tokens->add(strdup(param_str));
-         params->add(simulator->mk_cmd_str_arg(param_str));
+         params->add(con->sim->mk_cmd_str_arg(param_str));
          free(param_str);
          if (*end)
            end++;
@@ -205,35 +216,80 @@ cl_cmdline::split(void)
              *dot= '\0';
              dot++;
              if (strchr("0123456789", *param_str) != NULL)
-               sfr= simulator->mk_cmd_int_arg((long long)
+               sfr= con->sim->mk_cmd_int_arg((long long)
                                               strtol(param_str, 0, 0));
              else
-               sfr= simulator->mk_cmd_sym_arg(param_str);
+               sfr= con->sim->mk_cmd_sym_arg(param_str);
              if (*dot == '\0')
                {
                  bit= 0;
-                 simulator->cmd->printf("Uncomplete bit address\n");
+                 con->printf("Uncomplete bit address\n");
+                 delete sfr;
                }
              else
                {
                  if (strchr("0123456789", *dot) != NULL)
-                   bit= simulator->mk_cmd_int_arg((long long)
+                   bit= con->sim->mk_cmd_int_arg((long long)
                                                   strtol(dot, 0, 0));
                  else
-                   bit= simulator->mk_cmd_sym_arg(dot);
+                   bit= con->sim->mk_cmd_sym_arg(dot);
+                 params->add(con->sim->mk_cmd_bit_arg(sfr, bit));
+               }
+           }
+         else if ((dot= strchr(param_str, '[')) != NULL)
+           {
+             // array
+             class cl_cmd_arg *aname, *aindex;
+             *dot= '\0';
+             dot++;
+             if (strchr("0123456789", *param_str) != NULL)
+               aname= con->sim->mk_cmd_int_arg((long long)
+                                                strtol(param_str, 0, 0));
+             else
+               aname= con->sim->mk_cmd_sym_arg(param_str);
+             if (*dot == '\0')
+               {
+                 aname= 0;
+                 con->printf("Uncomplete array\n");
+               }
+             else
+               {
+                 char *p;
+                 p= dot + strlen(dot) - 1;
+                 while (p > dot &&
+                        *p != ']')
+                   {
+                     *p= '\0';
+                     p--;
+                   }
+                 if (*p == ']')
+                   *p= '\0';
+                 if (strlen(dot) == 0)
+                   {
+                     con->printf("Uncomplete array index\n");
+                     delete aname;
+                   }
+                 else    
+                   {
+                     if (strchr("0123456789", *dot) != NULL)
+                       aindex= con->sim->mk_cmd_int_arg((long long)
+                                                         strtol(dot, 0, 0));
+                     else
+                       aindex= con->sim->mk_cmd_sym_arg(dot);
+                     params->add(con->sim->mk_cmd_array_arg(aname, aindex));
+                   }
                }
-             params->add(simulator->mk_cmd_bit_arg(sfr, bit));
            }
          else if (strchr("0123456789", *param_str) != NULL)
            {
              // number
-             params->add(simulator->mk_cmd_int_arg((long long)
+             params->add(con->sim->mk_cmd_int_arg((long long)
                                                    strtol(param_str, 0, 0)));
            }
          else
            {
              // symbol
-             params->add(simulator->mk_cmd_sym_arg(param_str));
+             params->add(con->sim->mk_cmd_sym_arg(param_str));
            }
          free(param_str);
        }
@@ -290,20 +346,150 @@ cl_cmdline::insert_param(int pos, class cl_cmd_arg *param)
     params->add_at(pos, param);
 }
 
+bool
+cl_cmdline::syntax_match(class cl_sim *sim, char *syntax)
+{
+  if (!syntax)
+    return(DD_FALSE);
+  if (!*syntax &&
+      !params->count)
+    {
+      matched_syntax= syntax;
+      return(DD_TRUE);
+    }
+  if (!params->count)
+    return(DD_FALSE);
+  //printf("syntax %s?\n",syntax);
+  char *p= syntax;
+  int iparam= 0;
+  class cl_cmd_arg *parm= (class cl_cmd_arg *)(params->at(iparam));
+  while (*p &&
+        parm)
+    {
+      //printf("Checking %s as %c\n",parm->get_svalue(),*p);
+      switch (*p)
+       {
+       case SY_ADDR:
+         if (!parm->as_address())
+           return(DD_FALSE);
+         //printf("ADDRESS match %lx\n",parm->value.address);
+         break;
+       case SY_NUMBER:
+         if (!parm->as_number())
+           return(DD_FALSE);
+         break;
+       case SY_DATA:
+         if (!parm->as_data())
+           return(DD_FALSE);
+         break;
+       case SY_MEMORY:
+         if (!parm->as_memory())
+           return(DD_FALSE);
+         //printf("MEMORY match %s\n",parm->value.memory->class_name);
+         break;
+       case SY_HW:
+         if (!parm->as_hw(sim->uc))
+           return(DD_FALSE);
+         break;
+       case SY_STRING:
+         if (!parm->as_string())
+           return(DD_FALSE);
+         break;
+       case SY_DATALIST:
+         if (!set_data_list(parm, &iparam))
+           return(DD_FALSE);
+         break;
+       case SY_BIT:
+         if (!parm->as_bit(sim->uc))
+           return(DD_FALSE);
+         break;
+       default:
+         return(DD_FALSE);
+       }
+      p++;
+      iparam++;
+      if (iparam < params->count)
+       parm= (class cl_cmd_arg *)(params->at(iparam));
+      else
+       parm= 0;
+    }
+  if (!*p &&
+      !parm)
+    {
+      matched_syntax= syntax;
+      return(DD_TRUE);
+    }
+  return(DD_FALSE);
+}
+
+bool
+cl_cmdline::set_data_list(class cl_cmd_arg *parm, int *iparm)
+{
+  class cl_cmd_arg *next_parm;
+  int len, i, j;
+  t_mem *array;
+
+  len= 0;
+  array= 0;
+  for (i= *iparm, next_parm= param(i); next_parm; i++, next_parm= param(i))
+    {
+      if (next_parm->is_string())
+       {
+         int l;
+         char *s;
+         //s= proc_escape(next_parm->get_svalue(), &l);
+         if (!next_parm->as_string())
+           continue;
+         s= next_parm->value.string.string;
+         l= next_parm->value.string.len;
+         if (!array)
+           array= (t_mem*)malloc(sizeof(t_mem)*l);
+         else
+           array= (t_mem*)realloc(array, sizeof(t_mem)*(l+len));
+         for (j= 0; j < l; j++)
+           {
+             array[len]= s[j];
+             len++;
+           }
+         //if (s)
+         //free(s);
+       }
+      else
+       {
+         if (!next_parm->as_data())
+           {
+             if (array)
+               free(array);
+             return(DD_FALSE);
+           }
+         if (!array)
+           array= (t_mem*)malloc(sizeof(t_mem));
+         else
+           array= (t_mem*)realloc(array, sizeof(t_mem)*(1+len));
+         array[len]= next_parm->value.data;
+         len++;
+       }
+    }
+  *iparm= i;
+  parm->value.data_list.array= array;
+  parm->value.data_list.len= len;
+  return(DD_TRUE);
+}
+
 
 /*
  * Command
  *____________________________________________________________________________
  */
 
-cl_cmd::cl_cmd(class cl_sim *asim,
+cl_cmd::cl_cmd(//class cl_sim *asim,
               char *aname,
               int can_rep,
               char *short_hlp,
               char *long_hlp):
   cl_base()
 {
-  sim= asim;
+  //sim= asim;
   names= new cl_strings(1, 1);
   names->add(aname?strdup(aname):strdup("unknown"));
   can_repeat= can_rep;
@@ -379,15 +565,17 @@ cl_cmd::syntax_ok(class cl_cmdline *cmdline)
 }
 
 int
-cl_cmd::work(class cl_cmdline *cmdline, class cl_console *con)
+cl_cmd::work(class cl_sim *sim,
+            class cl_cmdline *cmdline, class cl_console *con)
 {
   if (!syntax_ok(cmdline))
     return(0);
-  return(do_work(cmdline, con));
+  return(do_work(sim, cmdline, con));
 }
 
 int
-cl_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_cmd::do_work(class cl_sim *sim,
+               class cl_cmdline *cmdline, class cl_console *con)
 {
   con->printf("Command \"%s\" does nothing.\n", (char*)(names->at(0)));
   return(0);
@@ -442,6 +630,20 @@ cl_cmdset::get_cmd(class cl_cmdline *cmdline)
   //return(0);
 }
 
+class cl_cmd *
+cl_cmdset::get_cmd(char *cmd_name)
+{
+  int i;
+
+  for (i= 0; i < count; i++)
+    {
+      class cl_cmd *c= (class cl_cmd *)at(i);
+      if (c->name_match(cmd_name, 1))
+       return(c);
+    }
+  return(0);
+}
+
 void
 cl_cmdset::del(char *name)
 {
@@ -481,13 +683,13 @@ cl_cmdset::replace(char *name, class cl_cmd *cmd)
  *____________________________________________________________________________
  */
 
-cl_super_cmd::cl_super_cmd(class cl_sim *asim,
+cl_super_cmd::cl_super_cmd(//class cl_sim *asim,
                           char *aname,
                           int  can_rep,
                           char *short_hlp,
                           char *long_hlp,
                           class cl_cmdset *acommands):
-  cl_cmd(asim, aname, can_rep, short_hlp, long_hlp)
+  cl_cmd(aname, can_rep, short_hlp, long_hlp)
 {
   commands= acommands;
 }
@@ -499,15 +701,18 @@ cl_super_cmd::~cl_super_cmd(void)
 }
 
 int
-cl_super_cmd::work(class cl_cmdline *cmdline, class cl_console *con)
+cl_super_cmd::work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con)
 {
-  class cl_cmd *cmd;
+  class cl_cmd *cmd= 0;
 
   if (!commands)
     return(0);
   
   if (!cmdline->shift())
     {
+      if ((cmd= commands->get_cmd("_no_parameters_")) != 0)
+       return(cmd->work(sim, cmdline, con));
       int i;
       con->printf("\"%s\" must be followed by the name of a subcommand\n"
                  "List of subcommands:\n", (char*)(names->at(0)));
@@ -524,7 +729,7 @@ cl_super_cmd::work(class cl_cmdline *cmdline, class cl_console *con)
                  cmdline->name, (char*)(names->at(0)));
       return(0);
     }
-  return(cmd->work(cmdline, con));
+  return(cmd->work(sim, cmdline, con));
 }
 
 
@@ -540,16 +745,21 @@ cl_console::cl_console(char *fin, char *fout, class cl_sim *asim):
 
   last_command= NULL;
   sim= asim;
-  in= stdin;
+  in= 0;
   if (fin)
-    if (f= fopen(fin, "r+"), in= f?f:stdin, !f)
+    if (f= fopen(fin, "r+"), in= f, !f)
       fprintf(stderr, "Can't open `%s': %s\n", fin, strerror(errno));
-  out= stdout;
+  out= 0;
   if (fout)
-    if (f= fopen(fout, "w+"), out= f?f:stdout, !f)
+    if (f= fopen(fout, "w+"), out= f, !f)
       fprintf(stderr, "Can't open `%s': %s\n", fout, strerror(errno));
   prompt= 0;
   flags= CONS_NONE;
+  if (in &&
+      isatty(fileno(in)))
+    flags|= CONS_INTERACTIVE;
+  else
+    printf("Warning: non-interactive console\n");
 }
 
 cl_console::cl_console(FILE *fin, FILE *fout, class cl_sim *asim):
@@ -559,7 +769,13 @@ cl_console::cl_console(FILE *fin, FILE *fout, class cl_sim *asim):
   sim= asim;
   in = fin;
   out= fout;
+  prompt= 0;
   flags= CONS_NONE;
+  if (in &&
+      isatty(fileno(in)))
+    flags|= CONS_INTERACTIVE;
+  else
+    printf("Warning: non-interactive console\n");
 }
 
 /*
@@ -636,8 +852,9 @@ cl_console::~cl_console(void)
 void
 cl_console::welcome(void)
 {
-  fprintf(out,
-         "ucsim %s, Copyright (C) 1997 Daniel Drotos, Talker Bt.\n"
+  if (!out)
+    return;
+  fprintf(out, "ucsim %s, Copyright (C) 1997 Daniel Drotos, Talker Bt.\n"
          "ucsim comes with ABSOLUTELY NO WARRANTY; for details type "
          "`show w'.\n"
          "This is free software, and you are welcome to redistribute it\n"
@@ -767,17 +984,17 @@ cl_console::read_line(void)
 }
 
 int
-cl_console::proc_input(void)
+cl_console::proc_input(class cl_cmdset *cmdset)
 {
-  int retval;
+  int retval= 0;
 
   if (feof(in))
     {
       fprintf(out, "End\n");
       return(1);
     }
-  char *cmd= read_line();
-  if (!cmd)
+  char *cmdstr= read_line();
+  if (!cmdstr)
     return(1);
   if (flags & CONS_FROZEN)
     {
@@ -786,16 +1003,28 @@ cl_console::proc_input(void)
       retval= 0;
     }
   else
-    retval= sim->do_cmd(cmd, this);
+    {
+      class cl_cmdline *cmdline;
+      class cl_cmd *cm;
+      cmdline= new cl_cmdline(cmdstr, this);
+      cmdline->init();
+      cm= cmdset->get_cmd(cmdline);
+      if (cm)
+       retval= cm->work(sim, cmdline, this);
+      delete cmdline;
+      if (!cm)
+       retval= interpret(cmdstr);
+    }
+  //retval= sim->do_cmd(cmd, this);
   if (!retval)
     print_prompt();
-  free(cmd);
+  free(cmdstr);
   return(retval);
 }
 
 /*
  * Old version, sim->do_cmd() falls into this if it doesn't find a new
- * command object which can handle enetered command
+ * command object which can handle entered command
  */
 
 int
@@ -837,7 +1066,7 @@ cl_listen_console::get_in_fd(void)
 }
 
 int
-cl_listen_console::proc_input(void)
+cl_listen_console::proc_input(class cl_cmdset *cmdset)
 {
   int newsock;
   ACCEPT_SOCKLEN_T size;
@@ -854,7 +1083,10 @@ cl_listen_console::proc_input(void)
     fprintf(stderr, "cannot open port for input\n");
   if (!(out= fdopen(newsock, "w+")))
     fprintf(stderr, "cannot open port for output\n");
-  sim->cmd->add_console(sim->cmd->mk_console(in, out, sim));
+  class cl_console *c= sim->cmd->mk_console(in, out, sim);
+  c->flags|= CONS_INTERACTIVE;
+  c->init();
+  sim->cmd->add_console(c);
   in= out= 0;
   return(0);
 }
@@ -867,11 +1099,12 @@ cl_listen_console::proc_input(void)
  *____________________________________________________________________________
  */
 
-cl_commander::cl_commander(class cl_sim *asim):
+cl_commander::cl_commander(class cl_cmdset *acmdset, class cl_sim *asim):
   cl_base()
 {
   cons= new cl_list(1, 1); 
   actual_console= frozen_console= 0;
+  cmdset= acmdset;
   sim= asim;
 }
 
@@ -898,6 +1131,7 @@ cl_commander::init(void)
 cl_commander::~cl_commander(void)
 {
   delete cons;
+  delete cmdset;
 }
 
 class cl_console *
@@ -939,7 +1173,8 @@ void
 cl_commander::set_fd_set(void)
 {
   int i;
-  
+
+  //fprintf(stderr, "** Setting fd set\n");  
   FD_ZERO(&read_set);
   fd_num= 0;
   for (i= 0; i < cons->count; i++)
@@ -948,10 +1183,16 @@ cl_commander::set_fd_set(void)
       class cl_console *c= (class cl_console*)(cons->at(i));
       if ((fd= c->get_in_fd()) >= 0)
        {
-         if (fd > fd_num)
-           fd_num= fd;
-         FD_SET(fd, &read_set);
+         if ((c->flags & CONS_FROZEN) == 0 ||
+             (c->flags & CONS_INTERACTIVE) != 0)
+           {
+             FD_SET(fd, &read_set);
+             if (fd > fd_num)
+               fd_num= fd;
+           }
        }
+      else
+       ;//fprintf(stderr, "** Skipping console %p\n",c);
     }
   fd_num++;
 }
@@ -1069,15 +1310,20 @@ cl_commander::input_avail(void)
 
   tv.tv_sec= tv.tv_usec= 0;
   active_set= read_set;
-  i= select(fd_num/*FD_SETSIZE*/, &active_set, NULL, NULL, &tv);
+  i= select(fd_num, &active_set, NULL, NULL, &tv);
   return(i);
 }
 
 int
 cl_commander::input_avail_on_frozen(void)
 {
+  int fd;
+
   if (!frozen_console)
     return(0);
+  if ((fd= frozen_console->get_in_fd()) >= 0 &&
+      !isatty(fd))
+    return(0);
   return(frozen_console->input_avail());
 }
 
@@ -1087,7 +1333,7 @@ cl_commander::wait_input(void)
   int i;
 
   active_set= read_set;
-  i= select(fd_num/*FD_SETSIZE*/, &active_set, NULL, NULL, NULL);
+  i= select(fd_num, &active_set, NULL, NULL, NULL);
   return(i);
 }
 
@@ -1096,7 +1342,7 @@ cl_commander::proc_input(void)
 {
   int i;
 
-  for (i= 0; i < fd_num/*FD_SETSIZE*/; i++)
+  for (i= 0; i < fd_num; i++)
     if (FD_ISSET(i, &active_set))
       {
        class cl_console *c;
@@ -1107,7 +1353,7 @@ cl_commander::proc_input(void)
            if (c->match(i))
              {
                actual_console= c;
-               int retval= c->proc_input();
+               int retval= c->proc_input(cmdset);
                if (retval)
                  {
                    del_console(c);
index 19512133544c05360a379d45b96028f4ba2bd93c..7a8500ae1fdad2b6e35ee84fbd49358f25b63afb 100644 (file)
@@ -39,6 +39,23 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "pobjcl.h"
 
 
+#define SY_ADDR                'a'
+#define ADDRESS                "a"
+#define SY_NUMBER      'n'
+#define NUMBER         "n"
+#define SY_DATA                'd'
+#define DATA           "d"
+#define SY_STRING      's'
+#define STRING         "s"
+#define SY_MEMORY      'm'
+#define MEMORY         "m"
+#define SY_HW          'h'
+#define HW             "h"
+#define SY_DATALIST    'D'
+#define DATALIST       "D"
+#define SY_BIT         'b'
+#define BIT            "b"
+
 /*
  * Command line with parameters
  */
@@ -50,9 +67,11 @@ public:
   char *name;
   class cl_list *params;
   class cl_ustrings *tokens;
+  char *matched_syntax;
+  class cl_console *con;
 
 public:
-  cl_cmdline(char *cmd);
+  cl_cmdline(char *acmd, class cl_console *acon);
   virtual ~cl_cmdline(void);
   virtual int init(void);
 
@@ -61,6 +80,8 @@ public:
   virtual int repeat(void);
   virtual class cl_cmd_arg *param(int num);
   virtual void insert_param(int pos, class cl_cmd_arg *param);
+  virtual bool syntax_match(class cl_sim *sim, char *syntax);
+  virtual bool set_data_list(class cl_cmd_arg *parm, int *iparm);
 private:
   char *skip_delims(char *start);
 };
@@ -74,14 +95,14 @@ private:
 class cl_cmd: public cl_base
 {
 public:
-  class cl_sim *sim;
+  //class cl_sim *sim;
   class cl_strings *names;
   int  can_repeat;
   char *short_help;
   char *long_help;
 
 public:
-  cl_cmd(class cl_sim *asim,
+  cl_cmd(//class cl_sim *asim,
         char *aname,
         int  can_rep,
         char *short_hlp,
@@ -92,10 +113,64 @@ public:
   virtual int name_match(char *aname, int strict);
   virtual int name_match(class cl_cmdline *cmdline, int strict);
   virtual int syntax_ok(class cl_cmdline *cmdline);
-  virtual int work(class cl_cmdline *cmdline, class cl_console *con);
-  virtual int do_work(class cl_cmdline *cmdline, class cl_console *con);
+  virtual int work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con);
+  virtual int do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con);
 };
 
+#define COMMAND_HEAD(CLASS_NAME) \
+class CLASS_NAME : public cl_cmd\
+{
+#define COMMAND_HEAD_ANCESTOR(CLASS_NAME,ANCESTOR) \
+class CLASS_NAME : public ANCESTOR \
+{
+
+#define COMMAND_METHODS(CLASS_NAME) \
+public:\
+  CLASS_NAME (char *aname,\
+              int  can_rep,\
+              char *chort_help,\
+              char *long_help):\
+    cl_cmd(aname, can_rep, short_help, long_help) {}\
+  virtual int do_work(class cl_sim *sim,\
+                     class cl_cmdline *cmdline, class cl_console *con);
+#define COMMAND_METHODS_ANCESTOR(CLASS_NAME,ANCESTOR) \
+public:\
+  CLASS_NAME (char *aname,\
+              int  can_rep,\
+              char *chort_help,\
+              char *long_help):\
+    ANCESTOR (aname, can_rep, short_help, long_help) {}\
+  virtual int do_work(class cl_sim *sim,\
+                     class cl_cmdline *cmdline, class cl_console *con);
+
+#define COMMAND_TAIL \
+}
+
+#define COMMAND(CLASS_NAME) \
+COMMAND_HEAD(CLASS_NAME) \
+COMMAND_METHODS(CLASS_NAME) \
+COMMAND_TAIL
+
+#define COMMAND_DATA(CLASS_NAME,DATA) \
+COMMAND_HEAD(CLASS_NAME) \
+public: DATA ; \
+COMMAND_METHODS(CLASS_NAME)\
+COMMAND_TAIL
+
+#define COMMAND_ANCESTOR(CLASS_NAME,ANCESTOR) \
+COMMAND_HEAD_ANCESTOR(CLASS_NAME,ANCESTOR) \
+COMMAND_METHODS_ANCESTOR(CLASS_NAME,ANCESTOR) \
+COMMAND_TAIL
+
+#define COMMAND_DATA_ANCESTOR(CLASS_NAME,ANCESTOR,DATA) \
+COMMAND_HEAD_ANCESTOR(CLASS_NAME,ANCESTOR) \
+public: DATA ; \
+COMMAND_METHODS_ANCESTOR(CLASS_NAME,ANCESTOR)\
+COMMAND_TAIL
+
+
 // Command set is list of cl_cmd objects
 class cl_cmdset: public cl_list
 {
@@ -107,6 +182,7 @@ public:
   cl_cmdset(class cl_sim *asim);
 
   virtual class cl_cmd *get_cmd(class cl_cmdline *cmdline);
+  virtual class cl_cmd *get_cmd(char *cmd_name);
   virtual void del(char *name);
   virtual void replace(char *name, class cl_cmd *cmd);
 };
@@ -118,7 +194,7 @@ public:
   class cl_cmdset *commands;
 
 public:
-  cl_super_cmd(class cl_sim *asim,
+  cl_super_cmd(//class cl_sim *asim,
               char *aname,
               int  can_rep,
               char *short_hlp,
@@ -126,7 +202,8 @@ public:
               class cl_cmdset *acommands);
   ~cl_super_cmd(void);
 
-  virtual int work(class cl_cmdline *cmdline, class cl_console *con);
+  virtual int work(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con);
 };
 
 
@@ -163,9 +240,8 @@ public:
   virtual int  get_in_fd(void);
   virtual int  input_avail(void);
   virtual char *read_line(void);
-  virtual int  proc_input(void);
+  virtual int  proc_input(class cl_cmdset *cmdset);
   virtual bool interpret(char *cmd);
-  virtual bool old_command(class cl_cmdline *cmdline) { return(DD_FALSE); }
 };
 
 #ifdef SOCKET_AVAIL
@@ -181,7 +257,7 @@ public:
 
   virtual int match(int fdnum);
   virtual int get_in_fd(void);
-  virtual int proc_input(void);
+  virtual int proc_input(class cl_cmdset *cmdset);
 };
 #endif
 
@@ -198,9 +274,10 @@ public:
   int fd_num;
   class cl_sim *sim;
   class cl_console *actual_console, *frozen_console;
+  class cl_cmdset *cmdset;
 
 public:
-  cl_commander(class cl_sim *asim);
+  cl_commander(class cl_cmdset *acmdset, class cl_sim *asim);
   ~cl_commander(void);
   virtual int init(void);
 
index 0ea5509ecc701119c52ffa2125add55f4ede45d5..a00d1b9f6dc5b7592916cb8895eff6b51d970f1e 100644 (file)
@@ -27,46 +27,167 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include "ddconfig.h"
 
+#include <ctype.h>
+
 // sim
 #include "simcl.h"
+#include "optioncl.h"
 
 // local
-#include "cmdsetcl.h"
+#include "setcl.h"
+#include "cmdutil.h"
+
+
+/*
+ * Command: set memory
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_set_mem_cmd::do_work(class cl_sim *sim,
+                       class cl_cmdline *cmdline, class cl_console *con)
+{
+  class cl_mem *mem= 0;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+
+  if (cmdline->syntax_match(sim, MEMORY ADDRESS DATALIST)) {
+    mem= params[0]->value.memory;
+    t_addr start= params[1]->value.address;
+    t_mem *array= params[2]->value.data_list.array;
+    int len= params[2]->value.data_list.len;
+    
+    if (len == 0)
+      con->printf("Error: no data\n");
+    else
+      {
+       int i;
+       t_addr addr;
+       for (i= 0, addr= start;
+            i < len && addr < mem->size;
+            i++, addr++)
+         mem->write(addr, &(array[i]));
+       mem->dump(start, start+len-1, 8, con);
+      }
+  }
+  else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+  
+  return(DD_FALSE);;
+}
+
+
+/*
+ * Command: set bit
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_set_bit_cmd::do_work(class cl_sim *sim,
+                       class cl_cmdline *cmdline, class cl_console *con)
+{
+  class cl_mem *mem;
+  t_addr mem_addr= 0;
+  t_mem bit_mask= 0;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+  
+  if (cmdline->syntax_match(sim, BIT NUMBER)) {
+    mem= params[0]->value.bit.mem;
+    mem_addr= params[0]->value.bit.mem_address;
+    bit_mask= params[0]->value.bit.mask;
+    if (params[1]->value.number)
+      mem->set_bit1(mem_addr, bit_mask);
+    else
+      mem->set_bit0(mem_addr, bit_mask);
+    mem->dump(mem_addr, mem_addr, 1, con);
+  }
+  else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+
+  return(DD_FALSE);;
+}
 
 
 /*
- * SET TIMER
+ * Command: set port
+ *----------------------------------------------------------------------------
  */
 
 int
-cl_set_cmd::timer(class cl_cmdline *cmdline, class cl_console *con)
+cl_set_port_cmd::do_work(class cl_sim *sim,
+                        class cl_cmdline *cmdline, class cl_console *con)
 {
+  class cl_hw *hw;
+  long l= 0, pn= -1;
   class cl_cmd_arg *params[4]= { cmdline->param(0),
                                 cmdline->param(1),
                                 cmdline->param(2),
                                 cmdline->param(3) };
-  int what, dir;
-  class cl_ticker *ticker;
   
-  if (params[1] == 0)
+  if (cmdline->syntax_match(sim, HW NUMBER)) {
+    hw= params[0]->value.hw;
+    pn= hw->id;
+    l= params[1]->value.number;
+  }
+  else if (cmdline->syntax_match(sim, NUMBER NUMBER)) {
+    pn= params[0]->value.number;
+    l= params[1]->value.number;
+  }
+  else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+  if (pn < 0 ||
+      pn > 3)
+    con->printf("Error: wrong port\n");
+  else
+    sim->uc->port_pins[pn]= l;
+  return(DD_FALSE);;
+}
+
+
+/*
+ * Command: set option
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_set_option_cmd::do_work(class cl_sim *sim,
+                          class cl_cmdline *cmdline, class cl_console *con)
+{
+  char *id= 0, *s= 0;
+  class cl_cmd_arg *params[4]= { cmdline->param(0),
+                                cmdline->param(1),
+                                cmdline->param(2),
+                                cmdline->param(3) };
+  
+  if (cmdline->syntax_match(sim, STRING STRING)) {
+    id= params[0]->value.string.string;
+    s= params[1]->value.string.string;
+  }
+  else
+    con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+  if (!id ||
+      !s)
     {
-      con->printf("Timer number is missing\n");
-      return(0);
+      con->printf("%s\n", short_help?short_help:"Error: wrong syntax\n");
+      return(DD_FALSE);
     }
-  what= (params[1])->get_ivalue();
-  if ((ticker= sim->uc->get_counter(what)) != 0)
+
+  int i;
+  for (i= 0; i < sim->uc->options->count; i++)
     {
-      con->printf("Timer %d already exists\n", what);
-      return(0);
+      class cl_option *o= (class cl_option *)(sim->uc->options->at(i));
+      if (!strcmp(id, o->id))
+       {
+         o->set_value(s);
+         break;
+       }
     }
-  if (params[2] != 0)
-    dir= (params[2])->get_ivalue();
-  else
-    dir= 1;
-  ticker= new cl_ticker(dir, 0, 0);
-  sim->uc->add_counter(ticker, what);
-
-  return(0);
+  return(DD_FALSE);;
 }
 
 
diff --git a/sim/ucsim/cmd.src/setcl.h b/sim/ucsim/cmd.src/setcl.h
new file mode 100644 (file)
index 0000000..057ec3a
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Simulator of microcontrollers (cmd.src/setcl.h)
+ *
+ * Copyright (C) 1999,99 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_SETCL_HEADER
+#define CMD_SETCL_HEADER
+
+#include "newcmdcl.h"
+
+
+// SET MEMORY
+COMMAND(cl_set_mem_cmd);
+
+// SET BIT
+COMMAND(cl_set_bit_cmd);
+
+// SET PORT
+COMMAND(cl_set_port_cmd);
+
+// SET OPTION
+COMMAND(cl_set_option_cmd);
+
+
+#endif
+
+/* End of cmd.src/setcl.h */
diff --git a/sim/ucsim/cmd.src/show.cc b/sim/ucsim/cmd.src/show.cc
new file mode 100644 (file)
index 0000000..02ba10b
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Simulator of microcontrollers (cmd.src/show.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "ddconfig.h"
+
+// prj
+#include "globals.h"
+
+// sim
+#include "simcl.h"
+
+// local
+#include "showcl.h"
+
+
+/*
+ * Command: show copying
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_show_copying_cmd::do_work(class cl_sim *sim,
+                            class cl_cmdline *cmdline, class cl_console *con)
+{
+  con->printf("%s\n", copying);
+  return(DD_FALSE);;
+}
+
+
+/*
+ * Command: show warranty
+ *----------------------------------------------------------------------------
+ */
+
+int
+cl_show_warranty_cmd::do_work(class cl_sim *sim,
+                             class cl_cmdline *cmdline, class cl_console *con)
+{
+  con->printf("%s\n", warranty);
+  return(DD_FALSE);;
+}
+
+
+/* End of cmd.src/show.cc */
diff --git a/sim/ucsim/cmd.src/showcl.h b/sim/ucsim/cmd.src/showcl.h
new file mode 100644 (file)
index 0000000..01a4fe0
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Simulator of microcontrollers (cmd.src/showcl.h)
+ *
+ * Copyright (C) 1999,99 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_SHOWCL_HEADER
+#define CMD_SHOWCL_HEADER
+
+#include "newcmdcl.h"
+
+
+// SHOW COPYING
+COMMAND(cl_show_copying_cmd);
+
+// SHOW WARRANTY
+COMMAND(cl_show_warranty_cmd);
+
+
+#endif
+
+/* End of cmd.src/showcl.h */
index 90f879608d7c4f48e125e54cb81ce954ac5655f5..694c43da20bfccba0bc9501e14bb91b41cb76cd4 100644 (file)
@@ -44,7 +44,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  */
 
 int
-cl_timer_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
+cl_timer_cmd::do_work(class cl_sim *sim,
+                     class cl_cmdline *cmdline, class cl_console *con)
 {
   char *s;
 
@@ -63,21 +64,21 @@ cl_timer_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
          con->printf("Timer number is missing\n");
          return(0);
        }
-      set_ticker(cmdline->param(1));
+      set_ticker(sim, cmdline->param(1));
       if (strstr(s, "c") == s ||
          strstr(s, "m") == s ||
          strstr(s, "a") == s)
-       return(add(cmdline, con));
+       return(add(sim, cmdline, con));
       else if (strstr(s, "d") == s)
-       return(del(cmdline, con));
+       return(del(sim, cmdline, con));
       else if (strstr(s, "g") == s)
-       return(get(cmdline, con));
+       return(get(sim, cmdline, con));
       else if (strstr(s, "r") == s)
-       return(run(cmdline, con));
+       return(run(sim, cmdline, con));
       else if (strstr(s, "s") == s)
-       return(stop(cmdline, con));
+       return(stop(sim, cmdline, con));
       else if (strstr(s, "v") == s)
-       return(val(cmdline, con));
+       return(val(sim, cmdline, con));
       else
        con->printf("Undefined timer command: \"%s\". Try \"help timer\"\n",
                    s);
@@ -86,14 +87,14 @@ cl_timer_cmd::do_work(class cl_cmdline *cmdline, class cl_console *con)
 }
 
 void
-cl_timer_cmd::set_ticker(class cl_cmd_arg *param)
+cl_timer_cmd::set_ticker(class cl_sim *sim,
+                        class cl_cmd_arg *param)
 {
-  if ((name= param->get_svalue()) == 0)
-    what= param->get_ivalue();
-  if (name)
+  if ((name= param->get_svalue()))
     ticker= sim->uc->get_counter(name);
   else
-    ticker= sim->uc->get_counter(what);
+    if (param->get_ivalue(&what))
+      ticker= sim->uc->get_counter(what);
 }
 
 /*
@@ -101,32 +102,41 @@ cl_timer_cmd::set_ticker(class cl_cmd_arg *param)
  */
 
 int
-cl_timer_cmd::add(class cl_cmdline *cmdline, class cl_console *con)
+cl_timer_cmd::add(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con)
 {
   class cl_cmd_arg *params[4]= { cmdline->param(0),
                                 cmdline->param(1),
                                 cmdline->param(2),
                                 cmdline->param(3) };
-  int dir= +1, in_isr= 0;
+  long dir= +1, in_isr= 0;
   
   if (!name &&
       what < 1)
     {
-      con->printf("Timer id must be greater then zero or a string\n");
-      return(0);
+      con->printf("Error: Timer id must be greater then zero or a string\n");
+      return(DD_FALSE);
     }
   if (ticker)
     {
       if (name)
-       con->printf("Timer \"%s\" already exists\n", name);
+       con->printf("Error: Timer \"%s\" already exists\n", name);
       else
-       con->printf("Timer %d already exists\n", what);
+       con->printf("Error: Timer %d already exists\n", what);
       return(0);
     }
-  if (params[2] != 0)
-    dir= (params[2])->get_ivalue();
-  if (params[3] != 0)
-    in_isr= (params[3])->get_ivalue();
+  if (params[2])
+    if (!params[2]->get_ivalue(&dir))
+      {
+       con->printf("Error: Wrong direction\n");
+       return(DD_FALSE);
+      }
+  if (params[3])
+    if (!params[3]->get_ivalue(&in_isr))
+      {
+       con->printf("Error: Wrong parameter\n");
+       return(DD_FALSE);
+      }
 
   if (name)
     {
@@ -139,7 +149,7 @@ cl_timer_cmd::add(class cl_cmdline *cmdline, class cl_console *con)
       sim->uc->add_counter(ticker, what);
     }
 
-  return(0);
+  return(DD_FALSE);
 }
 
 /*
@@ -147,7 +157,8 @@ cl_timer_cmd::add(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_timer_cmd::del(class cl_cmdline *cmdline, class cl_console *con)
+cl_timer_cmd::del(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con)
 {
   if (!ticker)
     {
@@ -170,7 +181,8 @@ cl_timer_cmd::del(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_timer_cmd::get(class cl_cmdline *cmdline, class cl_console *con)
+cl_timer_cmd::get(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con)
 {
   if (ticker)
     ticker->dump(what, sim->uc->xtal, con);
@@ -195,7 +207,8 @@ cl_timer_cmd::get(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_timer_cmd::run(class cl_cmdline *cmdline, class cl_console *con)
+cl_timer_cmd::run(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con)
 {
   if (!ticker)
     {
@@ -215,7 +228,8 @@ cl_timer_cmd::run(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_timer_cmd::stop(class cl_cmdline *cmdline, class cl_console *con)
+cl_timer_cmd::stop(class cl_sim *sim,
+                  class cl_cmdline *cmdline, class cl_console *con)
 {
   if (!ticker)
     {
@@ -236,7 +250,8 @@ cl_timer_cmd::stop(class cl_cmdline *cmdline, class cl_console *con)
  */
 
 int
-cl_timer_cmd::val(class cl_cmdline *cmdline, class cl_console *con)
+cl_timer_cmd::val(class cl_sim *sim,
+                 class cl_cmdline *cmdline, class cl_console *con)
 {
   class cl_cmd_arg *params[4]= { cmdline->param(0),
                                 cmdline->param(1),
@@ -246,20 +261,25 @@ cl_timer_cmd::val(class cl_cmdline *cmdline, class cl_console *con)
   if (!ticker)
     {
       if (name)
-       con->printf("Timer %d does not exist\n", name);
+       con->printf("Error: Timer %d does not exist\n", name);
       else
-       con->printf("Timer %d does not exist\n", what);
+       con->printf("Error: Timer %d does not exist\n", what);
       return(0);
     }
-  if (params[2] == 0)
+  if (params[2])
     {
-      con->printf("Value is missing\n");
-      return(0);
+      con->printf("Error: Value is missing\n");
+      return(DD_FALSE);
+    }
+  long val;
+  if (!params[2]->get_ivalue(&val))
+    {
+      con->printf("Error: Wrong parameter\n");
+      return(DD_FALSE);
     }
-  long val= (params[2])->get_ivalue();
   ticker->ticks= val;
 
-  return(0);
+  return(DD_FALSE);
 }
 
 
index faf32470e71db4b5caa8b08c6a1fa561c551c174..8ef8dcf94406899294a77f0e6a4e2a59d5dcaf52 100644 (file)
@@ -2,18 +2,13 @@
 # Makefile targets to remake configuration
 #
 
-freshconf: $(srcdir)/configure main.mk ddconfig.h
+freshconf: main.mk ddconfig.h
 
-$(srcdir)/configure: $(srcdir)/configure.in
-       cd $(srcdir) && $(SHELL) autoconf
-
-main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in
+main.mk: $(srcdir)/main_in.mk config.status
        $(SHELL) ./config.status
 
 ddconfig.h: ddconfig_in.h config.status
+       @echo "Re-making ddconfig.h"
        $(SHELL) ./config.status
 
-config.status: $(srcdir)/configure
-       $(SHELL) ./config.status --recheck
-
 # End of conf.mk
index 365d6ccfa1ce4025ea97896e33d4a97f32d3b296..87912927cd817285d516a396ba2065e10551def3 100755 (executable)
@@ -523,7 +523,7 @@ fi
 
 
 
-for ac_prog in gawk mawk nawk awk
+for ac_prog in mawk gawk nawk awk
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -1158,17 +1158,50 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
+echo "configure:1164: checking for dlfcn.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1169 "configure"
+#include "confdefs.h"
+#include <dlfcn.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+fi
+
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:1167: checking for $ac_hdr that defines DIR" >&5
+echo "configure:1200: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1172 "configure"
+#line 1205 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -1176,7 +1209,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:1180: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -1201,7 +1234,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:1205: checking for opendir in -ldir" >&5
+echo "configure:1238: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1209,7 +1242,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1213 "configure"
+#line 1246 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -1223,7 +1256,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:1227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1245,7 +1278,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1249: checking for opendir in -lx" >&5
+echo "configure:1282: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1253,7 +1286,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1257 "configure"
+#line 1290 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -1267,7 +1300,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:1271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1293,13 +1326,13 @@ fi
 # This must be after CXXCPP
 
 echo $ac_n "checking which header file defines FD_ macros""... $ac_c" 1>&6
-echo "configure:1297: checking which header file defines FD_ macros" >&5
-if eval "test \"`echo '$''{'s51_cv_fd'+set}'`\" = set"; then
+echo "configure:1330: checking which header file defines FD_ macros" >&5
+if eval "test \"`echo '$''{'ucsim_cv_fd'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  s51_cv_fd="unknown"
+  ucsim_cv_fd="unknown"
 cat > conftest.$ac_ext <<EOF
-#line 1303 "configure"
+#line 1336 "configure"
 #include "confdefs.h"
 
 #include <sys/time.h>
@@ -1310,12 +1343,12 @@ EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "yes" >/dev/null 2>&1; then
   rm -rf conftest*
-  s51_cv_fd="<sys/time.h>"
+  ucsim_cv_fd="<sys/time.h>"
 fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 1319 "configure"
+#line 1352 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1326,12 +1359,12 @@ EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "yes" >/dev/null 2>&1; then
   rm -rf conftest*
-  s51_cv_fd="<sys/types.h>"
+  ucsim_cv_fd="<sys/types.h>"
 fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 1335 "configure"
+#line 1368 "configure"
 #include "confdefs.h"
 
 #include <sys/select.h>
@@ -1342,19 +1375,19 @@ EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "yes" >/dev/null 2>&1; then
   rm -rf conftest*
-  s51_cv_fd="<sys/types.h>"
+  ucsim_cv_fd="<sys/types.h>"
 fi
 rm -f conftest*
 
 fi
 
-echo "$ac_t""$s51_cv_fd" 1>&6
+echo "$ac_t""$ucsim_cv_fd" 1>&6
 
 cat >> confdefs.h <<\EOF
 #define FD_HEADER_OK 0
 EOF
 
-if echo $s51_cv_fd|grep time >/dev/null 2>&1; then
+if echo $ucsim_cv_fd|grep time >/dev/null 2>&1; then
 cat >> confdefs.h <<\EOF
 #define FD_NEED_TIME_H 1
 EOF
@@ -1369,7 +1402,7 @@ cat >> confdefs.h <<\EOF
 EOF
 
 fi
-if echo $s51_cv_fd|grep types >/dev/null 2>&1; then
+if echo $ucsim_cv_fd|grep types >/dev/null 2>&1; then
 cat >> confdefs.h <<\EOF
 #define FD_NEED_TYPES_H 1
 EOF
@@ -1384,7 +1417,7 @@ cat >> confdefs.h <<\EOF
 EOF
 
 fi
-if echo $s51_cv_fd|grep select >/dev/null 2>&1; then
+if echo $ucsim_cv_fd|grep select >/dev/null 2>&1; then
 cat >> confdefs.h <<\EOF
 #define FD_NEED_SELECT_H 1
 EOF
@@ -1401,7 +1434,7 @@ EOF
 fi
 
 cat >> confdefs.h <<EOF
-#define HEADER_FD ${s51_cv_fd}
+#define HEADER_FD ${ucsim_cv_fd}
 EOF
 
 
@@ -1409,7 +1442,7 @@ EOF
 # Checking for functions/libs
 # ===========================================================================
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:1413: checking for socket in -lsocket" >&5
+echo "configure:1446: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1417,7 +1450,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1421 "configure"
+#line 1454 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -1431,7 +1464,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:1435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1459,7 +1492,7 @@ else
 fi
 
 echo $ac_n "checking for xdr_short in -lnsl""... $ac_c" 1>&6
-echo "configure:1463: checking for xdr_short in -lnsl" >&5
+echo "configure:1496: checking for xdr_short in -lnsl" >&5
 ac_lib_var=`echo nsl'_'xdr_short | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1467,7 +1500,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1471 "configure"
+#line 1504 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -1481,7 +1514,7 @@ int main() {
 xdr_short()
 ; return 0; }
 EOF
-if { (eval echo configure:1485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1508,8 +1541,56 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:1546: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1554 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:1568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  dl_ok="yes"
+DL="-ldl"
+else
+  echo "$ac_t""no" 1>&6
+dl_ok="no"
+DL=""
+fi
+
+
+
 echo $ac_n "checking for panel_above in -lpanel""... $ac_c" 1>&6
-echo "configure:1513: checking for panel_above in -lpanel" >&5
+echo "configure:1594: checking for panel_above in -lpanel" >&5
 ac_lib_var=`echo panel'_'panel_above | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1517,7 +1598,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpanel -lcurses $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1521 "configure"
+#line 1602 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -1531,7 +1612,7 @@ int main() {
 panel_above()
 ; return 0; }
 EOF
-if { (eval echo configure:1535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1554,7 +1635,7 @@ else
   echo "$ac_t""no" 1>&6
 panel_ok="no"
 echo $ac_n "checking for nl in -lcurses""... $ac_c" 1>&6
-echo "configure:1558: checking for nl in -lcurses" >&5
+echo "configure:1639: checking for nl in -lcurses" >&5
 ac_lib_var=`echo curses'_'nl | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1562,7 +1643,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1566 "configure"
+#line 1647 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -1576,7 +1657,7 @@ int main() {
 nl()
 ; return 0; }
 EOF
-if { (eval echo configure:1580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1607,12 +1688,12 @@ fi
 
 
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:1611: checking for vprintf" >&5
+echo "configure:1692: checking for vprintf" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1616 "configure"
+#line 1697 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -1638,7 +1719,7 @@ vprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
@@ -1662,12 +1743,12 @@ fi
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:1666: checking for _doprnt" >&5
+echo "configure:1747: checking for _doprnt" >&5
 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1671 "configure"
+#line 1752 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -1693,7 +1774,7 @@ _doprnt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
@@ -1720,12 +1801,12 @@ fi
 for ac_func in vsnprintf vasprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1724: checking for $ac_func" >&5
+echo "configure:1805: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1729 "configure"
+#line 1810 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1751,7 +1832,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1778,12 +1859,12 @@ done
 for ac_func in strlen strcpy strcat strstr strcmp strerror strtok strdup
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1782: checking for $ac_func" >&5
+echo "configure:1863: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1787 "configure"
+#line 1868 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1809,7 +1890,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1836,12 +1917,12 @@ done
 for ac_func in strchr memcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1840: checking for $ac_func" >&5
+echo "configure:1921: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1845 "configure"
+#line 1926 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1867,7 +1948,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1894,12 +1975,12 @@ done
 for ac_func in fgets
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1898: checking for $ac_func" >&5
+echo "configure:1979: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1903 "configure"
+#line 1984 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1925,7 +2006,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1952,12 +2033,12 @@ done
 for ac_func in yylex
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1956: checking for $ac_func" >&5
+echo "configure:2037: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1961 "configure"
+#line 2042 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1983,7 +2064,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2009,16 +2090,16 @@ done
 
 
 echo $ac_n "checking whether scanf knows %a""... $ac_c" 1>&6
-echo "configure:2013: checking whether scanf knows %a" >&5
-if eval "test \"`echo '$''{'s51_cv_scanf_a'+set}'`\" = set"; then
+echo "configure:2094: checking whether scanf knows %a" >&5
+if eval "test \"`echo '$''{'ucsim_cv_scanf_a'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo "a b" >conftest.data
 if test "$cross_compiling" = yes; then
-  s51_cv_scanf_a="unknown"
+  ucsim_cv_scanf_a="unknown"
 else
   cat > conftest.$ac_ext <<EOF
-#line 2022 "configure"
+#line 2103 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2041,14 +2122,14 @@ void main(void)
   exit(3);
 }
 EOF
-if { (eval echo configure:2045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
-  s51_cv_scanf_a="yes"
+  ucsim_cv_scanf_a="yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -fr conftest*
-  s51_cv_scanf_a="no"
+  ucsim_cv_scanf_a="no"
 fi
 rm -fr conftest*
 fi
@@ -2056,8 +2137,8 @@ fi
 
 fi
 
-echo "$ac_t""$s51_cv_scanf_a" 1>&6
-if test "$s51_cv_scanf_a" = "yes"; then
+echo "$ac_t""$ucsim_cv_scanf_a" 1>&6
+if test "$ucsim_cv_scanf_a" = "yes"; then
   cat >> confdefs.h <<\EOF
 #define SCANF_A 1
 EOF
@@ -2065,15 +2146,15 @@ EOF
 fi
 
 echo $ac_n "checking whether getcwd is GNUish""... $ac_c" 1>&6
-echo "configure:2069: checking whether getcwd is GNUish" >&5
-if eval "test \"`echo '$''{'s51_cv_getcwd'+set}'`\" = set"; then
+echo "configure:2150: checking whether getcwd is GNUish" >&5
+if eval "test \"`echo '$''{'ucsim_cv_getcwd'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
-  s51_cv_getcwd="unknown"
+  ucsim_cv_getcwd="unknown"
 else
   cat > conftest.$ac_ext <<EOF
-#line 2077 "configure"
+#line 2158 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2087,14 +2168,14 @@ void main(void)
   exit(0);
 }
 EOF
-if { (eval echo configure:2091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
-  s51_cv_getcwd="yes"
+  ucsim_cv_getcwd="yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -fr conftest*
-  s51_cv_getcwd="no"
+  ucsim_cv_getcwd="no"
 fi
 rm -fr conftest*
 fi
@@ -2102,8 +2183,8 @@ fi
 
 fi
 
-echo "$ac_t""$s51_cv_getcwd" 1>&6
-if test "$s51_cv_getcwd" = "yes"; then
+echo "$ac_t""$ucsim_cv_getcwd" 1>&6
+if test "$ucsim_cv_getcwd" = "yes"; then
   cat >> confdefs.h <<\EOF
 #define GNU_GETCWD 1
 EOF
@@ -2111,18 +2192,19 @@ EOF
 fi
 
 
+#'
 
 echo $ac_n "checking for type of length pointer parameter of accept""... $ac_c" 1>&6
-echo "configure:2117: checking for type of length pointer parameter of accept" >&5
-if eval "test \"`echo '$''{'s51_cv_accept_length_type'+set}'`\" = set"; then
+echo "configure:2199: checking for type of length pointer parameter of accept" >&5
+if eval "test \"`echo '$''{'ucsim_cv_accept_length_type'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_CPPFLAGS="$CPPFLAGS"
-    s51_cv_accept_length_type=no
+    ucsim_cv_accept_length_type=no
     for ac_val in int size_t socklen_t; do
       CPPFLAGS="$ac_save_CPPFLAGS -DACCEPT_SOCKLEN_T=$ac_val"
       cat > conftest.$ac_ext <<EOF
-#line 2126 "configure"
+#line 2208 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -2130,9 +2212,9 @@ int main() {
 struct sockaddr a; $ac_val len; accept (0, &a, &len);
 ; return 0; }
 EOF
-if { (eval echo configure:2134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2216: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  s51_cv_accept_length_type=$ac_val; break
+  ucsim_cv_accept_length_type=$ac_val; break
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -2142,11 +2224,11 @@ rm -f conftest*
     CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 
-echo "$ac_t""$s51_cv_accept_length_type" 1>&6
+echo "$ac_t""$ucsim_cv_accept_length_type" 1>&6
 
-  if test $s51_cv_accept_length_type != no; then
+  if test $ucsim_cv_accept_length_type != no; then
     cat >> confdefs.h <<EOF
-#define ACCEPT_SOCKLEN_T $s51_cv_accept_length_type
+#define ACCEPT_SOCKLEN_T $ucsim_cv_accept_length_type
 EOF
 
   fi
@@ -2158,7 +2240,7 @@ EOF
 
 # DD_COPT macro checks if the compiler specified as the 1st parameter
 # supports option specified as the 2nd parameter
-# For example: DD_CPORT(CXX, fPIC)
+# For example: DD_COPT(CXX, fPIC)
 
 
 
@@ -2166,14 +2248,14 @@ EOF
 # Checking characteristics of compilers and other programs
 # --------------------------------------------------------
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:2170: checking whether byte ordering is bigendian" >&5
+echo "configure:2252: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 2177 "configure"
+#line 2259 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -2184,11 +2266,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:2188: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 2192 "configure"
+#line 2274 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -2199,7 +2281,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:2203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -2219,7 +2301,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 2223 "configure"
+#line 2305 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2235,7 +2317,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:2239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -2259,31 +2341,31 @@ EOF
 fi
 
 echo $ac_n "checking whether preprocessor accepts -MM or -M""... $ac_c" 1>&6
-echo "configure:2263: checking whether preprocessor accepts -MM or -M" >&5
-if eval "test \"`echo '$''{'s51_cv_MM'+set}'`\" = set"; then
+echo "configure:2345: checking whether preprocessor accepts -MM or -M" >&5
+if eval "test \"`echo '$''{'ucsim_cv_MM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo "#include <stdio.h>" >_test_.c
 echo "" >>_test_.c
 $CXXCPP -v -MM _test_.c 1>&5 2>&5
 if test "$?" = "0"; then
-  s51_cv_MM="-MM"
+  ucsim_cv_MM="-MM"
 else
-  s51_cv_MM="-M"
+  ucsim_cv_MM="-M"
 fi
 rm -f _test_.*
 fi
 
-echo "$ac_t""$s51_cv_MM" 1>&6
-M_OR_MM=$s51_cv_MM
+echo "$ac_t""$ucsim_cv_MM" 1>&6
+M_OR_MM=$ucsim_cv_MM
 
 
 # This is the first time when CFLAGS are set/modified!!
 
 
 echo $ac_n "checking whether $CXX accepts -ggdb""... $ac_c" 1>&6
-echo "configure:2286: checking whether $CXX accepts -ggdb" >&5
-if eval "test \"`echo '$''{'s51_cv_CXXggdb'+set}'`\" = set"; then
+echo "configure:2368: checking whether $CXX accepts -ggdb" >&5
+if eval "test \"`echo '$''{'ucsim_cv_CXXggdb'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat >_test_.c <<EOF
@@ -2292,16 +2374,16 @@ void main(void) {}
 EOF
 $CXX -v -ggdb -c _test_.c 1>&5 2>&5
 if test "$?" = "0"; then
-  s51_cv_CXXggdb="yes"
+  ucsim_cv_CXXggdb="yes"
 else
-  s51_cv_CXXggdb="no"
+  ucsim_cv_CXXggdb="no"
 fi
 rm -f _test_.* a.out
 fi
 
-echo "$ac_t""$s51_cv_CXXggdb" 1>&6
+echo "$ac_t""$ucsim_cv_CXXggdb" 1>&6
 
-if test "$s51_cv_CXXggdb" = "yes"; then
+if test "$ucsim_cv_CXXggdb" = "yes"; then
     if test "$CXXFLAGS"x = x ;then
        CXXFLAGS="-ggdb -O"
     else
@@ -2311,8 +2393,8 @@ fi
 
 
 echo $ac_n "checking whether $CXX accepts -pipe""... $ac_c" 1>&6
-echo "configure:2315: checking whether $CXX accepts -pipe" >&5
-if eval "test \"`echo '$''{'s51_cv_CXXpipe'+set}'`\" = set"; then
+echo "configure:2397: checking whether $CXX accepts -pipe" >&5
+if eval "test \"`echo '$''{'ucsim_cv_CXXpipe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat >_test_.c <<EOF
@@ -2321,30 +2403,87 @@ void main(void) {}
 EOF
 $CXX -v -pipe -c _test_.c 1>&5 2>&5
 if test "$?" = "0"; then
-  s51_cv_CXXpipe="yes"
+  ucsim_cv_CXXpipe="yes"
 else
-  s51_cv_CXXpipe="no"
+  ucsim_cv_CXXpipe="no"
 fi
 rm -f _test_.* a.out
 fi
 
-echo "$ac_t""$s51_cv_CXXpipe" 1>&6
+echo "$ac_t""$ucsim_cv_CXXpipe" 1>&6
 
-if test "$s51_cv_CXXpipe" = "yes"; then
+if test "$ucsim_cv_CXXpipe" = "yes"; then
   CXXFLAGS="$CXXFLAGS -pipe"
 fi
 
+PICOPT=""
+SHAREDLIB="no"
+
+echo $ac_n "checking whether $CXX accepts -fPIC""... $ac_c" 1>&6
+echo "configure:2424: checking whether $CXX accepts -fPIC" >&5
+if eval "test \"`echo '$''{'ucsim_cv_CXXfPIC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat >_test_.c <<EOF
+#include <stdio.h>
+void main(void) {}
+EOF
+$CXX -v -fPIC -c _test_.c 1>&5 2>&5
+if test "$?" = "0"; then
+  ucsim_cv_CXXfPIC="yes"
+else
+  ucsim_cv_CXXfPIC="no"
+fi
+rm -f _test_.* a.out
+fi
+
+echo "$ac_t""$ucsim_cv_CXXfPIC" 1>&6
+
+if test "$ucsim_cv_CXXfPIC" = "yes"; then
+    PICOPT="-fPIC"
+else
+    
+echo $ac_n "checking whether $CXX accepts -fpic""... $ac_c" 1>&6
+echo "configure:2448: checking whether $CXX accepts -fpic" >&5
+if eval "test \"`echo '$''{'ucsim_cv_CXXfpic'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat >_test_.c <<EOF
+#include <stdio.h>
+void main(void) {}
+EOF
+$CXX -v -fpic -c _test_.c 1>&5 2>&5
+if test "$?" = "0"; then
+  ucsim_cv_CXXfpic="yes"
+else
+  ucsim_cv_CXXfpic="no"
+fi
+rm -f _test_.* a.out
+fi
+
+echo "$ac_t""$ucsim_cv_CXXfpic" 1>&6
+
+    if test "$ucsim_cv_CXXfpic" = "yes"; then
+       PICOPT="-fpic"
+    fi
+fi
+if test "$PICOPT"x != "x"; then
+    SHAREDLIB="yes"
+fi
+
+
+
 
 # Checks for typedefs, structures, and compiler characteristics.
 # ===========================================================================
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2343: checking return type of signal handlers" >&5
+echo "configure:2482: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2348 "configure"
+#line 2487 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2361,7 +2500,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2380,7 +2519,7 @@ EOF
 
 
 echo $ac_n "checking size of char""... $ac_c" 1>&6
-echo "configure:2384: checking size of char" >&5
+echo "configure:2523: checking size of char" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2388,7 +2527,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 2392 "configure"
+#line 2531 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2402,7 +2541,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_char=`cat conftestval`
 else
@@ -2422,7 +2561,7 @@ EOF
 
 
 echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:2426: checking size of short" >&5
+echo "configure:2565: checking size of short" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2430,7 +2569,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 2434 "configure"
+#line 2573 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2444,7 +2583,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_short=`cat conftestval`
 else
@@ -2464,7 +2603,7 @@ EOF
 
 
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:2468: checking size of int" >&5
+echo "configure:2607: checking size of int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2472,7 +2611,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 2476 "configure"
+#line 2615 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2486,7 +2625,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -2506,7 +2645,7 @@ EOF
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:2510: checking size of long" >&5
+echo "configure:2649: checking size of long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2514,7 +2653,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 2518 "configure"
+#line 2657 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2528,7 +2667,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -2548,7 +2687,7 @@ EOF
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:2552: checking size of long long" >&5
+echo "configure:2691: checking size of long long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2556,7 +2695,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 2560 "configure"
+#line 2699 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2570,7 +2709,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_long=`cat conftestval`
 else
@@ -2616,15 +2755,15 @@ type_name()
 }
 
 echo $ac_n "checking type name for byte""... $ac_c" 1>&6
-echo "configure:2620: checking type name for byte" >&5
+echo "configure:2759: checking type name for byte" >&5
 TYPE_BYTE=`type_name 1`
 echo "$ac_t""$TYPE_BYTE" 1>&6
 echo $ac_n "checking type name for word""... $ac_c" 1>&6
-echo "configure:2624: checking type name for word" >&5
+echo "configure:2763: checking type name for word" >&5
 TYPE_WORD=`type_name 2`
 echo "$ac_t""$TYPE_WORD" 1>&6
 echo $ac_n "checking type name for dword""... $ac_c" 1>&6
-echo "configure:2628: checking type name for dword" >&5
+echo "configure:2767: checking type name for dword" >&5
 TYPE_DWORD=`type_name 4`
 echo "$ac_t""$TYPE_DWORD" 1>&6
 cat >> confdefs.h <<EOF
@@ -2752,7 +2891,6 @@ avr.src/Makefile
 z80.src/Makefile
 gui.src/Makefile
 gui.src/serio.src/Makefile
-gui.src/portmon.src/Makefile
 doc/Makefile
  ddconfig.h:ddconfig_in.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
@@ -2797,10 +2935,14 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@RANLIB@%$RANLIB%g
+s%@dl_ok@%$dl_ok%g
+s%@DL@%$DL%g
 s%@panel_ok@%$panel_ok%g
 s%@curses_ok@%$curses_ok%g
 s%@CURSES_LIBS@%$CURSES_LIBS%g
 s%@M_OR_MM@%$M_OR_MM%g
+s%@SHAREDLIB@%$SHAREDLIB%g
+s%@PICOPT@%$PICOPT%g
 
 CEOF
 EOF
@@ -2850,7 +2992,6 @@ avr.src/Makefile
 z80.src/Makefile
 gui.src/Makefile
 gui.src/serio.src/Makefile
-gui.src/portmon.src/Makefile
 doc/Makefile
 "}
 EOF
@@ -3031,5 +3172,7 @@ rm -fr confdefs* $ac_clean_files
 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
 
+#gui.src/portmon.src/Makefile
+
 
 # End of configure/configure.in
index 00c0b354b1b222a70bb474d7497e8a0eb9252044..cb8ade102ad14bb3e4d24a0bcf0f6d224422c1c2 100644 (file)
@@ -53,55 +53,63 @@ AC_CHECK_HEADER(sys/socket.h,
                    AC_DEFINE_UNQUOTED(SOCKLEN_T, socklen_t),
                    AC_DEFINE_UNQUOTED(SOCKLEN_T, uint))
 )
+AC_CHECK_HEADER(dlfcn.h)
 AC_HEADER_DIRENT
 
 # This must be after CXXCPP
 
-AC_CACHE_CHECK(which header file defines FD_ macros, s51_cv_fd,
-[s51_cv_fd="unknown"
+AC_CACHE_CHECK(which header file defines FD_ macros, ucsim_cv_fd,
+[ucsim_cv_fd="unknown"
 AC_EGREP_CPP(yes, [
 #include <sys/time.h>
 #ifdef FD_ZERO
 yes
-#endif], s51_cv_fd="<sys/time.h>")
+#endif], ucsim_cv_fd="<sys/time.h>")
 AC_EGREP_CPP(yes, [
 #include <sys/types.h>
 #ifdef FD_ZERO
 yes
-#endif], s51_cv_fd="<sys/types.h>")
+#endif], ucsim_cv_fd="<sys/types.h>")
 AC_EGREP_CPP(yes, [
 #include <sys/select.h>
 #ifdef FD_ZERO
 yes
-#endif], s51_cv_fd="<sys/types.h>")])
+#endif], ucsim_cv_fd="<sys/types.h>")])
 
 AC_DEFINE(FD_HEADER_OK, 0)
-if echo $s51_cv_fd|grep time >/dev/null 2>&1; then
+if echo $ucsim_cv_fd|grep time >/dev/null 2>&1; then
 AC_DEFINE(FD_NEED_TIME_H, 1)
 AC_DEFINE(FD_HEADER_OK, 1)
 else
 AC_DEFINE(FD_NEED_TIME_H, 0)
 fi
-if echo $s51_cv_fd|grep types >/dev/null 2>&1; then
+if echo $ucsim_cv_fd|grep types >/dev/null 2>&1; then
 AC_DEFINE(FD_NEED_TYPES_H, 1)
 AC_DEFINE(FD_HEADER_OK, 1)
 else
 AC_DEFINE(FD_NEED_TYPES_H, 0)
 fi
-if echo $s51_cv_fd|grep select >/dev/null 2>&1; then
+if echo $ucsim_cv_fd|grep select >/dev/null 2>&1; then
 AC_DEFINE(FD_NEED_SELECT_H, 1)
 AC_DEFINE(FD_HEADER_OK, 1)
 else
 AC_DEFINE(FD_NEED_SELECT_H, 0)
 fi
 
-AC_DEFINE_UNQUOTED(HEADER_FD, ${s51_cv_fd})
+AC_DEFINE_UNQUOTED(HEADER_FD, ${ucsim_cv_fd})
 
 
 # Checking for functions/libs
 # ===========================================================================
 AC_CHECK_LIB(socket,socket)
 AC_CHECK_LIB(nsl,xdr_short)
+AC_CHECK_LIB(dl,dlopen,
+dl_ok="yes"
+DL="-ldl",
+dl_ok="no"
+DL="")
+AC_SUBST(dl_ok)
+AC_SUBST(DL)
 AC_CHECK_LIB(panel,panel_above,
 panel_ok="yes"
 curses_ok="yes"
@@ -128,7 +136,7 @@ dnl AC_CHECK_FUNCS(getdelim)
 AC_CHECK_FUNCS(fgets)
 AC_CHECK_FUNCS(yylex)
 
-AC_CACHE_CHECK(whether scanf knows %a, s51_cv_scanf_a,
+AC_CACHE_CHECK(whether scanf knows %a, ucsim_cv_scanf_a,
 [echo "a b" >conftest.data
 AC_TRY_RUN([
 #include <stdio.h>
@@ -147,15 +155,15 @@ void main(void)
     exit(0);
   exit(3);
 }],
-s51_cv_scanf_a="yes",
-s51_cv_scanf_a="no",
-s51_cv_scanf_a="unknown")
+ucsim_cv_scanf_a="yes",
+ucsim_cv_scanf_a="no",
+ucsim_cv_scanf_a="unknown")
 ])
-if test "$s51_cv_scanf_a" = "yes"; then
+if test "$ucsim_cv_scanf_a" = "yes"; then
   AC_DEFINE(SCANF_A)
 fi
 
-AC_CACHE_CHECK(whether getcwd is GNUish, s51_cv_getcwd,
+AC_CACHE_CHECK(whether getcwd is GNUish, ucsim_cv_getcwd,
 [AC_TRY_RUN([
 #include <unistd.h>
 void main(void)
@@ -164,55 +172,56 @@ void main(void)
     exit(1);
   exit(0);
 }],
-s51_cv_getcwd="yes",
-s51_cv_getcwd="no",
-s51_cv_getcwd="unknown")
+ucsim_cv_getcwd="yes",
+ucsim_cv_getcwd="no",
+ucsim_cv_getcwd="unknown")
 ])
-if test "$s51_cv_getcwd" = "yes"; then
+if test "$ucsim_cv_getcwd" = "yes"; then
   AC_DEFINE(GNU_GETCWD)
 fi
 
-AC_DEFUN(s51_ACCEPT_LENGTH_T,
+AC_DEFUN(ucsim_ACCEPT_LENGTH_T,
  [AC_CACHE_CHECK([for type of length pointer parameter of accept],
-   s51_cv_accept_length_type,
+   ucsim_cv_accept_length_type,
    [ac_save_CPPFLAGS="$CPPFLAGS"
-    s51_cv_accept_length_type=no
+    ucsim_cv_accept_length_type=no
     for ac_val in int size_t socklen_t; do
       CPPFLAGS="$ac_save_CPPFLAGS -DACCEPT_SOCKLEN_T=$ac_val"
       AC_TRY_COMPILE([#include <sys/types.h>
 #include <sys/socket.h>],
         [struct sockaddr a; $ac_val len; accept (0, &a, &len);],
-        [s51_cv_accept_length_type=$ac_val; break])
+        [ucsim_cv_accept_length_type=$ac_val; break])
     done
     CPPFLAGS="$ac_save_CPPFLAGS"])
 
-  if test $s51_cv_accept_length_type != no; then
-    AC_DEFINE_UNQUOTED(ACCEPT_SOCKLEN_T, $s51_cv_accept_length_type,
+  if test $ucsim_cv_accept_length_type != no; then
+    AC_DEFINE_UNQUOTED(ACCEPT_SOCKLEN_T, $ucsim_cv_accept_length_type,
       [Define to be the type of length parameter of accept (without the \*').])
   fi
  ]
 )
+#'
 
-s51_ACCEPT_LENGTH_T
+ucsim_ACCEPT_LENGTH_T
 
 # Macro definitions
 ###################
 
 # DD_COPT macro checks if the compiler specified as the 1st parameter
 # supports option specified as the 2nd parameter
-# For example: DD_CPORT(CXX, fPIC)
+# For example: DD_COPT(CXX, fPIC)
 
 AC_DEFUN(DD_COPT, [
-AC_CACHE_CHECK(whether $$1 accepts -$2,s51_cv_$1$2,
+AC_CACHE_CHECK(whether $$1 accepts -$2,ucsim_cv_$1$2,
 cat >_test_.c <<EOF
 #include <stdio.h>
 void main(void) {}
 EOF
 $$1 -v -$2 -c _test_.c 1>&5 2>&5
 if test "$?" = "0"; then
-  s51_cv_$1$2="yes"
+  ucsim_cv_$1$2="yes"
 else
-  s51_cv_$1$2="no"
+  ucsim_cv_$1$2="no"
 fi
 rm -f _test_.* a.out)
 ])
@@ -221,23 +230,23 @@ rm -f _test_.* a.out)
 # Checking characteristics of compilers and other programs
 # --------------------------------------------------------
 AC_C_BIGENDIAN
-AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,s51_cv_MM,
+AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,ucsim_cv_MM,
 echo "#include <stdio.h>" >_test_.c
 echo "" >>_test_.c
 $CXXCPP -v -MM _test_.c 1>&5 2>&5
 if test "$?" = "0"; then
-  s51_cv_MM="-MM"
+  ucsim_cv_MM="-MM"
 else
-  s51_cv_MM="-M"
+  ucsim_cv_MM="-M"
 fi
 rm -f _test_.*)
-M_OR_MM=$s51_cv_MM
+M_OR_MM=$ucsim_cv_MM
 AC_SUBST(M_OR_MM)
 
 # This is the first time when CFLAGS are set/modified!!
 
 DD_COPT(CXX, ggdb)
-if test "$s51_cv_CXXggdb" = "yes"; then
+if test "$ucsim_cv_CXXggdb" = "yes"; then
     if test "$CXXFLAGS"x = x ;then
        CXXFLAGS="-ggdb -O"
     else
@@ -246,10 +255,27 @@ if test "$s51_cv_CXXggdb" = "yes"; then
 fi
 
 DD_COPT(CXX, pipe)
-if test "$s51_cv_CXXpipe" = "yes"; then
+if test "$ucsim_cv_CXXpipe" = "yes"; then
   CXXFLAGS="$CXXFLAGS -pipe"
 fi
 
+PICOPT=""
+SHAREDLIB="no"
+DD_COPT(CXX, fPIC)
+if test "$ucsim_cv_CXXfPIC" = "yes"; then
+    PICOPT="-fPIC"
+else
+    DD_COPT(CXX, fpic)
+    if test "$ucsim_cv_CXXfpic" = "yes"; then
+       PICOPT="-fpic"
+    fi
+fi
+if test "$PICOPT"x != "x"; then
+    SHAREDLIB="yes"
+fi
+AC_SUBST(SHAREDLIB)
+AC_SUBST(PICOPT)
+
 
 # Checks for typedefs, structures, and compiler characteristics.
 # ===========================================================================
@@ -310,9 +336,10 @@ avr.src/Makefile
 z80.src/Makefile
 gui.src/Makefile
 gui.src/serio.src/Makefile
-gui.src/portmon.src/Makefile
 doc/Makefile
 )
 
+#gui.src/portmon.src/Makefile
+
 
 # End of configure/configure.in
index 5118a35c9d6c0372005927c4a60b29c6250ecc92..6fdc7f9c2e667ef2bb7422bc4a8765899228392a 100644 (file)
@@ -40,6 +40,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #undef HAVE_SYS_DIR_H
 #undef HAVE_SYS_SOCKET_H
 #undef HAVE_NDIR_H
+#undef HAVE_DLFCN_H
 
 #undef SOCKET_AVAIL
 #undef SOCKLEN_T
index 84e7ec235aa4c67f1cc0604cc77ba4fbdafee5af..6043982eb0c75d3908c7e641784dd10ca840b7ab 100644 (file)
 
 <h1>Command reference of ucsim</h1>
 
+
 <a href="cmd_general.html">General commands and information</a>
 
-<ul><li><a href="cmd_general.html#h"><b>help,?</b> Help about commands</a>
-<li><a href="cmd_general.html#show"><b>show</b> Show licensing information</a> (<font color="#ff2211">since 0.1.3</font>)
-<li><a href="cmd_general.html#file"><b>file,load FILE</b> Load FILE into ROM</a> (<font
-color="#ff2211">since 0.2.24</font>)<img src="new.gif">
-<li><a href="cmd_general.html#dl"><b>download,dl</b> Download (intel hex) data</a>
-<li><a href="cmd_general.html#q"><b>quit</b> Quit</a>
-(<font color="cmd_general.html#ff2211">changed 0.2.12</font>)
-<li><a href="cmd_general.html#kill"><b>kill</b> Shut down the simulator</a>
-(<font color="#ff2211">since 0.2.12</font>)
-<li><a href="cmd_general.html#reset"><b>reset</b> Reset</a>
-<li><a href="cmd_general.html#wi"><b>wi,Wi</b> Search for string in Internal RAM</a>
-<li><a href="cmd_general.html#wi"><b>wx,Wx</b> Search for string in External RAM</a>
-<li><a href="cmd_general.html#wi"><b>wc,Wc</b> Search for string in ROM</a>
-<li><a href="cmd_general.html#gopt"><b>gopt</b> Get value of option(s)</a>
-<li><a href="cmd_general.html#sopt"><b>sopt</b> Set value of option</a>
-<li><a href="cmd_general.html#conf"><b>conf</b> Configuration</a> (<font color="#ff2211">since 0.2.20</font>)<img src="new.gif">
-<li><a href="cmd_general.html#state"><b>state</b> State of simulator</a> (<font color="#ff2211">since 0.2.19</font>)<img src="new.gif">
-<li><a href="cmd_general.html#info"><b>info</b> Information</a> (<font color="#ff2211">since 0.2.20</font>)<img src="new.gif">
-<li><a href="cmd_general.html#timer"><b>timer a|d|g|r|s|v id [value]</b> Timer add|del|get|run|stop|value</a> (<font color="#ff2211">since 0.2.19</font>)<img src="new.gif">
+<ul><li><a href="cmd_general.html#h"><b>help,?</b> Help about
+commands</a> (<font color="#ff2211">changed 0.2.38</font>)
+
+<li><a href="cmd_general.html#show"><b>show</b> Show different kind of
+information</a> (<font color="#ff2211">since 0.1.3</font>) (<font
+color="#ff2211">changed 0.2.38</font>)
+
+<li><a href="cmd_general.html#file"><b>file,load</b> Load FILE into
+ROM</a>
+
+<li><a href="cmd_general.html#dl"><b>download,dl</b> Download (intel
+hex) data</a>
+
+<li><a href="cmd_general.html#q"><b>quit</b> Quit</a> (<font
+color="cmd_general.html#ff2211">changed 0.2.12</font>)
+
+<li><a href="cmd_general.html#kill"><b>kill</b> Shut down the
+simulator</a> (<font color="#ff2211">since 0.2.12</font>)
+
+<li><a href="cmd_general.html#reset"><b>reset</b> Reset
+
+<li><a href="cmd_general.html#where"><b>where,Where</b> Search for
+data in memory</a> (<font color="#ff2211">since 0.2.38</font>)
+
+<li><a href="cmd_general.html#conf"><b>conf</b> Configuration</a>
+
+<li><a href="cmd_general.html#state"><b>state</b> State of
+simulator</a>
+
+<li><a href="cmd_general.html#info"><b>info</b> Information</a> (<font
+color="#ff2211">changed 0.2.38</font>)
+
+<li><a href="cmd_general.html#timer"><b>timer</b> Managing timers to
+measure execution time and profiling</a>
+
+<li><a href="cmd_general.html#set"><b>set</b> Set various things</a>
+(<font color="#ff2211">since 0.2.38</font>)
+
+<li><a href="cmd_general.html#get"><b>get</b> Get various things</a>
+(<font color="#ff2211">since 0.2.38</font>)
+
+<li><a href="cmd_general.html#fill"><b>fill</b> Fill memory region
+with data</a> (<font color="#ff2211">since 0.2.38</font>)
+
 </ul>
 
+
 <a href="cmd_exec.html">Execution</a>
 
-<ul><li><a href="cmd_exec.html#g"><b>g</b> Go</a> (<font color="#ff2211">changed 0.2.12</font>)
-<li><a href="cmd_exec.html#stop"><b>stop</b> Stop</a> (<font color="#ff2211">since 0.2.12</font>)
-<li><a href="cmd_exec.html#s"><b>s</b> Step</a>
-<li><a href="cmd_exec.html#n"><b>n</b> Next</a>
-<li><a href="cmd_exec.html#pc"><b>pc</b> Set/get PC</a> (<font color="#ff2211">since 0.1.5</font>)
-<li><a href="cmd_exec.html#run"><b>run</b> Go</a> (<font color="#ff2211">since 0.2.20</font>)<img src="new.gif">
+<ul><li><a href="cmd_exec.html#stop"><b>stop</b> Stop</a> (<font
+color="#ff2211">since 0.2.12</font>)
+
+<li><a href="cmd_exec.html#step"><b>s,step</b> Step</a> (<font
+color="pink">renamed from <b>s</b> 0.2.38</font>)
+
+<li><a href="cmd_exec.html#n"><b>n,next</b> Next</a>
+
+<li><a href="cmd_exec.html#pc"><b>pc</b> Set/get PC</a> (<font
+color="#ff2211">since 0.1.5</font>)
+
+<li><a href="cmd_exec.html#run"><b>r,run,go</b> Go</a> (<font
+color="#ff2211">since 0.2.20</font>) (<font color="#ff2211">changed
+0.2.38</font>)
+
 </ul>
 
+
 <a href="cmd_bp.html">Breakpoints</a>
 
-<ul><li><b>bs</b> Set FETCH Breakpoint (<font color="#ff2211">removed
-0.2.20, use <a href="cmd_bp.html#break">break</a> or <a href="cmd_bp.html#tbreak">tbreak</a>
-instead</font>)
-<li><a href="cmd_bp.html#bse"><b>bse</b> Set EVENT Breakpoint</a>
-<li><b>bd</b> Delete FETCH Breakpoint (<font color="#ff2211">removed
-0.2.20</font>, use <a href="cmd_bp.html#clear">clear</a> instead)
-<li><a href="cmd_bp.html#bde"><b>bde</b> Delete EVENT Breakpoint</a>
-<li><a href="cmd_bp.html#ba"><b>ba</b> Delete all breakpoints</a>
-<li><b>bl</b> List Breakpoints (<font color="#ff2211">removed 0.2.20,
-use <a href="cmd_bp.html#info">info breakpoints</a> instead</font>)
-<li><a href="cmd_bp.html#break"><b>break</b> Set fix breakpoint</a> (<font color="#ff2211">since 0.2.20</font>)<img src="new.gif">
-<li><a href="cmd_bp.html#tbreak"><b>tbreak</b> Set fix breakpoint</a> (<font color="#ff2211">since 0.2.20</font>)<img src="new.gif">
-<li><a href="cmd_bp.html#clear"><b>clear</b> Clear fix breakpoint</a> (<font color="#ff2211">since 0.2.20</font>)<img src="new.gif">
+<ul><li><a href="cmd_bp.html#break"><b>break</b> Set fix
+breakpoint</a> (<font color="#ff2211">changed 0.2.38</font>)
+
+<li><a href="cmd_bp.html#tbreak"><b>tbreak</b> Set temporary
+breakpoint</a> (<font color="#ff2211">changed 0.2.38</font>)
+
+<li><a href="cmd_bp.html#clear"><b>clear</b> Clear fix breakpoint</a>
+
+<li><a href="cmd_bp.html#delete"><b>delete</b> Delete
+breakpoint(s)</a>
+
 </ul>
 
+
 <a href="cmd_dump.html">Dump commands</a>
 
-<ul><li><a href="cmd_dump.html#dis"><b>dis</b> Disassemble</a>
-<li><a href="cmd_dump.html#dc"><b>dc</b> Dump code in disass format</a>
+<ul><li><a href="cmd_dump.html#dump"><b>dump</b> Dump memory or bits</a>
+(<font color="#ff2211">since 0.2.38</font>)
+
+<li><a href="cmd_dump.html#disassemble"><b>disassemble</b>
+Disassemble</a>
+
+<li><a href="cmd_dump.html#dc"><b>dc</b> Dump code in disass
+format</a>
+
 <li><a href="cmd_dump.html#dch"><b>dch</b> Dump code in hex format</a>
+
 <li><a href="cmd_dump.html#di"><b>di</b> Dump Internal RAM</a>
+
 <li><a href="cmd_dump.html#dx"><b>dx</b> Dump External RAM</a>
-<li>dr Dump registers</a> (<font color="#ff2211">removed
-0.2.37</font>, use <a href="cmd_general.html#info_reg">info registers</a> instead)
-<li><a href="cmd_dump.html#dp"><b>dp</b> Dump ports</a>
+
 <li><a href="cmd_dump.html#ds"><b>ds</b> Dump SFR</a>
-<li><a href="cmd_dump.html#db"><b>db</b> Dump bit</a></ul>
-
-<a href="cmd_set.html">Set commands</a>
-
-<ul><li><a href="cmd_set.html#si"><b>si</b> Set Internal RAM</a>
-<li><a href="cmd_set.html#sx"><b>sx</b> Set External RAM</a>
-<li><a href="cmd_set.html#sc"><b>sc</b> Set code (ROM)</a>
-<li><a href="cmd_set.html#ss"><b>ss</b> Set SFR area</a>
-<li><a href="cmd_set.html#sb"><b>sb</b> Set bit</a>
-<li><a href="cmd_set.html#sp"><b>sp</b> Set port pins</a>
-<li><a href="cmd_set.html#fi"><b>fi</b> Fill IRAM area with data</a>
-<li><a href="cmd_set.html#fx"><b>fx</b> Fill XRAM area with data</a>
-<li><a href="cmd_set.html#fs"><b>fs</b> Fill SFR area with data</a>
-<li><a href="cmd_set.html#fc"><b>fc</b> Fill ROM area with data</a>
+
+</ul>
+
+
+<a href="cmd_removed.html">Removed obsolet commands</a>
+
+<ul><li><a href="cmd_removed.html#wi">wi,Wi</a> Search for string in
+Internal RAM (<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#where">where,Where</a> instead</font>)
+
+<li><a href="cmd_removed.html#wx">wx,Wx</a> Search for string in
+External RAM (<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#where">where,Where</a> instead</font>)
+
+<li><a href="cmd_removed.html#wc">wc,Wc</a> Search for string in ROM
+(<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#where">where,Where</a> instead</font>)
+
+<li><a href="cmd_removed.html#gopt">gopt</a> Get value of option(s)
+(<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#get_option">get option</a> instead</font>)
+
+<li><a href="cmd_removed.html#sopt">sopt</a> Set value of option
+(<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_set.html#set_option">set option</a> instead</font>)
+
+<li><a href="cmd_removed.html#g">g Go</a> (<font
+color="#ff2211">changed 0.2.12</font>) (<font color="#ff2211">removed
+0.2.38, use <a href="cmd_exec.html#run">run</a> instead</font>)
+
+<li>bs Set FETCH Breakpoint (<font color="#ff2211">removed 0.2.20, use
+<a href="cmd_bp.html#break">break</a> or <a
+href="cmd_bp.html#tbreak">tbreak</a> instead</font>)
+
+<li><a href="cmd_removed.html#bse">bse</a> Set EVENT Breakpoint (<font
+color="#ff2211">removed 0.2.38, use <a
+href="cmd_bp.html#break">break</a> or <a
+href="cmd_bp.html#tbreak">tbreak</a> instead</font>)
+
+<li>bd Delete FETCH Breakpoint (<font color="#ff2211">removed
+0.2.20</font>, use <a href="cmd_bp.html#clear">clear</a> instead)
+
+<li><a href="cmd_removed.html#bde">bde</a> Delete EVENT Breakpoint
+(<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_bp.html#delete">delete</a> instead</font>)
+
+<li><a href="cmd_removed.html#ba">ba</a> Delete all breakpoints (<font
+color="#ff2211">removed 0.2.38, use <a
+href="cmd_bp.html#delete">delete</a> instead</font>)
+
+<li>bl List Breakpoints (<font color="#ff2211">removed 0.2.20, use <a
+href="cmd_bp.html#info">info breakpoints</a> instead</font>)
+
+<li>dr Dump registers (<font color="#ff2211">removed 0.2.37</font>,
+use <a href="cmd_general.html#info_reg">info registers</a> instead)
+
+<li><a href="cmd_removed.html#dp">dp</a> Dump ports (<font
+color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#info_hw">info hardware</a> instead</font>)
+
+<li><a href="cmd_removed.html#si">si</a> Set Internal RAM</a> (<font
+color="#ff2211">removed 0.2.38, use <a href="cmd_set.html#set_mem">set
+memory</a> instead</font>)
+
+<li><a href="cmd_removed.html#sx">sx</a> Set External RAM</a> (<font
+color="#ff2211">removed 0.2.38, use <a href="cmd_set.html#set_mem">set
+memory</a> instead</font>)
+
+<li><a href="cmd_removed.html#sc">sc</a> Set code (ROM)</a> (<font
+color="#ff2211">removed 0.2.38, use <a href="cmd_set.html#set_mem">set
+memory</a> instead</font>)
+
+<li><a href="cmd_removed.html#ss">ss</a> Set SFR area</a> (<font
+color="#ff2211">removed 0.2.38, use <a href="cmd_set.html#set_mem">set
+memory</a> instead</font>)
+
+<li><a href="cmd_removed.html#sb">sb</a> Set bit</a> (<font
+color="#ff2211">removed 0.2.38, use <a href="cmd_set.html#set_bit">set
+bit</a> instead</font>)
+
+<li><a href="cmd_removed.html#fi">fi</a> Fill IRAM area with data
+(<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#fill">fill</a> instead</font>)
+
+<li><a href="cmd_removed.html#fx">fx</a> Fill XRAM area with data
+(<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#fill">fill</a> instead</font>)
+
+<li><a href="cmd_removed.html#fs">fs</a> Fill SFR area with data
+(<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#fill">fill</a> instead</font>)
+
+<li><a href="cmd_removed.html#fc">fc</a> Fill ROM area with data
+(<font color="#ff2211">removed 0.2.38, use <a
+href="cmd_general.html#fill">fill</a> instead</font>)
+
+<li><a href="cmd_removed.html#db">db</a> Dump bit</a> (<font
+color="#ff2211">removed 0.2.38, use <a
+href="cmd_set.html#dump">dump</a> instead</font>)
+
+<li><a href="cmd_removed.html#sp">sp</a> Set port pins</a> (<font
+color="#ff2211">removed 0.2.38, use <a
+href="cmd_set.html#set_port">set port</a> instead</font>)
+
 </ul>
 
 <hr>
index ca7cefec1a77d8d6917b0525ae026d70b14a8072..e786103db8d38747a65859d7ac2768686daa2622 100644 (file)
@@ -51,17 +51,39 @@ number specifies how many times the breakpoint must be hit before it
 causes the execution to stop. This hit number is 1 by default.
 
 
-<a name="break"><h3>break addr [hit]</h3></a>
-<a name="tbreak"><h3>tbreak addr [hit]</h3></a>
+<a name="break"><h3>break addr [hit]
+<br>break memory_type r|w addr [hit]</h3></a>
+<a name="tbreak"><h3>tbreak addr [hit]
+<br>tbreak memory_type r|w addr [hit]</h3></a>
 
-Set fetch breakpoint. The command specifies if the breakpoint will be
-fix (<b>break</b>) or dynamic (temporary) (<b>tbreak</b>). First
-parameter specifies address where the breakpoint must be placed to. It
-should be address of an instruction.
 
-<p>Second parameter is optional and it specifies the hit number. It is
+Set fetch or event breakpoint. The command specifies if the breakpoint
+will be fix (<b>break</b>) or dynamic (temporary)
+(<b>tbreak</b>).
+
+<p>Fetch or event breakpoint can be defined. First form defines fetch
+while second form defines event breakpoint.
+
+<dl><dt>Fetch breakpoint
+
+<dd>First parameter specifies address where the breakpoint must be
+placed to. It should be address of an instruction.
+<br>Second parameter is optional and it specifies the hit number. It is
 1 by default.
 
+<dt>Event breakpoint
+
+<dd>First parameter specifies class name of memory where we are going
+to watch for en event. Class names of memories can be checked by q<a
+href="cmd_general.html#conf">conf</a> command.
+<br>Second parameter specifies the event. It can be <b>r</b> to
+specify <b>read</b> operation or <b>w</b> which means <b>write</b>
+operation.
+<br>Remaining parameters are address of watched memory location and an
+optional hit number (1 by default).
+
+</dl>
+
 <pre>
 $ <font color="#118811">s51 remoansi.hex</font>
 ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
@@ -92,54 +114,6 @@ F 000160
 > </pre>
 
 
-<a name="bse"><h3>bse wi|ri|wx|rx|ws|rs|rc f|d addr [hit]</h3></a>
-
-Set event breakpoint. First parameter specifies type of event. See <a
-href="#breakpoints">general description of event breakpoints</a> above
-about meaning of event identifiers. Second parameter specify if the
-breakpoint will be fix (<b>f</b>) or dynamic (<b>d</b>). Third
-parameter specifies address. Remember that this is not an instruction
-address, it is address of the memory cell where specified event should
-occur.
-
-<p>Forth parameter is optional and it specifies the hit number. It is
-1 by default.
-
-<pre>
-$ <font color="#118811">s51 remoansi.hex</font>
-ucsim 0.2.12, 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.
-58659 bytes read from remoansi.hex
-> <font color="#118811">dis</font>
-   00d47e 22       RET
-   000000 02 01 60 LJMP  0160
-   000160 c2 90    CLR   P1.0
-   000162 c2 97    CLR   P1.7
-   000164 d2 b5    SETB  P3.5
-   000166 d2 b4    SETB  P3.4
-   000168 75 81 22 MOV   SP,#22
-   00016b 75 d0 00 MOV   PSW,#00
-   00016e 7e 00    MOV   R6,#00
-   000170 7f 00    MOV   R7,#00
-   000172 79 04    MOV   R1,#04
-   000174 12 0d b8 LCALL 0db8
-   000177 0f       INC   R7
-   000178 d9 fa    DJNZ  R1,0174
-   00017a 75 0b 00 MOV   0b,#00
-   00017d 75 0c 00 MOV   0c,#00
-   000180 02 02 2a LJMP  022a
-   000183 78 22    MOV   R0,#22
-   000185 76 00    MOV   @R0,#00
-   000187 d8 fc    DJNZ  R0,0185
-> <font color="#118811">bse wi f 6</font>
-> <font color="#118811">g</font>
-4
-   000170 7f 00    MOV   R7,#00
-> </pre>
-
-
 <a name="clear"><h3>clear [addr...]</h3></a>
 
 Delete fetch breakpoint. Parameter specifies address of breakpoint. If
@@ -166,38 +140,11 @@ Num Type       Disp Hit   Cnt   Address  What
 > </pre>
 
 
-<a name="bde"><h3>bde wi|ri|wx|rx|ws|rs|rc addr</h3></a>
-
-Delete event breakpoint. First parameter must be given to specify type
-of event. Second parameter is address of memory cell which the
-breakpoint is associated to. Continuing example given above:
-
-<pre>
-> <font color="#118811">bl</font>
-D 2(2) 000180 02 LJMP  022a
-F 1(1) 000006 wi
-> <font color="#118811">bde ri 6</font>
-No ri breakpoint at 000006
-> <font color="#118811">bde wi 6</font>
-> <font color="#118811">bl</font>
-D 2(2) 000180 02 LJMP  022a
-> </pre>
-
-
-<a name="ba"><h3>ba</h3></a>
+<a name="delete"><h3>delete [number...]</h3></a>
 
-Delete all breakpoints. This command deletes all fetch as well as
-event breakpoints. Be carefull because it does not ask you to confirm
-your intention.
+Delete breakpoint(s) by its number.
 
-<pre>
-> <font color="#118811">bl</font>
-F 1(1) 000160 c2 CLR   P1.0
-D 2(2) 000180 02 LJMP  022a
-F 1(1) 000006 wi
-> <font color="#118811">ba</font>
-> <font color="#118811">bl</font>
-> </pre>
+<p>If parameter is not used then all breakpoints are deleted.
 
 
 <hr>
index 3859e1e2e564c29ce7c3bdb2622e0385fa9a601a..2c36cbcc8d62665bc4c394e7ec4c9bae0c474981 100644 (file)
@@ -5,12 +5,82 @@
 
 <body bgcolor="white">
 
-                                                                 <!-- DUMP -->
 
 <h2>Dump commands of uCsim</h2>
 
-<a name="dis"><h3><img src="burst.gif" alt="[Repeatable]"> dis
-[start [offset [lines]]]</h3></a>
+<a name="dump"><h3>dump memory_type [start [end
+[bytes_per_line]]]
+<br>dump bit_name...</h3></a>
+
+First form can be used get content of memory while second form can be
+used to check value of bit or bits.
+
+
+<a name="dump_memory"><h4>dump memory_type [start [end
+[bytes_per_line]]]</h4></a>
+
+Hexadecimal dump of a memory region. First parameter specifies
+memory. Class name of the memory must be used, it can be checked using
+<a href="cmd_general.html#conf">conf</a> command which lists size and
+class name of all available memories.
+
+<p><b>start</b> and <b>end</b> parameters can be used to specify the
+first and last address of the region. If <b>end</b> is omitted then 64
+memory location is dumped. If both <b>start</b> and <b>end</b> are
+omitted then next 64 memory location will be dumped out. Every time
+when dump command is used the address of last dumped memory location
+is stored and next dump command automatically continues at next
+address.
+
+<p>Last parameter can be used to specify how many memory locations
+should be dumped out in one line. It is 8 by default.
+
+<pre>
+$ <font color="#118811">s51 remo.hex</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.
+> 55470 words read from remo.hex
+55470 words read from remo.hex
+> <font color="#118811">run</font>
+Simulation started, PC=0x000000
+
+Stop at 0x000515: (105) User stopped
+F 0x000515
+> <font color="#118811">du rom 20</font>
+0x0014 00 ac ff ff ff ff ff ff ........
+0x001c ff ff ff ff ff ff ff 02 ........
+0x0024 01 1c ff ff ff ff ff 32 .......2
+0x002c ff ff ff ff 02 0f a7 02 ........
+0x0034 0e 9c 02 0d d2 02 08 41 .......A
+0x003c c0 82 c0 83 c0 d0 c0 e0 ........
+0x0044 c0 00 a2 90 c0 d0 c2 90 ........
+0x004c 78 18 06 30 03 4b 20 92 x..0.K .
+0x0054 48 30 07 05 c2 07 02 00 H0......
+0x005c 9d 30 08 05 20 93 3a c2 .0.. .:.
+> <font color="#118811">du x 10 20 10</font>
+0x000a ff 01 00 fa 01 01 40 01 01 44 ......@..D
+0x0014 01                            .
+> <font color="#118811">du x</font>
+0x0015 00 00 00 00 00 00 00 00 ........
+0x001d 00 10 01 00 ae 01 00 ae ........
+0x0025 02 12 e1 00 5a 85 00 01 ....Z...
+0x002d 00 3b 00 00 5a 85 00 ab .;..Z...
+0x0035 1f 80 00 00 01 00 01 00 ........
+0x003d fa 0c 02 01 00 fa 00 02 ........
+0x0045 00 01 00 ab 00 00 00 00 ........
+0x004d 00 00 5a 85 ff 00 01 00 ..Z.....
+0x0055 00 00 00 94 a7 01 0c a6 ........
+0x005d 00 6f ff 00 00 00 00 00 .o......
+> </pre>
+
+
+<a name="dump_bit"><h4>dump bit_name...</h4></a>
+
+
+<a name="disassemble"><h3>disassemble [start [offset
+[lines]]]</h3></a>
 
 Disassemble code. This command can be used to list disassembled
 instructions which discovered by the code analyzer. First two
@@ -82,8 +152,7 @@ of instruction's code. Last element of the list is disassembled
 instruction. Every number appeared on the list is hexadecimal number.
 
 
-<a name="dc"><h3><img src="burst.gif" alt="[Repeatable]"> dc
-[start [stop]]</h3></a>
+<a name="dc"><h3>dc [start [stop]]</h3></a>
 
 Disassembled dump of code memory area. This command simply produces
 disassambled list of memory area specified by the parameters. Default
@@ -123,8 +192,7 @@ under certain conditions; type `show c' for details.
 > </pre>
 
 
-<a name="dch"><h3><img src="burst.gif" alt="[Repeatable]"> dch
-[start [stop]]</h3></a>
+<a name="dch"><h3>dch [start [stop]]</h3></a>
 
 Hexadecimal dump of code memory area from address <b>start</b> to
 address <b>stop</b>. Default value of start address is address of
@@ -160,8 +228,7 @@ ASCII charactes of bytes dumped out in the line. If value of the
 memory cell is not printable than a dot is dumped out.
 
 
-<a name="di"><h3><img src="burst.gif" alt="[Repeatable]"> di
-[start [stop]]</h3></a>
+<a name="di"><h3>di [start [stop]]</h3></a>
 
 Hexadecimal dump of internal RAM area from address <b>start</b> to
 address <b>stop</b>. Default value of start address is address of
@@ -195,8 +262,7 @@ F 000023
 > </pre>
 
 
-<a name="dx"><h3><img src="burst.gif" alt="[Repeatable]"> dx
-[start [stop]]</h3></a>
+<a name="dx"><h3>dx [start [stop]]</h3></a>
 
 Hexadecimal dump of external RAM area from address <b>start</b> to
 address <b>stop</b>. Default value of start address is address of
@@ -230,160 +296,6 @@ F 000023
 > </pre>
 
 
-<a name="dp"><h3>dp</h3></a>
-
-Dump out ports. This command shows actual value of ports.
-
-<pre>
-$ <font color="#118811">s51 remoansi.hex</font> 
-ucsim 0.2.12, 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.
-58659 bytes read from remoansi.hex
-> <font color="#118811">sopt stopit 1</font>
-> <font color="#118811">g</font>
-5
- * 000023 02 01 1c LJMP  011c
-> <font color="#118811">dp</font>
-P0    11111111 0xff 255 .    P1    11111110 0xfe 254 .
-Pin0  11111111 0xff 255 .    Pin1  11111111 0xff 255 .
-Port0 11111111 0xff 255 .    Port1 11111110 0xfe 254 .
-
-P2    11111111 0xff 255 .    P3    11111111 0xff 255 .
-Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
-Port2 11111111 0xff 255 .    Port3 11111111 0xff 255 .
-> </pre>
-
-First lines on the list (labeled with Px) are value of SFRs which are
-internal latch registers. Second lines (labeled with Pinx) are outputs
-of external devices connected to port pins of the
-microcontroller. These values can be set by you using <a
-href="#sp"><b>sp</b></a> command. Third lines (labeled with Portx)
-show actual values can be measured on pins of the device. These values
-are calculated with following pseudo formula:
-
-<p><tt>Portx= Px AND Pinx</tt>
-
-<p>All three values are displayed in binary, hexadecimal, decimal form
-and then the ASCII character of the value is shown.
-
-
-<a name="ds"><h3>ds [addr...]</h3></a>
-
-Print out SFR. This command can be used to get value of all or some
-SFRs. If you do not specify any parameter the <b>ds</b> command simply
-dumps out full SFR area 16 bytes per line.
-
-<pre>
-$ <font color="#118811">s51 remoansi.hex</font> 
-ucsim 0.2.12, 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.
-58659 bytes read from remoansi.hex
-> <font color="#118811">sopt stopit 1</font>
-> <font color="#118811">g</font>
-5
- * 000023 02 01 1c LJMP  011c
-> <font color="#118811">ds</font>
-000080 ff 2a ba 16 00 00 00 00 55 a1 d7 fe 50 fd 00 00 .*......U...P...
-000090 fe 00 00 00 00 00 00 00 7e 00 00 00 00 00 00 00 ........~.......
-0000a0 ff 00 00 00 00 00 00 00 97 00 00 00 00 00 00 00 ................
-0000b0 ff 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 ................
-0000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
-0000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
-0000e0 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
-0000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
-> <font color="#118811">ds p1 0x87</font>
-    P1 fe 254 .
-000087 00   0 .
-> <font color="#118811">ds p2 ip scon</font>
-    P2 ff 255 .
-    IP 15  21 .
-  SCON 7e 126 ~
-> </pre>
-
-If you specify one or more parameter the <b>ds</b> command prints out
-value of registers specified by parameters. Parameter can be an
-address or a symbolic name of the register. Note that the simulator
-implements a register at all address in the address space which is not
-true in real microcontroller where reading of an unimplemented
-register gets undefined value. Value of the registers printed out in
-hexadecimal, decimal, and ASCII form.
-
-<p>Note that different type of controllers can implement different
-registers:
-
-<pre>
-$ <font color="#118811">s51</font>
-ucsim 0.2.12, 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">ds rcap2l</font>
-> <font color="#118811">q</font>
-$ <font color="#118811">s51 -t 52</font>
-ucsim 0.2.12, 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">ds rcap2l</font>
-RCAP2L 00   0 .
-> </pre>
-
-
-<a name="db"><h3><img src="burst.gif" alt="[Repeatable]"> db
-addr...</h3></a>
-
-Dump bits. This command can be used to get value of bits. At least one
-parameter must be given. Bit address can be specified in three
-forms. First of all name of the bit can be used if it has any. Direct
-bit address is accepted too and it can be specified by address of IRAM
-or SFR which contains the bit and bit number within the byte separated
-by a dot. If the requested bit is in an SFR the address of the
-register can be specified by its name.
-
-<pre>
-$ <font color="#118811">s51</font>
-ucsim 0.2.12, 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">db it1 0x20.3 0x43 p2.5</font>
-000088    IT1 0
-000020   20.3 0
-000028   28.3 0
-0000a0   P2.5 1
-> </pre>
-
-Value of bits are printed out one per line. The list starts direct
-address of the bit followed by bit name or address of the memory cell
-or SFR which contains the displayed bit and bit number within the byte
-separated by a dot. At last the value of the bit is shown. Displaying
-a port bit you get value of SFR latch:
-
-<pre>
-> <font color="#118811">sp 1 0x0f</font>
-> <font color="#118811">ss p1 0x55</font>
-000090 55                                              U
-> <font color="#118811">dp</font>
-P0    11111111 0xff 255 .    P1    01010101 0x55  85 U
-Pin0  11111111 0xff 255 .    Pin1  00001111 0x0f  15 .
-Port0 11111111 0xff 255 .    Port1 00000101 0x05   5 .
-
-P2    11111111 0xff 255 .    P3    11111111 0xff 255 .
-Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
-Port2 11111111 0xff 255 .    Port3 11111111 0xff 255 .
-> <font color="#118811">db p1.2 p1.3 p1.4 p1.5 p1.6</font>
-000090   P1.2 1
-000090   P1.3 0
-000090   P1.4 1
-000090   P1.5 0
-000090   P1.6 1
-> </pre>
-
-
 <hr>
 
 </body>
index 624daa4617dde73961c9b0a93a3993410d56b4dd..8bca134842dfb67e9a8bc7cf18e6965c580c1648 100644 (file)
@@ -5,83 +5,8 @@
 
 <body bgcolor="white">
 
-                                                                 <!-- EXEC -->
-<h2>Execution commands of uCsim</h2>
-
-
-<a name="g"><h3>g [start [stop]]</h3></a>
-
-Go, start execution. Parameters are optional. First parameter
-specifies start address of the execution. By default execution starts
-at address specified by actual value of the PC. This can be overridden
-by first parameter. If second parameter is specified it places a
-dynamic breakpoint at specified address which stops the execution. If
-stop address is not given the simulator stops if it reaches a
-breakpoint, or the CPU accepts an interrupt and <b>stopit</b> option
-is TRUE, or fatal error occures or <a href="#stop">stop</a> command is
-used. Note that first instruction is executed without effect of
-breakpoints. It means that if there is a breakpoint at start address
-then it will not be hit.
-
-<pre>
-$ <font color="#118811">s51 remoansi.hex</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.
-55755 bytes read from remoansi.hex
-> <font color="#118811">b 0x187</font>
-> <font color="#118811">sopt stopit y</font>
-> <font color="#118811">g</font>
-Simulation started, PC=0x000000
-Stop at 000187: (4) Breakpoint
-F 000187
-> </pre>
-
-After execution is started the <tt>Simulaton started</tt> message
-appears with value of PC where the execution started and the simulator
-is ready to accept other commands while the simulation is running in
-background.
-
-<!--If execution stops the simulator first writes out a number which is
-the reason of the stop (this is a diagnostic feature, it will be
-improved in future versions). Reason can be:
-
-<dl><dt>0
-
-<dd>There is no reason to stop. This number should never appear.
-
-<dt>1
-
-<dd>Serious error for example unknown instruction code which is
-impossible to execute.
-
-<dt>2
-
-<dd>Invalid address used in an instruction. For example indirect
-address is bigger then 127 in 51 type of controller. Execution can be
-continued but result will be undefined.
-
-<dt>3
-
-<dd>Stack overflow. Execution can be continued but result will be
-undefined.
 
-<dt>4
-
-<dd>Breakpoint has been reached.
-
-<dt>5
-
-<dd>Interrupt accepted. It only stops the execution if <b>stopit</b>
-option is set to TRUE. See <a href="#sopt">sopt</a> command.
-
-</dl>
-
-After this diagnostic message the simulator prints out intruction at
-the PC in disassembled form. See <a href="#dis"><b>dis</b></a>
-commands for description of disassembled form.
--->
+<h2>Execution commands of uCsim</h2>
 
 
 <a name="stop"><h3>stop</h3></a>
@@ -114,12 +39,10 @@ PC is dissassembled, see the <a href="#dis"><b>dis</b></a> command for
 description of disassembled form.
 
 
-<a name="s"><h3><img src="burst.gif" alt="[Repeatable]"> s
-[step]</h3></a>
+<a name="step"><h3>s,step</h3></a>
 
 Step command. It executes one instruction without effect of
-breakpoints. Optional parameter can specify number of requested
-steps.
+breakpoints.
 
 <pre>
 $ <font color="#118811">s51 remoansi.hex</font>
@@ -133,23 +56,13 @@ under certain conditions; type `show c' for details.
 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
 000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
    000160 c2 90    CLR   P1.0
-> <font color="#118811">s 2</font>
-000000 00 00 00 00 00 00 00 00 ........
-000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
-000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
-   000162 c2 97    CLR   P1.7
-000000 00 00 00 00 00 00 00 00 ........
-000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
-000000 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
-   000164 d2 b5    SETB  P3.5
 > </pre>
 
 After execution of actual instruction pointed by PC the <b>step</b>
-command executes <a href="#dr"><b>dr</b></a> command.
+command dumps out the register set.
 
 
-<a name="n"><h3><img src="burst.gif" alt="[Repeatable]"> n
-[step]</h3></a>
+<a name="n"><h3>n,next</h3></a>
 
 Execute until next instruction is reached. This command is similar to
 <a href="#s"><b>step</b></a> command described above but if actual
@@ -167,8 +80,7 @@ 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.
 58659 bytes read from remoansi.hex
-> <font color="#118811">g 0 0x172</font>
-4
+> <font color="#118811">run 0 0x172</font>
    000172 79 04    MOV   R1,#04
 > <font color="#118811">dis 0x172 0 5</font>
    000170 7f 00    MOV   R7,#00
@@ -177,19 +89,16 @@ under certain conditions; type `show c' for details.
    000177 0f       INC   R7
    000178 d9 fa    DJNZ  R1,0174
    00017a 75 0b 00 MOV   0b,#00
-> <font color="#118811">n 3</font>
+> <font color="#118811">n</font>
 000000 00 04 00 00 00 00 00 00 ........
 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0000 @DPTR= 0x00   0 .
 000004 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
    000174 12 0d b8 LCALL 0db8
+> <font color="#118811">n</font>
 000000 00 04 00 00 00 00 00 00 ........
 000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0167 @DPTR= 0x00   0 .
 000004 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
    000177 0f       INC   R7
-000000 00 04 00 00 00 00 00 01 ........
-000000 00 .  ACC= 0x00   0 .  B= 0x00   DPTR= 0x0167 @DPTR= 0x00   0 .
-000004 00 .  PSW= 0x00 CY=0 AC=0 OV=0 P=0
-   000178 d9 fa    DJNZ  R1,0174
 > </pre>
 
 
@@ -216,10 +125,50 @@ Warning: maybe not instruction at 000020
 > </pre>
 
 
-<a name="run"><h3>run</h3></a>
+<a name="run"><h3>r,run,go [start [stop]]</h3></a>
 
 This command starts the execution of the simulated program.
 
+<p>Parameters are optional. First parameter specifies start address of
+the execution. By default execution starts at address specified by
+actual value of the PC. This can be overridden by first parameter.
+
+<p>If second parameter is specified it places a dynamic breakpoint at
+specified address which stops the execution. If stop address is not
+given the simulator stops if it reaches a breakpoint, or the CPU
+accepts an interrupt and <b>stopit</b> option is TRUE, or fatal error
+occures or <a href="#stop">stop</a> command is used on an other
+console, or ENTER key is pressed on the console where the run command
+was issued.
+
+<p>If program execution is started the console is <i>frozen</i> it is
+not possible to give commands on this console to the simulator while
+execution is running. If it is needed to control the simulator during
+program execution then more consoles can be used. See using <a
+href="mulcons.html">multiple consoles</a> for more information.
+
+<p>Note that first instruction is executed without effect of
+breakpoints and simulation will be started afterwards. It means that
+if there is a breakpoint at start address then it will not be hit. See
+following example:
+
+<pre>
+$ ./s51
+ucsim 0.2.38-pre1, 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">b 0x10</font>
+Breakpoint 1 at 0x000010: MOV   R7,A
+> <font color="#118811">b 0x20</font>
+Breakpoint 2 at 0x000020: MOV   R7,A
+> <font color="#118811">run 0x10</font>
+Warning: maybe not instruction at 0x000010
+Simulation started, PC=0x000010
+Stop at 0x000020: (104) Breakpoint
+F 0x000020
+> 
+</pre>
 
 <hr>
 
index b7031cc763ce97b81b73496e5bff2af8db071cb1..e0483de03fc95e6f09ba5eb527ef798c6d375437 100644 (file)
@@ -7,34 +7,33 @@
 
 <h2>General commands of uCsim</h2>
 
-                                                              <!-- GENERAL -->
-
-Some commands can be repeated by entering an empty command (just
-pressing ENTER if command console is interactive). This repeats the
-<b>full</b> command entered previously precisely including parameters
-of the command. Repeatable commands are signed with <img
-src="burst.gif" alt="[Repeatable]"> icon.
-
-<p>Some commands accept parameters which in most cases can be
-numbers. Numbers can be entered in C-style form. If the number begins
-whith <tt><b>0x</b></tt> or <tt><b>0X</b></tt> it is interpreted as a
-hexadecimal number. If it begins with <tt><b>0</b></tt> followed by
-digits it is interpreted as octal number. In other cases it is
-interpreted as decimal number.
 
 <p>Every command which changes content of ROM area such as <b><a
-href="#l">l</a></b>, <b><a href="#dl">dl</a></b> or <b><a
-href="#sc">sc</a></b> deletes result of code analyzer and causes to
+href="#dl">dl</a></b> or <b><a href="cmd_set#set_memory">set
+memory</a></b> deletes result of code analyzer and causes to
 re-analyze the code.
 
 
-<a name="show"><h3>show c|w</h3></a>
+<a name="show"><h3>show</h3></a>
+
+Show command can be used to display different kind of information. It
+must be followed by a subcommand. Subcommands are:
+
+<p>show <a href="#show_copying">copying</a>
+<br>show <a href="#show_warranty">warranty</a>
+
+
+<a name="show_copying"><h4>show copying</h4></a>
+
+This command can be used to list licensing information. It is first 10
+point of the version 2 of GNU Genral Public License. If you do not
+accept GPL simply do not use the program.
+
 
-This command can be used to list licensing information. If <b>c</b>
-option has given, the license is listed. It is first 10 point of the
-version 2 of GNU Genral Public License. Using <b>w</b> parameter the
-command prints out last 2 point of the license ("NO WARRANTY"
-message). If you do not accept GPL simply do not use the program.
+<a name="show_warranty"><h4>show warranty</h4></a>
+
+This command prints out last 2 point of the license ("NO WARRANTY"
+message).
 
 
 <a name="dl"><h3>download,dl</h3></a>
@@ -101,10 +100,16 @@ confirmation. It doesn't matter how many consoles are used and what
 commands are running on them.
 
 
-<a name="h"><h3>help,?</h3></a>
+<a name="h"><h3>?,help [command]</h3></a>
 
 Help command. It prints out short description of the commands.
 
+<p>If a command name is given as parameter then uCsim prints out all
+command that has the same name.
+
+<p>If parameter is unique name of a command then long description of
+the command is printed out.
+
 
 <a name="reset"><h3>reset</h3></a>
 
@@ -141,130 +146,44 @@ under certain conditions; type `show c' for details.
 > </pre>
 
 
-<a name="wi"><h3>wi,Wi string</h3></a>
-
-Searching for specified string in internal RAM area. String is
-interpreted from first non-space sharacter until end of the command
-including spaces. <b>wi</b> command makes case insensitive search and
-<b>Wi</b> can be used to make case sensitive search. Result is a hexa
-dump of memory areas that match with specified string. Most of C-style
-escape sequences can be used in the string: <tt>\f</tt>, <tt>\n</tt>,
-<tt>\r</tt>, <tt>\t</tt>, <tt>\v</tt>, <tt>\a</tt>, <tt>\b</tt>,
-<tt>\0</tt>, and <tt>\0xxx</tt> where <tt>xxx</tt> is an octadecimal
-number of the code of the character.
-
-<pre>
-$ <font color="#118811">s51 remoansi.hex</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.
-58659 bytes read from remoansi.hex
-> <font color="#118811">g</font>
-Simulation started, PC=0x000000
-
-Stop at 00019c: (7) User stopped
-F 00019c
-> <font color="#118811">si 20 Dani DAni</font>
-000014 44 61 6e 69 44 41 6e 69                         DaniDAni
-> <font color="#118811">wi dani</font>
-000014 44 61 6e 69             Dani
-000018 44 41 6e 69             DAni
-> <font color="#118811">Wi Dani</font>
-000014 44 61 6e 69             Dani
-> <font color="#118811">wi dani\0</font>
-000018 44 41 6e 69 00          DAni.
-> </pre>
-
-
-<a name="wx"><h3>wx,Wx string</h3></a>
-
-Search commands. These commands are similar to <a href="#wi"><b>wi,
-Wi</b></a> commands the only difference is that <b>wx,Wx</b> are used
-to search for a string in external memory.
-
-
-<a name="wc"><h3>wc,Wc string</h3></a>
-
-Search commands. These commands are similar to <a href="#wi"><b>wi,
-Wi</b></a> commands the only difference is that <b>wx,Wx</b> are used
-to search for a string in code memory area.
-
-
-<a name="gopt"><h3>gopt [opt]</h3></a>
-
-Get actual value of option(s). Some options can be set by <a
-href="#sopt"><b>sopt</b></a> to modify behavior of the
-simulator. Using <b>gopt</b> you can get actual value of these
-options. If you use this command without parameter you get list of all
-options known by the program. In this way you can figure out which
-options can be used.
-
-<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">gopt</font>
-verbose TRUE Verbose flag.
-stopit FALSE Stop if interrupt accepted.
-debug FALSE Debug flag.
-> <font color="#118811">gopt stopit</font>
-stopit FALSE Stop if interrupt accepted.
-> </pre>
-
-This version of the simulator knows about three options. First element
-of the list is name of the option (<b>verbose</b>, <b>debug</b> and
-<b>stopit</b>). This name can be used to identify the option in
-<b>gopt</b> and <a href="#sopt"><b>sopt</b></a> command. Second
-element of the list is the value of the option. In this case type of
-both options is boolean, their value can be TRUE or FALSE. Third
-element is a short description of the option.
-
-<dl><dt><b>verbose</b> <dd>?
-
-<dt><b>debug</b> <dd>Debug flag can be set by <b>-V</b> option of the
-program to TRUE otherwise its default value is FALSE. If it is TRUE,
-the simulator prints out short messages about important events.
-
-<dt><b>stopit</b> <dd>Setting this option to TRUE (default value is
-FALSE) forces execution to stop every time when CPU accepts an
-interrupt. You do not have to use breakpoints to inspect interrupts.
+<a name="where"><h3>where,Where memory_type data...</h3></a>
 
-</dl>
+Searching for some data in memory. First parameter specifies
+memory. Class name of the memory must be used, it can be checked using
+<a href="cmd_general.html#conf">conf</a> command which lists size and
+class name of all available memories.
 
+<p>Other parameters can be mixed list of strings (characters between "
+and ") and numbers. Strings can contain escape sequencies. Ucsim
+merges all parameters together and will search for megred list of
+values in specified memory.
 
-<a name="sopt"><h3>sopt opt value</h3></a>
+<p><b>where</b> command do case unsensitive search while <b>Where</b>
+command is for case sensitive search.
 
-Set option value. Options described at previous command (<a
-href="#gopt"><b>gopt</b></a>) can be set using this command. First
-parameter must be an option name and second the new
-value. Interpretation of the value depends on type of the
-option. Value for a boolean type of option interpreted as follows: if
-first character of the value is one of <tt>1</tt>, <tt>t</tt>,
-<tt>T</tt>, <tt>y</tt>, <tt>Y</tt> then value will be TRUE otherwise
-it will be FALSE.
+<p>Search is done in whole memory and all matches are dumped out.
 
 <pre>
-$ <font color="#118811">s51 -V</font>
-ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+$ <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">gopt</font>
-verbose TRUE Verbose flag.
-stopit FALSE Stop if interrupt accepted.
-debug FALSE Debug messages appears on this console.
-> <font color="#118811">sopt debug t</font>
-> <font color="#118811">gopt</font>
-verbose TRUE Verbose flag.
-stopit FALSE Stop if interrupt accepted.
-debug TRUE Debug messages appears on this console.
+> <font color="#118811">set mem x 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 x "dani"</font>
+0x0014 44 61 6e 69             Dani
+0x0025 64 61 6e 69             dani
+0x002a 44 61 6e 69             Dani
+> <font color="#118811">Where x "d ani"</font>
+0x0019 64 20 61 6e 69          d ani
 > </pre>
 
 
-<a name="conf"><h3>conf </h3></a>
+<a name="conf"><h3>conf</h3></a>
 
 This command prints out configuration of the simulator:
 
@@ -282,10 +201,10 @@ Controller has 8 hardware element(s).
   port[3]
   irq[0]
 Memories:
-  ROM  size= 0x010000 65536
-  XRAM size= 0x010000 65536
-  IRAM size= 0x000100 256
-  SFR  size= 0x000100 256
+  ROM  size= 0x010000  65536 width=  8 class= "rom"
+  XRAM size= 0x010000  65536 width=  8 class= "xram"
+  IRAM size= 0x000100    256 width=  8 class= "iram"
+  SFR  size= 0x000100    256 width=  8 class= "sfr"
 > 
 </pre>
 
@@ -479,32 +398,54 @@ well as pointed memory values.
 
 <p>Last line is disassembled instruction ap PC.
 
-<a name="info_hw"><h4>info hardware|hw cathegory [id]</h4></a>
+<a name="info_hw"><h4>info hardware|hw identifier</h4></a>
 
 This subcommand prints out information about a unit of the
-controller. Cathegory can be:
-
-<ul><li>timer
-<li>uart
-<li>port
-<li>pca
-<li>interrupt
-<li>wdt
-</ul>
-
-Ouput format of this command depends on CPU family and type of the CPU
-too because requested unit can be different in different type of
+controller. <b>identifier</b> specifies hardware element. One form of
+it is a name. Names of hardware elements can be checked by <a
+href="#conf">conf</a> command. This form is accepted only when name is
+unique. If more than one element exists with the same name then name
+must be followed by id number is squere brackets in same form as it is
+listed by <a href="#conf">conf</a> command.
+
+<p>Ouput format of this command depends on CPU family and type of the
+CPU too because requested unit can be different in different type of
 controller even in the same CPU family.
 
 <pre>
 $ <font color="#118811">s51 -t 51</font>
-ucsim 0.2.36, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+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">i h t</font>
+> <font color="#118811">conf</font>
+ucsim version 0.2.38-pre2
+Type of microcontroller: 51 CMOS
+Controller has 8 hardware element(s).
+  timer0[0]
+  timer1[1]
+  uart[0]
+  port[0]
+  port[1]
+  port[2]
+  port[3]
+  irq[0]
+Memories:
+  ROM  size= 0x010000  65536 width=  8 class= "rom"
+  XRAM size= 0x010000  65536 width=  8 class= "xram"
+  IRAM size= 0x000100    256 width=  8 class= "iram"
+  SFR  size= 0x000100    256 width=  8 class= "sfr"
+> <font color="#118811">i h port[2]</font>
+port[2]
+P2    11111111 0xff 255 . (Value in SFR register)
+Pin2  11111111 0xff 255 . (Output of outside circuits)
+Port2 11111111 0xff 255 . (Value on the port pins)
+> <font color="#118811">i h t[0]</font>
 timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
-timer1[1] 0x0000 13 bit timer OFF irq=0 dis prio=0
+> <font color="#118811">i h u</font>
+uart[0] Shift, fixed clock MultiProc=none irq=dis prio=0
+Receiver OFF RB8=0 irq=0
+Transmitter TB8=0 irq=0
 > 
 </pre>
 
@@ -512,99 +453,17 @@ Timer #2 differs a little bit from other timers of MCS51:
 
 <pre>
 $ <font color="#118811">s51 -t 52</font>
-ucsim 0.2.36, Copyright (C) 1997 Daniel Drotos, Talker Bt.
+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">i h t</font>
+> <font color="#118811">i h timer0</font>
 timer0[0] 0x0000 13 bit timer OFF irq=0 dis prio=0
-timer1[1] 0x0000 13 bit timer OFF irq=0 dis prio=0
+> <font color="#118811">i h t[2]</font>
 timer2[2] 0x0000 reload 0x0000 timer OFF irq=0 dis prio=0
 > 
 </pre>
 
-<p>If the controller contains more than one unit of a cathegory, then
-optional <b>id</b> parameter can be used to select a specific one. If
-<b>id</b> is not used then information is printed about all units
-belonging to specified cathegory.
-
-<pre>
-> <font color="#118811">i h t 1</font>
-timer1[1] 0x0000 13 bit timer OFF irq=0 dis prio=0
-> 
-</pre>
-
-It is possible that there is no unit belonging to some cathegory. It
-is also possible that the specific unit exists but information command
-of that unit is not implemented, in this case you have to check SFRs
-of the unit...
-
-<pre>
-> <font color="#118811">i h pca</font>
-> 
-</pre>
-
-Information you can get about units of MCS51 controllers:
-
-<pre>
-$ <font color="#118811">s51 -t 251</font> 
-ucsim 0.2.37, 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">g</font>
-Simulation started, PC=0x000000
-
-Stop at 0x000023: (105) User stopped
-F 0x000023
-> <font color="#118811">i h t</font>
-timer0[0] 0xaa8d 16 bit timer ON irq=0 en prio=0
-timer1[1] 0xfdff 8 bit autoreload timer ON irq=1 dis prio=0
-timer2[2] 0x0000 reload 0x0000 timer OFF irq=0 dis prio=0
-> <font color="#118811">i h u</font>
-uart[0] 8 bit UART timer clocked MultiProc=none irq=en prio=1
-Receiver ON RB8=1 irq=0
-Transmitter TB8=1 irq=1
-> <font color="#118811">i h po</font>
-port[0]
-P0    11111111 0xff 255 . (Value in SFR register)
-Pin0  11111111 0xff 255 . (Output of outside circuits)
-Port0 11111111 0xff 255 . (Value on the port pins)
-port[1]
-P1    11111111 0xff 255 . (Value in SFR register)
-Pin1  11111111 0xff 255 . (Output of outside circuits)
-Port1 11111111 0xff 255 . (Value on the port pins)
-port[2]
-P2    11111111 0xff 255 . (Value in SFR register)
-Pin2  11111111 0xff 255 . (Output of outside circuits)
-Port2 11111111 0xff 255 . (Value on the port pins)
-port[3]
-P3    11111111 0xff 255 . (Value in SFR register)
-Pin3  11111111 0xff 255 . (Output of outside circuits)
-Port3 11111111 0xff 255 . (Value on the port pins)
-> <font color="#118811">i h i</font>
-Interrupts are enabled. Interrupt sources:
-  Handler  En  Pr Req Act Name
-  0x000003 en   1 no  act external #0
-  0x00000b en   0 no  act timer #0
-  0x000013 en   1 no  act external #1
-  0x00001b dis  0 YES act timer #1
-  0x000033 dis  0 no  act PCA counter
-  0x000033 dis  0 no  act PCA module #0
-  0x000033 dis  0 no  act PCA module #1
-  0x000033 dis  0 no  act PCA module #2
-  0x000033 dis  0 no  act PCA module #3
-  0x000033 dis  0 no  act PCA module #4
-  0x000023 en   1 YES act serial transmit
-  0x000023 en   1 no  act serial receive
-  0x00002b dis  0 no  act timer #2 TF2
-  0x00002b dis  0 no  act timer #2 EXF2
-Active interrupt service(s):
-  Pr Handler  PC       Source
-   1 0x000023 0x003672 serial transmit
->
-</pre>
-
 
 <a name="timer"><h3>timer a|d|g|r|s|v id [value]</h3></a>
 
@@ -653,6 +512,242 @@ timer #3("unnamed") ON: 0 sec (0 clks)
 If you use 0 as timer id in "get" operation, simulator prints out
 value of all timers including predefined ones.
 
+
+<a name="set"><h3>set</h3></a>
+
+This command can be used to set various kind of things. It requires a
+subcommand to specify what is going to be set. Known subcommands are:
+
+<p>set <a href="#set_memory">memory</a>
+<br>set <a href="#set_bit">bit</a>
+<br>set <a href="#set_port">port</a>
+<br>set <a href="#set_option">option</a>
+
+
+<a name="set_memory"><h4>set memory memory_type address
+data...</h4></a>
+
+This command can be used to modify content of any simulated
+memory. First parameter must be a class name to specify type of
+memory. Class names can de checked by <a
+href="cmd_general.html#conf">conf</a> command.
+
+<p>Second parameter specifies start address of the modification.
+
+<p>Remaining parameters will be written into the memory starting at
+address specified by second parameter. Data list can include numbers
+as well as strings. See <a href="syntax.html">syntax</a> for more
+details.
+q
+<p>Modified memory locations 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 x 1 "ab\tcd\0ef\012ghq" 2 "ABC"</font>
+0x0001 61 62 09 63 64 00 65 66 ab.cd.ef
+0x0009 0a 67 68 71 02 41 42 43 .ghq.ABC
+> <font color="#118811">set mem sfr pcon 0x34</font>
+0x87 34                      4
+> </pre>
+
+
+<a name="set_bit"><h4>set bit address 0|1</h4></a>
+
+Set one bit to 0 or 1. First parameter specifies the bit. It can be
+the address of the bit (number or syqmbolic name) or it can be
+specified in <i>address<b>.</b>bitnumber</i> format where
+<i>address</i> addresses SFR area and <i>bitnumber</i> is number of
+bit in specified SFR location. Using this syntax any SFR (and 8051's
+internal RAM) location can be modified it need not be really bit
+addressable.
+
+<p>Second parameter interpreted as 1 if it is not zero.
+
+<p>Modified memory location is 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 bit tf1 1</font>
+0x88 80 .
+> <font color="#118811">set bit 130 0</font>
+0x80 fb .
+> <font color="#118811">set bit pcon.2 1</font>
+0x87 04 .
+> <font color="#118811">set bit 10.7 1</font>
+0x0a 80 .
+> 
+</pre>
+
+
+<a name="set_port"><h4>set port hardware_id data</h4></a>
+
+This command can be used to set value of external circuits which
+connected to ports of simulated controller. First parameter specifies
+port number. It can be an array which specifies a hardware element or
+simply a number.
+
+<pre>
+> <font color="#118811">set port 0 12</font>
+> <font color="#118811">i h po[0]</font>
+port[0]
+P0    11111111 0xff 255 . (Value in SFR register)
+Pin0  00001100 0x0c  12 . (Output of outside circuits)
+Port0 00001100 0x0c  12 . (Value on the port pins)
+> <font color="#118811">set port port[0] 23</font>
+> <font color="#118811">i h po[0]</font>
+port[0]
+P0    11111111 0xff 255 . (Value in SFR register)
+Pin0  00010111 0x17  23 . (Output of outside circuits)
+Port0 00010111 0x17  23 . (Value on the port pins)
+> </pre>
+
+
+<a name="set_option"><h4>set option name value</h4></a>
+
+<p>Set option value. Options described at (<a
+href="#get_option"><b>get option</b></a>) command can be set using
+this command. First parameter must be an option name and second the
+new value. Interpretation of the value depends on type of the
+option. Value for a boolean type of option interpreted as follows: if
+first character of the value is one of <tt>1</tt>, <tt>t</tt>,
+<tt>T</tt>, <tt>y</tt>, <tt>Y</tt> then value will be TRUE otherwise
+it will be FALSE.
+
+<pre>
+$ <font color="#118811">s51 -V</font>
+ucsim 0.2.38, 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">get opt</font>
+verbose TRUE Verbose flag.
+stopit FALSE Stop if interrupt accepted.
+debug FALSE Debug messages appears on this console.
+> <font color="#118811">set opt debug t</font>
+> <font color="#118811">get opt</font>
+verbose TRUE Verbose flag.
+stopit FALSE Stop if interrupt accepted.
+debug TRUE Debug messages appears on this console.
+> </pre>
+
+
+<a name="get"><h3>get</h3></a>
+
+This command can be used to get value of various kind of things. It
+requires a subcommand to specify what is going to be set. Known
+subcommands are:
+
+<p>get <a href="#get_sfr">sfr</a>
+<br>get <a href="#get_option">option</a>
+
+
+<a name="get_sfr"><h4>get sfr address...</h4></a>
+
+This command can be used to check values of SFR location(s) if SFR
+exists in simulated memory. Note that <a
+href="cmd_dump.html#dump_memory">dump memory</a> or <a
+href="cmd_dump.html#ds">ds</a> can be used as well.
+
+<p>Parameters are interpreted as SFR names or addresses and values of
+addressed locations 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">get sfr pcon p1 0 0x80 kahd scon</font>
+0x87 00 .
+0x90 ff .
+0x00 00 .
+0x80 ff .
+Warning: Invalid address kahd
+0x98 00 .
+> </pre>
+
+
+<a name="get_option"><h4>get option name</h4></a>
+
+Get actual value of option(s). Some options can be set by <a
+href="#set_option"><b>set option</b></a> to modify behavior of the
+simulator. Using <b>get option</b> you can get actual value of these
+options. If you use this command without parameter you get list of all
+options known by the program. In this way you can figure out which
+options can be used.
+
+<pre>
+$ <font color="#118811">s51 -V</font>
+ucsim 0.2.38, 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">get opt</font>
+verbose TRUE Verbose flag.
+stopit FALSE Stop if interrupt accepted.
+debug FALSE Debug flag.
+> <font color="#118811">get opt stopit</font>
+stopit FALSE Stop if interrupt accepted.
+> </pre>
+
+This version of the simulator knows about three options. First element
+of the list is name of the option (<b>verbose</b>, <b>debug</b> and
+<b>stopit</b>). This name can be used to identify the option in
+<b>gopt</b> and <a href="#set_option"><b>set option</b></a>
+command. Second element of the list is the value of the option. In
+this case type of both options is boolean, their value can be TRUE or
+FALSE. Third element is a short description of the option.
+
+<dl><dt><b>verbose</b> <dd>?
+
+<dt><b>debug</b> <dd>Debug flag can be set by <b>-V</b> option of the
+program to TRUE otherwise its default value is FALSE. If it is TRUE,
+the simulator prints out short messages about important events.
+
+<dt><b>stopit</b> <dd>Setting this option to TRUE (default value is
+FALSE) forces execution to stop every time when CPU accepts an
+interrupt. You do not have to use breakpoints to inspect interrupts.
+
+</dl>
+
+
+<a name="fill"><h3>fill memory_type start end data</h3></a>
+
+Fill memory region with specified data. First parameter specifies
+memory. Class name of the memory must be used, it can be checked using
+<a href="cmd_general.html#conf">conf</a> command which lists size and
+class 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 x 12 0x12 0x56</font>
+> <font color="#118811">dump x 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>
 
 </body>
diff --git a/sim/ucsim/doc/cmd_removed.html b/sim/ucsim/doc/cmd_removed.html
new file mode 100644 (file)
index 0000000..f937699
--- /dev/null
@@ -0,0 +1,690 @@
+<html>
+<head>
+<title>Removed commands of uCsim</title>
+</head>
+
+<body bgcolor="white">
+
+<h2>Removed commands of uCsim</h2>
+
+<font color="gray">
+
+
+<a name="bse"><h3>bse wi|ri|wx|rx|ws|rs|rc f|d addr [hit]</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_bp.html#break">break</a> or <a
+href="cmd_bp.html#tbreak">tbreak</a> instead!!</font>
+
+<p>Set event breakpoint. First parameter specifies type of event. See <a
+href="#breakpoints">general description of event breakpoints</a> above
+about meaning of event identifiers. Second parameter specify if the
+breakpoint will be fix (<b>f</b>) or dynamic (<b>d</b>). Third
+parameter specifies address. Remember that this is not an instruction
+address, it is address of the memory cell where specified event should
+occur.
+
+<p>Forth parameter is optional and it specifies the hit number. It is
+1 by default.
+
+<pre>
+$ <font color="#118811">s51 remoansi.hex</font>
+ucsim 0.2.12, 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.
+58659 bytes read from remoansi.hex
+> <font color="#118811">dis</font>
+   00d47e 22       RET
+   000000 02 01 60 LJMP  0160
+   000160 c2 90    CLR   P1.0
+   000162 c2 97    CLR   P1.7
+   000164 d2 b5    SETB  P3.5
+   000166 d2 b4    SETB  P3.4
+   000168 75 81 22 MOV   SP,#22
+   00016b 75 d0 00 MOV   PSW,#00
+   00016e 7e 00    MOV   R6,#00
+   000170 7f 00    MOV   R7,#00
+   000172 79 04    MOV   R1,#04
+   000174 12 0d b8 LCALL 0db8
+   000177 0f       INC   R7
+   000178 d9 fa    DJNZ  R1,0174
+   00017a 75 0b 00 MOV   0b,#00
+   00017d 75 0c 00 MOV   0c,#00
+   000180 02 02 2a LJMP  022a
+   000183 78 22    MOV   R0,#22
+   000185 76 00    MOV   @R0,#00
+   000187 d8 fc    DJNZ  R0,0185
+> <font color="#118811">bse wi f 6</font>
+> <font color="#118811">g</font>
+4
+   000170 7f 00    MOV   R7,#00
+> </pre>
+
+
+<a name="bde"><h3>bde wi|ri|wx|rx|ws|rs|rc addr</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_bp.html#delete">delete</a> instead!!</font>
+
+<p>Delete event breakpoint. First parameter must be given to specify type
+of event. Second parameter is address of memory cell which the
+breakpoint is associated to. Continuing example given above:
+
+<pre>
+> <font color="#118811">bl</font>
+D 2(2) 000180 02 LJMP  022a
+F 1(1) 000006 wi
+> <font color="#118811">bde ri 6</font>
+No ri breakpoint at 000006
+> <font color="#118811">bde wi 6</font>
+> <font color="#118811">bl</font>
+D 2(2) 000180 02 LJMP  022a
+> </pre>
+
+
+<a name="ba"><h3>ba</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_bp.html#delete">delete</a> instead!!</font>
+
+<p>Delete all breakpoints. This command deletes all fetch as well as
+event breakpoints. Be carefull because it does not ask you to confirm
+your intention.
+
+<pre>
+> <font color="#118811">bl</font>
+F 1(1) 000160 c2 CLR   P1.0
+D 2(2) 000180 02 LJMP  022a
+F 1(1) 000006 wi
+> <font color="#118811">ba</font>
+> <font color="#118811">bl</font>
+> </pre>
+
+
+<a name="dp"><h3>dp</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#info_hw">info hardware</a> instead!!</font>
+
+<p>Dump out ports. This command shows actual value of ports.
+
+<pre>
+$ <font color="#118811">s51 remoansi.hex</font> 
+ucsim 0.2.12, 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.
+58659 bytes read from remoansi.hex
+> <font color="#118811">sopt stopit 1</font>
+> <font color="#118811">g</font>
+5
+ * 000023 02 01 1c LJMP  011c
+> <font color="#118811">dp</font>
+P0    11111111 0xff 255 .    P1    11111110 0xfe 254 .
+Pin0  11111111 0xff 255 .    Pin1  11111111 0xff 255 .
+Port0 11111111 0xff 255 .    Port1 11111110 0xfe 254 .
+
+P2    11111111 0xff 255 .    P3    11111111 0xff 255 .
+Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
+Port2 11111111 0xff 255 .    Port3 11111111 0xff 255 .
+> </pre>
+
+First lines on the list (labeled with Px) are value of SFRs which are
+internal latch registers. Second lines (labeled with Pinx) are outputs
+of external devices connected to port pins of the
+microcontroller. These values can be set by you using <a
+href="#sp"><b>sp</b></a> command. Third lines (labeled with Portx)
+show actual values can be measured on pins of the device. These values
+are calculated with following pseudo formula:
+
+<p><tt>Portx= Px AND Pinx</tt>
+
+<p>All three values are displayed in binary, hexadecimal, decimal form
+and then the ASCII character of the value is shown.
+
+
+<a name="ds"><h3>ds [addr...]</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_dump.html#dump">dump</a> instead!!</font>
+
+Print out SFR. This command can be used to get value of all or some
+SFRs. If you do not specify any parameter the <b>ds</b> command simply
+dumps out full SFR area 16 bytes per line.
+
+<pre>
+$ <font color="#118811">s51 remoansi.hex</font> 
+ucsim 0.2.12, 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.
+58659 bytes read from remoansi.hex
+> <font color="#118811">sopt stopit 1</font>
+> <font color="#118811">g</font>
+5
+ * 000023 02 01 1c LJMP  011c
+> <font color="#118811">ds</font>
+000080 ff 2a ba 16 00 00 00 00 55 a1 d7 fe 50 fd 00 00 .*......U...P...
+000090 fe 00 00 00 00 00 00 00 7e 00 00 00 00 00 00 00 ........~.......
+0000a0 ff 00 00 00 00 00 00 00 97 00 00 00 00 00 00 00 ................
+0000b0 ff 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 ................
+0000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+0000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+0000e0 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+0000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+> <font color="#118811">ds p1 0x87</font>
+    P1 fe 254 .
+000087 00   0 .
+> <font color="#118811">ds p2 ip scon</font>
+    P2 ff 255 .
+    IP 15  21 .
+  SCON 7e 126 ~
+> </pre>
+
+If you specify one or more parameter the <b>ds</b> command prints out
+value of registers specified by parameters. Parameter can be an
+address or a symbolic name of the register. Note that the simulator
+implements a register at all address in the address space which is not
+true in real microcontroller where reading of an unimplemented
+register gets undefined value. Value of the registers printed out in
+hexadecimal, decimal, and ASCII form.
+
+<p>Note that different type of controllers can implement different
+registers:
+
+<pre>
+$ <font color="#118811">s51</font>
+ucsim 0.2.12, 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">ds rcap2l</font>
+> <font color="#118811">q</font>
+$ <font color="#118811">s51 -t 52</font>
+ucsim 0.2.12, 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">ds rcap2l</font>
+RCAP2L 00   0 .
+> </pre>
+
+
+<a name="db"><h3>db addr...</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_dump.html#dump">dump</a> instead!!</font>
+
+Dump bits. This command can be used to get value of bits. At least one
+parameter must be given. Bit address can be specified in three
+forms. First of all name of the bit can be used if it has any. Direct
+bit address is accepted too and it can be specified by address of IRAM
+or SFR which contains the bit and bit number within the byte separated
+by a dot. If the requested bit is in an SFR the address of the
+register can be specified by its name.
+
+<pre>
+$ <font color="#118811">s51</font>
+ucsim 0.2.12, 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">db it1 0x20.3 0x43 p2.5</font>
+000088    IT1 0
+000020   20.3 0
+000028   28.3 0
+0000a0   P2.5 1
+> </pre>
+
+Value of bits are printed out one per line. The list starts direct
+address of the bit followed by bit name or address of the memory cell
+or SFR which contains the displayed bit and bit number within the byte
+separated by a dot. At last the value of the bit is shown. Displaying
+a port bit you get value of SFR latch:
+
+<pre>
+> <font color="#118811">sp 1 0x0f</font>
+> <font color="#118811">ss p1 0x55</font>
+000090 55                                              U
+> <font color="#118811">dp</font>
+P0    11111111 0xff 255 .    P1    01010101 0x55  85 U
+Pin0  11111111 0xff 255 .    Pin1  00001111 0x0f  15 .
+Port0 11111111 0xff 255 .    Port1 00000101 0x05   5 .
+
+P2    11111111 0xff 255 .    P3    11111111 0xff 255 .
+Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
+Port2 11111111 0xff 255 .    Port3 11111111 0xff 255 .
+> <font color="#118811">db p1.2 p1.3 p1.4 p1.5 p1.6</font>
+000090   P1.2 1
+000090   P1.3 0
+000090   P1.4 1
+000090   P1.5 0
+000090   P1.6 1
+> </pre>
+
+
+<a name="g"><h3>g [start [stop]]</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_exec.html#run">run</a> instead!!</font>
+
+<p>Go, start execution. Parameters are optional. First parameter
+specifies start address of the execution. By default execution starts
+at address specified by actual value of the PC. This can be overridden
+by first parameter. If second parameter is specified it places a
+dynamic breakpoint at specified address which stops the execution. If
+stop address is not given the simulator stops if it reaches a
+breakpoint, or the CPU accepts an interrupt and <b>stopit</b> option
+is TRUE, or fatal error occures or <a href="#stop">stop</a> command is
+used. Note that first instruction is executed without effect of
+breakpoints. It means that if there is a breakpoint at start address
+then it will not be hit.
+
+<pre>
+$ <font color="#118811">s51 remoansi.hex</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.
+55755 bytes read from remoansi.hex
+> <font color="#118811">b 0x187</font>
+> <font color="#118811">sopt stopit y</font>
+> <font color="#118811">g</font>
+Simulation started, PC=0x000000
+Stop at 000187: (4) Breakpoint
+F 000187
+> </pre>
+
+After execution is started the <tt>Simulaton started</tt> message
+appears with value of PC where the execution started and the simulator
+is ready to accept other commands while the simulation is running in
+background.
+
+<!--If execution stops the simulator first writes out a number which is
+the reason of the stop (this is a diagnostic feature, it will be
+improved in future versions). Reason can be:
+
+<dl><dt>0
+
+<dd>There is no reason to stop. This number should never appear.
+
+<dt>1
+
+<dd>Serious error for example unknown instruction code which is
+impossible to execute.
+
+<dt>2
+
+<dd>Invalid address used in an instruction. For example indirect
+address is bigger then 127 in 51 type of controller. Execution can be
+continued but result will be undefined.
+
+<dt>3
+
+<dd>Stack overflow. Execution can be continued but result will be
+undefined.
+
+<dt>4
+
+<dd>Breakpoint has been reached.
+
+<dt>5
+
+<dd>Interrupt accepted. It only stops the execution if <b>stopit</b>
+option is set to TRUE. See <a href="#sopt">sopt</a> command.
+
+</dl>
+
+After this diagnostic message the simulator prints out intruction at
+the PC in disassembled form. See <a href="#dis"><b>dis</b></a>
+commands for description of disassembled form.
+-->
+
+
+<a name="wi"><h3>wi,Wi string</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#where">where,Where</a> instead!!</font>
+
+<p>Searching for specified string in internal RAM area. String is
+interpreted from first non-space sharacter until end of the command
+including spaces. <b>wi</b> command makes case insensitive search and
+<b>Wi</b> can be used to make case sensitive search. Result is a hexa
+dump of memory areas that match with specified string. Most of C-style
+escape sequences can be used in the string: <tt>\f</tt>, <tt>\n</tt>,
+<tt>\r</tt>, <tt>\t</tt>, <tt>\v</tt>, <tt>\a</tt>, <tt>\b</tt>,
+<tt>\0</tt>, and <tt>\0xxx</tt> where <tt>xxx</tt> is an octadecimal
+number of the code of the character.
+
+<pre>
+$ <font color="#118811">s51 remoansi.hex</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.
+58659 bytes read from remoansi.hex
+> <font color="#118811">g</font>
+Simulation started, PC=0x000000
+
+Stop at 00019c: (7) User stopped
+F 00019c
+> <font color="#118811">si 20 Dani DAni</font>
+000014 44 61 6e 69 44 41 6e 69                         DaniDAni
+> <font color="#118811">wi dani</font>
+000014 44 61 6e 69             Dani
+000018 44 41 6e 69             DAni
+> <font color="#118811">Wi Dani</font>
+000014 44 61 6e 69             Dani
+> <font color="#118811">wi dani\0</font>
+000018 44 41 6e 69 00          DAni.
+> </pre>
+
+
+<a name="wx"><h3>wx,Wx string</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#where">where,Where</a> instead!!</font>
+
+<p>Search commands. These commands are similar to <a href="#wi"><b>wi,
+Wi</b></a> commands the only difference is that <b>wx,Wx</b> are used
+to search for a string in external memory.
+
+
+<a name="wc"><h3>wc,Wc string</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#where">where,Where</a> instead!!</font>
+
+<p>Search commands. These commands are similar to <a href="#wi"><b>wi,
+Wi</b></a> commands the only difference is that <b>wx,Wx</b> are used
+to search for a string in code memory area.
+
+
+<a name="gopt"><h3>gopt [opt]</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#get_option">get_option</a> instead!!</font>
+
+<p>Get actual value of option(s). Some options can be set by <a
+href="#sopt"><b>sopt</b></a> to modify behavior of the
+simulator. Using <b>gopt</b> you can get actual value of these
+options. If you use this command without parameter you get list of all
+options known by the program. In this way you can figure out which
+options can be used.
+
+<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">gopt</font>
+verbose TRUE Verbose flag.
+stopit FALSE Stop if interrupt accepted.
+debug FALSE Debug flag.
+> <font color="#118811">gopt stopit</font>
+stopit FALSE Stop if interrupt accepted.
+> </pre>
+
+This version of the simulator knows about three options. First element
+of the list is name of the option (<b>verbose</b>, <b>debug</b> and
+<b>stopit</b>). This name can be used to identify the option in
+<b>gopt</b> and <a href="#sopt"><b>sopt</b></a> command. Second
+element of the list is the value of the option. In this case type of
+both options is boolean, their value can be TRUE or FALSE. Third
+element is a short description of the option.
+
+<dl><dt><b>verbose</b> <dd>?
+
+<dt><b>debug</b> <dd>Debug flag can be set by <b>-V</b> option of the
+program to TRUE otherwise its default value is FALSE. If it is TRUE,
+the simulator prints out short messages about important events.
+
+<dt><b>stopit</b> <dd>Setting this option to TRUE (default value is
+FALSE) forces execution to stop every time when CPU accepts an
+interrupt. You do not have to use breakpoints to inspect interrupts.
+
+</dl>
+
+
+<a name="sopt"><h3>sopt opt value</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#set_option">set_option</a> instead!!</font>
+
+<p>Set option value. Options described at previous command (<a
+href="#gopt"><b>gopt</b></a>) can be set using this command. First
+parameter must be an option name and second the new
+value. Interpretation of the value depends on type of the
+option. Value for a boolean type of option interpreted as follows: if
+first character of the value is one of <tt>1</tt>, <tt>t</tt>,
+<tt>T</tt>, <tt>y</tt>, <tt>Y</tt> then value will be TRUE otherwise
+it will be FALSE.
+
+<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">gopt</font>
+verbose TRUE Verbose flag.
+stopit FALSE Stop if interrupt accepted.
+debug FALSE Debug messages appears on this console.
+> <font color="#118811">sopt debug t</font>
+> <font color="#118811">gopt</font>
+verbose TRUE Verbose flag.
+stopit FALSE Stop if interrupt accepted.
+debug TRUE Debug messages appears on this console.
+> </pre>
+
+
+<a name="si"><h3>si addr data...</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#set_memory">set memory</a> instead!!</font>
+
+<p>Write data into internal RAM area. First parameter specifies start
+address of memory area to set and other parameters are data to set.
+
+<pre>
+$ <font color="#118811">s51</font>
+ucsim 0.2.12, 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">si 10 dani\040hej-ho</font>
+00000a 64 61 6e 69 20 68 65 6a 2d 68 6f                dani hej-ho
+> </pre>
+
+Result of the command is a memory dump of area which has been modified
+by the command. If there is syntax error in a data parameter then
+remaining parameters are dropped out.
+
+<pre>
+> <font color="#118811">si 20 1 2 0xi 3 4</font>
+Bad data 0xi
+000014 01 02                                           ..
+> </pre>
+
+
+<a name="sx"><h3>sx addr data...</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#set_memory">set memory</a> instead!!</font>
+
+<p>This command is similar to <a href="#si"><b>si</b></a> command
+described above but it is used to modify external RAM.
+
+
+<a name="sc"><h3>sc addr data...</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#set_memory">set memory</a> instead!!</font>
+
+<p>This command is similar to <a href="#si"><b>si</b></a> command
+described above but it is used to modify code memory area (ROM).
+
+
+<a name="ss"><h3>ss addr data...</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#set_memory">set memory</a> instead!!</font>
+
+<p>This command is similar to <a href="#si"><b>si</b></a> command
+described above but it is used to modify SFR. Other difference is that
+first parameter (<b>start</b> address) can be specified by name of SFR
+not by address only.
+
+<pre>
+$ <font color="#118811">s51</font>
+ucsim 0.2.12, 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">ss p1 0</font>
+000090 00                                              .
+> </pre>
+
+
+<a name="sb"><h3>sb addr data...</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#set_bit">set bit</a> instead!!</font>
+
+<p>Modify bit(s). First parameter is address of first bit to modify. See
+description of <a href="#db"><b>db</b></a> command how bit address can
+be specified. If first character of data parameter is <tt>0</tt> it
+means <i>zero</i> otherwise it means <i>one</i>.
+
+<pre>
+$ <font color="#118811">s51</font>
+ucsim 0.2.12, 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">sb 0x23.5 1</font>
+> <font color="#118811">db 0x23.5</font>
+000023   23.5 1
+> <font color="#118811">sb p3.3 0</font>
+> <font color="#118811">dp</font>
+P0    11111111 0xff 255 .    P1    11111111 0xff 255 .
+Pin0  11111111 0xff 255 .    Pin1  11111111 0xff 255 .
+Port0 11111111 0xff 255 .    Port1 11111111 0xff 255 .
+
+P2    11111111 0xff 255 .    P3    11110111 0xf7 247 .
+Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
+Port2 11111111 0xff 255 .    Port3 11110111 0xf7 247 .
+> <font color="#118811">sb tr1 0</font>
+> <font color="#118811">db tr1</font>
+000088    TR1 0
+> <font color="#118811">sb tr1 1</font>
+> <font color="#118811">db tr1</font>
+000088    TR1 1
+> </pre>
+
+</font>
+
+
+<a name="sp"><h3>sp port data</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#set_port">set port</a> instead!!</font>
+
+<p>This command can be used to sep up output values of external circuits
+connected to port pins. If a port bit is used as output to drive
+external circuits, do not set corresponding pin bit to zero because
+read back value of the port can be false. First parameter must be
+number of the port between 0 and 3.
+
+<pre>
+$ <font color="#118811">s51</font>
+ucsim 0.2.12, 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">dp</font>
+P0    11111111 0xff 255 .    P1    11111111 0xff 255 .
+Pin0  11111111 0xff 255 .    Pin1  11111111 0xff 255 .
+Port0 11111111 0xff 255 .    Port1 11111111 0xff 255 .
+
+P2    11111111 0xff 255 .    P3    11111111 0xff 255 .
+Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
+Port2 11111111 0xff 255 .    Port3 11111111 0xff 255 .
+> <font color="#118811">ss p1 0x55</font>
+000090 55                                              U
+> <font color="#118811">sp 1 0x0f</font>
+> <font color="#118811">dp</font>
+P0    11111111 0xff 255 .    P1    01010101 0x55  85 U
+Pin0  11111111 0xff 255 .    Pin1  00001111 0x0f  15 .
+Port0 11111111 0xff 255 .    Port1 00000101 0x05   5 .
+
+P2    11111111 0xff 255 .    P3    11111111 0xff 255 .
+Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
+Port2 11111111 0xff 255 .    Port3 11111111 0xff 255 .
+> </pre>
+
+
+<a name="fi"><h3>fi start stop data</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#fill">fill</a> instead!!</font>
+
+<p>Fill command. It can be used to fill up an area of internal RAM with a
+specified data.
+
+<pre>
+$ <font color="#118811">s51</font>
+ucsim 0.2.12, 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">fi 11 0x34 44</font>
+> <font color="#118811">di</font>
+000000 00 00 00 00 00 00 00 00 ........
+000008 00 00 00 2c 2c 2c 2c 2c ...,,,,,
+000010 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,,
+000018 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,,
+000020 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,,
+000028 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,,
+000030 2c 2c 2c 2c 2c 00 00 00 ,,,,,...
+000038 00 00 00 00 00 00 00 00 ........
+000040 00 00 00 00 00 00 00 00 ........
+000048 00 00 00 00 00 00 00 00 ........
+> </pre>
+
+
+<a name="fx"><h3>fx start stop data</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#fill">fill</a> instead!!</font>
+
+<p>Fill command. It works similar to <a href="#fi"><b>fi</b></a> but it
+puts data into external RAM instead of internal RAM.
+
+
+<a name="fs"><h3>fs start stop data</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#fill">fill</a> instead!!</font>
+
+<p>Fill command. It works similar to <a href="#fi"><b>fi</b></a> but it
+puts data into SFR instead of internal RAM.
+
+
+<a name="fc"><h3>fc start stop data</h3></a>
+
+<font color="#ff2211">Removed 0.2.38, use <a
+href="cmd_general.html#fill">fill</a> instead!!</font>
+
+<p>Fill command. It works similar to <a href="#fi"><b>fi</b></a> but it
+puts data into code memory (ROM) instead of internal RAM.
+
+
+</font>
+
+<hr>
+
+</body>
+</html>
index e062d772f25d8e5ca77e5367b808dbd25e7e5fb0..053627a2bd5f1bf92f73070fdef8435adf723acc 100644 (file)
@@ -27,175 +27,6 @@ number parameters if needed. Only space characters separate data
 parameters while normaly comma (<tt>,</tt>) and semicolon (<tt>;</tt>)
 are interpreted as separator characters too.
 
-<a name="si"><h3>si addr data...</h3></a>
-
-Write data into internal RAM area. First parameter specifies start
-address of memory area to set and other parameters are data to set.
-
-<pre>
-$ <font color="#118811">s51</font>
-ucsim 0.2.12, 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">si 10 dani\040hej-ho</font>
-00000a 64 61 6e 69 20 68 65 6a 2d 68 6f                dani hej-ho
-> </pre>
-
-Result of the command is a memory dump of area which has been modified
-by the command. If there is syntax error in a data parameter then
-remaining parameters are dropped out.
-
-<pre>
-> <font color="#118811">si 20 1 2 0xi 3 4</font>
-Bad data 0xi
-000014 01 02                                           ..
-> </pre>
-
-
-<a name="sx"><h3>sx addr data...</h3></a>
-
-This command is similar to <a href="#si"><b>si</b></a> command
-described above but it is used to modify external RAM.
-
-
-<a name="sc"><h3>sc addr data...</h3></a>
-
-This command is similar to <a href="#si"><b>si</b></a> command
-described above but it is used to modify code memory area (ROM).
-
-
-<a name="ss"><h3>ss addr data...</h3></a>
-
-This command is similar to <a href="#si"><b>si</b></a> command
-described above but it is used to modify SFR. Other difference is that
-first parameter (<b>start</b> address) can be specified by name of SFR
-not by address only.
-
-<pre>
-$ <font color="#118811">s51</font>
-ucsim 0.2.12, 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">ss p1 0</font>
-000090 00                                              .
-> </pre>
-
-
-<a name="sb"><h3>sb addr data...</h3></a>
-
-Modify bit(s). First parameter is address of first bit to modify. See
-description of <a href="#db"><b>db</b></a> command how bit address can
-be specified. If first character of data parameter is <tt>0</tt> it
-means <i>zero</i> otherwise it means <i>one</i>.
-
-<pre>
-$ <font color="#118811">s51</font>
-ucsim 0.2.12, 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">sb 0x23.5 1</font>
-> <font color="#118811">db 0x23.5</font>
-000023   23.5 1
-> <font color="#118811">sb p3.3 0</font>
-> <font color="#118811">dp</font>
-P0    11111111 0xff 255 .    P1    11111111 0xff 255 .
-Pin0  11111111 0xff 255 .    Pin1  11111111 0xff 255 .
-Port0 11111111 0xff 255 .    Port1 11111111 0xff 255 .
-
-P2    11111111 0xff 255 .    P3    11110111 0xf7 247 .
-Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
-Port2 11111111 0xff 255 .    Port3 11110111 0xf7 247 .
-> <font color="#118811">sb tr1 0</font>
-> <font color="#118811">db tr1</font>
-000088    TR1 0
-> <font color="#118811">sb tr1 1</font>
-> <font color="#118811">db tr1</font>
-000088    TR1 1
-> </pre>
-
-
-<a name="sp"><h3>sp port data</h3></a>
-
-This command can be used to sep up output values of external circuits
-connected to port pins. If a port bit is used as output to drive
-external circuits, do not set corresponding pin bit to zero because
-read back value of the port can be false. First parameter must be
-number of the port between 0 and 3.
-
-<pre>
-$ <font color="#118811">s51</font>
-ucsim 0.2.12, 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">dp</font>
-P0    11111111 0xff 255 .    P1    11111111 0xff 255 .
-Pin0  11111111 0xff 255 .    Pin1  11111111 0xff 255 .
-Port0 11111111 0xff 255 .    Port1 11111111 0xff 255 .
-
-P2    11111111 0xff 255 .    P3    11111111 0xff 255 .
-Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
-Port2 11111111 0xff 255 .    Port3 11111111 0xff 255 .
-> <font color="#118811">ss p1 0x55</font>
-000090 55                                              U
-> <font color="#118811">sp 1 0x0f</font>
-> <font color="#118811">dp</font>
-P0    11111111 0xff 255 .    P1    01010101 0x55  85 U
-Pin0  11111111 0xff 255 .    Pin1  00001111 0x0f  15 .
-Port0 11111111 0xff 255 .    Port1 00000101 0x05   5 .
-
-P2    11111111 0xff 255 .    P3    11111111 0xff 255 .
-Pin2  11111111 0xff 255 .    Pin3  11111111 0xff 255 .
-Port2 11111111 0xff 255 .    Port3 11111111 0xff 255 .
-> </pre>
-
-
-<a name="fi"><h3>fi start stop data</h3></a>
-
-Fill command. It can be used to fill up an area of internal RAM with a
-specified data.
-
-<pre>
-$ <font color="#118811">s51</font>
-ucsim 0.2.12, 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">fi 11 0x34 44</font>
-> <font color="#118811">di</font>
-000000 00 00 00 00 00 00 00 00 ........
-000008 00 00 00 2c 2c 2c 2c 2c ...,,,,,
-000010 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,,
-000018 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,,
-000020 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,,
-000028 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,,
-000030 2c 2c 2c 2c 2c 00 00 00 ,,,,,...
-000038 00 00 00 00 00 00 00 00 ........
-000040 00 00 00 00 00 00 00 00 ........
-000048 00 00 00 00 00 00 00 00 ........
-> </pre>
-
-
-<a name="fx"><h3>fx start stop data</h3></a>
-
-Fill command. It works similar to <a href="#fi"><b>fi</b></a> but it
-puts data into external RAM instead of internal RAM.
-
-
-<a name="fs"><h3>fs start stop data</h3></a>
-
-Fill command. It works similar to <a href="#fi"><b>fi</b></a> but it
-puts data into SFR instead of internal RAM.
-
-
-<a name="fc"><h3>fc start stop data</h3></a>
-
-Fill command. It works similar to <a href="#fi"><b>fi</b></a> but it
-puts data into code memory (ROM) instead of internal RAM.
-
 
 <hr>
 
index 61ffb9c59f2427e61893160722b82b3547a38c60..726c17620b59e303786e8062033641a6b0a76990 100644 (file)
@@ -136,8 +136,9 @@ debugger interfaces.
 <li><a href="serial.html">Serial interfaces</a>. <br>The simulator can
 virtually connect a terminal to serial interface of the simulated CPU.
 
-<li><a href="cmd.html">Command reference</a>. <i>(Now updated up to
-0.2.37)</i> <br>The simulator can be controlled via a command line
+<li><a href="syntax.html">Command syntax</a> and <a
+href="cmd.html">command reference</a>. <i>(Now updated up to
+0.2.38)</i> <br>The simulator can be controlled via a command line
 interface. It accepts simple commands.
 
 </ul>
index ff6cceb96d801f5e67bf9ae1bf3b46ae89104f4f..db9301b3f42050f677cac68bae2265f19c9551c4 100644 (file)
@@ -14,8 +14,6 @@ families:
 <br>AVR family is simulated by <b>savr</b>
 <br>Z80 processor is simulated by <b>sz80</b>
 
-<p>You can select 
-
 <p>The simulator can be started in the following way:
 
 <p><tt><font color="blue">$</font> s51 [-hHVvP] [-p prompt] [-t CPU]
diff --git a/sim/ucsim/doc/syntax.html b/sim/ucsim/doc/syntax.html
new file mode 100644 (file)
index 0000000..cd4f62a
--- /dev/null
@@ -0,0 +1,56 @@
+<html>
+<head>
+<title>Command syntax of uCsim</title>
+</head>
+
+<body bgcolor="white">
+
+<h2>Command syntax of uCsim</h2>
+
+<h3>Command names</h3>
+
+
+<h3>Type of parameters</h3>
+
+<h4>String</h4>
+
+<h4>Bit</h4>
+
+<h4>Array</h4>
+
+<h4>Number</h4>
+
+<p>Some commands accept parameters which in most cases can be
+numbers. Numbers can be entered in C-style form. If the number begins
+whith <tt><b>0x</b></tt> or <tt><b>0X</b></tt> it is interpreted as a
+hexadecimal number. If it begins with <tt><b>0</b></tt> followed by
+digits it is interpreted as octal number. In other cases it is
+interpreted as decimal number.
+
+<h4>Symbol</h4>
+
+
+<h3>Interpretation of parameters</h3>
+
+<h4>Address</h4>
+
+<h4>Number</h4>
+
+<h4>Data</h4>
+
+<h4>String</h4>
+
+<h4>Data list</h4>
+
+<h4>Memory</h4>
+
+<h4>Hardware element</h4>
+
+<h4>Bit</h4>
+
+<h4>
+
+<hr>
+
+</body>
+</html>
index eb10f8fb2c9c1580a32469809a67a9aeb0a4a953..e37bfebd766a69fdaa7550040e44394a69358337 100644 (file)
@@ -33,7 +33,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 
 // No other global variable should exists!
-class cl_sim *simulator;
+//class cl_sim *simulator;
 
 
 /* Delimiters to split up command line */
@@ -47,6 +47,14 @@ struct id_element mem_ids[]= {
   { 0, 0 }
 };
 
+struct id_element mem_classes[]= {
+  { MEM_ROM , "rom" },
+  { MEM_XRAM, "xram" },
+  { MEM_IRAM, "iram" },
+  { MEM_SFR , "sfr" },
+  { 0, 0 }
+};
+
 struct id_element cpu_states[]= {
   { stGO,      "OK" },
   { stIDLE,    "Idle" },
@@ -55,4 +63,289 @@ struct id_element cpu_states[]= {
 };
 
 
+char *warranty= 
+"                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+";
+
+
+char *copying=
+"                  GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The \"Program\", below,
+refers to any such program or work, and a \"work based on the Program\"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term \"modification\".)  Each licensee is addressed as \"you\".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and \"any
+later version\", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+";
+
+
 /* End of globals.cc */
index f5e106d10a2cb4a18d9f0c9d28917ed33f4f9c27..2a3c8e405514ec3b1d5fbec55eb9a8eea13ad602 100644 (file)
@@ -33,13 +33,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "stypes.h"
 
 
-extern class cl_sim *simulator;
+//extern class cl_sim *simulator;
 
 extern char delimiters[];
 
 extern struct id_element mem_ids[];
+extern struct id_element mem_classes[];
 extern struct id_element cpu_states[];
 
+extern char *warranty;
+extern char *copying;
 
 #endif
 
index b91fd8bf45723ed1d96a69fc0233d31bf74f58b7..89d1c8c9d6670e6d829d0780e3a47f63f3e71c95 100644 (file)
@@ -14,7 +14,8 @@ INSTALL               = @INSTALL@
 PRJDIR         = ..
 
 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
-CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR)
+CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
+                 -I$(PRJDIR)/sim.src -I$(PRJDIR)/cmd.src
 CFLAGS          = @CFLAGS@ -Wall
 CXXFLAGS        = @CXXFLAGS@ -Wall
 M_OR_MM         = @M_OR_MM@
@@ -36,63 +37,79 @@ infodir         = @infodir@
 srcdir          = @srcdir@
 
 PKGS           =
-# serio.src portmon.src
+CURSES_PKGS    = serio.src
 
-LOBJECTS       = event.o \
-                 view.o frame.o bg.o label.o \
-                 group.o win.o desk.o app.o
+# Common code
+OBJECTS                = rec.o
+SOURCES                = $(patsubst %.o,%.cc,$(OBJECTS))
+
+# uCsim only
+UCSIM_OBJECTS  = gui.o if.o
+UCSIM_SOURCES  = $(patsubst %.o,%.cc,$(UCSIM_OBJECTS))
+
+# Tool only
+TOOL_OBJECTS   =
+TOOL_SOURCES   = $(patsubst %.o,%.cc,$(TOOL_OBJECTS))
+
+ALL_SOURCES    = $(SOURCES) $(UCSIM_SOURCES) $(TOOL_SOURCES)
 
 
 # Compiling entire program or any subproject
 # ------------------------------------------
 all: gui.src
 
-libs: guilib
-
+gui.src: checkconf gui_api
 ifeq ($(curses_ok),yes)
-gui.src: checkconf guilib
-else
-gui.src: checkconf guilib
-endif
-       @for pkg in $(PKGS); do\
+       @for pkg in $(CURSES_PKGS); do\
          $(MAKE) -C $$pkg $$pkg ;\
        done
+endif
+#      @for pkg in $(PKGS); do\
+#        $(MAKE) -C $$pkg $$pkg ;\
+#      done
 
-a: a.o
-       $(CXX) $(LDFLAGS) $(LIBS) a.o -o $@
+gui_api: ucsim_lib tool_lib
 
 
 # Compiling and installing everything and runing test
 # ---------------------------------------------------
-install:
+install: install_gui_api
        @for pkg in $(PKGS); do\
          cd $$pkg && $(MAKE) install ; cd ..;\
        done
 
+install_gui_api:
+
 
 # Deleting all the installed files
 # --------------------------------
-uninstall:
+uninstall: uninstall_gui_api
        @for pkg in $(PKGS); do\
          cd $$pkg && $(MAKE) uninstall ; cd ..;\
        done
 
+uninstall_gui_api:
+
 
 # Performing self-test
 # --------------------
-check:
+check: check_gui_api
        @for pkg in $(PKGS); do\
          cd $$pkg && $(MAKE) check ; cd ..;\
        done
 
+check_gui_api:
+
 
 # Performing installation test
 # ----------------------------
-installcheck:
+installcheck: installcheck_gui_api
        @for pkg in $(PKGS); do\
          cd $$pkg && $(MAKE) installcheck ; cd ..;\
        done
 
+installcheck_gui_api:
+
 
 # Creating installation directories
 # ---------------------------------
@@ -106,26 +123,25 @@ installdirs:
 # ---------------------
 dep: Makefile.dep
 
-Makefile.dep: *.cc *.h
-       $(CXXCPP) $(CPPFLAGS) $(M_OR_MM) *.cc >Makefile.dep
+Makefile.dep: $(ALL_SOURCES) *.h
+       $(CXXCPP) -MM $(CPPFLAGS) $(M_OR_MM) $(ALL_SOURCES) >Makefile.dep
 
 include Makefile.dep
 include clean.mk
 
-#parser.cc: parser.y
-
-#plex.cc: plex.l
 
 # My rules
 # --------
-ifeq ($(curses_ok),yes)
-guilib: libgui.a
-else
-guilib:
-endif
+ucsim_lib: $(PRJDIR)/libguiucsim.a
+
+$(PRJDIR)/libguiucsim.a: $(OBJECTS) $(UCSIM_OBJECTS)
+       ar -rcu $*.a $(OBJECTS) $(UCSIM_OBJECTS)
+       $(RANLIB) $*.a
+
+tool_lib: $(PRJDIR)/libguitool.a
 
-libgui.a: $(LOBJECTS)
-       ar -rcu $*.a $(LOBJECTS)
+$(PRJDIR)/libguitool.a: $(OBJECTS) $(TOOL_OBJECTS)
+       ar -rcu $*.a $(OBJECTS) $(TOOL_OBJECTS)
        $(RANLIB) $*.a
 
 .cc.o:
index bd548323026a37687a8465ce0b9d90ee44c5bf80..d5896439602ec8280b64e2e89fbc032fb9709302 100644 (file)
@@ -1,6 +1,6 @@
 # uCsim gui.src/clean.mk
 
-PKGS           = serio.src portmon.src
+PKGS           = serio.src
 
 # Deleting all files created by building the program
 # --------------------------------------------------
diff --git a/sim/ucsim/gui.src/gui.cc b/sim/ucsim/gui.src/gui.cc
new file mode 100644 (file)
index 0000000..dbacfcf
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Simulator of microcontrollers (gui.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@*/
+
+#include "guicl.h"
+
+
+cl_gui::cl_gui(class cl_sim *asim):
+  cl_base()
+{
+  sim= asim;
+  ifs= new cl_list(2, 2);
+}
+
+cl_gui::~cl_gui(void)
+{
+  delete ifs;
+}
+
+class cl_gui_if *
+cl_gui::if_by_obj(class cl_guiobj *o)
+{
+  int i;
+
+  for (i= 0; i < ifs->count; i++)
+    {
+      class cl_gui_if *gi= (class cl_gui_if *)(ifs->at(i));
+      if (gi->obj &&
+         gi->obj == o)
+       return(gi);
+    }
+  return(0);
+}
+
+
+/* End of gui.src/gui.cc */
diff --git a/sim/ucsim/gui.src/guicl.h b/sim/ucsim/gui.src/guicl.h
new file mode 100644 (file)
index 0000000..6d7f99f
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Simulator of microcontrollers (guicl.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 GUISRC_GUICL_HEADER
+#define GUISRC_GUICL_HEADER
+
+#include "ddconfig.h"
+
+// prj
+#include "pobjcl.h"
+
+// sim
+#include "simcl.h"
+
+// local
+#include "ifcl.h"
+
+
+class cl_gui: public cl_base
+{
+public:
+  class cl_sim *sim;
+  class cl_list *ifs;
+public:
+  cl_gui(class cl_sim *asim);
+  ~cl_gui(void);
+  
+  virtual class cl_gui_if *if_by_obj(class cl_guiobj *o);
+};
+
+
+#endif
+
+/* End of gui.src/guicl.h */
diff --git a/sim/ucsim/gui.src/if.cc b/sim/ucsim/gui.src/if.cc
new file mode 100644 (file)
index 0000000..b93c2ce
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Simulator of microcontrollers (if.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@*/
+
+#include "ifcl.h"
+
+
+cl_gui_if::cl_gui_if(class cl_guiobj *o):
+  cl_base()
+{
+  obj= o;
+}
+
+
+/* End of gui.src/if.cc */
diff --git a/sim/ucsim/gui.src/ifcl.h b/sim/ucsim/gui.src/ifcl.h
new file mode 100644 (file)
index 0000000..aec1025
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Simulator of microcontrollers (guiifcl.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 GUISRC_IFCL_HEADER
+#define GUISRC_IFCL_HEADER
+
+#include "ddconfig.h"
+
+// prj
+#include "pobjcl.h"
+
+// sim
+#include "guiobjcl.h"
+
+
+class cl_gui_if: public cl_base
+{
+public:
+  class cl_guiobj *obj;                // Object inspected by the GUI tool
+public:
+  cl_gui_if(class cl_guiobj *o);
+};
+
+
+#endif
+
+/* End of gui.src/ifcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/a.cc b/sim/ucsim/gui.src/obsolete/a.cc
new file mode 100644 (file)
index 0000000..81d62c3
--- /dev/null
@@ -0,0 +1,87 @@
+#include <curses.h>
+#include <panel.h>
+
+int sfr[4];
+int port[4];
+
+void
+init_panel(PANEL *p)
+{
+  int mask, x, y;
+  int na, ha;
+  int cursor= 2;
+  WINDOW *w= panel_window(p);
+  
+  if (has_colors())
+    {
+      na= COLOR_PAIR(1);
+      ha= COLOR_PAIR(2);
+    }
+  else
+    {
+      na= A_NORMAL;
+      ha= A_STANDOUT;
+    }
+  //wattron(w, COLOR_PAIR);
+  x= 0;
+  for (mask= 1, y= 0; mask < 0x100; mask<<= 1,y++)
+    {
+      wattrset(w, (y==cursor)?ha:na);
+      mvwprintw(w, y,x, "%s", (sfr[0]&mask)?"High":" Low");
+    }
+}
+
+wchar_t
+wait_input(PANEL *p)
+{
+  WINDOW *w= panel_window(p);
+  wchar_t c;
+
+  c= wgetch(w);
+  printw("%d 0x%x\n",c,c);
+  return(c);
+}
+
+int
+main(int argc, char *argv[])
+{
+  wchar_t c;
+
+  initscr();      /* initialize the curses library */
+  keypad(stdscr, TRUE);  /* enable keyboard mapping */
+  nonl();         /* tell curses not to do NL->CR/NL on output */
+  cbreak();       /* take input chars one at a time, no wait for \n */
+  noecho();       /* don't echo input */
+  if (has_colors())
+    {
+      start_color();
+      printw("has %d colors and %d pairs\n", COLORS, COLOR_PAIRS);
+      init_pair(1, COLOR_WHITE, COLOR_BLUE);
+      init_pair(2, COLOR_WHITE, COLOR_RED);
+    }
+  if (has_key(KEY_UP))
+    printw("has UP KEY_UP=0x%x\n",KEY_UP);
+  else
+    printf("has no UP\n");
+  c= getch();
+  printw("got %d %x\n",c,c);
+
+  WINDOW *w= newwin(10,10, 3,3);
+  keypad(w, TRUE);
+  PANEL *p= new_panel(w);
+
+  sfr[0]= 0x5a;
+  init_panel(p);
+  update_panels();
+  doupdate();
+  c= wait_input(p);
+  //c= getch();
+
+  endwin();
+  if (c==KEY_UP)
+    printf("got UP\n");
+  else if (c==KEY_DOWN)
+    printf("got DOWN\n");
+  else
+    printf("got \"%d\"\n", c);
+}
diff --git a/sim/ucsim/gui.src/obsolete/app.cc b/sim/ucsim/gui.src/obsolete/app.cc
new file mode 100644 (file)
index 0000000..309497b
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Simulator of microcontrollers (app.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include <stdlib.h>
+
+#include "appcl.h"
+#include "deskcl.h"
+
+
+cl_app::cl_app(char *iname):
+  cl_group(iname, this)
+{
+  drawn= 0;
+}
+
+cl_app::~cl_app(void)
+{
+  endwin();
+}
+
+int
+cl_app::init(void)
+{
+  initscr();
+  keypad(stdscr, TRUE);
+  nonl();
+  cbreak();
+  noecho();
+  
+  pos= new cl_box(0,0, COLS, LINES);
+  cl_view::init();
+  state|= SF_SELECTED;//select();
+  class cl_box b(*pos);
+  //b.move_rel(0,1);
+  //b.grow(0,-2);
+  if ((desk= mk_desk(&b)))
+    insert(desk);
+  desk->select();
+  mk_views(desk);
+
+  //update();
+  update_panels();
+  doupdate();
+  return(0);
+}
+
+class cl_gin *
+cl_app::mk_input(void)
+{
+  class cl_gin *i= new cl_gin();
+  i->init();
+  i->add_input(stdin, 0);
+  return(i);
+}
+
+int *
+cl_app::mk_palette(void)
+{
+  int *p, i;
+  int colors;
+
+  colors= 64;
+  p= (int*)malloc(colors * sizeof(int));
+  if (has_colors())
+    {
+      start_color();
+
+      init_pair(i= C_WIN+C_WIN_NORMAL, COLOR_YELLOW, COLOR_BLUE);
+      p[i]= COLOR_PAIR(i)|A_BOLD;
+      for (i= 1; i < colors; i++)
+       p[i]= p[C_WIN+C_WIN_NORMAL];
+      // desktop
+      init_pair(i= C_DSK_BG, COLOR_BLACK, COLOR_WHITE);
+      p[i]= COLOR_PAIR(i);
+      // menus and status bar
+      init_pair(i= C_DSK_NORMAL, COLOR_WHITE, COLOR_BLUE);
+      p[i]= COLOR_PAIR(i)|A_BOLD;
+      init_pair(i= C_DSK_DISABLED, COLOR_WHITE, COLOR_BLUE);
+      p[i]= COLOR_PAIR(i);
+      // window
+      init_pair(i= C_WIN+C_WIN_FPASSIVE, COLOR_WHITE, COLOR_BLUE);
+      p[i]= COLOR_PAIR(i);
+      init_pair(i= C_WIN+C_WIN_FACTIVE, COLOR_WHITE, COLOR_BLUE);
+      p[i]= COLOR_PAIR(i)|A_BOLD;
+      init_pair(i= C_WIN+C_WIN_SELECTED, COLOR_YELLOW, COLOR_RED);
+      p[i]= COLOR_PAIR(i)|A_BOLD; 
+    }
+  else
+    {
+      for (i= 0; i < colors; i++)
+       p[i]= A_NORMAL;
+      p[C_WIN+C_WIN_FACTIVE]|= A_BOLD;
+      p[C_WIN+C_WIN_SELECTED]|= A_REVERSE;
+    }
+  return(p);
+}
+
+class cl_group *
+cl_app::mk_desk(class cl_box *ipos)
+{
+  class cl_group *d= new cl_desk(ipos, "desktop", this);
+  d->init();
+  return(d);
+}
+
+
+int
+cl_app::handle_event(struct t_event *event)
+{
+  if (!cl_group::handle_event(event))
+    {
+      if (event->what == EV_KEY)
+       switch (event->event.key)
+         {
+         case KEY_BREAK: case KEY_EXIT:
+           event->what= EV_COMMAND;
+           event->event.msg.cmd= CMD_QUIT;
+           break;
+         }
+    }
+  return(0);
+}
+
+int
+cl_app::run(void)
+{
+  struct t_event event;
+  
+  drawn= 0;
+  while (get_event(&event))
+    {
+      if (!handle_event(&event))
+       {
+         if (event.what == EV_COMMAND &&
+             event.event.msg.cmd == CMD_QUIT)
+           return(0);
+         unhandled(&event);
+       }
+      if (drawn)
+       update();
+      drawn= 0;
+    }
+  return(0);
+}
+
+
+/* End of gui.src/app.cc */
diff --git a/sim/ucsim/gui.src/obsolete/appcl.h b/sim/ucsim/gui.src/obsolete/appcl.h
new file mode 100644 (file)
index 0000000..92a80c9
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Simulator of microcontrollers (appcl.h)
+ *
+ * Copyright (C) 1999,99 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 APPCL_HEADER
+#define APPCL_HEADER
+
+#include "groupcl.h"
+
+
+class cl_app: public cl_group
+{
+public:
+  class cl_group *desk;
+  int drawn;
+public:
+  cl_app(char *iname);
+  ~cl_app(void);
+  virtual int init(void);
+  virtual class cl_gin *mk_input(void);
+  virtual int *mk_palette(void);
+  virtual class cl_group *mk_desk(class cl_box *ipos);
+  
+  virtual int handle_event(struct t_event *event);
+  virtual int run(void);
+};
+
+
+#endif
+
+/* End of gui.src/appcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/bg.cc b/sim/ucsim/gui.src/obsolete/bg.cc
new file mode 100644 (file)
index 0000000..d854d30
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Simulator of microcontrollers (bg.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include <stdlib.h>
+
+#include "bgcl.h"
+
+
+cl_bg::cl_bg(class cl_box *ipos, char *iname, class cl_app *iapp):
+  cl_view(ipos, iname, iapp)
+{
+  options&= ~OF_SELECTABLE;
+}
+
+int *
+cl_bg::mk_palette(void)
+{
+  int *p;
+
+  p= (int*)malloc(1*sizeof(int));
+  p[0]= C_DSK_BG;
+  return(p);
+}
+
+int
+cl_bg::draw(void)
+{
+  int x, y, color= get_color(0);
+  
+  wmove(window, 0, 0);
+  wattrset(window, color);
+  for (y= 0; y < pos->h; y++)
+    for (x= 0; x < pos->w; x++)
+      waddch(window, ACS_CKBOARD);
+  return(0);
+}
+
+
+/* End of gui.src/bg.cc */
diff --git a/sim/ucsim/gui.src/obsolete/bgcl.h b/sim/ucsim/gui.src/obsolete/bgcl.h
new file mode 100644 (file)
index 0000000..968ed81
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Simulator of microcontrollers (bgcl.h)
+ *
+ * Copyright (C) 1999,99 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 BGCL_HEADER
+#define BGCL_HEADER
+
+
+#include "viewcl.h"
+#include "appcl.h"
+
+
+class cl_bg: public cl_view
+{
+public:
+  cl_bg(class cl_box *ipos, char *iname, class cl_app *iapp);
+  virtual int *mk_palette(void);
+  virtual int draw(void);
+};
+
+
+#endif
+
+/* End of gui.src/bgcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/desk.cc b/sim/ucsim/gui.src/obsolete/desk.cc
new file mode 100644 (file)
index 0000000..6808cd7
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Simulator of microcontrollers (desk.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "deskcl.h"
+#include "bgcl.h"
+
+
+int
+cl_desk::handle_event(struct t_event *event)
+{
+  if (cl_group::handle_event(event))
+    return(1);
+  if (event->what == EV_KEY &&
+      event->event.key == KEY_F(6))
+    {
+      select_next();
+      return(1);
+    }
+  return(0);
+}
+
+int
+cl_desk::mk_views(class cl_group *ins_to)
+{
+  class cl_box b(*pos);
+
+  b.move_rel(0,1);
+  b.grow(0,-2);
+  insert(new cl_bg(&b, "background", app));
+  return(0);
+}
+
+
+/* End of gui.src/desk.cc */
diff --git a/sim/ucsim/gui.src/obsolete/deskcl.h b/sim/ucsim/gui.src/obsolete/deskcl.h
new file mode 100644 (file)
index 0000000..b3346b7
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Simulator of microcontrollers (deskcl.h)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "groupcl.h"
+
+
+class cl_desk: public cl_group
+{
+public:
+  cl_desk(class cl_box *ipos, char *iname, class cl_app *iapp):
+    cl_group(ipos, iname, iapp) {}
+  virtual int mk_views(class cl_group *ins_to);
+
+  virtual int handle_event(struct t_event *event);
+};
+
+
+/* End of gui.src/deskcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/event.cc b/sim/ucsim/gui.src/obsolete/event.cc
new file mode 100644 (file)
index 0000000..3207589
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Simulator of microcontrollers (event.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "ddconfig.h"
+
+#include <curses.h>
+
+//#include <stdio.h>
+
+#include "eventcl.h"
+
+
+cl_input_src::cl_input_src(FILE *ifile, class cl_view *iview)
+{
+  file= ifile;
+  view= iview;
+}
+
+
+cl_gin::cl_gin(void)
+{
+  FD_ZERO(&in_set);
+  max_fdes= 0;
+  inputs= new cl_list(1, 1);
+}
+
+cl_gin::~cl_gin(void)
+{
+  delete inputs;
+}
+
+
+int
+cl_gin::add_input(FILE *ifile, class cl_view *iview)
+{
+  int d= fileno(ifile);
+
+  inputs->add(new cl_input_src(ifile, iview));
+  if (d > max_fdes)
+    max_fdes= d;
+  FD_SET(d, &in_set);
+  return(0);
+}
+
+class cl_input_src *
+cl_gin::get_input_src(int fdes)
+{
+  int i;
+  
+  for (i= 0; i < inputs->count; i++)
+    {
+      class cl_input_src *s= (class cl_input_src *)(inputs->at(i));
+      if (fileno(s->file) == fdes)
+       return(s);
+    }
+  return(0);
+}
+
+int
+cl_gin::get_event(struct t_event *event)
+{
+  fd_set set;
+  //static struct timeval timeout= {0,0};
+  wchar_t c;
+
+  //FD_ZERO(&set);
+  set= in_set;
+  //FD_SET(fileno(stdin), &set);
+  if(::select(/*fileno(stdin)*/max_fdes+1,
+             &set, NULL, NULL,
+             NULL/*&timeout*/) > 0)
+    {
+      int i;
+      for (i= 0; i < inputs->count; i++)
+       {
+         class cl_input_src *s= (class cl_input_src *)(inputs->at(i));
+         if (!s->file ||
+             !(FD_ISSET(fileno(s->file), &set)))
+           continue;
+         if (s->view)
+           {
+             if (s->file)
+               {
+                 c= fgetc(s->file);
+                 return(s->view->mk_event(event, s->file, c));
+               }
+           }
+         else
+           if ((c= getch()) > 0)
+             {
+               event->what= EV_KEY;
+               event->event.key= c;
+               return(1);
+             }
+       }
+    }
+  
+  return(0);
+}
+
+
+/* End of gui.src/event.cc */
diff --git a/sim/ucsim/gui.src/obsolete/eventcl.h b/sim/ucsim/gui.src/obsolete/eventcl.h
new file mode 100644 (file)
index 0000000..4077a72
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Simulator of microcontrollers (eventcl.h)
+ *
+ * Copyright (C) 1999,99 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 EVENTCL_HEADER
+#define EVENTCL_HEADER
+
+#include "ddconfig.h"
+
+#if FD_HEADER_OK
+# include HEADER_FD
+#endif
+
+#include "pobjcl.h"
+
+#include "viewcl.h"
+
+
+#define EV_NOTHING     0x0000
+#define EV_MOUSE_DOWN  0x0001
+#define EV_MOUSE_UP    0x0002
+#define EV_MOUSE_MOVE  0x0004
+#define EV_MOUSE_AUTO  0x0008
+#define EV_KEY         0x0010
+#define EV_COMMAND     0x0100
+#define EV_BROADCAST   0x0200
+
+// cathegories
+#define EV_MOUSE       (EV_MOUSE_DOWN|EV_MOUSE_UP|EV_MOUSE_MOVE|EV_MOUSE_AUTO)
+#define EV_KEYBOARD    EV_KEY
+#define EV_MESSAGE     0xff00
+
+#define CMD_QUIT       0
+
+struct t_event {
+  int what;
+  union {
+    wchar_t key;
+    struct {
+      int cmd;
+      long param;
+    } msg;
+  } event;
+};
+
+
+class cl_input_src: public cl_base
+{
+public:
+  FILE *file;
+  class cl_view *view;
+  cl_input_src(FILE *ifile, class cl_view *iview);
+};
+
+class cl_gin: public cl_base
+{
+public:
+  fd_set in_set;
+  int max_fdes;
+  cl_list *inputs;
+public:
+  cl_gin(void);
+  ~cl_gin(void);
+
+  virtual int add_input(FILE *ifile, class cl_view *iview);
+  virtual class cl_input_src *get_input_src(int fdes);
+  virtual int get_event(struct t_event *event);
+};
+
+
+#endif
+
+/* End of gui.src/eventcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/frame.cc b/sim/ucsim/gui.src/obsolete/frame.cc
new file mode 100644 (file)
index 0000000..b6b00e8
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Simulator of microcontrollers (frame.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "ddconfig.h"
+
+#include <stdlib.h>
+#include "i_string.h"
+
+#include "framecl.h"
+#include "wincl.h"
+
+
+cl_frame::cl_frame(class cl_box *ipos, class cl_view *iwindow, char *iname,
+                  class cl_app *iapp):
+  cl_view(ipos, iname, iapp)
+{
+  win= iwindow;
+  options&= ~OF_SELECTABLE;
+}
+
+int *
+cl_frame::mk_palette(void)
+{
+  int *p;
+
+  p= (int*)malloc(2*sizeof(int));
+  p[0]= C_WIN_FPASSIVE;
+  p[1]= C_WIN_FACTIVE;
+  return(p);
+}
+
+int
+cl_frame::draw(void)
+{
+  char *t;
+  int color;
+
+  color= get_color((win && (win->state&SF_SELECTED))?1:0);
+  wattrset(window, color);
+  box(window, ACS_VLINE, ACS_HLINE);
+  if (!(t= strdup(((class cl_win *)win)->get_title())))
+    return(0);
+  if ((signed)strlen(t) > (pos->w)-4)
+    t[(pos->w)-4]= '\0';
+  mvwprintw(window, 0,((pos->w)-strlen(t))/2, "[%s]", t);
+  free(t);
+  app->drawn++;
+  return(0);
+}
+
+
+/* End of gui.src/frame.cc */
diff --git a/sim/ucsim/gui.src/obsolete/framecl.h b/sim/ucsim/gui.src/obsolete/framecl.h
new file mode 100644 (file)
index 0000000..6a3c06a
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Simulator of microcontrollers (framecl.h)
+ *
+ * Copyright (C) 1999,99 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 FRAMELCL_HEADER
+#define FRAMELCL_HEADER
+
+#include "viewcl.h"
+#include "appcl.h"
+
+
+class cl_frame: public cl_view
+{
+  class cl_view *win;
+public:
+  cl_frame(class cl_box *ipos, class cl_view *iwindow, char *iname,
+          class cl_app *iapp);
+  virtual int *mk_palette(void);
+  virtual int draw(void);
+};
+
+
+#endif
+
+/* End of gui.src/framecl.h */
diff --git a/sim/ucsim/gui.src/obsolete/group.cc b/sim/ucsim/gui.src/obsolete/group.cc
new file mode 100644 (file)
index 0000000..45bb0e4
--- /dev/null
@@ -0,0 +1,393 @@
+/*
+ * Simulator of microcontrollers (group.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "groupcl.h"
+#include "appcl.h"
+
+
+cl_group::cl_group(class cl_box *ipos, char *iname, class cl_app *iapp):
+  cl_view(ipos, iname, iapp)
+{
+  current= 0;
+}
+
+cl_group::cl_group(char *iname, class cl_app *iapp):
+  cl_view(iname, iapp)
+{
+  current= 0;
+}
+
+cl_group::~cl_group(void)
+{}
+
+int
+cl_group::init(void)
+{
+  cl_view::init();
+  mk_views(this);
+  return(0);
+}
+
+int
+cl_group::mk_views(class cl_group *ins_to)
+{
+  return(0);
+}
+
+
+/*
+ * Make output by drawing all subviews
+ */
+
+static void do_draw_view(class cl_view *view)
+{
+  view->draw();
+}
+
+int
+cl_group::draw(void)
+{
+  /*int i;
+
+  for (i= 0; i < views->count; i++)
+    {
+      class cl_view *v= (class cl_view *)(views->at(i));
+      v->draw();
+      app->drawn++;
+      }*/
+  for_each(do_draw_view);
+  return(0);
+}
+
+/*int
+cl_group::update(void)
+{
+  draw();
+  update_panels();
+  doupdate();
+}*/
+
+
+int
+cl_group::handle_event(struct t_event *event)
+{
+  int handled= 0;
+
+  if (event->what & (EV_KEY|EV_COMMAND))
+    {
+      if (current)
+       handled= current->handle_event(event);
+    }
+  else if (event->what & EV_MESSAGE)
+    {
+      class cl_view *v= last;
+      do 
+       {
+         handled= v->handle_event(event);
+         v= v->next;
+       }
+      while (! handled &&
+            v != last);
+    }
+  return(handled);
+}
+
+
+/*
+ * Managing views
+ */
+
+//class cl_view *
+void
+cl_group::insert(class cl_view *view)
+{
+  /*if (view &&
+      view->ok())
+    {
+      views->add_at(0, view);
+      view->parent= this;
+      view->select();
+      //view->draw();
+      return(view);
+      }
+      return(0);*/
+  insert_before(view, first());
+  if (view->options & OF_SELECTABLE)
+    view->select();
+  draw();
+}
+
+void
+cl_group::insert_before(class cl_view *view, class cl_view *target)
+{
+  unsigned int ss;
+
+  if (view &&
+      !(view->parent) &&
+      (!target ||
+       target->parent == this))
+    {
+      ss= view->state;
+      //view->hide();
+      insert_view(view, target);
+      /*if (ss & SF_VISIBLE)
+       view->show();*/
+      if (state & SF_ACTIVE)
+       view->change_state(SF_ACTIVE, 1);
+    }
+}
+
+void
+cl_group::insert_view(class cl_view *view, class cl_view *target)
+{
+  view->parent= this;
+  if (target)
+    {
+      target= target->prev();
+      view->next= target->next;
+      target->next= view;
+    }
+  else
+    {
+      if (!last)
+       view->next= view;
+      else
+       {
+         view->next= last->next;
+         last->next= view;
+       }
+      last= view;
+    }
+}
+
+class cl_view *
+cl_group::first(void)
+{
+  if (!last)
+    return(0);
+  return(last->next);
+}
+
+
+/*class cl_view *
+cl_group::get_by_state(unsigned int what, int enabled)
+{
+  int i;
+
+  for (i= 0; i < views->count; i++)
+    {
+      class cl_view *v= (class cl_view *)(views->at(i));
+      if ((enabled &&
+          (state&what))
+         ||
+         (!enabled &&
+          ((~state)&what))
+         )
+       return(v);
+    }
+  return(0);
+}*/
+
+/*int
+cl_group::select(void)
+{
+}*/
+
+/*int
+cl_group::unselect(void)
+{
+}*/
+
+int
+cl_group::select_next()
+{
+  /*  int start, i;
+  class cl_view *v;
+
+  if (views->count <= 1)
+    return(1);
+  if (current)
+    start= views->index_of(current);
+  else
+    if ((v= get_by_state(SF_SELECTED, 1)))
+      start= views->index_of(v);
+    else
+      if ((v= get_by_state(SF_FOCUSED, 1)))
+       start= views->index_of(v);
+      else
+       start= 0;
+  i= (start+1)%(views->count);
+  while (i != start)
+    {
+      v= (class cl_view *)(views->at(i));
+      if ((v->options & OF_SELECTABLE) &&
+         v->select())
+       {
+         //update();
+         return(1);
+       }
+      i= (i+1)%(views->count);
+      }*/
+  return(0);
+}
+
+int
+cl_group::select_prev()
+{
+  /*  int start, i;
+  class cl_view *v;
+
+  if (views->count <= 1)
+    return(1);
+  if (current)
+    start= views->index_of(current);
+  else
+    if ((v= get_by_state(SF_SELECTED, 1)))
+      start= views->index_of(v);
+    else
+      if ((v= get_by_state(SF_FOCUSED, 1)))
+       start= views->index_of(v);
+      else
+       start= 0;
+  i= start-1; if (i < 0) i= views->count-1;
+  while (i != start)
+    {
+      v= (class cl_view *)(views->at(i));
+      if ((v->options & OF_SELECTABLE) &&
+         v->select())
+       {
+         //update();
+         return(1);
+       }
+      i= start-1; if (i < 0) i= views->count-1;
+      }*/
+  return(0);
+}
+
+class cl_view *
+cl_group::current_sub_view(void)
+{
+  return(current);
+}
+
+void
+cl_group::for_each(void (*func)(class cl_view *view))
+{
+  class cl_view *v;
+
+  if (!last)
+    return;
+  v= last->next;
+  do
+    {
+      func(v);
+      v= v->next;
+    }
+  while (v != last);
+}
+
+void
+cl_group::set_current(class cl_view *view)
+{
+  //current= view;
+  if (current == view)
+    return;
+  //lock();
+  /*focus_view(view, 0);*/
+  if ((state & SF_FOCUSED) &&
+      (current != 0))
+    current->change_state(SF_FOCUSED, 0);
+  //if (mode!=ENTER_SELECT) select_view(current, 0);
+  if (current)
+    current->change_state(SF_SELECTED, 0);
+  //if (mode!=LEAVE_SELECT) select_view(view, 1);
+  if (view)
+    view->change_state(SF_SELECTED, 1);
+  //focuse_view(view, 1);
+  if ((state & SF_FOCUSED) &&
+      (view != 0))
+    view->change_state(SF_SELECTED, 1);
+  current= view;
+  //unlock();
+}
+
+/*int
+cl_group::terminal_view(void)
+{
+  return(views->count == 0);
+}*/
+
+static unsigned int grp_what, grp_en;
+
+static void
+do_set_state(class cl_view *v)
+{
+  v->change_state(grp_what, grp_en);
+}
+
+void
+cl_group::change_state(unsigned int what, int enable)
+{
+  cl_view::change_state(what, enable);
+  /*if (enable &&
+      (what & SF_SELECTED))
+    {
+      class cl_view *v= get_by_state(SF_SELECTED, 1);
+      if (v)
+       {
+         current= v;
+         current->change_state(SF_FOCUSED, 1);
+         current->change_state(SF_SELECTED, 1);
+       }
+      else
+       {
+         if ((v= get_by_state(SF_FOCUSED, 1)))
+           {
+             current= v;
+             current->change_state(SF_SELECTED, 1);
+           }
+       }
+       }*/
+  switch (what)
+    {
+      case SF_ACTIVE:
+       //lock();
+       grp_what= what;
+       grp_en= enable;
+       for_each(do_set_state);
+       //unlock();
+       break;
+    case SF_FOCUSED:
+      if (current)
+       current->change_state(SF_FOCUSED, enable);
+      break;
+    }
+  draw();
+}
+
+
+/* End of gui.src/group.cc */
diff --git a/sim/ucsim/gui.src/obsolete/groupcl.h b/sim/ucsim/gui.src/obsolete/groupcl.h
new file mode 100644 (file)
index 0000000..87f0ba8
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Simulator of microcontrollers (groupcl.h)
+ *
+ * Copyright (C) 1999,99 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 GROUPCL_HEADER
+#define GROUPCL_HEADER
+
+#include "viewcl.h"
+
+class cl_group: public cl_view
+{
+public:
+  class cl_view *current;
+
+public:
+  cl_group(class cl_box *ipos, char *iname, class cl_app *iapp);
+  cl_group(char *iname, class cl_app *iapp);
+  ~cl_group(void);
+  virtual int init(void);
+  virtual int mk_views(class cl_group *ins_to);
+  virtual int is_group(void) {return(1);}
+
+  virtual int draw(void);
+  //virtual int update(void);
+
+  virtual int handle_event(struct t_event *event);
+
+  virtual /*class cl_view **/void insert(class cl_view *view);
+  virtual void insert_before(class cl_view *view, class cl_view *target);
+  virtual void insert_view(class cl_view *view, class cl_view *target);
+  virtual class cl_view *first(void);
+  virtual void for_each(void (*func)(class cl_view *view));
+  //virtual class cl_view *get_by_state(unsigned int what, int enabled);
+  //virtual int select(void);
+  //virtual int unselect(void);
+  virtual int select_next();
+  virtual int select_prev();
+  virtual class cl_view *current_sub_view(void);
+  virtual void set_current(class cl_view *view);
+  //virtual int terminal_view(void);
+  virtual void change_state(unsigned int what, int enable);
+};
+
+
+#endif
+
+/* End of gui.src/groupcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/label.cc b/sim/ucsim/gui.src/obsolete/label.cc
new file mode 100644 (file)
index 0000000..90c54a3
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Simulator of microcontrollers (label.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "ddconfig.h"
+
+#include <stdlib.h>
+#include "i_string.h"
+
+#include "labelcl.h"
+
+
+cl_label::cl_label(class cl_box *ipos, class cl_app *iapp, char *ilabel):
+  cl_view(ipos, "label", iapp)
+{
+  options&= ~OF_SELECTABLE;
+  if (!ilabel ||
+      !(*ilabel))
+    label= strdup("");
+  else
+    label= strdup(ilabel);
+}
+
+cl_label::~cl_label(void)
+{
+  free(label);
+}
+
+int *
+cl_label::mk_palette(void)
+{
+  int *p;
+
+  p= (int*)malloc(1*sizeof(int));
+  p[0]= C_WIN_NORMAL;
+  return(p);
+}
+
+int
+cl_label::draw(void)
+{
+  int color= get_color(0);
+
+  cl_view::draw();
+  wattrset(window, color);
+  mvwprintw(window, 0,0, "%s", label);
+  return(0);
+}
+
+
+/* End of gui.src/label.cc */
diff --git a/sim/ucsim/gui.src/obsolete/labelcl.h b/sim/ucsim/gui.src/obsolete/labelcl.h
new file mode 100644 (file)
index 0000000..79d6288
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Simulator of microcontrollers (labelcl.h)
+ *
+ * Copyright (C) 1999,99 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 LABELCL_HEADER
+#define LABELCL_HEADER
+
+
+#include "viewcl.h"
+#include "appcl.h"
+
+
+class cl_label: public cl_view
+{
+public:
+  char *label;
+public:
+  cl_label(class cl_box *ipos, class cl_app *iapp, char *ilabel);
+  ~cl_label(void);
+  virtual int *mk_palette(void);
+  virtual int draw(void);
+};
+
+
+#endif
+
+/* End of gui.src/labelcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/palette.h b/sim/ucsim/gui.src/obsolete/palette.h
new file mode 100644 (file)
index 0000000..6f9d383
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Simulator of microcontrollers (palette.h)
+ *
+ * Copyright (C) 1999,99 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 PALETTE_HEADER
+#define PALETTE_HEADER
+
+
+#define C_DSK_BG               1
+#define C_DSK_NORMAL           2
+#define C_DSK_DISABLED         3
+
+#define C_WIN                  8
+#define C_WIN_FPASSIVE         0
+#define C_WIN_FACTIVE          1
+#define C_WIN_NORMAL           5
+#define C_WIN_SELECTED         6
+
+#endif
+
+/* End of gui.src/palette.h */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/(c).1 b/sim/ucsim/gui.src/obsolete/portmon.src/(c).1
new file mode 100644 (file)
index 0000000..d673f9f
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Simulator of microcontrollers (@@F@@)
+ *
+ * Copyright (C) @@S@@,@@Y@@ 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. */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/Makefile.in b/sim/ucsim/gui.src/obsolete/portmon.src/Makefile.in
new file mode 100644 (file)
index 0000000..9ba4c00
--- /dev/null
@@ -0,0 +1,130 @@
+#
+# uCsim gui.src/portmon.src/Makefile
+#
+# (c) Drotos Daniel, Talker Bt. 1999
+#
+
+SHELL          = /bin/sh
+CXX            = @CXX@
+CPP            = @CPP@
+CXXCPP         = @CXXCPP@
+RANLIB         = @RANLIB@
+INSTALL                = @INSTALL@
+
+PRJDIR         = ../..
+PKGDIR         = ../
+
+DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
+CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) -I$(PKGDIR)
+CFLAGS          = @CFLAGS@ -Wall
+CXXFLAGS        = @CXXFLAGS@ -Wall
+M_OR_MM         = @M_OR_MM@
+
+LIBS           = -L$(PRJDIR) -L$(PKGDIR) -lgui @CURSES_LIBS@ -lutil @LIBS@
+
+curses_ok      = @curses_ok@
+
+prefix          = @prefix@
+exec_prefix     = @exec_prefix@
+bindir          = @bindir@
+libdir          = @libdir@
+datadir         = @datadir@
+includedir      = @includedir@
+mandir          = @mandir@
+man1dir         = $(mandir)/man1
+man2dir         = $(mandir)/man2
+infodir         = @infodir@
+srcdir          = @srcdir@
+
+OBJECTS         = portmon.o \
+                 pmapp.o port.o
+
+
+# Compiling entire program or any subproject
+# ------------------------------------------
+all: checkconf otherlibs portmon.src
+
+
+# Compiling and installing everything and runing test
+# ---------------------------------------------------
+install: all installdirs
+       $(INSTALL) -s portmon $(bindir)
+
+
+# Deleting all the installed files
+# --------------------------------
+uninstall:
+       rm -f $(bindir)/portmon
+
+
+# Performing self-test
+# --------------------
+check:
+
+
+# Performing installation test
+# ----------------------------
+installcheck:
+
+
+# Creating installation directories
+# ---------------------------------
+installdirs:
+       test -d $(bindir) || $(INSTALL) -d $(bindir)
+
+
+# Creating dependencies
+# ---------------------
+dep: Makefile.dep
+
+Makefile.dep: *.cc *.h $(PRJDIR)/*.h $(PKGDIR)/*.h
+       $(CXXCPP) $(CPPFLAGS) $(M_OR_MM) *.cc >Makefile.dep
+
+include Makefile.dep
+include clean.mk
+
+#parser.cc: parser.y
+
+#plex.cc: plex.l
+
+# My rules
+# --------
+ifeq ($(curses_ok),yes)
+portmon.src: portmon
+else
+portmon.src:
+endif
+
+portmon: $(OBJECTS) $(PRJDIR)/*.a $(PKGDIR)/*.a
+       $(CXX) $(CXXFLAGS) -o portmon $(OBJECTS) $(LIBS)
+
+ifeq ($(curses_ok),yes)
+otherlibs:
+       cd $(PRJDIR) && $(MAKE) libs
+       cd $(PKGDIR) && $(MAKE) libs
+else
+otherlibs:
+endif
+
+.cc.o:
+       $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+.y.cc:
+       rm -f $*.cc $*.h
+       $(YACC) -d $<
+       mv y.tab.c $*.cc
+       mv y.tab.h $*.h
+
+.l.cc:
+       rm -f $*.cc
+       $(LEX) -t $< >$*.cc
+
+
+# Remaking configuration
+# ----------------------
+checkconf:
+       @if [ -f $(PRJDIR)/devel ]; then\
+         $(MAKE) -f conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" freshconf;\
+       fi
+
+# End of gui.src/portmon.src/Makefile.in
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/clean.mk b/sim/ucsim/gui.src/obsolete/portmon.src/clean.mk
new file mode 100644 (file)
index 0000000..02760e9
--- /dev/null
@@ -0,0 +1,28 @@
+# uCsim gui.src/portmon.src/clean.mk
+
+# Deleting all files created by building the program
+# --------------------------------------------------
+clean:
+       rm -f *core *[%~] *.[oa]
+       rm -f .[a-z]*~
+       rm -f portmon
+
+
+# Deleting all files created by configuring or building the program
+# -----------------------------------------------------------------
+distclean: clean
+       rm -f config.cache config.log config.status
+       rm -f Makefile *.dep
+
+
+# Like clean but some files may still exist
+# -----------------------------------------
+mostlyclean: clean
+
+
+# Deleting everything that can reconstructed by this Makefile. It deletes
+# everything deleted by distclean plus files created by bison, etc.
+# -----------------------------------------------------------------------
+realclean: distclean
+
+# End of gui.src/portmon.src/clean.mk
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/conf.mk b/sim/ucsim/gui.src/obsolete/portmon.src/conf.mk
new file mode 100644 (file)
index 0000000..b3ad736
--- /dev/null
@@ -0,0 +1,12 @@
+# uCsim gui.src/portmon.src/conf.mk
+
+#
+# Makefile targets to remake configuration
+#
+
+freshconf: Makefile
+
+Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in
+       cd $(PRJDIR) && $(SHELL) ./config.status
+
+# End of gui.src/portmon.src/conf.mk
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/pmapp.cc b/sim/ucsim/gui.src/obsolete/portmon.src/pmapp.cc
new file mode 100644 (file)
index 0000000..2605a22
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Simulator of microcontrollers (pmapp.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "wincl.h"
+#include "labelcl.h"
+
+#include "pmappcl.h"
+#include "portcl.h"
+
+
+int
+cl_pmapp::mk_views(class cl_group *ins_to)
+{
+  class cl_view *v;
+  //class cl_win *w;
+  class cl_box *b;
+  
+  b= new cl_box(0,0,0,0);
+
+  if (!ins_to)
+    return(0);
+  
+  b->set(43,2,14,13);
+  v= new cl_portw(b, 3, "Port #3", this);
+  v->init();
+  ins_to->insert(v);
+    
+  b->set(29,2,14,13);
+  v= new cl_portw(b, 2, "Port #2", this);
+  v->init();
+  ins_to->insert(v);
+  /*
+  b->set(15,2,14,13);
+  ins_to->insert(v= new cl_portw(b, 1, "Port #1", this));
+  v->init();
+
+  b->set(1,2,14,13);
+  ins_to->insert(v= new cl_portw(b, 0, "Port #0", this));
+  v->init();
+
+  b->set(59,3,19,11);
+  v= new cl_label(b, this,
+"Next win: n,TAB\nPrev win: p\nCursor  : u,d,l,r,\n          arrows\nToggle  : space,CR\nQuit    : q");
+  v->init();
+  b->move_rel(-1,-1);
+  b->grow(2,2);
+  
+  b->set(58,2,21,13);
+  w= new cl_win(b, "Help", this);
+  w->options&= ~OF_SELECTABLE;
+  w->init();
+  w->insert(v);
+  ins_to->insert(w);
+  w->draw();
+  */
+  delete b;
+
+  return(0);
+}
+
+int *
+cl_pmapp::mk_palette(void)
+{
+  return(cl_app::mk_palette());
+}
+
+int
+cl_pmapp::handle_event(struct t_event *event)
+{
+  if (event->what == EV_KEY)
+    switch (event->event.key)
+      {
+      case 'q':
+       event->what= EV_COMMAND;
+       event->event.msg.cmd= CMD_QUIT;
+       return(0);
+      case 'p':
+       desk->select_prev();
+       return(1);
+      case 'n': case '\t':
+       desk->select_next();
+       return(1);
+       
+      }
+  return(cl_app::handle_event(event));
+}
+
+
+/* End of gui.src/portmon.src/pmapp.cc */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/pmappcl.h b/sim/ucsim/gui.src/obsolete/portmon.src/pmappcl.h
new file mode 100644 (file)
index 0000000..d9f3011
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Simulator of microcontrollers (pmappcl.h)
+ *
+ * Copyright (C) 1999,99 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 PMAPPCL_HEADER
+#define PMAPPCL_HEADER
+
+#include "appcl.h"
+
+
+class cl_pmapp: public cl_app
+{
+public:
+  cl_pmapp(char *iname): cl_app(iname) {}
+
+  virtual int mk_views(class cl_group *ins_to);
+  virtual int *mk_palette(void);
+
+  virtual int handle_event(struct t_event *event);
+};
+
+
+#endif
+
+/* End of gui.src/portmon.src/pmappcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/port.cc b/sim/ucsim/gui.src/obsolete/portmon.src/port.cc
new file mode 100644 (file)
index 0000000..010ec3e
--- /dev/null
@@ -0,0 +1,143 @@
+/*@1@*/
+
+#include "portcl.h"
+
+
+/*
+ * Viewer of the port
+ */
+
+cl_port::cl_port(class cl_box *ipos, int iid, char *iname, class cl_app *iapp):
+  cl_view(ipos, iname, iapp)
+{
+  id= iid;
+  sfr= 0;
+  pin= 0;
+  curs_x= curs_y= 0;
+}
+
+int
+cl_port::draw(void)
+{
+  int x, y, mask, hc, nc;
+
+  cl_view::draw();
+
+  nc= hc= get_color(C_WIN_NORMAL);
+  if (state & SF_SELECTED)
+    hc= get_color(C_WIN_SELECTED);
+  mvwprintw(window, 0,0, "SFR PORT PIN");
+  for (x= 0, mask= 0x80, y= 1; mask; mask>>= 1,y++)
+    {
+      wattrset(window, (curs_x)?nc:(curs_y==y-1?hc:nc));
+      mvwprintw(window, y,x, "  %c", (sfr&mask)?'1':'0');
+    }
+  wattrset(window, nc);
+  for (x= 5, mask= 0x80, y= 1; mask; mask>>= 1,y++)
+    mvwprintw(window, y,x, "%c", (sfr&pin&mask)?'1':'0');
+  for (x=9, mask= 0x80, y= 1; mask; mask>>= 1,y++)
+    {
+      wattrset(window, curs_x?(curs_y==y-1?hc:nc):nc);
+      mvwprintw(window, y,x, "%c  ", (pin&mask)?'1':'0');
+    }
+  wattrset(window, nc);
+  mvwprintw(window, 9,0, "0x%02x    0x%02x", sfr, pin);
+  mvwprintw(window, 10,4, "0x%02x", sfr&pin);
+  app->drawn++;
+  return(0);
+}
+
+int
+cl_port::handle_event(struct t_event *event)
+{
+  if (event->what == EV_KEY)
+    switch (event->event.key)
+      {
+      case KEY_HOME:
+       curs_y= 0; draw(); return(1);
+      case KEY_A1:
+       curs_x= curs_y= 0; draw(); return(1);
+      case KEY_A3:
+       curs_y= 0; curs_x= 1; draw(); return(1);
+      case KEY_C1:
+       curs_x= 0; curs_y= 7; draw(); return(1);
+      case KEY_C3:
+       curs_x= 1; curs_y= 7; draw(); return(1);
+      case KEY_LEFT: case KEY_RIGHT: case 'j': case 'k': case 'l': case 'r':
+       if (curs_x)
+         curs_x= 0;
+       else
+         curs_x= 1;
+       draw();
+       return(1);
+      case KEY_UP: case 'u':
+       curs_y--;
+       if (curs_y < 0)
+         curs_y= 7;
+       draw();
+       return(1);
+      case KEY_DOWN: case 'd':
+       curs_y++;
+       if (curs_y > 7)
+         curs_y= 0;
+       draw();
+       return(1);
+      case ' ': case '\n': case '\r':
+       if (curs_x)
+         toggle_pin(7-curs_y);
+       else
+         toggle_sfr(7-curs_y);
+       return(1);
+      }
+  return(cl_view::handle_event(event));
+}
+
+int
+cl_port::toggle_sfr(int bitnr)
+{
+  int mask= 1<<bitnr;
+  sfr^= mask;
+  draw();
+  return(0);
+}
+
+int
+cl_port::toggle_pin(int bitnr)
+{
+  int mask= 1<<bitnr;
+  pin^= mask;
+  draw();
+  return(0);
+}
+
+/*
+ * Window to show port viewer
+ ******************************************************************************
+ */
+
+cl_portw::cl_portw(class cl_box *ipos, int iid, char *ititle,
+                  class cl_app *iapp):
+  cl_win(ipos, ititle, iapp)
+{
+  id= iid;
+}
+
+class cl_view *
+cl_portw::mk_intern(class cl_box *ipos)
+{
+  char n[100]= "";
+
+  sprintf(n, "port%dviewer", id);
+  class cl_view *v= new cl_port(ipos, id, n, app);
+  v->init();
+  return(v);
+}
+
+int
+cl_portw::handle_event(struct t_event *event)
+{
+  return(cl_win::handle_event(event));
+}
+
+
+/* End of gui.src/portmap.src/port.cc */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/portcl.h b/sim/ucsim/gui.src/obsolete/portmon.src/portcl.h
new file mode 100644 (file)
index 0000000..760f0ad
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Simulator of microcontrollers (portcl.h)
+ *
+ * Copyright (C) 1999,99 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 PORTCL_HEADER
+#define PORTCL_HEADER
+
+#include "viewcl.h"
+#include "wincl.h"
+
+
+class cl_port: public cl_view
+{
+public:
+  int id;
+  int sfr, pin;
+  int curs_x, curs_y;
+public:
+  cl_port(class cl_box *ipos, int iid, char *iname, class cl_app *iapp);
+
+  virtual int draw(void);
+  virtual int handle_event(struct t_event *event);
+  int toggle_sfr(int bitnr);
+  int toggle_pin(int bitnr);
+};
+
+class cl_portw: public cl_win
+{
+public:
+  int id;
+public:
+  cl_portw(class cl_box *ipos, int iid, char *ititle, class cl_app *iapp);
+  virtual class cl_view *mk_intern(class cl_box *ipos);
+
+  virtual int handle_event(struct t_event *event);
+};
+
+
+#endif
+
+/* End of gui.src/portmon.src/portcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/portmon.src/portmon.cc b/sim/ucsim/gui.src/obsolete/portmon.src/portmon.cc
new file mode 100644 (file)
index 0000000..50d3b3a
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Simulator of microcontrollers (portmon.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include <curses.h>
+
+#include "pmappcl.h"
+
+
+class cl_pmapp *app;
+
+void xx(class cl_view *v)
+{
+  fprintf(stderr,"%s 0x%x ", v->name, v->state);
+}
+
+int
+main(int argc, char *argv)
+{
+  app= new cl_pmapp("portmon");
+  app->init();
+  {
+    class cl_view *v= app;
+    while (v)
+      {
+       if (v->is_group())
+         {
+           class cl_group *g= (class cl_group *)v;
+           fprintf(stderr, "%s->%s\n", g->name,(g->current)?(g->current->name):"none");
+           g->for_each(xx);
+           fprintf(stderr, "\n");
+           v= g->current;
+         }
+       else
+         v= 0;
+      }
+  }
+  app->run();
+  //getch();
+  delete app;
+  return(0);
+}
+
+
+/* End of gui.src/portmon.src/portmon.cc */
diff --git a/sim/ucsim/gui.src/obsolete/view.cc b/sim/ucsim/gui.src/obsolete/view.cc
new file mode 100644 (file)
index 0000000..9ead6f4
--- /dev/null
@@ -0,0 +1,356 @@
+/*
+ * Simulator of microcontrollers (view.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "ddconfig.h"
+
+#include <stdlib.h>
+#include "i_string.h"
+
+#include "appcl.h"
+
+
+/*
+ * Box
+ */
+
+cl_box::cl_box(int ix, int iy, int iw, int ih):
+  cl_base()
+{
+  x= ix;
+  y= iy;
+  w= iw;
+  h= ih;
+}
+
+void
+cl_box::set(int ix, int iy, int iw, int ih)
+{
+  x= ix;
+  y= iy;
+  w= iw;
+  h= ih;
+}
+
+void
+cl_box::move_rel(int dx, int dy)
+{
+  x+= dx;
+  y+= dy;
+}
+
+void
+cl_box::grow(int dw, int dh)
+{
+  w+= dw;
+  h+= dh;
+}
+
+
+/*
+ * Astbract of a viewer
+ ******************************************************************************
+ */
+
+cl_view::cl_view(class cl_box *ipos, char *iname, class cl_app *iapp):
+  cl_base()
+{
+  pos= new cl_box(ipos->x,ipos->y, ipos->w,ipos->h);
+  if ((window= newwin(pos->h,pos->w, pos->y,pos->x)))
+    {
+      leaveok(window, TRUE);
+      panel= new_panel(window);
+    }
+  else
+    {
+      panel= 0;
+      delwin(window);
+      window= 0;
+    }
+  parent= 0;
+  next= last= 0;
+  app= iapp;
+  state= SF_NOTHING;
+  options= OF_SELECTABLE;
+  if (!iname ||
+      !(*iname))
+    {
+      name= (char*)malloc(100);
+      sprintf(name, "view%p", this);
+    }
+  else
+    name= strdup(iname);
+}
+
+cl_view::cl_view(char *iname, class cl_app *iapp):
+  cl_base()
+{
+  window= 0;
+  panel= 0;
+  parent= 0;
+  next= last= 0;
+  app= iapp;
+  state= SF_NOTHING;
+  options= OF_SELECTABLE;
+  if (!iname ||
+      !(*iname))
+    {
+      name= (char*)malloc(100);
+      sprintf(name, "view%p", this);
+    }
+  else
+    name= strdup(iname);
+}
+
+cl_view::~cl_view(void)
+{
+  if (panel)
+    del_panel(panel);
+  if (window)
+    delwin(window);
+  if (palette)
+    free(palette);
+  if (name)
+    free(name);
+}
+
+int
+cl_view::init(void)
+{
+  input= mk_input();
+  palette= mk_palette();
+  //draw();
+  return(0);
+}
+
+class cl_gin *
+cl_view::mk_input(void)
+{
+  return(0);
+}
+
+int *
+cl_view::mk_palette(void)
+{
+  return(0);
+}
+
+int
+cl_view::ok(void)
+{
+  return(window && panel);
+}
+
+
+/*
+ * Make output into the view
+ */
+
+int
+cl_view::draw(void)
+{
+  int color, x, y;
+
+  color= get_color(palette?0:C_WIN_NORMAL);
+  
+  wattrset(window, color);
+  for (y= 0; y < pos->h; y++)
+    for (x= 0; x < pos->w; x++)
+      mvwaddch(window, y,x, ' ');
+  app->drawn++;
+
+  return(0);
+}
+
+int
+cl_view::update(void)
+{
+  draw();
+  update_panels();
+  doupdate();
+  return(0);
+}
+
+int
+cl_view::get_color(int color)
+{
+  int *p;
+  class cl_view *v;
+
+  v= this;
+  while (v)
+    {
+      p= v->get_palette();
+      if (p)
+       color= p[color];
+      v= v->parent;
+    }
+  return(color);
+}
+
+int *
+cl_view::get_palette(void)
+{
+  return(palette);
+}
+
+
+/*
+ * Event handling
+ */
+
+int
+cl_view::get_event(struct t_event *event)
+{
+  if (parent)
+    return(parent->get_event(event));
+  if (input)
+    return(input->get_event(event));
+  return(0);
+}
+
+int
+cl_view::handle_event(struct t_event *event)
+{
+  return(0);
+}
+
+int
+cl_view::unhandled(struct t_event *event)
+{
+  return(0);
+}
+
+int
+cl_view::mk_event(struct t_event *event, FILE *f, int key)
+{
+  event->what= EV_KEY;
+  event->event.key= key;
+  return(1);
+}
+
+
+class cl_view *
+cl_view::prev(void)
+{
+  class cl_view *v;
+
+  v= next;
+  while (v != this)
+    v= v->next;
+  return(v);
+}
+
+class cl_view *
+cl_view::prev_view(void)
+{
+  if (parent &&
+      parent->first() == this)
+    return(0);
+  else
+    return(prev());    
+}
+
+
+int
+cl_view::select(void)
+{
+  /*  class cl_view *v;
+
+  if (!(options & OF_SELECTABLE))
+    return(0);
+  if (state & SF_SELECTED)
+    return(1);
+  if (parent &&
+      !(parent->select()))
+    return(0);
+  if (parent)
+    {
+      v= parent->current_sub_view();
+      if (v &&
+         v != this)
+       v->unselect();
+      parent->set_current(this);
+    }
+  change_state(SF_FOCUSED, 1);
+  change_state(SF_SELECTED, 1);
+  draw();
+  return(1);*/
+  if (options & OF_SELECTABLE)
+    if (parent)
+      parent->set_current(this);
+  return(1);
+}
+
+int
+cl_view::unselect(void)
+{
+  class cl_view *csv= current_sub_view();
+  if (csv &&
+      !(csv->unselect()))
+    return(0);
+  if (!terminal_view())
+    change_state(SF_FOCUSED, 0);
+  change_state(SF_SELECTED, 0);
+  draw();
+  return(1);
+}
+
+class cl_view *
+cl_view::current_sub_view(void)
+{
+  return(0);
+}
+
+int
+cl_view::terminal_view(void)
+{
+  return(1);
+}
+
+void
+cl_view::change_state(unsigned int what, int enable)
+{
+  if (enable)
+    state|= what;
+  else
+    state&= ~what;
+  if (parent)
+    {
+      switch (what)
+       {
+       case SF_FOCUSED:
+         //reset_cursor();
+         /*message(parent, EV_BROADCAST,
+           (enable)?CM_RECEIVED_FOCUS:CM_RELEASED_FOCUS, this);*/
+         break;
+       }
+    }
+  draw();
+}
+
+
+/* End of gui.src/view.cc */
diff --git a/sim/ucsim/gui.src/obsolete/viewcl.h b/sim/ucsim/gui.src/obsolete/viewcl.h
new file mode 100644 (file)
index 0000000..668fee1
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Simulator of microcontrollers (viewcl.h)
+ *
+ * Copyright (C) 1999,99 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 VIEWCL_HEADER
+#define VIEWCL_HEADER
+
+#include <curses.h>
+#include <panel.h>
+
+#include "pobjcl.h"
+
+#include "palette.h"
+#include "eventcl.h"
+
+
+// Status flags
+#define SF_NOTHING     0x0000
+#define SF_SELECTED    0x0001
+#define SF_FOCUSED     0x0002
+#define SF_ACTIVE      0x0004
+
+// Option flags
+#define OF_NOTHING     0x0000
+#define OF_SELECTABLE  0x0001
+
+
+class cl_box: public cl_base
+{
+public:
+  int x, y;
+  int w, h;
+public:
+  cl_box(int ix, int iy, int iw, int ih);
+  void set(int ix, int iy, int iw, int ih);
+  void move_rel(int dx, int dy);
+  void grow(int dw, int dh);
+};
+
+
+class cl_app;
+class cl_group;
+
+class cl_view: public cl_base
+{
+public:
+  char *name;
+  WINDOW *window;
+  PANEL *panel;
+  class cl_group *parent;
+  class cl_view *next, *last;
+  class cl_app *app;
+  class cl_gin *input;
+  class cl_box *pos;
+  int *palette;
+  unsigned int state; // See SF_XXXX
+  unsigned int options; // See OF_XXXX
+public:
+  cl_view(class cl_box *ipos, char *iname, class cl_app *iapp);
+  cl_view(char *name, class cl_app *iapp);
+  ~cl_view(void);
+  virtual int init(void);
+  virtual class cl_gin *mk_input(void);
+  virtual int *mk_palette(void);
+  virtual int is_group(void) {return(0);}
+
+  virtual int ok(void);
+  virtual int draw(void);
+  virtual int update(void);
+  virtual int get_color(int color);
+  virtual int *get_palette(void);
+
+  virtual int get_event(struct t_event *event);
+  virtual int handle_event(struct t_event *event);
+  virtual int unhandled(struct t_event *event);
+  virtual int mk_event(struct t_event *event, FILE *f, int key);
+
+  virtual class cl_view *prev(void);
+  virtual class cl_view *prev_view(void);
+
+  virtual int select(void);
+  virtual int unselect(void);
+  virtual class cl_view *get_by_state(unsigned int what, int enabled)
+    {return(0);}
+  virtual int select_next() {return(0);}
+  virtual class cl_view *current_sub_view(void);
+  virtual void set_current(class cl_view *view) {}
+  virtual int terminal_view(void);
+  virtual void change_state(unsigned int what, int enable);
+};
+
+
+#endif
+
+/* End of gui.src/viewcl.h */
diff --git a/sim/ucsim/gui.src/obsolete/win.cc b/sim/ucsim/gui.src/obsolete/win.cc
new file mode 100644 (file)
index 0000000..b5a9a92
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Simulator of microcontrollers (win.cc)
+ *
+ * Copyright (C) 1999,99 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@*/
+
+#include "ddconfig.h"
+
+#include <stdlib.h>
+#include "i_string.h"
+
+#include "wincl.h"
+
+
+cl_win::cl_win(class cl_box *ipos, char *ititle, class cl_app *iapp):
+  cl_group(ipos, 0, iapp)
+{
+  title= strdup(ititle);
+  free(name);
+  if (!ititle ||
+      !(*ititle))
+    {
+      name= (char*)malloc(100);
+      sprintf(name, "win%p", this);
+    }
+  else
+    name= strdup(ititle);
+}
+
+cl_win::~cl_win(void)
+{
+  if (frame)
+    delete frame;
+  if (title)
+    free(title);
+}
+
+int
+cl_win::init(void)
+{
+  cl_group::init();
+  if ((frame= mk_frame(pos)))
+    insert(frame);
+  class cl_box *b= new cl_box(pos->x,pos->y, pos->w,pos->h);
+  b->move_rel(1,1);
+  b->grow(-2,-2);
+  if ((intern= mk_intern(b)))
+    insert(intern);
+  //draw();
+  delete b;
+  return(0);
+}
+
+int *
+cl_win::mk_palette(void)
+{
+  int *p= (int*)malloc(8*sizeof(int)), i;
+  for (i= 0; i < 8; i++)
+    p[i]= i+C_WIN;
+  return(p);
+}
+
+class cl_frame *
+cl_win::mk_frame(class cl_box *ipos)
+{
+  char n[100]= "";
+  
+  sprintf(n, "frameof_\"%s\"", name);
+  class cl_frame *f= new cl_frame(ipos, this, n, app);
+  f->init();
+  return(f);
+}
+
+class cl_view *
+cl_win::mk_intern(class cl_box *ipos)
+{
+  class cl_view *v= new cl_view(ipos, 0, app);
+  v->init();
+  v->options&= ~OF_SELECTABLE;
+  return(v);
+}
+
+char *
+cl_win::get_title(void)
+{
+  return(title);
+}
+
+
+/* End of gui.src/win.cc */
diff --git a/sim/ucsim/gui.src/obsolete/wincl.h b/sim/ucsim/gui.src/obsolete/wincl.h
new file mode 100644 (file)
index 0000000..ddbd0a9
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Simulator of microcontrollers (wincl.h)
+ *
+ * Copyright (C) 1999,99 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 WINCL_HEADER
+#define WINCL_HEADER
+
+#include "groupcl.h"
+#include "framecl.h"
+
+
+class cl_win: public cl_group
+{
+public:
+  class cl_view *frame;
+  class cl_view *intern;
+  char *title;
+public:
+  cl_win(class cl_box *ipos, char *ititle, class cl_app *iapp);
+  ~cl_win(void);
+  virtual int init(void);
+  virtual int *mk_palette(void);
+  virtual class cl_frame *mk_frame(class cl_box *ipos);
+  virtual class cl_view *mk_intern(class cl_box *ipos);
+
+  virtual char *get_title(void);
+};
+
+
+#endif
+
+/* End of gui.src/wincl.h */
diff --git a/sim/ucsim/gui.src/rec.cc b/sim/ucsim/gui.src/rec.cc
new file mode 100644 (file)
index 0000000..dce2efa
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Simulator of microcontrollers (rec.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@*/
+
+#include "reccl.h"
+
+
+/* End of gui.src/rec.cc */
diff --git a/sim/ucsim/gui.src/reccl.h b/sim/ucsim/gui.src/reccl.h
new file mode 100644 (file)
index 0000000..4ead68b
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Simulator of microcontrollers (reccl.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 GUISRC_RECCL_HEADER
+#define GUISRC_RECCL_HEADER
+
+#include "ddconfig.h"
+
+#include "pobjcl.h"
+
+
+#endif
+
+/* End of gui.src/reccl.h */
index e7c34297b9d629b4be5d09953c93fe0d1738c3cb..d3d7800ada95d1415f63268a54dda8aa578f886e 100644 (file)
@@ -111,6 +111,7 @@ libutil.a: $(OBJECTS)
 # ----------------------
 checkconf:
        @if [ -f devel ]; then\
+         echo "MAIN.MK checkconf";\
          $(MAKE) -f conf.mk srcdir="$(srcdir)" freshconf;\
        fi
 
index 2149ecd715294e0b974fd79b8f6823ad63e22ac2..57405baa9e03eded243293d2d143284a5fa5775b 100644 (file)
@@ -55,7 +55,6 @@ cl_base::cl_base(void) {}
 
 cl_base::~cl_base(void) {}
 
-
 int cl_base::init(void) {return(0);}
 
 
index 62dc60af35056f79519fcf8e217ee3fef9d55416..08e82b54bc5f909745e7f91f669a6ab190932b6a 100644 (file)
@@ -17,16 +17,21 @@ PRJDIR              = ..
 
 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
 CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
-                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src
+                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src -I$(PRJDIR)/gui.src
 CFLAGS          = @CFLAGS@ -Wall
 CXXFLAGS        = @CXXFLAGS@ -Wall
 M_OR_MM         = @M_OR_MM@
+PICOPT         = @PICOPT@
+SHAREDLIB      = @SHAREDLIB@
 
 SDCC           = sdcc
 SDCFLAGS       = --debug --stack-after-data --model-small
 SDCPPFLAGS     = 
 
-LIBS           = @LIBS@ -L$(PRJDIR) -lutil -lsim -lcmd
+LIBS           = @LIBS@ -L$(PRJDIR) -lsim -lcmd -lguiucsim -lutil
+DL             = @DL@
+
+dl_ok          = @dl_ok@
 
 prefix          = @prefix@
 exec_prefix     = @exec_prefix@
@@ -40,11 +45,12 @@ man2dir         = $(mandir)/man2
 infodir         = @infodir@
 srcdir          = @srcdir@
 
-OBJECTS         = s51.o glob.o sim51.o cmd51.o \
+OBJECTS_SHARED = glob.o sim51.o \
                  inc.o jmp.o mov.o logic.o arith.o bit.o \
                  timer0.o timer1.o timer2.o serial.o port.o interrupt.o \
-                 uc51.o uc52.o uc51r.o uc89c51r.o uc251.o \
-                 cmd.o dump.o go.o cmd_brk.o set.o where.o show.o
+                 uc51.o uc52.o uc51r.o uc89c51r.o uc251.o
+OBJECTS_EXE    = s51.o 
+OBJECTS                = $(OBJECTS_SHARED) $(OBJECTS_EXE)
 
 
 # Compiling entire program or any subproject
@@ -104,17 +110,28 @@ include clean.mk
 # --------
 .SUFFIXES: .rel
 
-s51.src: s51
+s51.src: s51 shared_lib
 
 s51: $(OBJECTS) $(PRJDIR)/*.a
        $(CXX) $(CXXFLAGS) -o s51 $(OBJECTS) $(LIBS)
 
+ifeq ($(SHAREDLIB),yes)
+shared_lib: $(PRJDIR)/s51.so
+else
+shared_lib:
+       @echo "No shared lib made."
+endif
+
+$(PRJDIR)/s51.so: $(OBJECTS_SHARED)
+       $(CXX) -shared $(OBJECTS_SHARED) -o $(PRJDIR)/s51.so
+
 otherlibs:
        cd $(PRJDIR)/cmd.src && $(MAKE) all
        cd $(PRJDIR)/sim.src && $(MAKE) all
+       $(MAKE) -C $(PRJDIR)/gui.src checkconf ucsim_lib
 
 .cc.o:
-       $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+       $(CXX) $(CXXFLAGS) $(PICOPT) $(CPPFLAGS) -c $< -o $@
 
 .c.rel:
        $(SDCC) $(SDCFLAGS) $(SDCPPFLAGS) -c $<
index 6df4c8f8cbc6f9739c6004533b28e631368d01ca..d1949152cc16896ef0fce2858bb7d79ac7594db2 100644 (file)
@@ -66,7 +66,7 @@ t_uc51::inst_rrc(uchar code)
   bool cy;
   uchar acc;
 
-  cy= GET_C;
+  cy= SFR_GET_C;
   SET_C((acc= sfr->read(ACC)) & 0x01);
   event_at.ws= event_at.rs= ACC;
   acc>>= 1;
@@ -215,7 +215,7 @@ t_uc51::inst_rlc(uchar code)
   bool cy;
   uchar acc;
 
-  cy= GET_C;
+  cy= SFR_GET_C;
   SET_C((acc= sfr->get(event_at.rs= ACC)) & 0x80);
   acc<<= 1;
   if (cy)
@@ -239,7 +239,7 @@ t_uc51::inst_addc_a_$data(uchar code)
 
   data= fetch();
   acc = sfr->get(ACC);
-  newC= (((uint)acc+(uint)data+((orgC= GET_C)?1:0)) > 255)?0x80:0;
+  newC= (((uint)acc+(uint)data+((orgC= SFR_GET_C)?1:0)) > 255)?0x80:0;
   newA= ((acc&0x0f)+(data&0x0f)+(orgC?1:0)) & 0xf0;
   c6  = ((acc&0x7f)+(data&0x7f)+(orgC?1:0)) & 0x80;
   sfr->set(event_at.ws= ACC, acc + data + (orgC?1:0));
@@ -264,7 +264,7 @@ t_uc51::inst_addc_a_addr(uchar code)
 
   data= read(get_direct(fetch(), &event_at.ri, &event_at.rs));
   acc = sfr->get(ACC);
-  newC= (((uint)acc+(uint)data+((orgC= GET_C)?1:0)) > 255)?0x80:0;
+  newC= (((uint)acc+(uint)data+((orgC= SFR_GET_C)?1:0)) > 255)?0x80:0;
   newA= ((acc&0x0f)+(data&0x0f)+(orgC?1:0)) & 0xf0;
   c6  = ((acc&0x7f)+(data&0x7f)+(orgC?1:0)) & 0x80;
   sfr->set(event_at.ws= ACC, acc + data + (orgC?1:0));
@@ -291,7 +291,7 @@ t_uc51::inst_addc_a_$ri(uchar code)
   addr= get_indirect(event_at.ri= *(get_reg(code & 0x01)), &res);
   acc = sfr->get(ACC);
   data= *addr;
-  newC= (((uint)acc+(uint)data+((orgC= GET_C)?1:0)) > 255)?0x80:0;
+  newC= (((uint)acc+(uint)data+((orgC= SFR_GET_C)?1:0)) > 255)?0x80:0;
   newA= ((acc&0x0f)+(data&0x0f)+(orgC?1:0)) & 0xf0;
   c6  = ((acc&0x7f)+(data&0x7f)+(orgC?1:0)) & 0x80;
   sfr->set(event_at.ws= ACC, acc + data + (orgC?1:0));
@@ -316,7 +316,7 @@ t_uc51::inst_addc_a_rn(uchar code)
 
   data= *(get_reg(code & 0x07, &event_at.ri));
   acc = sfr->get(ACC);
-  newC= (((uint)acc+(uint)data+((orgC= GET_C)?1:0)) > 255)?0x80:0;
+  newC= (((uint)acc+(uint)data+((orgC= SFR_GET_C)?1:0)) > 255)?0x80:0;
   newA= ((acc&0x0f)+(data&0x0f)+(orgC?1:0)) & 0xf0;
   c6  = ((acc&0x7f)+(data&0x7f)+(orgC?1:0)) & 0x80;
   sfr->set(event_at.ws= ACC, acc + data + (orgC?1:0));
@@ -364,22 +364,22 @@ t_uc51::inst_div_ab(uchar code)
 int
 t_uc51::inst_subb_a_$data(uchar code)
 {
-  uchar data, d, acc;
-  bool newC, newA, c6;
+  uchar data, acc, result, psw, c;
 
   data= fetch();
   acc = sfr->get(ACC);
-  d= ~data + (GET_C?0:1);
-  newC= (acc < data+(GET_C?1:0))?0x80:0;
-  newA= !(((acc&0x0f)+(d&0x0f)) & 0xf0);
-  c6  = (((acc&0x7f)+(d&0x7f)) & 0x80)?0:0x80;
-  acc-= data;
-  if (GET_C)
-    acc--;
-  sfr->set(event_at.ws= ACC, acc);
-  SET_C(newC);
-  SET_BIT(newC ^ c6, PSW, bmOV);
-  SET_BIT(newA, PSW, bmAC);
+  result= acc-data;
+  psw= sfr->get(PSW);
+  if ((c= (psw & bmCY)?1:0))
+    result--;
+  sfr->set(event_at.ws= ACC, result);
+  sfr->set(PSW,
+          (psw & ~(bmCY|bmOV|bmAC)) |
+          (((unsigned int)acc < (unsigned int)(data+c))?bmCY:0) |
+          (((acc<0x80 && data>0x7f && result>0x7f) ||
+            (acc>0x7f && data<0x80 && result<0x80))?bmOV:0) |
+          (((acc&0x0f) < ((data+c)&0x0f) ||
+            (c && ((data&0x0f)==0x0f)))?bmAC:0));
   return(resGO);
 }
 
@@ -393,24 +393,23 @@ t_uc51::inst_subb_a_$data(uchar code)
 int
 t_uc51::inst_subb_a_addr(uchar code)
 {
-  uchar *addr, data, d, acc;
-  bool newC, newA, c6;
+  uchar *addr, data, acc, result, psw,c ;
 
   addr= get_direct(fetch(), &event_at.ri, &event_at.rs);
   acc = sfr->get(ACC);
   data= read(addr);
-  d= ~data + (GET_C?0:1);
-  newC= (acc < data+(GET_C?1:0))?0x80:0;
-  newA= !(((acc&0x0f)+(d&0x0f)) & 0xf0);
-  c6  = (((acc&0x7f)+(d&0x7f)) & 0x80)?0:0x80;
-  acc-= data;
-  event_at.ws= ACC;
-  if (GET_C)
-    acc--;
-  sfr->set(ACC, acc);
-  SET_C(newC);
-  SET_BIT(newC ^ c6, PSW, bmOV);
-  SET_BIT(newA, PSW, bmAC);
+  result= acc-data;
+  psw= sfr->get(PSW);
+  if ((c= (psw & bmCY)?1:0))
+    result--;
+  sfr->set(event_at.ws= ACC, result);
+  sfr->set(PSW,
+          (psw & ~(bmCY|bmOV|bmAC)) |
+          (((unsigned int)acc < (unsigned int)(data+c))?bmCY:0) |
+          (((acc<0x80 && data>0x7f && result>0x7f) ||
+            (acc>0x7f && data<0x80 && result<0x80))?bmOV:0) |
+          (((acc&0x0f) < ((data+c)&0x0f) ||
+            (c && ((data&0x0f)==0x0f)))?bmAC:0));
   return(resGO);
 }
 
@@ -424,24 +423,23 @@ t_uc51::inst_subb_a_addr(uchar code)
 int
 t_uc51::inst_subb_a_$ri(uchar code)
 {
-  uchar data, d, acc;
-  bool newC, newA, c6;
+  uchar data, acc, result, psw, c;
   int res;
 
   data= *(get_indirect(event_at.ri= *(get_reg(code & 0x01)), &res));
   acc = sfr->get(ACC);
-  d= ~data + (GET_C?0:1);
-  newC= (acc < data+(GET_C?1:0))?0x80:0;
-  newA= !(((acc&0x0f)+(d&0x0f)) & 0xf0);
-  c6  = (((acc&0x7f)+(d&0x7f)) & 0x80)?0:0x80;
-  acc-= data;
-  event_at.ws= ACC;
-  if (GET_C)
-    acc--;
-  sfr->set(ACC, acc);
-  SET_C(newC);
-  SET_BIT(newC ^ (acc & 0x80), PSW, bmOV);
-  SET_BIT(newA, PSW, bmAC);
+  result= acc-data;
+  psw= sfr->get(PSW);
+  if ((c= (psw & bmCY)?1:0))
+    result--;
+  sfr->set(event_at.ws= ACC, result);
+  sfr->set(PSW,
+          (psw & ~(bmCY|bmOV|bmAC)) |
+          (((unsigned int)acc < (unsigned int)(data+c))?bmCY:0) |
+          (((acc<0x80 && data>0x7f && result>0x7f) ||
+            (acc>0x7f && data<0x80 && result<0x80))?bmOV:0) |
+          (((acc&0x0f) < ((data+c)&0x0f) ||
+            (c && ((data&0x0f)==0x0f)))?bmAC:0));
   return(res);
 }
 
@@ -455,23 +453,22 @@ t_uc51::inst_subb_a_$ri(uchar code)
 int
 t_uc51::inst_subb_a_rn(uchar code)
 {
-  uchar data, d, acc;
-  bool newC, newA, c6;
+  uchar data, acc, result, psw, c;
 
   data= *(get_reg(code & 0x07, &event_at.ri));
   acc = sfr->get(ACC);
-  d= ~data + (GET_C?0:1);
-  newC= (acc < data+(GET_C?1:0))?0x80:0;
-  newA= !(((acc&0x0f)+(d&0x0f)) & 0xf0);
-  c6  = (((acc&0x7f)+(d&0x7f)) & 0x80)?0:0x80;
-  acc-= data;
-  event_at.ws= ACC;
-  if (GET_C)
-    acc--;
-  sfr->set(ACC, acc);
-  SET_C(newC);
-  SET_BIT(newC ^ (acc & 0x80), PSW, bmOV);
-  SET_BIT(newA, PSW, bmAC);
+  result= acc-data;
+  psw= sfr->get(PSW);
+  if ((c= (psw & bmCY)?1:0))
+    result--;
+  sfr->set(event_at.ws= ACC, result);
+  sfr->set(PSW,
+          (psw & ~(bmCY|bmOV|bmAC)) |
+          (((unsigned int)acc < (unsigned int)(data+c))?bmCY:0) |
+          (((acc<0x80 && data>0x7f && result>0x7f) ||
+            (acc>0x7f && data<0x80 && result<0x80))?bmOV:0) |
+          (((acc&0x0f) < ((data+c)&0x0f) ||
+            (c && ((data&0x0f)==0x0f)))?bmAC:0));
   return(resGO);
 }
 
@@ -493,6 +490,7 @@ t_uc51::inst_mul_ab(uchar code)
   sfr->set(event_at.ws= ACC, temp & 0xff);
   sfr->set(event_at.rs= B, (temp >> 8) & 0xff);
   SET_BIT(sfr->get(B), PSW, bmOV);
+  SET_BIT(0, PSW, bmCY);
   tick(3);
   return(resGO);
 }
index 914c972827b453d3325c8055d0933f97f5b9bebd..89aa6d120fb8f7161861656a4b021d0d0ab91d76 100644 (file)
@@ -77,6 +77,7 @@ t_uc51::inst_jbc_bit_addr(uchar code)
       (*addr)&= ~BIT_MASK(bitaddr);
       PC= (PC + (signed char)jaddr) & (EROM_SIZE - 1);
     }
+  tick(1);
   return(resGO);
 }
 
@@ -382,6 +383,7 @@ t_uc51::inst_jmp_$a_dptr(uchar code)
   PC= (sfr->get(DPH)*256 + sfr->get(DPL) +
        read_mem(MEM_SFR, ACC)) &
     (EROM_SIZE - 1);
+  tick(1);
   return(resGO);
 }
 
index c324ff59ffc5c965a42b469f04f115aa33d1a6c1..885b33243e096130bc76d4dd65946f10573cf842 100644 (file)
@@ -276,7 +276,7 @@ t_uc51::inst_push(uchar code)
   int res;
 
   addr= get_direct(fetch(), &event_at.ri, &event_at.rs);
-  MEM(MEM_SFR)[SP]++;
+  sfr->add(SP, 1);
   sp= get_indirect(sfr->get(SP), &res);
   if (res != resGO)
     res= resSTACK_OV;
@@ -361,7 +361,7 @@ t_uc51::inst_pop(uchar code)
   sp= get_indirect(get_mem(MEM_SFR, SP), &res);
   if (res != resGO)
     res= resSTACK_OV;
-  MEM(MEM_SFR)[SP]--;
+  sfr->add(SP, -1);
   (*addr)= *sp;
   proc_write(addr);
   tick(1);
@@ -485,6 +485,7 @@ t_uc51::inst_movx_$dptr_a(uchar code)
 {
   set_mem(MEM_XRAM, event_at.wx= sfr->get(DPH)*256+sfr->get(DPL),
          sfr->get(event_at.rs= ACC));
+  tick(1);
   return(resGO);
 }
 
index da2c65c06f2bbc2e008e266d858e3b8cb713dc80..117a1ecbb2d3c0c0a4a32eeb50cb91b26af405b9 100644 (file)
@@ -27,9 +27,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include "ddconfig.h"
 
-#include <stdio.h>
+//#include <stdio.h>
 
-#include "globals.h"
+//#include "globals.h"
 
 #include "sim51cl.h"
 
@@ -42,12 +42,13 @@ int
 main(int argc, char *argv[])
 {
   int retval;
-
-  simulator= new cl_sim51(argc, argv);
-  if (simulator->init())
+  class cl_sim *sim;
+  
+  sim= new cl_sim51(argc, argv);
+  if (sim->init())
     return(1);
-  retval= simulator->main();
-  delete simulator;
+  retval= sim->main();
+  delete sim;
   
   return(retval);
 }
index 9979fe7159f4ccc6827d17311fa1b1963860a5cd..7b40348951be0a7dc7278d0503f6df8eb7ad7578 100644 (file)
@@ -35,9 +35,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include "globals.h"
 #include "utils.h"
+#include "cmdutil.h"
+#ifdef SOCKET_AVAIL
+#include <sys/socket.h>
+#endif
 
 #include "sim51cl.h"
-#include "cmd51cl.h"
+//#include "cmd51cl.h"
 #include "uc51cl.h"
 #include "uc52cl.h"
 #include "uc51rcl.h"
@@ -47,7 +51,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 
 cl_sim51::cl_sim51(int iargc, char *iargv[]):
-  cl_sim("t:s:S:hH", iargc, iargv)
+  cl_sim("t:s:S:hHk:", iargc, iargv)
 {}
 
 static void
@@ -57,7 +61,7 @@ print_help(char *name)
   printf("Usage: %s [-hHVvP] [-p prompt] [-t CPU] [-X freq[k|M]]\n"
         "       [-c file] [-s file] [-S optionlist]"
 #ifdef SOCKET_AVAIL
-        " [-Z portnum]"
+        " [-Z portnum] [-k portnum]"
 #endif
         "\n"
         "       [files...]\n", name);
@@ -69,6 +73,7 @@ print_help(char *name)
      "  -c file      Open command console on `file'\n"
 #ifdef SOCKET_AVAIL
      "  -Z portnum   Use localhost:portnumber for command console\n"
+     "  -k portnum   Use localhost:portnum for serial I/O\n"
 #endif
      "  -s file      Connect serial interface to `file'\n"
      "  -S options   `options' is a comma separated list of options\n"
@@ -122,7 +127,7 @@ cl_sim51::proc_arg(char optopt, char *optarg)
            fprintf(stderr, "-s option can not be used more than once.\n");
            break;
          }
-       arguments->add(new cl_prg_arg('s', 0, (long long)1));
+       arguments->add(new cl_prg_arg('s', 0, (long)1));
        if ((Ser_in= fopen(optarg, "r")) == NULL)
          {
            fprintf(stderr,
@@ -140,6 +145,50 @@ cl_sim51::proc_arg(char optopt, char *optarg)
        break;
       }
 
+#ifdef SOCKET_AVAIL
+      // socket serial I/O by Alexandre Frey <Alexandre.Frey@trusted-logic.fr>
+    case 'k':
+      {
+        FILE *Ser_in, *Ser_out;
+        int  sock;
+        unsigned short serverport;
+        int client_sock;
+
+        if (arg_avail("Ser_in")) {
+          fprintf(stderr, "Serial input specified more than once.\n");
+        }
+        if (arg_avail("Ser_out")) {
+          fprintf(stderr, "Serial output specified more than once.\n");
+        }
+
+        serverport = atoi(optarg);
+        sock = make_server_socket(serverport);
+        if (listen(sock, 1) < 0) {
+          fprintf(stderr, "Listen on port %d: %s\n", serverport,
+                 strerror(errno));
+          return (4);
+        }
+        fprintf(stderr, "Listening on port %d for a serial connection.\n",
+               serverport);
+        if ((client_sock = accept(sock, NULL, NULL)) < 0) {
+          fprintf(stderr, "accept: %s\n", strerror(errno));
+        }
+        fprintf(stderr, "Serial connection established.\n");
+
+        if ((Ser_in = fdopen(client_sock, "r")) == NULL) {
+          fprintf(stderr, "Can't create input stream: %s\n", strerror(errno));
+          return (4);
+        }
+        arguments->add(new cl_prg_arg(0, "Ser_in", Ser_in));
+        if ((Ser_out = fdopen(client_sock, "w")) == NULL) {
+          fprintf(stderr, "Can't create output stream: %s\n", strerror(errno));
+          return (4);
+        }
+        arguments->add(new cl_prg_arg(0, "Ser_out", Ser_out));
+        break;
+      }
+#endif
+      
     case 'S':
 
       subopts= optarg;
@@ -223,12 +272,6 @@ cl_sim51::proc_arg(char optopt, char *optarg)
   return(0);
 }
 
-class cl_commander *
-cl_sim51::mk_commander(void)
-{
-  class cl_commander *cmd= new cl_51cmd(this);
-  return(cmd);
-}
 
 class cl_uc *
 cl_sim51::mk_controller(void)
@@ -237,7 +280,7 @@ cl_sim51::mk_controller(void)
 
   i= 0;
   if (get_sarg('t', 0) == NULL)
-    simulator->arguments->add(new cl_prg_arg('t', 0, "C51"));
+    arguments->add(new cl_prg_arg('t', 0, "C51"));
   while ((cpus_51[i].type_str != NULL) &&
         (strcmp(get_sarg('t', 0), cpus_51[i].type_str) != 0))
     i++;
@@ -263,12 +306,5 @@ cl_sim51::mk_controller(void)
   return(NULL);
 }
 
-void
-cl_sim51::build_cmd_set(void)
-{
-  cl_sim::build_cmd_set();
-  cmdset->del("ds");
-}
-
 
 /* End of s51.src/sim51.cc */
index 55cc28e455d6ae9b89d04ba72a33705c274d52cb..e15cd2d31b7733f6c061f16b5ff923ce6bbf6a19 100644 (file)
@@ -36,9 +36,7 @@ class cl_sim51: public cl_sim
 public:
   cl_sim51(int iargc, char *iargv[]);
   virtual int proc_arg(char optopt, char *optarg);
-  virtual class cl_commander *mk_commander(void);
   virtual class cl_uc *mk_controller(void);
-  virtual void build_cmd_set(void);
 };
 
 
index b7b13a487a1d01ea8f497e1de9944de5f6177147..99e01aa19d8acfee17c369e53fc753c8817ee54a 100644 (file)
@@ -48,7 +48,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "uc51cl.h"
 #include "glob.h"
 #include "regs51.h"
-#include "dump.h"
 #include "timer0cl.h"
 #include "timer1cl.h"
 #include "serialcl.h"
@@ -198,9 +197,9 @@ t_uc51::mk_hw_elements(void)
 }
 
 class cl_mem *
-t_uc51::mk_mem(enum mem_class type)
+t_uc51::mk_mem(enum mem_class type, char *class_name)
 {
-  class cl_mem *m= cl_uc::mk_mem(type);
+  class cl_mem *m= cl_uc::mk_mem(type, class_name);
   if (type == MEM_SFR)
     sfr= m;
   if (type == MEM_IRAM)
@@ -235,7 +234,7 @@ t_uc51::~t_uc51(void)
  */
 
 void
-t_uc51::write_rom(uint addr, ulong data)
+t_uc51::write_rom(t_addr addr, ulong data)
 {
   if (addr < EROM_SIZE)
     set_mem(MEM_ROM, addr, data);
@@ -265,11 +264,11 @@ t_uc51::bit_tbl(void)
 }
 
 char *
-t_uc51::disass(uint addr, char *sep)
+t_uc51::disass(t_addr addr, char *sep)
 {
   char work[256], temp[20], c[2];
   char *buf, *p, *b, *t;
-  uint code= get_mem(MEM_ROM, addr);
+  t_mem code= get_mem(MEM_ROM, addr);
 
   p= work;
   b= dis_tbl()[code].mnemonic;
@@ -315,11 +314,11 @@ t_uc51::disass(uint addr, char *sep)
                      get_mem(MEM_ROM, addr+1)&0x07);
              break;
            case 'r': // rel8 address at 2nd byte
-             sprintf(temp, "%04x",
+             sprintf(temp, "%04lx",
                      addr+2+(signed char)(get_mem(MEM_ROM, addr+1)));
              break;
            case 'R': // rel8 address at 3rd byte
-             sprintf(temp, "%04x",
+             sprintf(temp, "%04lx",
                      addr+3+(signed char)(get_mem(MEM_ROM, addr+2)));
              break;
            case 'd': // data8 at 2nd byte
@@ -370,33 +369,6 @@ t_uc51::disass(uint addr, char *sep)
   return(buf);
 }
 
-void
-t_uc51::print_disass(uint addr, class cl_console *con)
-{
-  char *dis;
-  class cl_brk *b;
-  int i;
-  uint code= get_mem(MEM_ROM, addr);
-
-  b  = fbrk_at(addr);
-  dis= disass(addr, NULL);
-  if (b)
-    con->printf("%c", (b->perm == brkFIX)?'F':'D');
-  else
-    con->printf(" ");
-  con->printf("%c %06x %02x",
-             inst_at(addr)?' ':'*',
-             addr, code);
-  for (i= 1; i < inst_length(code); i++)
-    con->printf(" %02x", get_mem(MEM_ROM, addr+i));
-  while (i < 3)
-    {
-      con->printf("   ");
-      i++;
-    }
-  con->printf(" %s\n", dis);
-  free(dis);
-}
 
 void
 t_uc51::print_regs(class cl_console *con)
@@ -405,7 +377,8 @@ t_uc51::print_regs(class cl_console *con)
   uchar data;
 
   start= sfr->get(PSW) & 0x18;
-  dump_memory(iram, &start, start+7, 8, /*sim->cmd_out()*/con, sim);
+  //dump_memory(iram, &start, start+7, 8, /*sim->cmd_out()*/con, sim);
+  iram->dump(start, start+7, 8, con);
   start= sfr->get(PSW) & 0x18;
   data= iram->get(iram->get(start));
   con->printf("%06x %02x %c",
@@ -430,6 +403,29 @@ t_uc51::print_regs(class cl_console *con)
 }
 
 
+bool
+t_uc51::extract_bit_address(t_addr bit_address,
+                           class cl_mem **mem,
+                           t_addr *mem_addr,
+                           t_mem *bit_mask)
+{
+  if (mem)
+    *mem= sfr;
+  if (bit_address > 0xff)
+    return(DD_FALSE);
+  if (bit_mask)
+    *bit_mask= 1 << (bit_address % 8);
+  if (mem_addr)
+    {
+      if (bit_address < 0x80)
+       *mem_addr= bit_address/8 + 0x20;
+      else
+       *mem_addr= bit_address & 0xf8;
+    }
+  return(DD_TRUE);
+}
+
+
 /*
  * Resetting the micro-controller
  */
@@ -484,7 +480,7 @@ t_uc51::clear_sfr(void)
  */
 
 void
-t_uc51::analyze(uint addr)
+t_uc51::analyze(t_addr addr)
 {
   uint code;
   struct dis_entry *tabl;
@@ -572,9 +568,15 @@ uchar *
 t_uc51::get_direct(t_mem addr, t_addr *ev_i, t_addr *ev_s)
 {
   if (addr < SFR_START)
-    return(&(MEM(MEM_IRAM)[*ev_i= addr]));
+    {
+      return(&(iram->umem8[*ev_i= addr]));
+      //return(&(MEM(MEM_IRAM)[*ev_i= addr]));
+    }
   else
-    return(&(MEM(MEM_SFR)[*ev_s= addr]));
+    {
+      return(&(sfr->umem8[*ev_s= addr]));
+      //return(&(MEM(MEM_SFR)[*ev_s= addr]));
+    }
 }
 
 /*
@@ -589,7 +591,8 @@ t_uc51::get_indirect(uchar addr, int *res)
     *res= resINV_ADDR;
   else
     *res= resGO;
-  return(&(MEM(MEM_IRAM)[addr]));
+  return(&(iram->umem8[addr]));
+  //return(&(MEM(MEM_IRAM)[addr]));
 }
 
 
@@ -600,15 +603,19 @@ t_uc51::get_indirect(uchar addr, int *res)
 uchar *
 t_uc51::get_reg(uchar regnum)
 {
-  return(&(MEM(MEM_IRAM)[(sfr->get(PSW) & (bmRS0|bmRS1)) |
-                       (regnum & 0x07)]));
+  return(&(iram->umem8[(sfr->get(PSW) & (bmRS0|bmRS1)) |
+                     (regnum & 0x07)]));
+  //return(&(MEM(MEM_IRAM)[(sfr->get(PSW) & (bmRS0|bmRS1)) |
+  //           (regnum & 0x07)]));
 }
 
 uchar *
 t_uc51::get_reg(uchar regnum, t_addr *event)
 {
-  return(&(MEM(MEM_IRAM)[*event= (sfr->get(PSW) & (bmRS0|bmRS1)) |
-                       (regnum & 0x07)]));
+  return(&(iram->umem8[*event= (sfr->get(PSW) & (bmRS0|bmRS1)) |
+                     (regnum & 0x07)]));
+  //return(&(MEM(MEM_IRAM)[*event= (sfr->get(PSW) & (bmRS0|bmRS1)) |
+  //           (regnum & 0x07)]));
 }
 
 
@@ -621,16 +628,24 @@ uchar *
 t_uc51::get_bit(uchar bitaddr)
 {
   if (bitaddr < 128)
-    return(&(MEM(MEM_IRAM)[(bitaddr/8)+32]));
-  return(&(MEM(MEM_SFR)[bitaddr & 0xf8]));
+    {
+      return(&(iram->umem8[(bitaddr/8)+32]));
+      //return(&(MEM(MEM_IRAM)[(bitaddr/8)+32]));
+    }
+  return(&(iram->umem8[bitaddr & 0xf8]));
+  //return(&(MEM(MEM_SFR)[bitaddr & 0xf8]));
 }
 
 uchar *
 t_uc51::get_bit(uchar bitaddr, t_addr *ev_i, t_addr *ev_s)
 {
   if (bitaddr < 128)
-    return(&(MEM(MEM_IRAM)[*ev_i= (bitaddr/8)+32]));
-  return(&(MEM(MEM_SFR)[*ev_s= bitaddr & 0xf8]));
+    {
+      return(&(iram->umem8[*ev_i= (bitaddr/8)+32]));
+      //return(&(MEM(MEM_IRAM)[*ev_i= (bitaddr/8)+32]));
+    }
+  return(&(sfr->umem8[*ev_s= bitaddr & 0xf8]));
+  //return(&(MEM(MEM_SFR)[*ev_s= bitaddr & 0xf8]));
 }
 
 uchar
@@ -681,13 +696,17 @@ t_uc51::proc_write_sp(uchar val)
 uchar
 t_uc51::read(uchar *addr)
 {
-  if (addr == &(MEM(MEM_SFR)[P0]))
+  //if (addr == &(MEM(MEM_SFR)[P0]))
+  if (addr == &(sfr->umem8[P0]))
     return(get_mem(MEM_SFR, P0) & port_pins[0]);
-  if (addr == &(MEM(MEM_SFR)[P1]))
+  //if (addr == &(MEM(MEM_SFR)[P1]))
+  if (addr == &(sfr->umem8[P1]))
     return(get_mem(MEM_SFR, P1) & port_pins[1]);
-  if (addr == &(MEM(MEM_SFR)[P2]))
+  //if (addr == &(MEM(MEM_SFR)[P2]))
+  if (addr == &(sfr->umem8[P2]))
     return(get_mem(MEM_SFR, P2) & port_pins[2]);
-  if (addr == &(MEM(MEM_SFR)[P3]))
+  //if (addr == &(MEM(MEM_SFR)[P3]))
+  if (addr == &(sfr->umem8[P3]))
     return(get_mem(MEM_SFR, P3) & port_pins[3]);
   return(*addr);
 }
@@ -1198,11 +1217,12 @@ t_uc51::do_timer0(int cycles)
              while (cycles--)
                {
                  // mod 0, TH= 8 bit t/c, TL= 5 bit precounter
-                 (MEM(MEM_SFR)[TL0])++;
+                 //(MEM(MEM_SFR)[TL0])++;
+                 sfr->add(TL0, 1);
                  if (sfr->get(TL0) > 0x1f)
                    {
                      sfr->set_bit0(TL0, ~0x1f);
-                     if (!++(MEM(MEM_SFR)[TH0]))
+                     if (!/*++(MEM(MEM_SFR)[TH0])*/sfr->add(TH0, 1))
                        {
                          sfr->set_bit1(TCON, bmTF0);
                          t0_overflow();
@@ -1218,9 +1238,9 @@ t_uc51::do_timer0(int cycles)
              while (cycles--)
                {
                  // mod 1 TH+TL= 16 bit t/c
-                 if (!++(MEM(MEM_SFR)[TL0]))
+                 if (!/*++(MEM(MEM_SFR)[TL0])*/sfr->add(TL0, 1))
                    {
-                     if (!++(MEM(MEM_SFR)[TH0]))
+                     if (!/*++(MEM(MEM_SFR)[TH0])*/sfr->add(TH0, 1))
                        {
                          sfr->set_bit1(TCON, bmTF0);
                          t0_overflow();
@@ -1236,7 +1256,7 @@ t_uc51::do_timer0(int cycles)
              while (cycles--)
                {
                  // mod 2 TL= 8 bit t/c auto reload from TH
-                 if (!++(MEM(MEM_SFR)[TL0]))
+                 if (!/*++(MEM(MEM_SFR)[TL0])*/sfr->add(TL0, 1))
                    {
                      sfr->set(TL0, sfr->get(TH0));
                      sfr->set_bit1(TCON, bmTF0);
@@ -1248,7 +1268,7 @@ t_uc51::do_timer0(int cycles)
            {
              // mod 3 TL= 8 bit t/c
              //       TH= 8 bit timer controlled with T1's bits
-             if (!++(MEM(MEM_SFR)[TL0]))
+             if (!/*++(MEM(MEM_SFR)[TL0])*/sfr->add(TL0, 1))
                {
                  sfr->set_bit1(TCON, bmTF0);
                  t0_overflow();
@@ -1263,7 +1283,7 @@ t_uc51::do_timer0(int cycles)
           (p3 & port_pins[3] & bm_INT1)) ||
          (tcon & bmTR1))
        {
-         if (!++(MEM(MEM_SFR)[TH0]))
+         if (!/*++(MEM(MEM_SFR)[TH0])*/sfr->add(TH0, 1))
            {
              sfr->set_bit1(TCON, bmTF1);
              s_tr_t1++;
@@ -1313,10 +1333,10 @@ t_uc51::do_timer1(int cycles)
              while (cycles--)
                {
                  // mod 0, TH= 8 bit t/c, TL= 5 bit precounter
-                 if (++(MEM(MEM_SFR)[TL1]) > 0x1f)
+                 if (/*++(MEM(MEM_SFR)[TL1])*/sfr->add(TL1, 1) > 0x1f)
                    {
                      sfr->set_bit0(TL1, ~0x1f);
-                     if (!++(MEM(MEM_SFR)[TH1]))
+                     if (!/*++(MEM(MEM_SFR)[TH1])*/sfr->add(TH1, 1))
                        {
                          sfr->set_bit1(TCON, bmTF1);
                          s_tr_t1++;
@@ -1333,8 +1353,8 @@ t_uc51::do_timer1(int cycles)
              while (cycles--)
                {
                  // mod 1 TH+TL= 16 bit t/c
-                 if (!++(MEM(MEM_SFR)[TL1]))
-                   if (!++(MEM(MEM_SFR)[TH1]))
+                 if (!/*++(MEM(MEM_SFR)[TL1])*/sfr->add(TL1, 1))
+                   if (!/*++(MEM(MEM_SFR)[TH1])*/sfr->add(TH1, 1))
                      {
                        sfr->set_bit1(TCON, bmTF1);
                        s_tr_t1++;
@@ -1350,7 +1370,7 @@ t_uc51::do_timer1(int cycles)
              while (cycles--)
                {
                  // mod 2 TL= 8 bit t/c auto reload from TH
-                 if (!++(MEM(MEM_SFR)[TL1]))
+                 if (!/*++(MEM(MEM_SFR)[TL1])*/sfr->add(TL1, 1))
                    {
                      sfr->set(TL1, sfr->get(TH1));
                      sfr->set_bit1(TCON, bmTF1);
index 9ce1294e20798536a34e9a90faa0c7a709a1d568..840b83430245ee2a485f521331e39c6c2b678986 100644 (file)
@@ -88,20 +88,23 @@ public:
   virtual int    init(void);
   virtual char  *id_string(void);
   virtual void mk_hw_elements(void);
-  virtual class cl_mem *mk_mem(enum mem_class type);
+  virtual class cl_mem *mk_mem(enum mem_class type, char *class_name);
 
-          void   write_rom(uint addr, ulong data);
+          void   write_rom(t_addr addr, ulong data);
   virtual int clock_per_cycle(void) { return(12); }
   virtual struct dis_entry *dis_tbl(void);
   virtual struct name_entry *sfr_tbl(void);
   virtual struct name_entry *bit_tbl(void);
   //virtual char   *disass(uint addr, char *sep);
-  virtual char *disass(uint addr, char *sep);
-  virtual void   print_disass(uint addr, class cl_console *con);
+  virtual char *disass(t_addr addr, char *sep);
   virtual void   print_regs(class cl_console *con);
+  virtual bool   extract_bit_address(t_addr bit_address,
+                                    class cl_mem **mem,
+                                    t_addr *mem_addr,
+                                    t_mem *bit_mask);
   virtual void   reset(void);
   virtual void   clear_sfr(void);
-  virtual void   analyze(uint addr);
+  virtual void   analyze(t_addr addr);
   virtual void   set_p_flag(void);
   virtual void   proc_write(uchar *addr);
   virtual void   proc_write_sp(uchar val);
index 191dd08caaff8c2796118e11451aefa228a9dfea..7ce5ecdf111390e03da2c27a0fed60f1ed8fdbcb 100644 (file)
@@ -61,7 +61,9 @@ t_uc51r::reset(void)
   t_uc52::reset();
   WDT= -1; // Disable WDT
   wdtrst= 0;
-  MEM(MEM_SFR)[SADDR]= MEM(MEM_SFR)[SADEN]= 0;
+  //MEM(MEM_SFR)[SADDR]= MEM(MEM_SFR)[SADEN]= 0;
+  sfr->set(SADDR, 0);
+  sfr->set(SADEN, 0);
 }
 
 
@@ -102,7 +104,7 @@ t_uc51r::proc_write(uchar *addr)
 {
   t_uc52::proc_write(addr);
   // Handling WDT
-  if (addr == &(MEM(MEM_SFR)[WDTRST]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[WDTRST]))
     {
       if ((wdtrst == 0x1e) &&
          (*addr == 0xe1))
@@ -194,31 +196,38 @@ t_uc51r::do_timer2(int cycles)
                  if (p1 & port_pins[1] & bmT2EX)
                    {
                      // UP
-                     if (!++(MEM(MEM_SFR)[TL2]))
-                       if (!++(MEM(MEM_SFR)[TH2]))
+                     if (!/*++(MEM(MEM_SFR)[TL2])*/sfr->add(TL2, 1))
+                       if (!/*++(MEM(MEM_SFR)[TH2])*/sfr->add(TH2, 1))
                          {
                            overflow++;
-                           MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[RCAP2H];
-                           MEM(MEM_SFR)[TL2]= MEM(MEM_SFR)[RCAP2L];
+                           //MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[RCAP2H];
+                           sfr->set(TH2, sfr->get(RCAP2H));
+                           //MEM(MEM_SFR)[TL2]= MEM(MEM_SFR)[RCAP2L];
+                           sfr->set(TL2, sfr->get(RCAP2L));
                            mem(MEM_SFR)->set_bit1(T2CON, bmTF2);
                          }
                    }
                  else
                    {
                      // DOWN
-                     MEM(MEM_SFR)[TL2]--;
-                     if (MEM(MEM_SFR)[TL2] == 0xff)
-                         MEM(MEM_SFR)[TH2]--;
-                     if (MEM(MEM_SFR)[TH2] == MEM(MEM_SFR)[RCAP2H] &&
-                         MEM(MEM_SFR)[TL2] == MEM(MEM_SFR)[RCAP2L])
+                     //MEM(MEM_SFR)[TL2]--;
+                     if (/*MEM(MEM_SFR)[TL2]*/sfr->add(TL2, -1) == 0xff)
+                       /*MEM(MEM_SFR)[TH2]--*/sfr->add(TH2, -1);
+                     /*if (MEM(MEM_SFR)[TH2] == MEM(MEM_SFR)[RCAP2H] &&
+                       MEM(MEM_SFR)[TL2] == MEM(MEM_SFR)[RCAP2L])*/
+                     if (sfr->get(TH2) == sfr->get(RCAP2H) &&
+                         sfr->get(TL2) == sfr->get(RCAP2L))
                        {
                          overflow++;
-                         MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[TL2]= 0xff;
+                         //MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[TL2]= 0xff;
+                         sfr->set(TH2, 0xff);
+                         sfr->set(TL2, 0xff);
                          mem(MEM_SFR)->set_bit1(T2CON, bmTF2);
                        }
                    }
                  while (overflow--)
-                   MEM(MEM_SFR)[P1]^= bmEXF2;
+                   //MEM(MEM_SFR)[P1]^= bmEXF2;
+                   sfr->set(P1, sfr->get(P1) ^ bmEXF2);
                }
            }
          else
@@ -261,11 +270,13 @@ t_uc51r::do_t2_clockout(int cycles)
   if (t2con & bmTR2)
     while (cycles--)
       {
-       if (!++(MEM(MEM_SFR)[TL2]))
-         if (!++(MEM(MEM_SFR)[TH2]))
+       if (!/*++(MEM(MEM_SFR)[TL2])*/sfr->add(TL2, 1))
+         if (!/*++(MEM(MEM_SFR)[TH2])*/sfr->add(TH2, 1))
            {
-             MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[RCAP2H];
-             MEM(MEM_SFR)[TL2]= MEM(MEM_SFR)[RCAP2L];
+             //MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[RCAP2H];
+             sfr->set(TH2, sfr->get(RCAP2H));
+             //MEM(MEM_SFR)[TL2]= MEM(MEM_SFR)[RCAP2L];
+             sfr->set(TL2, sfr->get(RCAP2L));
              clock_out++;
              if (!(t2con & bmC_T2))
                {
@@ -383,13 +394,19 @@ int
 t_uc51r::inst_movx_a_$dptr(uchar code)
 {
   if ((get_mem(MEM_SFR, AUXR) & bmEXTRAM) ||
-      MEM(MEM_SFR)[DPH])
-    MEM(MEM_SFR)[event_at.ws= ACC]= read_mem(MEM_XRAM,
+      /*MEM(MEM_SFR)[DPH]*/sfr->get(DPH))
+    /*MEM(MEM_SFR)[event_at.ws= ACC]= read_mem(MEM_XRAM,
                                             event_at.rx=
                                             MEM(MEM_SFR)[DPH]*256+
-                                            MEM(MEM_SFR)[DPL]);
+                                            MEM(MEM_SFR)[DPL]);*/
+    sfr->set(event_at.ws= ACC, read_mem(MEM_XRAM,
+                                       event_at.rx=
+                                       /*MEM(MEM_SFR)[DPH]*/sfr->get(DPH)*256+
+                                       /*MEM(MEM_SFR)[DPL]*/sfr->get(DPL)));
   else
-    MEM(MEM_SFR)[event_at.ws= ACC]= ERAM[event_at.rx= MEM(MEM_SFR)[DPL]];
+    //MEM(MEM_SFR)[event_at.ws= ACC]= ERAM[event_at.rx= MEM(MEM_SFR)[DPL]];
+    sfr->set(event_at.ws= ACC, ERAM[event_at.rx=
+                                  /*MEM(MEM_SFR)[DPL]*/sfr->get(DPL)]);
   tick(1);
   return(resGO);
 }
@@ -409,11 +426,16 @@ t_uc51r::inst_movx_a_$ri(uchar code)
 
   addr= get_indirect(*(get_reg(code & 0x01)), &res);
   if (get_mem(MEM_SFR, AUXR) & bmEXTRAM)
-    MEM(MEM_SFR)[event_at.ws= ACC]=
+    /*MEM(MEM_SFR)[event_at.ws= ACC]=
       read_mem(MEM_XRAM,
-              event_at.rx= (MEM(MEM_SFR)[P2]&port_pins[2])*256+*addr);
+      event_at.rx= (MEM(MEM_SFR)[P2]&port_pins[2])*256+*addr);*/
+    sfr->set(event_at.ws= ACC,
+            read_mem(MEM_XRAM,
+                     event_at.rx=
+                     (/*MEM(MEM_SFR)[P2]*/sfr->get(P2)&port_pins[2])*256+*addr));
   else
-    MEM(MEM_SFR)[event_at.ws= ACC]= ERAM[event_at.rx= *addr];
+    //MEM(MEM_SFR)[event_at.ws= ACC]= ERAM[event_at.rx= *addr];
+    sfr->set(event_at.ws= ACC, ERAM[event_at.rx= *addr]);
   tick(1);
   return(res);
 }
@@ -429,12 +451,14 @@ int
 t_uc51r::inst_movx_$dptr_a(uchar code)
 {
   if ((get_mem(MEM_SFR, AUXR) & bmEXTRAM) ||
-      MEM(MEM_SFR)[DPH])
+      /*MEM(MEM_SFR)[DPH]*/sfr->get(DPH))
     write_mem(MEM_XRAM,
-             event_at.wx= MEM(MEM_SFR)[DPH]*256+MEM(MEM_SFR)[DPL],
-             MEM(MEM_SFR)[event_at.rs= ACC]);
+             event_at.wx= /*MEM(MEM_SFR)[DPH]*/sfr->get(DPH)*256 +
+                          /*MEM(MEM_SFR)[DPL]*/sfr->get(DPL),
+             /*MEM(MEM_SFR)[event_at.rs= ACC]*/sfr->get(event_at.rs= ACC));
   else
-    ERAM[event_at.wx= MEM(MEM_SFR)[DPL]]= MEM(MEM_SFR)[event_at.rs= ACC];
+    ERAM[event_at.wx= /*MEM(MEM_SFR)[DPL]*/sfr->get(DPL)]=
+      /*MEM(MEM_SFR)[*/sfr->get(event_at.rs= ACC)/*]*/;
   return(resGO);
 }
 
@@ -454,10 +478,11 @@ t_uc51r::inst_movx_$ri_a(uchar code)
   addr= get_indirect(event_at.wi= *(get_reg(code & 0x01)), &res);
   if (get_mem(MEM_SFR, AUXR) & bmEXTRAM)
     write_mem(MEM_XRAM,
-             event_at.wx= (MEM(MEM_SFR)[P2] & port_pins[2])*256 + *addr,
-             MEM(MEM_SFR)[ACC]);
+             event_at.wx=
+             (/*MEM(MEM_SFR)[P2]*/sfr->get(P2) & port_pins[2])*256 + *addr,
+             /*MEM(MEM_SFR)[ACC]*/sfr->get(ACC));
   else
-    ERAM[event_at.wx= *addr]= MEM(MEM_SFR)[ACC];
+    ERAM[event_at.wx= *addr]= /*MEM(MEM_SFR)[ACC]*/sfr->get(ACC);
   tick(1);
   return(res);
 }
index 9f64b0637c96c0408bf95273f5c10967b0d88938..ea79cabbe98a3aec078cb2edc577e5b88ab407b1 100644 (file)
@@ -73,7 +73,7 @@ uchar *
 t_uc52::get_indirect(uchar addr, int *res)
 {
   *res= resGO;
-  return(&(MEM(MEM_IRAM)[addr]));
+  return(&(/*MEM(MEM_IRAM)*/iram->umem8[addr]));
 }
 
 
@@ -168,11 +168,13 @@ t_uc52::do_t2_baud(int cycles)
   if (t2con & bmTR2)
     while (cycles--)
       {
-       if (!++(MEM(MEM_SFR)[TL2]))
-         if (!++(MEM(MEM_SFR)[TH2]))
+       if (!/*++(MEM(MEM_SFR)[TL2])*/sfr->add(TL2, 1))
+         if (!/*++(MEM(MEM_SFR)[TH2])*/sfr->add(TH2, 1))
            {
-             MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[RCAP2H];
-             MEM(MEM_SFR)[TL2]= MEM(MEM_SFR)[RCAP2L];
+             //MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[RCAP2H];
+             sfr->set(TH2, sfr->get(RCAP2H));
+             //MEM(MEM_SFR)[TL2]= MEM(MEM_SFR)[RCAP2L];
+             sfr->set(TL2, sfr->get(RCAP2L));
              s_rec_t2++;
              s_tr_t2++;
            }
@@ -196,9 +198,9 @@ t_uc52::do_t2_capture(int *cycles, bool nocount)
     *cycles= 0;
   else
     {
-      if (!++(MEM(MEM_SFR)[TL2]))
+      if (!/*++(MEM(MEM_SFR)[TL2])*/sfr->add(TL2, 1))
        {
-         if (!++(MEM(MEM_SFR)[TH2]))
+         if (!/*++(MEM(MEM_SFR)[TH2])*/sfr->add(TH2, 1))
            mem(MEM_SFR)->set_bit1(T2CON, bmTF2);
        }
     }
@@ -207,8 +209,10 @@ t_uc52::do_t2_capture(int *cycles, bool nocount)
       !(p1 & port_pins[1] & bmT2EX) &&
       (t2con & bmEXEN2))
     {
-      MEM(MEM_SFR)[RCAP2H]= MEM(MEM_SFR)[TH2];
-      MEM(MEM_SFR)[RCAP2L]= MEM(MEM_SFR)[TL2];
+      //MEM(MEM_SFR)[RCAP2H]= MEM(MEM_SFR)[TH2];
+      sfr->set(RCAP2H, sfr->get(TH2));
+      //MEM(MEM_SFR)[RCAP2L]= MEM(MEM_SFR)[TL2];
+      sfr->set(RCAP2L, sfr->get(TL2));
       mem(MEM_SFR)->set_bit1(T2CON, bmEXF2);
       prev_p1&= ~bmT2EX; // Falling edge has been handled
     }
@@ -231,9 +235,9 @@ t_uc52::do_t2_reload(int *cycles, bool nocount)
     *cycles= 0;
   else
     {
-      if (!++(MEM(MEM_SFR)[TL2]))
+      if (!/*++(MEM(MEM_SFR)[TL2])*/sfr->add(TL2, 1))
        {
-         if (!++(MEM(MEM_SFR)[TH2]))
+         if (!/*++(MEM(MEM_SFR)[TH2])*/sfr->add(TH2, 1))
            {
              mem(MEM_SFR)->set_bit1(T2CON, bmTF2);
              overflow++;
@@ -252,8 +256,10 @@ t_uc52::do_t2_reload(int *cycles, bool nocount)
   if (overflow ||
       ext2)
     {
-      MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[RCAP2H];
-      MEM(MEM_SFR)[TL2]= MEM(MEM_SFR)[RCAP2L];
+      //MEM(MEM_SFR)[TH2]= MEM(MEM_SFR)[RCAP2H];
+      sfr->set(TH2, sfr->get(RCAP2H));
+      //MEM(MEM_SFR)[TL2]= MEM(MEM_SFR)[RCAP2L];
+      sfr->set(TL2, sfr->get(RCAP2L));
     }
 }
 
index 4d0383865c47941596f3b6407b5be8c38be749b8..8021dbdc3a47f4a00f5568517ecbe55e3d95864c 100644 (file)
@@ -71,32 +71,32 @@ t_uc89c51r::proc_write(uchar *addr)
 {
   t_uc51r::proc_write(addr);
 
-  if (addr == &(MEM(MEM_SFR)[CCAP0L]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP0L]))
     mem(MEM_SFR)->set_bit0(CCAPM0, bmECOM);
-  if (addr == &(MEM(MEM_SFR)[CCAP0H]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP0H]))
     mem(MEM_SFR)->set_bit1(CCAPM0, bmECOM);
 
-  if (addr == &(MEM(MEM_SFR)[CCAP1L]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP1L]))
     mem(MEM_SFR)->set_bit0(CCAPM1, bmECOM);
-  if (addr == &(MEM(MEM_SFR)[CCAP1H]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP1H]))
     mem(MEM_SFR)->set_bit1(CCAPM1, bmECOM);
 
-  if (addr == &(MEM(MEM_SFR)[CCAP2L]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP2L]))
     mem(MEM_SFR)->set_bit0(CCAPM2, bmECOM);
-  if (addr == &(MEM(MEM_SFR)[CCAP2H]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP2H]))
     mem(MEM_SFR)->set_bit1(CCAPM2, bmECOM);
 
-  if (addr == &(MEM(MEM_SFR)[CCAP3L]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP3L]))
     mem(MEM_SFR)->set_bit0(CCAPM3, bmECOM);
-  if (addr == &(MEM(MEM_SFR)[CCAP3H]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP3H]))
     mem(MEM_SFR)->set_bit1(CCAPM3, bmECOM);
 
-  if (addr == &(MEM(MEM_SFR)[CCAP4L]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP4L]))
     mem(MEM_SFR)->set_bit0(CCAPM4, bmECOM);
-  if (addr == &(MEM(MEM_SFR)[CCAP4H]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[CCAP4H]))
     mem(MEM_SFR)->set_bit1(CCAPM4, bmECOM);
 
-  if (addr == &(MEM(MEM_SFR)[AUXR]))
+  if (addr == &(/*MEM(MEM_SFR)*/sfr->umem8[AUXR]))
     mem(MEM_SFR)->set_bit0(AUXR, 0x04);
 }
 
@@ -225,9 +225,9 @@ t_uc89c51r::do_pca_counter(int cycles)
 {
   while (cycles--)
     {
-      if (++(MEM(MEM_SFR)[CL]) == 0)
+      if (/*++(MEM(MEM_SFR)[CL])*/sfr->add(CL, 1) == 0)
        {
-         if (++(MEM(MEM_SFR)[CH]) == 0)
+         if (/*++(MEM(MEM_SFR)[CH])*/sfr->add(CH, 1) == 0)
            {
              /* CH,CL overflow */
              mem(MEM_SFR)->set_bit1(CCON, bmCF);
@@ -264,20 +264,24 @@ t_uc89c51r::do_pca_module(int nr)
       )
     {
       /* Capture */
-      MEM(MEM_SFR)[CCAPL[nr]]= MEM(MEM_SFR)[CL];
-      MEM(MEM_SFR)[CCAPH[nr]]= MEM(MEM_SFR)[CH];
+      //MEM(MEM_SFR)[CCAPL[nr]]= MEM(MEM_SFR)[CL];
+      sfr->set(CCAPL[nr], sfr->get(CL));
+      //MEM(MEM_SFR)[CCAPH[nr]]= MEM(MEM_SFR)[CH];
+      sfr->set(CCAPH[nr], sfr->get(CH));
       mem(MEM_SFR)->set_bit1(CCON, bmCCF[nr]);
     }
 
   if (ccapm & bmECOM)
     {
       /* Comparator enabled */
-      if (MEM(MEM_SFR)[CL] == MEM(MEM_SFR)[CCAPL[nr]] &&
-         MEM(MEM_SFR)[CH] == MEM(MEM_SFR)[CCAPH[nr]])
+      /*if (MEM(MEM_SFR)[CL] == MEM(MEM_SFR)[CCAPL[nr]] &&
+       MEM(MEM_SFR)[CH] == MEM(MEM_SFR)[CCAPH[nr]])*/
+      if (sfr->get(CL) == sfr->get(CCAPL[nr]) &&
+         sfr->get(CH) == sfr->get(CCAPH[nr]))
        {
          /* Match */
          if (nr == 4 &&
-             (MEM(MEM_SFR)[CMOD] & bmWDTE))
+             (/*MEM(MEM_SFR)[CMOD]*/sfr->get(CMOD) & bmWDTE))
            {
              reset();
            }
@@ -285,16 +289,20 @@ t_uc89c51r::do_pca_module(int nr)
          if (ccapm & bmTOG)
            {
              /* Toggle */
-             MEM(MEM_SFR)[P1]^= bmCEX[nr];
+             //MEM(MEM_SFR)[P1]^= bmCEX[nr];
+             sfr->set(P1, sfr->get(P1) ^ bmCEX[nr]);
            }
        }
       if (ccapm & bmPWM)
        {
          /* PWM */
-         if (MEM(MEM_SFR)[CL] == 0)
-           MEM(MEM_SFR)[CCAPL[nr]]= MEM(MEM_SFR)[CCAPH[nr]];
-         if (MEM(MEM_SFR)[CL] < MEM(MEM_SFR)[CCAPL[nr]])
-           MEM(MEM_SFR)[P1]&= ~(bmCEX[nr]);
+         if (/*MEM(MEM_SFR)[CL]*/sfr->get(CL) == 0)
+           //MEM(MEM_SFR)[CCAPL[nr]]= MEM(MEM_SFR)[CCAPH[nr]];
+           sfr->set(CCAPL[nr], sfr->get(CCAPH[nr]));
+         if (/*MEM(MEM_SFR)[CL]*/sfr->get(CL) <
+             /*MEM(MEM_SFR)[CCAPL[nr]]*/sfr->get(CCAPL[nr]))
+           //MEM(MEM_SFR)[P1]&= ~(bmCEX[nr]);
+           sfr->set(P1, sfr->get(P1) & ~(bmCEX[nr]));
          else
            mem(MEM_SFR)->set_bit1(P1, bmCEX[nr]);
        }
index 9f05ae5f6ac99da67c132dc3f017b4d45a93e2d5..f01b32f408c4efd9dc9d680bf6c3f832f435e7de 100644 (file)
@@ -16,7 +16,8 @@ INSTALL               = @INSTALL@
 PRJDIR         = ..
 
 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
-CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) -I$(PRJDIR)/cmd.src
+CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
+                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/gui.src
 CFLAGS          = @CFLAGS@ -Wall
 CXXFLAGS        = @CXXFLAGS@ -Wall
 M_OR_MM         = @M_OR_MM@
@@ -33,8 +34,8 @@ man2dir         = $(mandir)/man2
 infodir         = @infodir@
 srcdir          = @srcdir@
 
-OBJECTS         = sim.o itsrc.o brk.o option.o arg.o stack.o \
-                 uc.o hw.o mem.o
+OBJECTS         = app.o sim.o itsrc.o brk.o option.o arg.o stack.o \
+                 guiobj.o uc.o hw.o mem.o
 
 
 # Compiling entire program or any subproject
diff --git a/sim/ucsim/sim.src/app.cc b/sim/ucsim/sim.src/app.cc
new file mode 100644 (file)
index 0000000..27faec2
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Simulator of microcontrollers (app.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@*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+// prj
+#include "i_string.h"
+
+// local
+#include "appcl.h"
+
+
+/*
+ * Program options
+ */
+
+cl_option::cl_option(int atype, char sn, char *ln)
+{
+  type= atype;
+  short_name= sn;
+  if (!ln)
+    long_name= NULL;
+  else
+    long_name= strdup(ln);
+  values= new cl_ustrings(1, 1);
+}
+
+cl_option::~cl_option(void)
+{
+  if (long_name)
+    free(long_name);
+  delete values;
+}
+
+int
+cl_option::add_value(char *value)
+{
+  values->add(value);
+  return(values->count - 1);
+}
+
+char *
+cl_option::get_value(int index)
+{
+  if (index > values->count - 1)
+    return(0);
+  return((char*)(values->at(index)));
+}
+
+/* List of options */
+
+cl_options::cl_options(void):
+  cl_list(2, 2)
+{
+}
+
+
+/*
+ * Application
+ ****************************************************************************
+ */
+
+cl_app::cl_app(void)
+{
+  options= new cl_options();
+}
+
+cl_app::~cl_app(void)
+{
+  delete options;
+}
+
+
+/* End of sim.src/app.cc */
diff --git a/sim/ucsim/sim.src/appcl.h b/sim/ucsim/sim.src/appcl.h
new file mode 100644 (file)
index 0000000..e1e4e3d
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Simulator of microcontrollers (sim.src/appcl.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 SIM_APPCL_HEADER
+#define SIM_APPCL_HEADER
+
+#include "ddconfig.h"
+
+#include "pobjcl.h"
+
+
+/* Options */
+
+#define OPT_GENERAL    0x0001
+#define OPT_SIM                0x0002
+#define OPT_UC         0x0004
+#define OPT_PRG_OPT    (OPT_GENERAL|OPT_SIM|OPT_UC)
+#define OPT_51         0x0010
+#define OPT_AVR                0x0020
+#define OPT_Z80                0x0040
+#define OPT_TARGET     (OPT_51|OPT_AVR|OPT_Z80)
+
+class cl_option: public cl_base
+{
+public:
+  int type;    // See OPT_XXX
+  char short_name;
+  char *long_name;
+  class cl_ustrings *values;
+
+public:
+  cl_option(int atype, char sn, char *ln);
+  ~cl_option(void);
+
+  virtual int add_value(char *value);
+  virtual char *get_value(int index);
+};
+
+class cl_options: public cl_list
+{
+public:
+  cl_options(void);
+};
+
+
+/* Application */
+
+class cl_app: public cl_base
+{
+public:
+  class cl_options *options;
+
+public:
+  cl_app(void);
+  ~cl_app(void);
+};
+
+
+#endif
+
+/* End of sim.src/appcl.h */
index e326ca6d8352ac3d467d74333005be6383dd65b9..4a79f7479ce4ceaf83669e5b125285b32478bf5a 100644 (file)
@@ -48,7 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  * Making the argument
  */
 
-cl_arg::cl_arg(long long lv):
+cl_arg::cl_arg(long lv):
   cl_base()
 {
   i_value= lv;
@@ -86,10 +86,12 @@ cl_arg::~cl_arg(void)
  * Getting value of the argument
  */
 
-long long
-cl_arg::get_ivalue(void)
+bool
+cl_arg::get_ivalue(long *value)
 {
-  return(i_value);
+  if (value)
+    *value= i_value;
+  return(DD_TRUE);
 }
 
 char *
@@ -116,34 +118,206 @@ cl_arg::get_pvalue(void)
  *----------------------------------------------------------------------------
  */
 
-cl_cmd_int_arg::cl_cmd_int_arg(long long addr):
-  cl_cmd_arg(addr)
+cl_cmd_arg::~cl_cmd_arg(void)
+{
+  if (interpreted_as_string)
+    {
+      if (value.string.string)
+       free(value.string.string);
+    }
+}
+
+bool
+cl_cmd_arg::as_address(void)
+{
+  return(get_address(&(value.address)));    
+}
+
+bool
+cl_cmd_arg::as_number(void)
+{
+  return(get_ivalue(&(value.number)));
+}
+
+bool
+cl_cmd_arg::as_data(void)
+{
+  long l;
+  bool ret= get_ivalue(&l);
+  value.data= l;
+  return(ret);
+}
+
+bool
+cl_cmd_arg::as_memory(void)
+{
+  value.memory= uc->mem(s_value);
+  return(value.memory != 0);
+}
+
+bool
+cl_cmd_arg::as_hw(class cl_uc *uc)
+{
+  return(DD_FALSE);
+}
+
+bool
+cl_cmd_arg::as_string(void)
+{
+  char *s= get_svalue();
+  if (!s)
+    return(DD_FALSE);
+  if (is_string())
+    value.string.string= proc_escape(s, &value.string.len);
+  else
+    {
+      value.string.string= strdup(s);
+      value.string.len= strlen(s);
+    }
+  return(interpreted_as_string= value.string.string != NULL);
+}
+
+bool
+cl_cmd_arg::as_bit(class cl_uc *uc)
+{
+  return(get_bit_address(uc,
+                        &(value.bit.mem),
+                        &(value.bit.mem_address),
+                        &(value.bit.mask)));
+}
+
+
+/* Interger number */
+
+cl_cmd_int_arg::cl_cmd_int_arg(class cl_uc *iuc, long addr):
+  cl_cmd_arg(iuc, addr)
 {}
 
-cl_cmd_sym_arg::cl_cmd_sym_arg(char *sym):
-  cl_cmd_arg(sym)
+bool
+cl_cmd_int_arg::get_address(t_addr *addr)
+{
+  long iv;
+
+  bool b= get_ivalue(&iv);
+  if (addr)
+    *addr= iv;
+  return(b);
+}
+
+bool
+cl_cmd_int_arg::get_bit_address(class cl_uc *uc, // input
+                               class cl_mem **mem, // outputs
+                               t_addr *mem_addr,
+                               t_mem *bit_mask)
+{
+  t_addr bit_addr;
+
+  if (!get_address(&bit_addr))
+    return(DD_FALSE);
+  return(uc->extract_bit_address(bit_addr, mem, mem_addr, bit_mask));
+}
+
+bool
+cl_cmd_int_arg::as_string(void)
+{
+  value.string.string= (char*)malloc(100);
+  sprintf(value.string.string, "%ld", i_value);
+  value.string.len= strlen(value.string.string);
+  return(interpreted_as_string= value.string.string != NULL);
+}
+
+
+/* Symbol */
+
+cl_cmd_sym_arg::cl_cmd_sym_arg(class cl_uc *iuc, char *sym):
+  cl_cmd_arg(iuc, sym)
 {}
 
-long
-cl_cmd_sym_arg::get_address(void)
+bool
+cl_cmd_sym_arg::as_string(void)
+{
+  char *s= get_svalue();
+  if (!s)
+    return(DD_FALSE);
+  value.string.string= strdup(s);
+  value.string.len= strlen(s);
+  return(interpreted_as_string= value.string.string != NULL);
+}
+
+bool
+cl_cmd_sym_arg::get_address(t_addr *addr)
 {
   struct name_entry *ne;
 
-  if ((ne= get_name_entry(simulator->uc->sfr_tbl(),
+  if ((ne= get_name_entry(uc->sfr_tbl(),
                          get_svalue(),
-                         simulator->uc)) != NULL)
+                         uc)) != NULL)
     {
-      return(ne->addr);
+      if (addr)
+       *addr= ne->addr;
+      return(1);
     }
-  return(-1);
+  return(0);
 }
 
-cl_cmd_str_arg::cl_cmd_str_arg(char *str):
-  cl_cmd_arg(str)
+bool
+cl_cmd_sym_arg::get_bit_address(class cl_uc *uc, // input
+                               class cl_mem **mem, // outputs
+                               t_addr *mem_addr,
+                               t_mem *bit_mask)
+{
+  struct name_entry *ne;
+
+  if ((ne= get_name_entry(uc->bit_tbl(),
+                         get_svalue(),
+                         uc)) == NULL)
+    return(DD_FALSE);
+  return(uc->extract_bit_address(ne->addr, mem, mem_addr, bit_mask));
+}
+
+bool
+cl_cmd_sym_arg::as_address(void)
+{
+  struct name_entry *ne;
+  //printf("SYM %s as addr?\n",get_svalue());
+  if ((ne= get_name_entry(uc->sfr_tbl(), get_svalue(), uc)) != NULL)
+    {
+      value.address= ne->addr;
+      return(DD_TRUE);
+    }
+  return(DD_FALSE);
+}
+
+bool
+cl_cmd_sym_arg::as_hw(class cl_uc *uc)
+{
+  cl_hw *hw, *found;
+  int i= 0;
+
+  hw= found= uc->get_hw(get_svalue(), &i);
+  if (!hw)
+    return(DD_FALSE);
+  i++;
+  found= uc->get_hw(get_svalue(), &i);
+  if (found)
+    return(DD_FALSE);
+  value.hw= hw;
+  return(DD_TRUE);
+}
+
+
+/* String */
+
+cl_cmd_str_arg::cl_cmd_str_arg(class cl_uc *iuc, char *str):
+  cl_cmd_arg(iuc, str)
 {}
 
-cl_cmd_bit_arg::cl_cmd_bit_arg(class cl_cmd_arg *asfr, class cl_cmd_arg *abit):
-  cl_cmd_arg((long long)0)
+
+/* Bit */
+
+cl_cmd_bit_arg::cl_cmd_bit_arg(class cl_uc *iuc,
+                              class cl_cmd_arg *asfr, class cl_cmd_arg *abit):
+  cl_cmd_arg(iuc, (long)0)
 {
   sfr= asfr;
   bit= abit;
@@ -157,12 +331,84 @@ cl_cmd_bit_arg::~cl_cmd_bit_arg(void)
     delete bit;
 }
 
-long
-cl_cmd_bit_arg::get_address(void)
+bool
+cl_cmd_bit_arg::get_address(t_addr *addr)
 {
   if (sfr)
-    return(sfr->get_address());
-  return(-1);
+    return(sfr->get_address(addr));
+  return(0);
+}
+
+bool
+cl_cmd_bit_arg::get_bit_address(class cl_uc *uc, // input
+                               class cl_mem **mem, // outputs
+                               t_addr *mem_addr,
+                               t_mem *bit_mask)
+{
+printf("**1\n");
+  if (mem)
+    *mem= uc->mem(MEM_SFR);
+printf("**2\n");
+  if (mem_addr)
+    {
+printf("**3\n");
+      if (!sfr ||
+         !sfr->get_address(mem_addr))
+       return(DD_FALSE);
+printf("**4\n");
+    }
+printf("**5\n");
+  if (bit_mask)
+    {
+printf("**6\n");
+      if (!bit)
+       return(DD_FALSE);
+printf("**7\n");
+      long l;
+      if (!bit->get_ivalue(&l) ||
+         l > 7)
+       return(DD_FALSE);
+printf("**8\n");
+      *bit_mask= 1 << l;
+    }
+printf("**9\n");
+  return(DD_TRUE);
+}
+
+
+/* Array */
+
+cl_cmd_array_arg::cl_cmd_array_arg(class cl_uc *iuc,
+                                  class cl_cmd_arg *aname,
+                                  class cl_cmd_arg *aindex):
+  cl_cmd_arg(iuc, (long)0)
+{
+  name = aname;
+  index= aindex;
+}
+
+cl_cmd_array_arg::~cl_cmd_array_arg(void)
+{
+  if (name)
+    delete name;
+  if (index)
+    delete index;
+}
+
+bool
+cl_cmd_array_arg::as_hw(class cl_uc *uc)
+{
+  char *n;
+  t_addr a;
+
+  if (name == 0 ||
+      index == 0 ||
+      (n= name->get_svalue()) == NULL ||
+      !index->get_address(&a))
+    return(DD_FALSE);
+  
+  value.hw= uc->get_hw(n, a, NULL);
+  return(value.hw != NULL);
 }
 
 
@@ -171,7 +417,7 @@ cl_cmd_bit_arg::get_address(void)
  *----------------------------------------------------------------------------
  */
 
-cl_prg_arg::cl_prg_arg(char sn, char *ln, long long lv):
+cl_prg_arg::cl_prg_arg(char sn, char *ln, long lv):
   cl_arg(lv)
 {
   short_name= sn;
index ff65fa12ac982989e7813dd2673f4cc06d93a8a0..91d1f715891e5ffd2b39daff1d3456fff1d318ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (argcl.h)
+ * Simulator of microcontrollers (sim.src/argcl.h)
  *
  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
  * 
@@ -25,8 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
-#ifndef ARGCL_HEADER
-#define ARGCL_HEADER
+#ifndef SIM_ARGCL_HEADER
+#define SIM_ARGCL_HEADER
 
 #include "pobjcl.h"
 
@@ -39,23 +39,27 @@ class cl_arg: public cl_base
 {
 public:
   union {
-    long long i_value;
+    long i_value;
     double f_value;
     void *p_value;
   };
   char *s_value;
 
 public:  
-  cl_arg(long long lv);
+  cl_arg(long lv);
   cl_arg(char *lv);
   cl_arg(double fv);
   cl_arg(void *pv);
   ~cl_arg(void);
 
-  virtual long long get_ivalue(void);
+  virtual bool get_ivalue(long *value);
   virtual char *get_svalue(void);
   virtual double get_fvalue(void);
   virtual void *get_pvalue(void);
+  virtual bool get_bit_address(class cl_uc *uc, // input
+                              class cl_mem **mem, // outputs
+                              t_addr *mem_addr,
+                              t_mem *bit_mask) { return(DD_FALSE); }
 };
 
 
@@ -66,33 +70,80 @@ public:
 class cl_cmd_arg: public cl_arg
 {
 public:
-  cl_cmd_arg(long long i): cl_arg(i) {}
-  cl_cmd_arg(char *s): cl_arg(s) {}
+  class cl_uc *uc;
 
-  virtual int is_string(void) { return(0); }
-  virtual long get_address(void) { return(-1); }
+  bool interpreted_as_string;
+  union {
+    long number;
+    t_addr address;
+    t_mem data;
+    class cl_mem *memory;
+    class cl_hw *hw;
+    struct {
+      int len;
+      char *string;
+    } string;
+    struct {
+      t_mem *array;
+      int len;
+    } data_list;
+    struct {
+      class cl_mem *mem;
+      t_addr mem_address;
+      t_mem mask;
+    } bit;
+  } value;
+
+public:
+  cl_cmd_arg(class cl_uc *iuc, long i): cl_arg(i)
+  { uc= iuc; interpreted_as_string= DD_FALSE; }
+  cl_cmd_arg(class cl_uc *iuc, char *s): cl_arg(s)
+  { uc= iuc; interpreted_as_string= DD_FALSE; }
+  ~cl_cmd_arg(void);
+
+  virtual int is_string(void) { return(DD_FALSE); }
+  virtual bool get_address(t_addr *addr) { return(DD_FALSE); }
+  virtual bool as_address(void);
+  virtual bool as_number(void);
+  virtual bool as_data(void);
+  virtual bool as_string(void);
+  virtual bool as_memory(void);
+  virtual bool as_hw(class cl_uc *uc);
+  virtual bool as_bit(class cl_uc *uc);
 };
 
 class cl_cmd_int_arg: public cl_cmd_arg
 {
 public:
-  cl_cmd_int_arg(long long addr);
-
-  virtual long get_address(void) { return(get_ivalue()); }
+  cl_cmd_int_arg(class cl_uc *iuc, long addr);
+
+  virtual bool get_address(t_addr *addr);
+  virtual bool get_bit_address(class cl_uc *uc, // input
+                              class cl_mem **mem, // outputs
+                              t_addr *mem_addr,
+                              t_mem *bit_mask);
+  virtual bool as_string(void);
 };
 
 class cl_cmd_sym_arg: public cl_cmd_arg
 {
 public:
-  cl_cmd_sym_arg(char *sym);
-
-  virtual long get_address(void);
+  cl_cmd_sym_arg(class cl_uc *iuc, char *sym);
+
+  virtual bool get_address(t_addr *addr);
+  virtual bool get_bit_address(class cl_uc *uc, // input
+                              class cl_mem **mem, // outputs
+                              t_addr *mem_addr,
+                              t_mem *bit_mask);
+  virtual bool as_address(void);
+  virtual bool as_string(void);
+  virtual bool as_hw(class cl_uc *uc);
 };
 
 class cl_cmd_str_arg: public cl_cmd_arg
 {
 public:
-  cl_cmd_str_arg(char *str);
+  cl_cmd_str_arg(class cl_uc *iuc, char *str);
 
   virtual int is_string(void) { return(1); }
 };
@@ -103,10 +154,27 @@ public:
   class cl_cmd_arg *sfr, *bit;
 
 public:
-  cl_cmd_bit_arg(class cl_cmd_arg *asfr, class cl_cmd_arg *abit);
+  cl_cmd_bit_arg(class cl_uc *iuc,
+                class cl_cmd_arg *asfr, class cl_cmd_arg *abit);
   ~cl_cmd_bit_arg(void);
 
-  virtual long get_address(void);
+  virtual bool get_address(t_addr *addr);
+  virtual bool get_bit_address(class cl_uc *uc, // input
+                              class cl_mem **mem, // outputs
+                              t_addr *mem_addr,
+                              t_mem *bit_mask);
+};
+
+class cl_cmd_array_arg: public cl_cmd_arg
+{
+public:
+  class cl_cmd_arg *name, *index;
+
+public:
+  cl_cmd_array_arg(class cl_uc *iuc,
+                  class cl_cmd_arg *aname, class cl_cmd_arg *aindex);
+  ~cl_cmd_array_arg(void);
+  virtual bool as_hw(class cl_uc *uc);
 };
 
 
@@ -121,7 +189,7 @@ public:
   char *long_name;
 
 public:
-  cl_prg_arg(char sn, char *ln, long long lv);
+  cl_prg_arg(char sn, char *ln, long lv);
   cl_prg_arg(char sn, char *ln, char *lv);
   cl_prg_arg(char sn, char *ln, double fv);
   cl_prg_arg(char sn, char *ln, void *pv);
index 3543b1b2d4ae8254c78727c1aa84fad1f93f20ab..17a1e1ac633f6a0549ac5bf26861fa02902e2fa2 100644 (file)
@@ -267,14 +267,14 @@ brk_coll::there_is_event(enum brk_event ev)
   return(DD_FALSE);
 }
 
-int
+/*int
 brk_coll::make_new_nr(void)
 {
   if (count == 0)
     return(1);
   class cl_brk *b= (class cl_brk *)(at(count-1));
   return(b->nr+1);
-}
+}*/
 
 void
 brk_coll::add_bp(class cl_brk *bp)
@@ -314,6 +314,20 @@ brk_coll::get_bp(t_addr addr, int *idx)
   return(0);
 }
 
+class cl_brk *
+brk_coll::get_bp(int nr)
+{
+  int i;
+
+  for (i= 0; i < count; i++)
+    {
+      class cl_brk *bp= (class cl_brk *)(at(i));
+      if (bp->nr == nr)
+       return(bp);
+    }
+  return(0);
+}
+
 bool
 brk_coll::bp_at(t_addr addr)
 {
index 9f8643076aab173d46bf5f2e52fb83af8b0c9b0c..59fe1a77c32b4ee5cb9287f27b19b74f4726bb0d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (brkcl.h)
+ * Simulator of microcontrollers (sim.src/brkcl.h)
  *
  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
  * 
@@ -25,8 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
-#ifndef BRKCL_HEADER
-#define BRKCL_HEADER
+#ifndef SIM_BRKCL_HEADER
+#define SIM_BRKCL_HEADER
 
 #include "ddconfig.h"
 
@@ -197,11 +197,12 @@ public:
   virtual int  compare(void *key1, void *key2);
 
   virtual bool there_is_event(enum brk_event ev);
-  virtual int make_new_nr(void);
+  //virtual int make_new_nr(void);
 
   virtual void add_bp(class cl_brk *bp);
   virtual void del_bp(t_addr addr);
   virtual class cl_brk *get_bp(t_addr addr, int *idx);
+  virtual class cl_brk *get_bp(int nr);
   virtual bool bp_at(t_addr addr);
 };
 
diff --git a/sim/ucsim/sim.src/guiobj.cc b/sim/ucsim/sim.src/guiobj.cc
new file mode 100644 (file)
index 0000000..6019bc2
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Simulator of microcontrollers (guiobj.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@*/
+
+#include "guiobjcl.h"
+
+
+cl_guiobj::cl_guiobj(void):
+  cl_base()
+{
+}
+
+
+/* End of gui.src/guiobj.cc */
diff --git a/sim/ucsim/sim.src/guiobjcl.h b/sim/ucsim/sim.src/guiobjcl.h
new file mode 100644 (file)
index 0000000..e01dbce
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Simulator of microcontrollers (sim.src/guiobjcl.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 SIM_GUIOBJCL_HEADER
+#define SIM_GUIOBJCL_HEADER
+
+#include "ddconfig.h"
+
+#include "pobjcl.h"
+
+
+class cl_guiobj: public cl_base
+{
+public:
+  cl_guiobj(void);
+};
+
+
+#endif
+
+/* End of sim.src/guiobjcl.h */
index ed7f8162304c457e9ce53091a5c03f3414fbbddb..210c807898670ed5a01dc79ad680354158979d50 100644 (file)
@@ -35,7 +35,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 
 cl_hw::cl_hw(class cl_uc *auc, enum hw_cath cath, int aid, char *aid_string):
-  cl_base()
+  cl_guiobj()
 {
   flags= HWF_INSIDE;
   uc= auc;
index 0efce2e6997200b653b5224fd32cc136c87385f4..297ffb98233db69d63bec7b6883fd3e1d47bd1d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (hwcl.h)
+ * Simulator of microcontrollers (sim.src/hwcl.h)
  *
  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
  * 
@@ -27,17 +27,18 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 /* Abstract hw element. It can be a timer, serial line or whatever */
 
-#ifndef HWCL_HEADER
-#define HWCL_HEADER
+#ifndef SIM_HWCL_HEADER
+#define SIM_HWCL_HEADER
 
 #include "stypes.h"
 #include "pobjcl.h"
 #include "uccl.h"
+#include "guiobjcl.h"
 
 #include "newcmdcl.h"
 
 
-class cl_hw: public cl_base
+class cl_hw: public cl_guiobj
 {
 public:
   int flags;
index 2e96279d0295069485ddc6582cb14bc5cae146e9..d585af9ac8d836908c11cbc1e816e6336d0d5082 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (itsrccl.h)
+ * Simulator of microcontrollers (sim.src/itsrccl.h)
  *
  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
  * 
@@ -25,8 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
-#ifndef ITSRCCL_HEADER
-#define ITSRCCL_HEADER
+#ifndef SIM_ITSRCCL_HEADER
+#define SIM_ITSRCCL_HEADER
 
 #include "pobjcl.h"
 #include "stypes.h"
index 06354edf654995417b42df0ca6c2602765f5ba81..5c9aa49f096bc4ce32a99233fae6a0aef9397c83 100644 (file)
@@ -46,7 +46,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  * Memory location handled specially by a hw element
  */
 
-cl_memloc::cl_memloc(long addr):
+cl_memloc::cl_memloc(t_addr addr):
   cl_base()
 {
   address= addr;
@@ -75,7 +75,7 @@ cl_memloc::read(class cl_mem *mem)
 }
 
 void
-cl_memloc::write(class cl_mem *mem, long addr, ulong *val)
+cl_memloc::write(class cl_mem *mem, t_addr addr, t_mem *val)
 {
   class cl_hw *hw;
   int i;
@@ -117,7 +117,7 @@ cl_memloc_coll::compare(void *key1, void *key2)
 }
 
 class cl_memloc *
-cl_memloc_coll::get_loc(long address)
+cl_memloc_coll::get_loc(t_addr address)
 {
   t_index i;
 
@@ -132,12 +132,14 @@ cl_memloc_coll::get_loc(long address)
  ******************************************************************************
  */
 
-cl_mem::cl_mem(enum mem_class atype, t_addr asize, int awidth):
-  cl_base()
+cl_mem::cl_mem(enum mem_class atype, char *aclass_name,
+              t_addr asize, int awidth):
+  cl_guiobj()
 {
   int i;
 
   type= atype;
+  class_name= aclass_name;
   width= awidth;
   size= asize;
   mem= 0;
@@ -152,12 +154,26 @@ cl_mem::cl_mem(enum mem_class atype, t_addr asize, int awidth):
   read_locs= new cl_memloc_coll();
   write_locs= new cl_memloc_coll();
   dump_finished= 0;
+  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));
 }
 
 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;
 }
@@ -180,7 +196,7 @@ cl_mem::id_string(void)
   return(s?s:(char*)"NONE");
 }
 
-ulong
+t_mem
 cl_mem::read(t_addr addr)
 {
   class cl_memloc *loc;
@@ -201,7 +217,7 @@ cl_mem::read(t_addr addr)
     return((((TYPE_UDWORD*)mem)[addr])&mask);
 }
 
-ulong
+t_mem
 cl_mem::get(t_addr addr)
 {
   if (addr >= size)
@@ -283,33 +299,54 @@ cl_mem::set_bit0(t_addr addr, t_mem bits)
     ((TYPE_UDWORD*)mem)[addr]&= ~bits;
 }
 
-void
+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;
 
-  if (start < 0)
-    {
-      start= dump_finished;
-      stop= start+stop;
-    }
   while ((start <= stop) &&
         (start < size))
     {
-      con->printf("%06x ", start);
-      for (i= 0; (i < bpl) &&
+      con->printf(addr_format, start); con->printf(" ");
+      for (i= 0;
+          (i < bpl) &&
             (start+i < size) &&
             (start+i <= stop);
           i++)
        {
-         char format[10];
-         sprintf(format, "%%0%dx ", width/4);
-         con->printf(format/*"%02x "*/, get(start+i));
+         con->printf(data_format, read(start+i)); con->printf(" ");
        }
       while (i < bpl)
        {
-         //FIXME
-         con->printf("   ");
+         int j;
+         j= width/4 + ((width%4)?1:0) + 1;
+         while (j)
+           {
+             con->printf(" ");
+             j--;
+           }
          i++;
        }
       for (i= 0; (i < bpl) &&
@@ -330,6 +367,57 @@ cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con)
       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));
+}
+
+bool
+cl_mem::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);
 }
 
 
@@ -337,7 +425,7 @@ cl_mem::dump(t_addr start, t_addr stop, int bpl, class cl_console *con)
  * Bitmap
  */
 
-cl_bitmap::cl_bitmap(long asize):
+cl_bitmap::cl_bitmap(t_addr asize):
   cl_base()
 {
   map= (uchar*)malloc(size= asize/(8*SIZEOF_CHAR));
@@ -350,7 +438,7 @@ cl_bitmap::~cl_bitmap(void)
 }
 
 void
-cl_bitmap::set(long pos)
+cl_bitmap::set(t_addr pos)
 {
   int i;
 
@@ -359,7 +447,7 @@ cl_bitmap::set(long pos)
 }
 
 void
-cl_bitmap::clear(long pos)
+cl_bitmap::clear(t_addr pos)
 {
   int i;
 
@@ -368,7 +456,7 @@ cl_bitmap::clear(long pos)
 }
 
 bool
-cl_bitmap::get(long pos)
+cl_bitmap::get(t_addr pos)
 {
   return(map[pos/(8*SIZEOF_CHAR)] & (1 << (pos & ((8*SIZEOF_CHAR)-1))));
 }
@@ -386,8 +474,8 @@ cl_bitmap::empty(void)
  * Special memory for code (ROM)
  */
 
-cl_rom::cl_rom(long asize, int awidth):
-  cl_mem(MEM_ROM, asize, awidth)
+cl_rom::cl_rom(t_addr asize, int awidth):
+  cl_mem(MEM_ROM, get_id_string(mem_classes, MEM_ROM), asize, awidth)
 {
   bp_map= new cl_bitmap(asize);
   inst_map= new cl_bitmap(asize);
index 4f3e84b5d26f5729be006c281605cdc6f6fce49c..3e0dcf7552d4239165f88317c27ad7b1b7dc1a43 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (memcl.h)
+ * Simulator of microcontrollers (sim.src/memcl.h)
  *
  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
  * 
@@ -25,12 +25,14 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
-#ifndef MEMCL_HEADER
-#define MEMCL_HEADER
+#ifndef SIM_MEMCL_HEADER
+#define SIM_MEMCL_HEADER
 
 #include "stypes.h"
 #include "pobjcl.h"
 
+#include "guiobjcl.h"
+
 
 class cl_mem;
 
@@ -39,15 +41,15 @@ class cl_mem;
 class cl_memloc: public cl_base
 {
 public:
-  long address;
+  t_addr address;
   class cl_list *hws;
 
 public:
-  cl_memloc(long addr);
+  cl_memloc(t_addr addr);
   ~cl_memloc(void);
 
   virtual ulong read(class cl_mem *mem);
-  virtual void write(class cl_mem *mem, long addr, ulong *val);
+  virtual void write(class cl_mem *mem, t_addr addr, t_mem *val);
 };
 
 class cl_memloc_coll: public cl_sorted_list
@@ -58,16 +60,18 @@ public:
   virtual void *key_of(void *item);
   virtual int compare(void *key1, void *key2);
 
-  class cl_memloc *get_loc(long address);
+  class cl_memloc *get_loc(t_addr address);
 };
 
 
 /* Memory */
 
-class cl_mem: public cl_base
+class cl_mem: public cl_guiobj
 {
 public:
   enum mem_class type;
+  char *class_name;
+  char *addr_format, *data_format;
   t_addr size;
   ulong mask;
   int width; // in bits
@@ -76,21 +80,26 @@ public:
     uchar *umem8;
   };
   class cl_memloc_coll *read_locs, *write_locs;
-  int dump_finished;
+  t_addr dump_finished;
 
 public:
-  cl_mem(enum mem_class atype, t_addr asize, int awidth);
+  cl_mem(enum mem_class atype, char *aclass_name, t_addr asize, int awidth);
   ~cl_mem(void);
   virtual int init(void);
   virtual char *id_string(void);
 
-  virtual ulong read(t_addr addr);
-  virtual ulong get(t_addr addr);
+  virtual t_mem read(t_addr addr);
+  virtual t_mem get(t_addr addr);
   virtual void 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 dump(t_addr start, t_addr stop, int bpl, class cl_console *con);
+  virtual t_mem add(t_addr addr, long 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);
 };
 
 /* Spec for CODE */
@@ -101,11 +110,11 @@ public:
   uchar *map;
   int size;
 public:
-  cl_bitmap(long asize);
+  cl_bitmap(t_addr asize);
   ~cl_bitmap(void);
-  virtual void set(long pos);
-  virtual void clear(long pos);
-  virtual bool get(long pos);
+  virtual void set(t_addr pos);
+  virtual void clear(t_addr pos);
+  virtual bool get(t_addr pos);
   virtual bool empty(void);
 };
 
@@ -115,7 +124,7 @@ public:
   class cl_bitmap *bp_map;
   class cl_bitmap *inst_map;
 public:
-  cl_rom(long asize, int awidth);
+  cl_rom(t_addr asize, int awidth);
   ~cl_rom(void);
 };
 
index 5345d322db5e02638cffb6789e21439467692645..bdbe15c478a52e3f113679cf00f8cc7ebe4fde57 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (optioncl.h)
+ * Simulator of microcontrollers (sim.src/optioncl.h)
  *
  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
  * 
@@ -25,8 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
-#ifndef OPTIONCL_HEADER
-#define OPTIONCL_HEADER
+#ifndef SIM_OPTIONCL_HEADER
+#define SIM_OPTIONCL_HEADER
 
 #include "ddconfig.h"
 
index 836e4d420d524c21b251b025bcc792ee5e821dc4..b80e8cae7f4038a24232819a74c445c9d2087b66 100644 (file)
@@ -43,6 +43,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 // cmd
 #include "cmdsetcl.h"
 #include "infocl.h"
+#include "setcl.h"
+#include "getcl.h"
+#include "showcl.h"
+#include "bpcl.h"
+#include "cmdguicl.h"
+#include "cmdconfcl.h"
 
 // local
 #include "simcl.h"
@@ -61,6 +67,7 @@ cl_sim::cl_sim(char *more_args, int iargc, char *iargv[]):
   arguments= new cl_list(2, 2);
   accept_args= more_args?strdup(more_args):0;
   in_files= new cl_ustrings(2, 2);
+  gui= new cl_gui(this);
 }
 
 int
@@ -70,14 +77,20 @@ cl_sim::init(void)
 
   cl_base::init();
   proc_arguments(argc, argv);
-  cmdset= mk_cmdset();
+  class cl_cmdset *cmdset= new cl_cmdset(this);
   cmdset->init();
-  build_cmd_set();
+  build_cmd_set(cmdset);
   if (!(uc= mk_controller()))
     return(1);
   uc->init();
-  cmd= mk_commander();
+  cmd= new cl_commander(cmdset, this);
   cmd->init();
+  char *Config= get_sarg(0, "Config");
+  if (Config)
+    {
+      class cl_console *con= cmd->mk_console(Config, 0/*"/dev/tty"*/, this);
+      cmd->add_console(con);
+    }
   if (cmd->cons->get_count() == 0)
     {
       fprintf(stderr, "No command console available.\n");
@@ -114,7 +127,7 @@ cl_sim::proc_arguments(int argc, char *argv[])
   char *opts, *cp;
 
   opts= (char*)malloc((accept_args?strlen(accept_args):0)+100);
-  strcpy(opts, "c:p:PX:vV");
+  strcpy(opts, "c:C:p:PX:vV");
 #ifdef SOCKET_AVAIL
   strcat(opts, "Z:r:");
 #endif
@@ -129,15 +142,19 @@ cl_sim::proc_arguments(int argc, char *argv[])
        arguments->add(new cl_prg_arg('c', 0, optarg));
        break;
 
+      case 'C':
+       arguments->add(new cl_prg_arg(0, "Config", optarg));
+       break;
+
 #ifdef SOCKET_AVAIL
       case 'Z':
        // By Sandeep
-       arguments->add(new cl_prg_arg('Z', 0, (long long)1));
+       arguments->add(new cl_prg_arg('Z', 0, (long)1));
        if (!optarg || !isdigit(*optarg))
          fprintf(stderr, "expected portnumber to follow -Z\n");
        else {
          char *p;
-         long long l= strtol(optarg, &p, 0);
+         long l= strtol(optarg, &p, 0);
          arguments->add(new cl_prg_arg(0, "Zport", l));
        }
        break;
@@ -148,13 +165,13 @@ cl_sim::proc_arguments(int argc, char *argv[])
        break;
 
       case 'P':
-       arguments->add(new cl_prg_arg('P', 0, (long long)1));
+       arguments->add(new cl_prg_arg('P', 0, (long)1));
        break;
 
 #ifdef SOCKET_AVAIL
       case 'r':
        arguments->add(new cl_prg_arg('r', 0,
-                                     (long long)strtol(optarg, NULL, 0)));
+                                     (long)strtol(optarg, NULL, 0)));
        break;
 #endif
 
@@ -182,7 +199,7 @@ cl_sim::proc_arguments(int argc, char *argv[])
         break;
 
       case 'V':
-       arguments->add(new cl_prg_arg('V', 0, (long long)1));
+       arguments->add(new cl_prg_arg('V', 0, (long)1));
        break;
 
       case '?':
@@ -252,7 +269,14 @@ cl_sim::get_iarg(char sname, char *lname)
       a= (class cl_prg_arg *)(arguments->at(i));
       if ((sname && a->short_name == sname) ||
          (lname && a->long_name && strcmp(a->long_name, lname) == 0))
-       return(a->get_ivalue());
+       {
+         long iv;
+         if (a->get_ivalue(&iv))
+           return(iv);
+         else
+           //FIXME
+           return(0);
+       }
     }
   return(0);
 }
@@ -306,29 +330,16 @@ cl_sim::get_parg(char sname, char *lname)
   return(0);
 }
 
-class cl_commander *
-cl_sim::mk_commander()
-{
-  class cl_commander *cmd= new cl_commander(this);
-  return(cmd);
-}
-
 class cl_uc *
 cl_sim::mk_controller(void)
 {
   return(new cl_uc(this));
 }
 
-class cl_cmdset *
-cl_sim::mk_cmdset(void)
-{
-  return(new cl_cmdset(this));
-}
-
 class cl_cmd_arg *
 cl_sim::mk_cmd_int_arg(long long i)
 {
-  class cl_cmd_arg *arg= new cl_cmd_int_arg(i);
+  class cl_cmd_arg *arg= new cl_cmd_int_arg(uc, i);
   arg->init();
   return(arg);
 }
@@ -336,7 +347,7 @@ cl_sim::mk_cmd_int_arg(long long i)
 class cl_cmd_arg *
 cl_sim::mk_cmd_sym_arg(char *s)
 {
-  class cl_cmd_arg *arg= new cl_cmd_sym_arg(s);
+  class cl_cmd_arg *arg= new cl_cmd_sym_arg(uc, s);
   arg->init();
   return(arg);
 }
@@ -344,7 +355,7 @@ cl_sim::mk_cmd_sym_arg(char *s)
 class cl_cmd_arg *
 cl_sim::mk_cmd_str_arg(char *s)
 {
-  class cl_cmd_arg *arg= new cl_cmd_str_arg(s);
+  class cl_cmd_arg *arg= new cl_cmd_str_arg(uc, s);
   arg->init();
   return(arg);
 }
@@ -352,7 +363,15 @@ cl_sim::mk_cmd_str_arg(char *s)
 class cl_cmd_arg *
 cl_sim::mk_cmd_bit_arg(class cl_cmd_arg *sfr, class cl_cmd_arg *bit)
 {
-  class cl_cmd_arg *arg= new cl_cmd_bit_arg(sfr, bit);
+  class cl_cmd_arg *arg= new cl_cmd_bit_arg(uc, sfr, bit);
+  arg->init();
+  return(arg);
+}
+
+class cl_cmd_arg *
+cl_sim::mk_cmd_array_arg(class cl_cmd_arg *aname, class cl_cmd_arg *aindex)
+{
+  class cl_cmd_arg *arg= new cl_cmd_array_arg(uc, aname, aindex);
   arg->init();
   return(arg);
 }
@@ -374,7 +393,9 @@ cl_sim::main(void)
        {
          uc->do_inst(-1);
          if (cmd->input_avail())
-           done= cmd->proc_input();
+           {
+             done= cmd->proc_input();
+           }
        }
       else
        {
@@ -385,25 +406,23 @@ cl_sim::main(void)
   return(0);
 }
 
-int
+/*int
 cl_sim::do_cmd(char *cmdstr, class cl_console *console)
 {
   class cl_cmdline *cmdline;
-  class cl_cmd *cmd;
+  class cl_cmd *cm;
   int retval= 0;
 
-  cmdline= new cl_cmdline(cmdstr);
+  cmdline= new cl_cmdline(cmdstr, console);
   cmdline->init();
-  if (console->old_command(cmdline))
-    return(console->interpret(cmdstr));
-  cmd= cmdset->get_cmd(cmdline);
-  if (cmd)
-    retval= cmd->work(cmdline, console);
+  cm= cmd->cmdset->get_cmd(cmdline);
+  if (cm)
+    retval= cm->work(cmdline, console);
   delete cmdline;
-  if (cmd)
+  if (cm)
     return(retval);
   return(console->interpret(cmdstr));
-}
+}*/
 
 void
 cl_sim::start(class cl_console *con)
@@ -411,6 +430,7 @@ cl_sim::start(class cl_console *con)
   state|= SIM_GO;
   con->flags|= CONS_FROZEN;
   cmd->frozen_console= con;
+  cmd->set_fd_set();
 }
 
 void
@@ -460,103 +480,125 @@ cl_sim::stop(int reason)
       cmd->frozen_console->print_prompt();
       cmd->frozen_console= 0;
     }
+  cmd->set_fd_set();
 }
 
 
-/*
- * Obsolete methods for old commander
- */
-
-/*FILE *
-cl_sim::cmd_in(void)
-{
-  if (!cmd ||
-      cmd->cons->get_count() == 0)
-    return(stdin);
-  if (cmd->actual_console)
-    return(cmd->actual_console->in?cmd->actual_console->in:stdin);
-  class cl_console *con= (class cl_console *)(cmd->cons->at(0));
-  return(con->in?con->in:stdin);
-}*/
-
-/*FILE *
-cl_sim::cmd_out(void)
-{
-  if (!cmd ||
-      cmd->cons->get_count() == 0)
-    return(stdout);
-  if (cmd->actual_console)
-    return(cmd->actual_console->out?cmd->actual_console->out:stdout);
-  class cl_console *con= (class cl_console *)(cmd->cons->at(0));
-  return(con->out?con->out:stdout);
-}*/
-
-
 /*
  */
 
 void
-cl_sim::build_cmd_set(void)
+cl_sim::build_cmd_set(class cl_cmdset *cmdset)
 {
   class cl_cmd *cmd;
   class cl_cmdset *cset;
 
-  cmdset->add(cmd= new cl_conf_cmd(this, "conf", 0,
+  {
+    cset= new cl_cmdset(this);
+    cset->init();
+    cset->add(cmd= new cl_conf_cmd("_no_parameters_", 0,
 "conf               Configuration",
 "long help of conf"));
+    cmd->init();
+    cset->add(cmd= new cl_conf_addmem_cmd("addmem", 0,
+"conf addmem\n"
+"                   Make memory",
+"long help of conf addmem"));
+    cmd->init();
+  }
+  cmdset->add(cmd= new cl_super_cmd("conf", 0,
+"conf subcommand    Information, see `conf' command for more help",
+"long help of conf", cset));
   cmd->init();
 
-  cmdset->add(cmd= new cl_state_cmd(this, "state", 0,
+  cmdset->add(cmd= new cl_state_cmd("state", 0,
 "state              State of simulator",
 "long help of state"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_file_cmd(this, "file", 0,
+  cmdset->add(cmd= new cl_file_cmd("file", 0,
 "file \"FILE\"        Load FILE into ROM",
 "long help of file"));
   cmd->init();
   cmd->add_name("load");
 
-  cmdset->add(cmd= new cl_dl_cmd(this, "download", 0,
+  cmdset->add(cmd= new cl_dl_cmd("download", 0,
 "download,dl          Load (intel.hex) data",
 "long help of download"));
   cmd->init();
   cmd->add_name("dl");
 
-  cset= new cl_cmdset(this);
-  cset->init();
-  cset->add(cmd= new cl_info_bp_cmd(this, "breakpoints", 0, 
+  {
+    cset= new cl_cmdset(this);
+    cset->init();
+    cset->add(cmd= new cl_info_bp_cmd("breakpoints", 0, 
 "info breakpoints   Status of user-settable breakpoints",
 "long help of info breakpoints"));
-  cmd->add_name("bp");
-  cmd->init();
-  cset->add(cmd= new cl_info_reg_cmd(this, "registers", 0, 
+    cmd->add_name("bp");
+    cmd->init();
+    cset->add(cmd= new cl_info_reg_cmd("registers", 0, 
 "info registers     List of integer registers and their contents",
 "long help of info registers"));
-  cmd->init();
-  cset->add(cmd= new cl_info_hw_cmd(this, "hardware", 0, 
+    cmd->init();
+    cset->add(cmd= new cl_info_hw_cmd("hardware", 0, 
 "info hardware cathegory\n"
 "                   Status of hardware elements of the CPU",
 "long help of info hardware"));
-  cmd->add_name("hw");
-  cmd->init();
-
-  cmdset->add(cmd= new cl_super_cmd(this, "info", 0,
+    cmd->add_name("h   w");
+    cmd->init();
+  }
+  cmdset->add(cmd= new cl_super_cmd("info", 0,
 "info subcommand    Information, see `info' command for more help",
 "long help of info", cset));
   cmd->init();
 
-  cmdset->add(cmd= new cl_get_cmd(this, "get", 0,
-"get                Get",
-"long help of get"));
+  {
+    cset= new cl_cmdset(this);
+    cset->init();
+    cset->add(cmd= new cl_get_sfr_cmd("sfr", 0,
+"get sfr address...\n"
+"                   Get value of addressed SFRs",
+"long help of get sfr"));
+    cmd->init();
+    cset->add(cmd= new cl_get_option_cmd("option", 0,
+"get option name\n"
+"                   Get value of an option",
+"long help of get option"));
+    cmd->init();
+  }
+  cmdset->add(cmd= new cl_super_cmd("get", 0,
+"get subcommand     Get, see `get' command for more help",
+"long help of get", cset));
   cmd->init();
 
-  cmdset->add(cmd= new cl_set_cmd(this, "set", 0,
-"set                Set",
-"long help of set"));
+  {
+    cset= new cl_cmdset(this);
+    cset->init();
+    cset->add(cmd= new cl_set_mem_cmd("memory", 0,
+"set memory memory_type address data...\n"
+"                   Place list of data into memory",
+"long help of set memory"));
+    cmd->init();
+    cset->add(cmd= new cl_set_bit_cmd("bit", 0,
+"set bit addr 0|1   Set specified bit to 0 or 1",
+"long help of set bit"));
+    cmd->init();
+    cset->add(cmd= new cl_set_port_cmd("port", 0,
+"set port hw data   Set data connected to port",
+"long help of set port"));
+    cmd->init();
+    cset->add(cmd= new cl_set_option_cmd("option", 0,
+"set option name value\n"
+"                   Set value of an option",
+"long help of set option"));
+    cmd->init();
+  }
+  cmdset->add(cmd= new cl_super_cmd("set", 0,
+"set subcommand     Set, see `set' command for more help",
+"long help of set", cset));
   cmd->init();
 
-  cmdset->add(cmd= new cl_timer_cmd(this, "timer", 0,
+  cmdset->add(cmd= new cl_timer_cmd("timer", 0,
 "timer a|d|g|r|s|v id [direction|value]\n"
 "                   Timer add|del|get|run|stop|value",
 "timer add|create|make id [direction] -- create a new timer\n"
@@ -567,84 +609,169 @@ cl_sim::build_cmd_set(void)
 "timer value id val -- set value of a timer to `val'"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_run_cmd(this, "run", 0,
-"run                Go",
+  cmdset->add(cmd= new cl_run_cmd("run", 0,
+"run [start [stop]] Go",
 "long help of run"));
   cmd->init();
-  //cmd->add_name("g");
+  cmd->add_name("go");
+  cmd->add_name("r");
 
-  cmdset->add(cmd= new cl_step_cmd(this, "step", 0,
+  cmdset->add(cmd= new cl_stop_cmd("stop", 0,
+"stop               Stop",
+"long help of stop"));
+  cmd->init();
+
+  cmdset->add(cmd= new cl_step_cmd("step", 0,
 "step               Step",
 "long help of step"));
   cmd->init();
   cmd->add_name("s");
 
-  cmdset->add(cmd= new cl_reset_cmd(this, "reset", 0,
+  cmdset->add(cmd= new cl_next_cmd("next", 0,
+"next               Next",
+"long help of next"));
+  cmd->init();
+  cmd->add_name("n");
+
+  cmdset->add(cmd= new cl_pc_cmd("pc", 0,
+"pc [addr]          Set/get PC",
+"long help of pc"));
+  cmd->init();
+
+  cmdset->add(cmd= new cl_reset_cmd("reset", 0,
 "reset              Reset",
 "long help of reset"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_dump_cmd(this, "dump", 0,
-"dump i|x|r|s [start [stop]]\n"
-"                   Dump memory",
+  cmdset->add(cmd= new cl_dump_cmd("dump", 0,
+"dump memory_type [start [stop [bytes_per_line]]]\n"
+"                   Dump memory of specified type\n"
+"dump bit...        Dump bits",
 "long help of dump"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_di_cmd(this, "di", 0,
+  cmdset->add(cmd= new cl_di_cmd("di", 0,
 "di [start [stop]]  Dump Internal RAM",
 "long help of di"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_dx_cmd(this, "dx", 0,
+  cmdset->add(cmd= new cl_dx_cmd("dx", 0,
 "dx [start [stop]]  Dump External RAM",
 "long help of dx"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_ds_cmd(this, "ds", 0,
+  cmdset->add(cmd= new cl_ds_cmd("ds", 0,
 "ds [start [stop]]  Dump SFR",
 "long help of ds"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_dch_cmd(this, "dch", 0,
+  cmdset->add(cmd= new cl_dch_cmd("dch", 0,
 "dch [start [stop]] Dump code in hex form",
 "long help of dch"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_dc_cmd(this, "dc", 0,
+  cmdset->add(cmd= new cl_dc_cmd("dc", 0,
 "dc [start [stop]]  Dump code in disass form",
 "long help of dc"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_break_cmd(this, "break", 0,
-"break addr [hit]   Set fix breakpoint",
+  cmdset->add(cmd= new cl_disassemble_cmd("disassemble", 0,
+"disassemble [start [offset [lines]]]\n"
+"                   Disassemble code",
+"long help of disassemble"));
+  cmd->init();
+
+  cmdset->add(cmd= new cl_fill_cmd("fill", 0,
+"fill memory_type start end data\n"
+"                   Fill memory region with data",
+"long help of fill"));
+  cmd->init();
+
+  cmdset->add(cmd= new cl_where_cmd("where", 0,
+"where memory_type data...\n"
+"                   Case unsensitive search for data",
+"long help of where"));
+  cmd->init();
+
+  cmdset->add(cmd= new cl_Where_cmd("Where", 0,
+"Where memory_type data...\n"
+"                   Case sensitive search for data",
+"long help of Where"));
+  cmd->init();
+
+  cmdset->add(cmd= new cl_break_cmd("break", 0,
+"break addr [hit]   Set fix breakpoint\n"
+"break mem_type r|w addr [hit]\n"
+"                   Set fix event breakpoint",
 "long help of break"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_tbreak_cmd(this, "tbreak", 0,
-"tbreak addr [hit]  Set temporary breakpoint",
+  cmdset->add(cmd= new cl_tbreak_cmd("tbreak", 0,
+"tbreak addr [hit]  Set temporary breakpoint\n"
+"tbreak mem_type r|w addr [hit]\n"
+"                   Set temporary event breakpoint",
 "long help of tbreak"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_clear_cmd(this, "clear", 0,
+  cmdset->add(cmd= new cl_clear_cmd("clear", 0,
 "clear [addr...]    Clear fix breakpoint",
 "long help of clear"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_help_cmd(this, "help", 0,
-"help               Help",
+  cmdset->add(cmd= new cl_delete_cmd("delete", 0,
+"delete [nr...]     Delete breakpoint(s)",
+"long help of clear"));
+  cmd->init();
+
+  cmdset->add(cmd= new cl_help_cmd("help", 0,
+"help [command]     Help about command(s)",
 "long help of help"));
   cmd->init();
   cmd->add_name("?");
 
-  cmdset->add(cmd= new cl_quit_cmd(this, "quit", 0,
+  cmdset->add(cmd= new cl_quit_cmd("quit", 0,
 "quit               Quit",
 "long help of quit"));
   cmd->init();
 
-  cmdset->add(cmd= new cl_kill_cmd(this, "kill", 0,
+  cmdset->add(cmd= new cl_kill_cmd("kill", 0,
 "kill               Shutdown simulator",
 "long help of kill"));
   cmd->init();
+
+  {
+    cset= new cl_cmdset(this);
+    cset->init();
+    cset->add(cmd= new cl_show_copying_cmd("copying", 0, 
+"show copying       Conditions for redistributing copies of uCsim",
+"long help of show copying"));
+    cmd->init();
+    cset->add(cmd= new cl_show_warranty_cmd("warranty", 0, 
+"show warranty      Various kinds of warranty you do not have",
+"long help of show warranty"));
+    cmd->init();
+  }
+  cmdset->add(cmd= new cl_super_cmd("show", 0,
+"show subcommand    Generic command for showing things about the uCsim",
+"long help of show", cset));
+  cmd->init();
+
+  {
+    cset= new cl_cmdset(this);
+    cset->init();
+    cset->add(cmd= new cl_gui_start_cmd("start", 0, 
+"gui start          Start interfacing with GUI tool",
+"long help of gui start"));
+    cmd->init();
+    cset->add(cmd= new cl_gui_stop_cmd("stop", 0, 
+"gui stop           Stop interfacing with GUI tool",
+"long help of gui stop"));
+    cmd->init();
+  }
+  cmdset->add(cmd= new cl_super_cmd("gui", 0,
+"gui subcommand     Operations to support GUI tools",
+"long help of gui", cset));
+  cmd->init();
 }
 
 
index 21a83a3db62194ae775aea367070722e2834de31..f4fbec207d44121c535c0adb6ca953f060933ed0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (simcl.h)
+ * Simulator of microcontrollers (sim.src/simcl.h)
  *
  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
  * 
@@ -25,8 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
-#ifndef SIMCL_HEADER
-#define SIMCL_HEADER
+#ifndef SIM_SIMCL_HEADER
+#define SIM_SIMCL_HEADER
 
 #include <stdio.h>
 
@@ -36,6 +36,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 // cmd
 #include "newcmdcl.h"
 
+// gui
+#include "guicl.h"
+
 // local
 #include "uccl.h"
 #include "argcl.h"
@@ -49,8 +52,7 @@ public:
 
   class cl_commander *cmd;
   class cl_uc *uc;
-  class cl_cmdset *cmdset;
-  //class cl_console *frozen_console;
+  class cl_gui *gui;
 
   char *accept_args;
   class cl_ustrings *in_files;
@@ -58,22 +60,21 @@ public:
   
 public:
   cl_sim(char *more_args, int iargc, char *iargv[]);
-  //cl_sim(class cl_uc *auc);
   ~cl_sim(void);
   virtual int init(void);
   
   virtual int proc_arguments(int argc, char *argv[]);
   virtual int proc_arg(char arg, char *optarg);
 
-  virtual class cl_commander *mk_commander(void);
   virtual class cl_uc *mk_controller(void);
-  virtual class cl_cmdset *mk_cmdset(void);
-  virtual void build_cmd_set(void);
+  virtual void build_cmd_set(class cl_cmdset *cmdset);
   virtual class cl_cmd_arg *mk_cmd_int_arg(long long i);
   virtual class cl_cmd_arg *mk_cmd_sym_arg(char *s);
   virtual class cl_cmd_arg *mk_cmd_str_arg(char *s);
   virtual class cl_cmd_arg *mk_cmd_bit_arg(class cl_cmd_arg *sfr,
                                           class cl_cmd_arg *bit);
+  virtual class cl_cmd_arg *mk_cmd_array_arg(class cl_cmd_arg *aname,
+                                            class cl_cmd_arg *aindex);
 
   int arg_avail(char name);
   int arg_avail(char *name);
@@ -83,14 +84,8 @@ public:
   virtual void *get_parg(char sname, char *lname);
 
   virtual int main(void);
-  virtual int do_cmd(char *cmd, class cl_console *console);
   virtual void start(class cl_console *con);
   virtual void stop(int reason);
-
-  // Obsolete, for old commander
-  //public:
-  //FILE *cmd_out(void);
-  //FILE *cmd_in(void);
 };
 
 
index e8f4658226c17a085c8bc24cd1ec81407d403ac7..98747ff4180919bf4bca9c8072bf1fb2163d7269 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (stackcl.h)
+ * Simulator of microcontrollers (sim.src/stackcl.h)
  *
  * Copyright (C) 2000,00 Drotos Daniel, Talker Bt.
  * 
@@ -25,8 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
-#ifndef STACKCL_HEADER
-#define STACKCL_HEADER
+#ifndef SIM_STACKCL_HEADER
+#define SIM_STACKCL_HEADER
 
 #include "stypes.h"
 #include "pobjcl.h"
index 026648b0b50088e26106200c6add1570d3af8a1f..7d7e74238fa604ce4dc7c82c75601eb1edef4a9d 100644 (file)
@@ -30,8 +30,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <ctype.h>
 #include "i_string.h"
 
+#include "globals.h"
+#include "utils.h"
+
 #include "uccl.h"
 #include "hwcl.h"
 #include "memcl.h"
@@ -146,12 +150,14 @@ cl_uc::init(void)
     xtal= sim->get_farg('X', 0);
   for (mc= MEM_ROM; mc < MEM_TYPES; mc++)
     {
-      class cl_mem *m= mk_mem((enum mem_class)mc);
+      class cl_mem *m= mk_mem((enum mem_class)mc,
+                             get_id_string(mem_classes, mc));
       mems->put_at(mc, m);
     }
   ebrk= new brk_coll(2, 2, (class cl_rom *)mem(MEM_ROM));
   fbrk= new brk_coll(2, 2, (class cl_rom *)mem(MEM_ROM));
   fbrk->Duplicates= DD_FALSE;
+  brk_counter= 0;
   mk_hw_elements();
   reset();
   return(0);
@@ -191,7 +197,7 @@ cl_uc::reset(void)
  */
 
 class cl_mem *
-cl_uc::mk_mem(enum mem_class type)
+cl_uc::mk_mem(enum mem_class type, char *class_name)
 {
   class cl_mem *m;
 
@@ -200,7 +206,8 @@ cl_uc::mk_mem(enum mem_class type)
   if (type == MEM_ROM)
     m= new cl_rom(get_mem_size(type), get_mem_width(type));
   else
-    m= new cl_mem(type, get_mem_size(type), get_mem_width(type));
+    m= new cl_mem(type, get_id_string(mem_classes, type),
+                 get_mem_size(type), get_mem_width(type));
   m->init();
   return(m);
 }
@@ -237,7 +244,7 @@ cl_uc::mk_hw_elements(void)
  */
 
 ulong
-cl_uc::read_mem(enum mem_class type, long addr)
+cl_uc::read_mem(enum mem_class type, t_mem addr)
 {
   class cl_mem *m;
 
@@ -249,7 +256,7 @@ fprintf(stderr, "cl_uc::read_mem(type= %d, 0x%06lx) TROUBLE\n", type, addr);
 }
 
 ulong
-cl_uc::get_mem(enum mem_class type, long addr)
+cl_uc::get_mem(enum mem_class type, t_addr addr)
 {
   class cl_mem *m;
 
@@ -261,7 +268,7 @@ printf("cl_uc::get_mem(type= %d, 0x%06lx) TROUBLE\n", type, addr);
 }
 
 void
-cl_uc::write_mem(enum mem_class type, long addr, ulong val)
+cl_uc::write_mem(enum mem_class type, t_addr addr, t_mem val)
 {
   class cl_mem *m;
 
@@ -275,7 +282,7 @@ else printf("cl_uc::write_mem(type= %d, 0x%06lx, 0x%lx) TROUBLE\n", type, addr,
 }
 
 void
-cl_uc::set_mem(enum mem_class type, long addr, ulong val)
+cl_uc::set_mem(enum mem_class type, t_addr addr, t_mem val)
 {
   class cl_mem *m;
 
@@ -295,7 +302,50 @@ cl_uc::mem(enum mem_class type)
   return((class cl_mem *)(mems->at(type)));
 }
 
-TYPE_UBYTE *
+class cl_mem *
+cl_uc::mem(char *class_name)
+{
+  int i, found= 0;
+  char *mcn, *n, *s;
+
+  if (!class_name)
+    return(0);
+  s= n= strdup(class_name);
+  while (*s)
+    {
+      *s= toupper(*s);
+      s++;
+    }
+  if (!class_name ||
+      !(*class_name))
+    return(0);
+  for (i= 0; !found && i < mems->count; i++)
+    {
+      cl_mem *m= (cl_mem *)(mems->at(i));
+      if (!m ||
+         !m->class_name ||
+         !(*(m->class_name)))
+       continue;
+      s= mcn= strdup(m->class_name);
+      while (*s)
+       {
+         *s= toupper(*s);
+         s++;
+       }
+      if (strstr(/*m->class_name*/mcn,/*class_name*/n) == /*m->class_name*/mcn)
+       found= 1;
+      free(mcn);
+      if (found)
+       {
+         free(n);
+         return(m);
+       }
+    }
+  free(n);
+  return(0);
+}
+
+/*TYPE_UBYTE *
 cl_uc::MEM(enum mem_class type)
 {
   class cl_mem *m;
@@ -304,8 +354,8 @@ cl_uc::MEM(enum mem_class type)
     //FIXME
 {printf("TROUBLE\n");    return(0);
 }
-  return((uchar *)(m->mem));
-}
+  return((TYPE_UBYTE *)(m->mem));
+}*/
 
 
 /* Local function for `read_hex_file' method to read some bytes */
@@ -465,7 +515,7 @@ cl_uc::read_hex_file(const char *name)
  */
 
 bool
-cl_uc::inst_at(uint addr)
+cl_uc::inst_at(t_addr addr)
 {
   class cl_rom *rom= (class cl_rom *)mem(MEM_ROM);
   
@@ -475,7 +525,7 @@ cl_uc::inst_at(uint addr)
 }
 
 void
-cl_uc::set_inst_at(uint addr)
+cl_uc::set_inst_at(t_addr addr)
 {
   class cl_rom *rom= (class cl_rom *)mem(MEM_ROM);
   
@@ -484,7 +534,7 @@ cl_uc::set_inst_at(uint addr)
 }
 
 void
-cl_uc::del_inst_at(uint addr)
+cl_uc::del_inst_at(t_addr addr)
 {
   class cl_rom *rom= (class cl_rom *)mem(MEM_ROM);
   
@@ -511,7 +561,7 @@ cl_uc::there_is_inst(void)
 /* Register callback hw objects for mem read/write */
 
 void
-cl_uc::register_hw_read(enum mem_class type, long addr, class cl_hw *hw)
+cl_uc::register_hw_read(enum mem_class type, t_addr addr, class cl_hw *hw)
 {
   class cl_mem *m;
   class cl_memloc *l;
@@ -531,7 +581,7 @@ cl_uc::register_hw_read(enum mem_class type, long addr, class cl_hw *hw)
 }
 
 void
-cl_uc::register_hw_write(enum mem_class type, long addr, class cl_hw *hw)
+cl_uc::register_hw_write(enum mem_class type, t_addr addr, class cl_hw *hw)
 {
 }
 
@@ -558,6 +608,27 @@ cl_uc::get_hw(enum hw_cath cath, int *idx)
   return(hw);
 }
 
+class cl_hw *
+cl_uc::get_hw(char *id_string, int *idx)
+{
+  class cl_hw *hw= 0;
+  int i= 0;
+
+  if (idx)
+    i= *idx;
+  for (; i < hws->count; i++)
+    {
+      hw= (class cl_hw *)(hws->at(i));
+      if (strstr(hw->id_string, id_string) == hw->id_string)
+       break;
+    }
+  if (i >= hws->count)
+    return(0);
+  if (idx)
+    *idx= i;
+  return(hw);
+}
+
 class cl_hw *
 cl_uc::get_hw(enum hw_cath cath, int hwid, int *idx)
 {
@@ -579,6 +650,27 @@ cl_uc::get_hw(enum hw_cath cath, int hwid, int *idx)
   return(hw);
 }
 
+class cl_hw *
+cl_uc::get_hw(char *id_string, int hwid, int *idx)
+{
+  class cl_hw *hw;
+  int i= 0;
+
+  if (idx)
+    i= *idx;
+  hw= get_hw(id_string, &i);
+  while (hw &&
+        hw->id != hwid)
+    {
+      i++;
+      hw= get_hw(id_string, &i);
+    }
+  if (hw && 
+      idx)
+    *idx= i;
+  return(hw);
+}
+
 
 /*
  * Help of the command interpreter
@@ -606,7 +698,7 @@ cl_uc::bit_tbl(void)
 }
 
 char *
-cl_uc::disass(uint addr, char *sep)
+cl_uc::disass(t_addr addr, char *sep)
 {
   char *buf;
 
@@ -616,9 +708,41 @@ cl_uc::disass(uint addr, char *sep)
 }
 
 void
-cl_uc::print_disass(uint addr, class cl_console *con)
+cl_uc::print_disass(t_addr addr, class cl_console *con)
 {
-  con->printf("uc::print_disass unimplemented\n");
+  char *dis;
+  class cl_brk *b;
+  int i;
+  class cl_mem *rom= mem(MEM_ROM);
+  t_mem code= get_mem(MEM_ROM, addr);
+
+  if (!rom)
+    return;
+  b= fbrk_at(addr);
+  dis= disass(addr, NULL);
+  if (b)
+    con->printf("%c", (b->perm == brkFIX)?'F':'D');
+  else
+    con->printf(" ");
+  con->printf("%c ", inst_at(addr)?' ':'?');
+  con->printf(rom->addr_format, addr); con->printf(" ");
+  con->printf(rom->data_format, code);
+  for (i= 1; i < inst_length(code); i++)
+    {
+      con->printf(" ");
+      con->printf(rom->data_format, get_mem(MEM_ROM, addr+i));
+    }
+  int li= longest_inst();
+  while (i < li)
+    {
+      int j;
+      j= rom->width/4 + ((rom->width%4)?1:0) + 1;
+      while (j)
+       con->printf(" "), j--;
+      i++;
+    }
+  con->printf(" %s\n", dis);
+  free(dis);
 }
 
 void
@@ -628,7 +752,7 @@ cl_uc::print_regs(class cl_console *con)
 }
 
 int
-cl_uc::inst_length(uint code)
+cl_uc::inst_length(t_mem code)
 {
   struct dis_entry *tabl= dis_tbl();
   int i;
@@ -637,8 +761,24 @@ cl_uc::inst_length(uint code)
   return(tabl[i].mnemonic?tabl[i].length:1);    
 }
 
+int
+cl_uc::longest_inst(void)
+{
+  struct dis_entry *de= dis_tbl();
+  int max= 0;
+
+  while (de &&
+        de->mnemonic)
+    {
+      if (de->length > max)
+       max= de->length;
+      de++;
+    }
+  return(max);
+}
+
 bool
-cl_uc::get_name(uint addr, struct name_entry tab[], char *buf)
+cl_uc::get_name(t_addr addr, struct name_entry tab[], char *buf)
 {
   int i;
 
@@ -652,6 +792,57 @@ cl_uc::get_name(uint addr, struct name_entry tab[], char *buf)
   return(tab[i].name != NULL);
 }
 
+char *
+cl_uc::symbolic_bit_name(t_addr bit_address,
+                        class cl_mem *mem,
+                        t_addr mem_addr,
+                        t_mem bit_mask)
+{
+  char *sym_name= 0;
+  int i;
+
+  i= 0;
+  while (bit_tbl()[i].name &&
+        (bit_tbl()[i].addr != bit_address))
+    i++;
+  if (bit_tbl()[i].name)
+    {
+      sym_name= strdup(bit_tbl()[i].name);
+      return(sym_name);
+    }
+
+  if (mem &&
+      mem->class_name &&
+      strstr(mem->class_name, "sfr") == mem->class_name)
+    {
+      i= 0;
+      while (sfr_tbl()[i].name &&
+            (sfr_tbl()[i].addr != mem_addr))
+       i++;
+      if (sfr_tbl()[i].name)
+       sym_name= strdup(sfr_tbl()[i].name);
+      else
+       sym_name= 0;
+    }
+  if (!sym_name)
+    {
+      sym_name= (char *)malloc(16);
+      sprintf(sym_name, mem?(mem->addr_format):"0x%06x", mem_addr);
+    }
+  sym_name= (char *)realloc(sym_name, strlen(sym_name)+2);
+  strcat(sym_name, ".");
+  i= 0;
+  while (bit_mask > 1)
+    {
+      bit_mask>>=1;
+      i++;
+    }
+  char bitnumstr[10];
+  sprintf(bitnumstr, "%1d", i);
+  strcat(sym_name, bitnumstr);
+  return(sym_name);
+}
+
 
 /*
  * Execution
@@ -798,7 +989,7 @@ cl_uc::fetch(void)
  */
 
 bool
-cl_uc::fetch(ulong *code)
+cl_uc::fetch(t_mem *code)
 {
   class cl_brk *brk;
   int idx;
@@ -916,7 +1107,7 @@ cl_uc::st_ret(class cl_stack_op *op)
  */
 
 class cl_fetch_brk *
-cl_uc::fbrk_at(long addr)
+cl_uc::fbrk_at(t_addr addr)
 {
   int idx;
   
@@ -945,6 +1136,34 @@ cl_uc::rm_fbrk(long addr)
   fbrk->del_bp(addr);
 }*/
 
+/* Get a breakpoint specified by its number */
+
+class cl_brk *
+cl_uc::brk_by_nr(int nr)
+{
+  class cl_brk *bp;
+
+  if ((bp= fbrk->get_bp(nr)))
+    return(bp);
+  if ((bp= ebrk->get_bp(nr)))
+    return(bp);
+  return(0);
+}
+
+/* Get a breakpoint from the specified collection by its number */
+
+class cl_brk *
+cl_uc::brk_by_nr(class brk_coll *bpcoll, int nr)
+{
+  class cl_brk *bp;
+
+  if ((bp= bpcoll->get_bp(nr)))
+    return(bp);
+  return(0);
+}
+
+/* Remove an event breakpoint specified by its address and id */
+
 void
 cl_uc::rm_ebrk(t_addr addr, char *id)
 {
@@ -960,13 +1179,93 @@ cl_uc::rm_ebrk(t_addr addr, char *id)
     }
 }
 
+/* Remove a breakpoint specified by its number */
+
+void
+cl_uc::rm_brk(int nr)
+{
+  class cl_brk *bp;
+
+  if ((bp= brk_by_nr(fbrk, nr)))
+    fbrk->del_bp(bp->addr);
+  else if ((bp= brk_by_nr(ebrk, nr)))
+    ebrk->free_at(ebrk->index_of(bp));
+}
+
 void
 cl_uc::put_breaks(void)
 {}
 
+/* Remove all fetch and event breakpoints */
+
 void
-cl_uc::remove_breaks(void)
-{}
+cl_uc::remove_all_breaks(void)
+{
+  while (fbrk->count)
+    {
+      class cl_brk *brk= (class cl_brk *)(fbrk->at(0));
+      fbrk->del_bp(brk->addr);
+    }
+  while (ebrk->count)
+    ebrk->free_at(ebrk->count-1);
+}
+
+int
+cl_uc::make_new_brknr(void)
+{
+  if (brk_counter == 0)
+    return(brk_counter= 1);
+  if (fbrk->count == 0 &&
+      ebrk->count == 0)
+    return(brk_counter= 1);
+  return(++brk_counter);
+}
+
+class cl_ev_brk *
+cl_uc::mk_ebrk(enum brk_perm perm, class cl_mem *mem,
+              char op, t_addr addr, int hit)
+{
+  class cl_ev_brk *b;
+  op= toupper(op);
+
+  switch (mem->type)
+    {
+    case MEM_ROM:
+      if (op == 'R')
+       b= new cl_rc_brk(make_new_brknr(), addr, perm, hit);
+      else
+       return(0);
+      break;
+    case MEM_IRAM:
+      if (op == 'R')
+       b= new cl_ri_brk(make_new_brknr(), addr, perm, hit);
+      else if (op == 'W')
+       b= new cl_wi_brk(make_new_brknr(), addr, perm, hit);
+      else
+       return(0);
+      break;
+    case MEM_XRAM:
+      if (op == 'R')
+       b= new cl_rx_brk(make_new_brknr(), addr, perm, hit);
+      else if (op == 'W')
+       b= new cl_wx_brk(make_new_brknr(), addr, perm, hit);
+      else
+       return(0);
+      break;
+    case MEM_SFR:
+      if (op == 'R')
+       b= new cl_rs_brk(make_new_brknr(), addr, perm, hit);
+      else if (op == 'W')
+       b= new cl_ws_brk(make_new_brknr(), addr, perm, hit);
+      else
+       return(0);
+      break;
+    default:
+      return(0);
+    }
+  b->init();
+  return(b);
+}
 
 
 /* End of uc.cc */
index 5a373065b03886ce47936f6d7e3e1154d3328d20..efa9045afaacbd5153026fac40e721f46e8a95f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Simulator of microcontrollers (uccl.h)
+ * Simulator of microcontrollers (sim.src/uccl.h)
  *
  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
  * 
@@ -25,8 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA. */
 /*@1@*/
 
-#ifndef UCCL_HEADER
-#define UCCL_HEADER
+#ifndef SIM_UCCL_HEADER
+#define SIM_UCCL_HEADER
 
 // prj
 #include "stypes.h"
@@ -78,6 +78,7 @@ public:
   class cl_list *counters;     // User definable timers (tickers)
   double xtal;                 // Clock speed
 
+  int brk_counter;             // Number of breakpoints
   class brk_coll *fbrk;                // Collection of FETCH break-points
   class brk_coll *ebrk;                // Collection of EVENT breakpoints
   class cl_sim *sim;
@@ -99,34 +100,37 @@ public:
   virtual void reset(void);
 
   // making objects
-  virtual class cl_mem *mk_mem(enum mem_class type);
+  virtual class cl_mem *mk_mem(enum mem_class type, char *class_name);
   virtual t_addr get_mem_size(enum mem_class type);
   virtual int get_mem_width(enum mem_class type);
   virtual void mk_hw_elements(void);
 
   // manipulating memories
-  virtual ulong read_mem(enum mem_class type, long addr);
-  virtual ulong get_mem(enum mem_class type, long addr);
-  virtual void write_mem(enum mem_class type, long addr, ulong val);
-  virtual void set_mem(enum mem_class type, long addr, ulong val);
+  virtual ulong read_mem(enum mem_class type, t_addr addr);
+  virtual ulong get_mem(enum mem_class type, t_addr addr);
+  virtual void write_mem(enum mem_class type, t_addr addr, t_mem val);
+  virtual void set_mem(enum mem_class type, t_addr addr, t_mem val);
   virtual class cl_mem *mem(enum mem_class type);
-  virtual TYPE_UBYTE *MEM(enum mem_class type);
+  virtual class cl_mem *mem(char *class_name);
+  //virtual TYPE_UBYTE *MEM(enum mem_class type);
 
   // file handling
   virtual long read_hex_file(const char *name);
 
   // instructions, code analyzer
-  virtual void analyze(uint addr) {}
-  virtual bool inst_at(uint addr);
-  virtual void set_inst_at(uint addr);
-  virtual void del_inst_at(uint addr);
+  virtual void analyze(t_addr addr) {}
+  virtual bool inst_at(t_addr addr);
+  virtual void set_inst_at(t_addr addr);
+  virtual void del_inst_at(t_addr addr);
   virtual bool there_is_inst(void);
 
   // manipulating hw elements
-  virtual void register_hw_read(enum mem_class, long addr, class cl_hw *hw);
-  virtual void register_hw_write(enum mem_class, long addr, class cl_hw *hw);
+  virtual void register_hw_read(enum mem_class, t_addr addr, class cl_hw *hw);
+  virtual void register_hw_write(enum mem_class, t_addr addr, class cl_hw *hw);
   virtual class cl_hw *get_hw(enum hw_cath cath, int *idx);
+  virtual class cl_hw *get_hw(char *id_string, int *idx);
   virtual class cl_hw *get_hw(enum hw_cath cath, int hwid, int *idx);
+  virtual class cl_hw *get_hw(char *id_string, int hwid, int *idx);
 
   // "virtual" timers
   virtual int tick(int cycles);
@@ -141,7 +145,7 @@ public:
 
   // execution
   virtual t_mem fetch(void);
-  virtual bool fetch(ulong *code);
+  virtual bool fetch(t_mem *code);
   virtual int do_inst(int step);
   virtual void pre_inst(void);
   virtual int exec_inst(void);
@@ -156,27 +160,42 @@ public:
   virtual int st_ret(class cl_stack_op *op);
 
   // breakpoints
-  virtual class cl_fetch_brk *fbrk_at(long addr);
+  virtual class cl_fetch_brk *fbrk_at(t_addr addr);
   virtual class cl_ev_brk *ebrk_at(t_addr addr, char *id);
   //virtual void rm_fbrk(long addr);
+  virtual class cl_brk *brk_by_nr(int nr);
+  virtual class cl_brk *brk_by_nr(class brk_coll *bpcoll, int nr);
   virtual void rm_ebrk(t_addr addr, char *id);
+  virtual void rm_brk(int nr);
   virtual void put_breaks(void);
-  virtual void remove_breaks(void);
+  virtual void remove_all_breaks(void);
+  virtual int make_new_brknr(void);
+  virtual class cl_ev_brk *mk_ebrk(enum brk_perm perm, class cl_mem *mem,
+                                  char op, t_addr addr, int hit);
 
   // disassembling and symbol recognition
-  virtual char *disass(uint addr, char *sep);
+  virtual char *disass(t_addr addr, char *sep);
   virtual struct dis_entry *dis_tbl(void);
   virtual struct name_entry *sfr_tbl(void);
   virtual struct name_entry *bit_tbl(void);
-  virtual void print_disass(uint addr, class cl_console *con);
+  virtual void print_disass(t_addr addr, class cl_console *con);
   virtual void print_regs(class cl_console *con);
-  virtual int inst_length(uint code);
-  virtual bool get_name(uint addr, struct name_entry tab[], char *buf);
+  virtual int inst_length(t_mem code);
+  virtual int longest_inst(void);
+  virtual bool get_name(t_addr addr, struct name_entry tab[], char *buf);
+  virtual bool extract_bit_address(t_addr bit_address,
+                                  class cl_mem **mem,
+                                  t_addr *mem_addr,
+                                  t_mem *bit_mask) {return(DD_FALSE);}
+  virtual char *symbolic_bit_name(t_addr bit_address,
+                                 class cl_mem *mem,
+                                 t_addr mem_addr,
+                                 t_mem bit_mask);
 
   /* Following fields and virtual methods defined in uc51 I don't have
      energy to redesign them:-( */
 public:
-  uchar port_pins[3];  // Port pins
+  uchar port_pins[4];  // Port pins
 public:
   virtual void proc_write(uchar *addr) {}
   virtual void set_p_flag(void) {}
index 86243c5d0af180fa8445f6e6f572ec642db394a0..81a50689e60658f34ac4402370eb28488596e757 100644 (file)
@@ -98,10 +98,11 @@ enum mem_class
 };
 
 // Flags of consoles
-#define CONS_NONE      0
-#define CONS_DEBUG     0x01    // Print debug messages on this console
-#define CONS_FROZEN    0x02    // Console is frozen (g command issued)
-#define CONS_PROMPT    0x04    // Prompt is out, waiting for input
+#define CONS_NONE       0
+#define CONS_DEBUG      0x01   // Print debug messages on this console
+#define CONS_FROZEN     0x02   // Console is frozen (g command issued)
+#define CONS_PROMPT     0x04   // Prompt is out, waiting for input
+#define CONS_INTERACTIVE 0x08  // Interactive console
 
 // States of simulator
 #define SIM_NONE       0
@@ -132,7 +133,13 @@ if (newbit) \
   (mem(MEM_SFR))->set_bit1((reg), (bitmask)); \
 else \
   (mem(MEM_SFR))->set_bit0((reg), (bitmask));
-#define GET_C (get_mem(MEM_SFR, PSW) & bmCY)
+#define SFR_SET_BIT(newbit, reg, bitmask) \
+if (newbit) \
+  sfr->set_bit1((reg), (bitmask)); \
+else \
+  sfr->set_bit0((reg), (bitmask));
+#define GET_C     (get_mem(MEM_SFR, PSW) & bmCY)
+#define SFR_GET_C (sfr->get(PSW) & bmCY)
 #define SET_C(newC) SET_BIT((newC), PSW, bmCY)
 
 #define IRAM_SIZE 256    /* Size of Internal RAM */
index 6bbdbc170ac73c5216d9f2367a41e4da289d6276..d8b4a0833152c784ab9481a1936aa0cf8a8771ae 100644 (file)
@@ -69,5 +69,34 @@ get_id_string(struct id_element *ids, int id)
   return(ids[i].id_string);
 }
 
+char *
+get_id_string(struct id_element *ids, int id, char *def)
+{
+  char *s= get_id_string(ids, id);
+
+  return(s?s:def);
+}
+
+int
+get_string_id(struct id_element *ids, char *str)
+{
+  int i= 0;
+
+  while (ids[i].id_string &&
+        strcmp(ids[i].id_string, str) != 0)
+    i++;
+  return(ids[i].id);
+}
+
+int
+get_string_id(struct id_element *ids, char *str, int def)
+{
+  int i= 0;
+
+  while (ids[i].id_string &&
+        strcmp(ids[i].id_string, str) != 0)
+    i++;
+  return(ids[i].id_string?ids[i].id:def);
+}
 
 /* End of utils.cc */
index 271d1b41cb2dbd946f156466c92651544efb71d2..08472244fd1827c54ac6dadb4bbc306c2ba6541b 100644 (file)
@@ -33,6 +33,9 @@ extern int get_sub_opt(char **option,
                       const char * const *tokens,
                       char **valuep);
 extern char *get_id_string(struct id_element *ids, int id);
+extern char *get_id_string(struct id_element *ids, int id, char *def);
+extern int get_string_id(struct id_element *ids, char *str);
+extern int get_string_id(struct id_element *ids, char *str, int def);
 
 
 #endif
index c5ff13314576649c645e05add28707388c1fd8ed..b8f6bc4c6b1482fb41764109d31a440f56a5b2f3 100644 (file)
@@ -17,12 +17,12 @@ PRJDIR              = ..
 
 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
 CPPFLAGS        = @CPPFLAGS@ -I. -I$(PRJDIR) \
-                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src
+                 -I$(PRJDIR)/cmd.src -I$(PRJDIR)/sim.src -I$(PRJDIR)/gui.src
 CFLAGS          = @CFLAGS@ -Wall
 CXXFLAGS        = @CXXFLAGS@ -Wall
 M_OR_MM         = @M_OR_MM@
 
-LIBS           = @LIBS@ -L$(PRJDIR) -lsim -lcmd -lutil
+LIBS           = @LIBS@ -L$(PRJDIR) -lsim -lcmd -lutil -lguiucsim
 
 prefix          = @prefix@
 exec_prefix     = @exec_prefix@
index 7c857009f127dcabedbed64f25d51cc4d7800c05..9668b567f3e0bf9ee53596cb1012a62a32646c6f 100644 (file)
@@ -35,10 +35,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 int
 main(int argc, char *argv[])
 {
-  simulator= new cl_simz80(0, argc, argv);
-  simulator->init();
-  simulator->main();
-  delete simulator;
+  class cl_sim *sim= new cl_simz80(0, argc, argv);
+  sim->init();
+  sim->main();
+  delete sim;
   return(0);
 }
 
index 47b42d5a59d525526e39905380eb7f9458111a52..6ea06537770e0819c686b0d9c004cc17f724a352 100644 (file)
@@ -86,14 +86,6 @@ cl_z80::get_mem_size(enum mem_class type)
  return(cl_uc::get_mem_size(type));
 }
 
-/*int
-cl_z80::get_mem_width(enum mem_class type)
-{
-  if (type == MEM_ROM)
-    return(16);
-  return(cl_uc::get_mem_width(type));
-}*/
-
 void
 cl_z80::mk_hw_elements(void)
 {
@@ -126,7 +118,7 @@ cl_z80::bit_tbl(void)
 }*/
 
 char *
-cl_z80::disass(uint addr, char *sep)
+cl_z80::disass(t_addr addr, char *sep)
 {
   char work[256], temp[20];
   char *buf, *p, *b, *t;
@@ -263,32 +255,6 @@ cl_z80::disass(uint addr, char *sep)
   return(buf);
 }
 
-void
-cl_z80::print_disass(uint addr, class cl_console *con)
-{
-  char *dis;
-  class cl_brk *b;
-  int i;
-
-  b  = fbrk_at(addr);
-  dis= disass(addr, NULL);
-  if (b)
-    con->printf("%c", (b->perm == brkFIX)?'F':'D');
-  else
-    con->printf(" ");
-  con->printf("%c %06x %04x",
-             inst_at(addr)?' ':'*',
-             addr, get_mem(MEM_ROM, addr));
-  for (i= 1; i < inst_length(get_mem(MEM_ROM, addr)); i++)
-    con->printf(" %04x", get_mem(MEM_ROM, addr+i));
-  while (i < 2)
-    {
-      con->printf("     ");
-      i++;
-    }
-  con->printf(" %s\n", dis);
-  free(dis);
-}
 
 void
 cl_z80::print_regs(class cl_console *con)
index a9ef160ebfa70b4869ccf1ea392ce3ec76c07d64..470b999a31d08f81976d67dec21cdef39cf1068b 100644 (file)
@@ -49,14 +49,12 @@ public:
   virtual char *id_string(void);
 
   virtual t_addr get_mem_size(enum mem_class type);
-  //virtual int get_mem_width(enum mem_class type);
   virtual void mk_hw_elements(void);
 
   virtual struct dis_entry *dis_tbl(void);
   //virtual struct name_entry *sfr_tbl(void);
   //virtual struct name_entry *bit_tbl(void);
-  virtual char *disass(uint addr, char *sep);
-  virtual void print_disass(uint addr, class cl_console *con);
+  virtual char *disass(t_addr addr, char *sep);
   virtual void print_regs(class cl_console *con);
 
   virtual int exec_inst(void);