µCsim: Invocation

# Starting the simulator

There are separate programs to simulate different microcontroller families:

Intel MCS48 family is simulated by ucsim_i8048
Intel MCS51 family is simulated by ucsim_51
Intel MCS80/85 family is simulated by ucsim_i8085
Philips XA processor is simulated by ucsim_xa
Atmel AVR processor is simulated by ucsim_avr
Zilog Z80 family is simulated by ucsim_z80
Toshiba TLCS90 processor is simulated by ucsim_tlcs
Rabbit family is simulated by ucsim_rxk
Motorola M68HC08 processor is simulated by ucsim_m68hc08
Motorola MC6800 processor is simulated by ucsim_m6800
Motorola MC6809 processor family is simulated by ucsim_m6809
Motorola MC68HC11 processor is simulated by ucsim_m68hc11
Motorola MC68HC12 processor is simulated by ucsim_m68hc12
MOS MOS6502 processor is simulated by ucsim_mos6502
ST ST7 processor is simulated by ucsim_st7
ST STM8 family is simulated by ucsim_stm8
Padauk family is simulated by ucsim_pdk
PicoBlaze processor is simulated by ucsim_pblaze
p1516 processor is simulated by ucsim_p1516
f8 processor is simulated by ucsim_f8
OISC processors are simulated ny ucsim_oisc

The simulator can be started in the following way:

`$ ucsim_XXX [-bBEgGhHlPqVvw] [-a nr] [-c file] [-C cfg_file] [-e command] [-I if_optionlist] [-k portnum] [-o colorlist] [-p prompt] [-R seed]\n [-s file] [-S optionlist] [-t CPU] [-U uartnr] [-u hw] [-X freq[k|M]]\n [-z portnum] [-Z portnum] [files...]`

Specified files must be names of Intel hex files. Simulator loads them in the specified order into the ROM of the simulated system. If the file is specified without extension, the simulator will try to find intel hex file (filename extended with .hex), omf file (with .omf) and cdb file (with .cdb extension). Simulator can interpret content of these SDCC output files and reads information from them.

Options:

-a nr
  Set size of variable space. Default is 256.
-b
  Black & white (non-color) console.
`-B`
  Beep on breakpoints. Print out a beep character to the console when a breakpoint hits.
`-c file`
  Open command console on file. Command consoles are on standard input and output by default. Using this option the console can be opened on any file for example on the serial interface of the computer.
-C cfg_file
  Read and execute initial commands from specified file.
`-e command`
  Execute command at program startup (before config file).
`-E`
  Start simulation when the program is loaded, but use emulation mode instead of normal run mode.
`-g`
  Go, start simulation when the program is loaded.
`-G`
  Start simulation when the program is loaded and terminate the simulator when the simulation stops (maybe on breakpoint).
`-h`
  Print out a short help about the options and stop.
`-H`
  Print out types of known CPUs. Names printed out by this option can be used to determine CPU type using `-t` option.
`-I if=memory[address],in=file,out=file`
  Specify options (as comma separated list) for the simulator interface. if option turns on the interface and specifies address space and location for use by the interface. in and out can be used to specify file names to use for file IO.
  See more about simulator interface.
`-k portnum`
  Listen for incoming connections on port portnum. When this port connected, the connection will be attached to simulated UART0.This option is not useful for other UARTs, so it is better to use the more general -S option.
`-l`
  Use colors of light theme (default is dark)
`-o colorsetting,...
`
  List of color settings in form: `what=colspec,...` where what specifies object to be colored and colspec is : separated list of color options e.g.: prompt=b:white:black (bold white on black).
  what can be:
  - `bg` default backgound color,
  - `prompt` prompt color,
  - `prompt_console` console number in front of the prompt,
  - `command` color of entered command,
  - `answer` default color for answers printed by commands,
  - `result` color of expression result,
  - `dump_address` address color in memory dump (1st column)
  - `dump_label` label color in memory dump (2nd column)
  - `dump_number` color of numerical part of the dump (3rd column)
  - `dump_char` color of textual part of the dump (4th column)
  - `comment` comment color in disassembly
  - `error` color of error messages
  - `debug` color of debug messages
  - `ui_mkey` menu-key color on UI display
  - `ui_mitem` menu-item color on UI display
  - `ui_label` label color on UI display
  - `ui_time` color of time-value on UI display
  - `ui_title` title color on UI display
  - `ui_run` run-state color on UI display
  - `bit0` Bit 0 color on UI display
  - `bit1` Bit 1 color on UI display
  - `ui_stop` stop-state color on UI display
  - `led_on` color of ON LEDS on FPGA display
  - `led_off` color of OFF LEDS on FPGA display
  - `btn_on` color of ON buttons on FPGA display
  - `btn_off` color of OFF buttons on FPGA display
  - `sw_on` color of ON switches on FPGA display
  - `sw_off` color of OFF switches on FPGA display
  colspec can be a rendering option, or a color name. First color name is used for foreground color and the last one will be the color of background. Rendering options are:
  - b bold
  - f faint
  - i italic
  - u undelined
  - d double underlined
  - c crossed over
  - o overlined
  - k or l blink
  Color name can be a predefined name, or an RGB value. Known names are:
  - black
  - bblack (bright black, this is grey on some terminals)
  - red
  - bred (bright red)
  - green
  - bgreen (bright green)
  - yellow
  - byellow (bright yellow)
  - blue
  - bblue (bright blue)
  - magenta
  - bmagenta (bright magenta)
  - cyan
  - bcyan (bright cyan)
  - white
  - bwhite (bright white)
  How the named colors appear on the screen depends on the terminal emulator program.
  RGB values can be specified as #RRGGBB where components are two character hexadecimal values of the red, green and blue.
  Example (set prompt to blinking bold white on green, and set command to underlined bright green on black):
  -o prompt=lb:white:green,command=u:bgreen:black
`-p prompt`
  Using this option you can specify any string to be the prompt of command interpreter, for example:

      $ ucsim_51 -p "s51> "
      	  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.
      	    0s51>

`-P`
  Prompt will be a null ('\0') character. This feature can be useful for programs which controls simulator through a pipe.
`-R seed`
  Set seed value for the random number generator.
`-s file`
  Connect serial interface (UART0) of the simulated microcontroller to the file. Nothing is used by default which means that characters transmitted by serial interface of the simulated microcontroller go to nowhere and it will never receive anything. If you are going to communicate with serial interface interactively the best idea is to specify a terminal with -s option.
`-S uart=nr,in=file,out=file,port=nr,iport=nr,oport=nr,raw`
  Using this option you can specify different files for input and output streams that µCsim uses to simulate microprocessor's serial interface.
  See more about serial interface simulation.
`-t CPU`
  Type of CPU. Recognized types are different for different simulators, for example MCS51 simulator recognizes 51, 8051, 8751, C51, 80C51, 87C51, 31, 8031, C31, 80C31, 52, 8052, 8752, C52, 80C52, 87C52, 32, 8032, C32, 80C32, 51R, 51RA, 51RB, 51RC, C51R, C51RA, C51RB, C51RC, 89C51R, 251, C251, DS390, DS390F. Note that recognition of a CPU type as option does not mean that the simulator can simulate that kind of CPU. Default type is C51.
  DS390 supports Dallas DS80C390 24 bit flat mode, dual-dptr operations, etc. DS390F is the same as DS390, but it starts already in 24 bit flat mode (ACON = 0xFA instead of 0xF8). DS390F is needed to run programs compiled with sdcc -mds390.
  `-H` option can be used to list all of recognized CPU types.
  See how to select CPU type.
`-U uartnr`
  Connect console of standard io to uart as a display of it. ID of the uart must be specified as parameter to -U option.
`-u hw`
  Connect console of standard io to a hardware element specified as option parameter as a display. Hardware element can be specified in the same way as in info hardware command.
`-v`
  Print out version number and stop.
`-V`
  Verbose mode. The simulator notifies you about some kind of internal actions for example interrupts. Messages are printed on command console.
-w
  Writable flash.
`-X freq[k|M]`
  XTAL frequency is freq Hertz. k or M can be used to specify frequency in kHZ or MHz. Space is not allowed between the number and the k or M. Default value is 11059200 Hz.
`-z portnum`
  If sockets are available on the system, µCsim listens on port portnum for incoming connections and servs command consoles for clients. Port number can be changed using this option. quit command exits µCsim only if not active connection is opened to this port. kill command can be used to close all connections and quit µCsim immediately.
`-Z portnum`
  Listen for incoming connections on port portnum. Using this option µCsim can serve multiple consoles. You can get a console by simply telnet into machine running µCsim to port portnumber. This option is not available on platforms which doesn't support BSD networking. If -Z option is used, instead of -z, then default console on stdio will not be opened, and the only way to open a console is using telnet to portnum.
  See how to use multiple consoles.