\documentclass[a4paper,twoside,12pt]{book} \usepackage[utf8]{inputenc} \title{MCU 8051 IDE handbook} \author{Martin Ošmera } \newcommand{\mysubject}{MCU~8051~IDE handbook} \newcommand{\mykeywords}{8051, IDE, Linux} % \usepackage[light,condensed,math]{iwona} %\usepackage{lmodern} %\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif \usepackage[T1]{fontenc} \usepackage{float} \usepackage{graphicx} \usepackage{fancyhdr} \usepackage{longtable} \usepackage[usenames,dvipsnames]{color} \usepackage{pifont} \usepackage{wrapfig} \usepackage[footnotesize,bf]{caption} \usepackage[pdftex,colorlinks=true,linkcolor=blue,urlcolor=blue,pdftitle={\title{}},pdfauthor={\author{}},pdfsubject={\mysubject{}},pdfkeywords={\mykeywords{}},bookmarksopen=false,pdfpagemode=None]{hyperref} \floatstyle{ruled} \newfloat{code}{thp}{lop} \floatname{code}{Code} \definecolor{highlight_constant}{rgb}{0.333, 0.666, 0.0} \definecolor{highlight_unknown_base}{rgb}{0.533, 0.133, 0.133} \definecolor{highlight_comment}{rgb}{0.533, 0.533, 0.533} \definecolor{highlight_symbol}{rgb}{0.666, 0.0, 1.0} \definecolor{highlight_oper_sep}{rgb}{0.866, 0.533, 0.0} \definecolor{highlight_directive}{rgb}{0.533, 0.533, 1.0} \definecolor{highlight_label}{rgb}{0.533, 0.333, 0.0} \definecolor{highlight_instruction}{rgb}{0.0, 0.0, 1.0} \definecolor{highlight_sfr}{rgb}{0.0, 0.0, 0.866} \definecolor{highlight_indirect}{rgb}{0.866, 0.0, 0.0} \definecolor{highlight_imm_hex}{rgb}{0.666, 0.0, 0.866} \definecolor{highlight_macro}{rgb}{0.8, 0.0, 0.866} \definecolor{highlight_imm_dec}{rgb}{0.0, 0.533, 0.866} \definecolor{highlight_hex}{rgb}{0.533, 0.0, 0.733} \definecolor{highlight_oct}{rgb}{0.533, 0.0, 0.0} \definecolor{highlight_dec}{rgb}{0.0, 0.333, 0.666} \definecolor{highlight_bin}{rgb}{0.2, 0.2, 0.333} \definecolor{highlight_string}{rgb}{0.533, 0.533, 0.0} \definecolor{highlight_control}{rgb}{1.0, 0.0, 0.0} \definecolor{highlight_imm_oct}{rgb}{0.666, 0.0, 0.0} \definecolor{highlight_imm_bin}{rgb}{0.333, 0.333, 0.666} \definecolor{highlight_char}{rgb}{0.0, 1.0, 1.0} \definecolor{highlight_imm_constant}{rgb}{0.937, 0.737, 0.168} \definecolor{highlight_imm_unknown}{rgb}{0.666, 0.2, 0.2} \definecolor{highlight_lst_number}{rgb}{0.0, 0.882, 1.0} \definecolor{highlight_lst_code}{rgb}{1.0, 0.2, 0.968} \definecolor{highlight_lst_address}{rgb}{0.349, 0.356, 1.0} \definecolor{highlight_lst_line}{rgb}{0.074, 0.003, 0.513} \definecolor{highlight_lst_macro}{rgb}{0.533, 0.533, 0.533} \definecolor{highlight_lst_include}{rgb}{0.533, 0.533, 0.533} \definecolor{highlight_lst_msg}{rgb}{0.0, 0.0, 0.0} \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ \MakeUppercase{#1}}{}} \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} \newcommand{\menuitem}[1]{\texttt{#1}} \newcommand{\fileextension}[1]{\texttt{#1}} \newcommand{\mysmallfont}{\fontsize{8pt}{10pt} \selectfont{}} \newcommand{\uC}{$\mu$C } \pdfadjustspacing=1 \raggedbottom \pagestyle{fancy} \fancyhf{} \fancyhead[EL,OR]{\bfseries\thepage} \fancyhead[LO]{\bfseries\rightmark} \fancyhead[RE]{\bfseries\leftmark} \fancypagestyle{plain}{ \fancyhead{} \fancyhead[EL,OR]{\bfseries\thepage} \renewcommand{\headrulewidth}{0pt} } \begin{document} \maketitle \thanks{ I would like to thank to the following people for their support during the project development: \begin{itemize} \item \textbf{Andre Cunha}~\textit{(Brazil)} for review of this document. \item \textbf{Yuanhui Zhang}~\textit{(China)} for bug reports and help with debugging. \item \textbf{Kara Blackowiak}~\textit{(USA)} for certain code reviews. \item \textbf{Marek Nožka}~\textit{(Moravia, CZ, EU)} for help with debugging. \item \textbf{Kostya V. Ivanov}~\textit{(Russia)} for bug fixes in the simulator engine. \item \textbf{Shakthi Kannan}~\textit{(India)} for adding this software to the FEL project and for a few patches. \item \textbf{Trevor Spiteri}~ for help with debugging (patches) the HD44780 simulator. \item \textbf{Miroslav Hradílek}~\textit{(EU)} for bug reports and suggestions \item \textbf{Fabricio Alcalde}~\textit{(Argentina)} for suggestions and bug reports. \item \textbf{Francisco Albani}~\textit{(Argentina)} for suggestions and a few bug reports. \end{itemize} } \tableofcontents \newpage \chapter*{Preface} \addcontentsline{toc}{chapter}{Preface} \section*{Goals of the project} \addcontentsline{toc}{section}{Goals of the project} MCU~8051~IDE is an integrated development environment for microcontrollers based on MCS-51 intended for Assembly language and C language. This IDE is currently available on GNU/Linux and Microsoft\textregistered\~Windows\textregistered\ (since version 1.3.6). This program was originally intended for education purposes, but now the area of potential usage is surely significantly wider. This program was created to fill a gap in the open source software of this kind. User interface, source codes, documentation, web pages, etc., are written in English in order to make this software available to as many user as possible, but there is support for internationalization using i18n since version 1.3.10. This documentation is written in \LaTeX. It is very important to note that this software was not developed for any company, person or something similar and it is completely noncommercial, open source software distributed under \href{http://gnu.cz/article/30/pdf/gpl-cz.pdf}{GNU GPLv2} license intended for a group of people with common interest, in this case 8051. \subsection*{MCU 8051 IDE should offer:} \begin{dingautolist}{172} \setlength{\itemsep}{-3pt} \item A transparent view on a simulated program for 8051; \item Easy source code editing even for an user with small knowledge of the assembly language; \item User friendly advanced IDE for MCS-51. \end{dingautolist} \subsection*{List of the most important parts of MCU 8051 IDE:} \begin{dinglist}{43} \setlength{\itemsep}{-3pt} \item Source code editor; \item Optimization capable macro-assembler; \item Advanced MCU simulator; \item Hexadecimal editor; \item Interface for hardware tool control plug-ins; \item Scientific calculator and special calculator optimized for 8051. \end{dinglist} \section*{Requirements} \addcontentsline{toc}{section}{Requirements} Hardware requirements are not defined. This program should run without problems on all POSIX systems (like GNU/Linux, etc.), where all of the software dependencies were satisfied. The IDE is officially distributed as a source code package (primary programming language is TCL), RPM package (currently available in official RHEL repositories), DEB package (currently available in official Debian repositories) and ebuild for Gentoo Linux (currently NOT available in the portage tree). \begin{table}[h] \centering{} \mysmallfont{} \begin{tabular}{|l|c|l|} \hline \textbf{Package} & \textbf{Min. version} & \textbf{Download location} \\\hline \multicolumn{2}{|l}{\textbf{Required packages:}} & (The IDE will not run without these packages) \\\hline tcl & 8.5 & \url{http://www.tcl.tk/software/tcltk/downloadnow85.html} \\\hline tk & 8.5 & \url{http://www.tcl.tk/software/tcltk/downloadnow85.html} \\\hline bwidget & 1.8 & \url{http://sourceforge.net/projects/tcllib} \\\hline itcl & 3.4 & \url{http://sourceforge.net/projects/incrtcl} \\\hline tdom & 0.8 & \url{http://www.tdom.org} \\\hline tkimg & 1.3 & \url{http://sourceforge.net/projects/tkimg} \\\hline tcllib & 1.6 & \url{http://sourceforge.net/projects/tcllib} \\\hline \multicolumn{2}{|l}{\textbf{Optional packages:}} & (Functionality might be unnecessarily limited without these packages) \\\hline Tclx & 8.4 & \url{http://tclx.sourceforge.net} \\ & \multicolumn{2}{l|}{\textit{(Signal handling (signals like SIGINT)}} \\\hline cmake & 2.6 & \url{http://www.cmake.org/HTML/Download.html} \\ & \multicolumn{2}{l|}{ \textit{(If you prefer this way of installation:} \texttt{``./configure \&\& make \&\& make install''}) } \\\hline rxvt-unicode & 8.3 & \url{http://software.schmorp.de} \\\hline & \multicolumn{2}{l|}{\textit{(If you want terminal emulator)}} \\\hline asem-51 & 1.3 & \url{http://plit.de/asem-51/download.htm} \\\hline & \multicolumn{2}{l|}{\textit{(If you want to use a really good assembler :) )}} \\\hline sdcc & 2.9 & \url{http://sdcc.sourceforge.net/} \\\hline & \multicolumn{2}{l|}{\textit{(If you want to used C language compiler)}} \\\hline doxygen & 1.3 & \url{www.doxygen.org/} \\\hline & \multicolumn{2}{l|}{\textit{(If you want to use doxygen directly from the IDE)}} \\\hline indent & 1.2 & \url{http://www.gnu.org/software/indent/} \\\hline & \multicolumn{2}{l|}{\textit{(If you want to use auto-indent function for C language)}}\\\hline hunspell & 1.2 & \url{http://hunspell.sourceforge.net} \\\hline & \multicolumn{2}{l|}{\textit{(If you want to have spell checker function available)}} \\\hline bash & 4.0 & \url{http://tiswww.case.edu/php/chet/bash/bashtop.html} \\\hline & \multicolumn{2}{l|}{\textit{(If you want to have spell checker function available)}} \\\hline gawk & 3.1 & \url{http://www.gnu.org/software/gawk/} \\\hline & \multicolumn{2}{l|}{\textit{(If you want to have spell checker function available)}} \\\hline \end{tabular} \caption{Software requirements} \end{table} \section*{Intended Audience} \addcontentsline{toc}{section}{Intended Audience} This manual is intended for any individual, regardless of his or her experience with assembler, C language, MCU~8051~IDE or Linux, but it is assumed here that the reader is familiar with basic concepts of assembly language programming and with 8051 processor architecture. Advanced users are not likely to read this manual, but all suggestions on documentation will be considered. If you would like to contribute to this project or the documentation, please consult the project web page. % The preferred way to ask technical questions or start a discussion is to use our mailing list: (mcu8051ide-devel AT lists.sourceforge.net). TODO: finish it Thanks for your cooperation which helps to make this software better. \chapter{Brief introduction} This chapter will provide you with a brief introduction about the main components that are part of MCU 8051 IDE. The purpose of this chapter is to contextualize you on the sofware, informing about the parts that composes it. The next chapter will cover rapidly the Graphical User Interface, which will be described in further details on chapter. \section{Main components of MCU 8051 IDE} \paragraph{Editor} The code editor is featured with syntax highlighting and validation, auto-completion and spell checking for comments \footnote{Spell checking for comments is available only if you have installed the Hunspell program. This feature is currently not available on MS\textregistered Windows\textregistered OS.}, as well as a command line that speeds up the access to various editor options. It also provides a panel showing line numbers, bookmarks, breakpoints and warnings from syntax validator. Editor is capable to export the source code within it as XHTML and \LaTeX\ and contains a number of useful tools like automatic indentation, searching and replacement of expressions, copy to clipboard, paste from clipboard, among others. \paragraph{Assembler} The assembler is one of the integral parts of MCU 8051 IDE. It is a macro assembler with support for dozens of directives and capable of performing peephole optimizations. Support for peephole optimizations means that the assembler can attempt to optimize the resulting code for higher execution speed and lower size without tempering with its very functionality. It is important to note that automatic peephole optimization can sometimes be harmful and so it is disabled by default. A macro assembler is a software that allows the user to define a \textbf{macro instruction}, which consists of a sequence of basic instructions, and use it later instead of repeatedly copying and pasting the set of instructions over and over along the source code. Assembler behavior can be configured either globally, using the proper configuration dialog, or locally in source code, by means of assembler directives and control sequences (e.g. \texttt{\$TITLE('Some title to show in the code listing')}). The assembler is capable of generating four kinds of output code: \begin{dinglist}{43} \setlength{\itemsep}{-3pt} \item Object code (machine code) as an hexadecimal file, with \fileextension{.hex} extension and in Intel\textregistered\ 8 HEX format; \item Object code (machine code) as a binary file, with \fileextension{.bin} extension and in format of raw binary data; \item Code listing, in \fileextension{.lst} extension; \item Code for integrated MCU simulator, in \fileextension{.adf} extension. \end{dinglist} \paragraph{Simulator} The simulator is a software component intended for the simulation of the chosen microcontroller in a virtual environment. It allows user to monitor precisely what is happening in the MCU in an exact moment in time, as well as to modify its components, for instance by altering the value of a register, canceling an interrupt or forcing a subprogram to return. In that way it might be possible to ferret out certain flaws in the program being debugged, which would be hard or nearly impossible to find and/or fix in other ways. Even though it is better to have ICD (In-Circuit Debugger) or ICE (In-Circuit Emulator) at hand, MCU~8051~IDE in current version does not support neither of them % \textcolor{blue}{[MARTIN, ARE YOU PLANNING TO ADD SUPPORT ON NEXT VERSIONS? IF SO, IT IS GOOD TO MENTION THIS HERE.]}. :) Sorry Andre, the only think I plan regarding this project is to "retire", I was working on it during my studies on the school, now I've got another responsibilities to attend to, I am really sorry. MCU simulator implemented in this IDE supports dozens of microcontrollers and most of them are treated in slightly different way allowing to take into account most of the nuances between the supported MCUs. User can adjust simulator behavior to fit his or her needs by modifying clock frequency, size of connected external code, data memory and others, or for instance by disabling or enabling certain warnings, which pops up when the simulated program do something ``strange'', like some kind of invalid access into memory or stack overflow or underflow. Besides that, it is possible for the user to modify all registers which the MCU deals with, including those which are not accessible by the running program, like the Program Counter. User have always an overview of all possible, pending and active interrupts and can tamper with them at any time. The simulator also allows for altering code memory and all kinds of data memories. The program being simulated can be at any time "hibernated" into a file, preferably with \fileextension{.m5ihib} extension, and resumed later from this same file. Such a file contains the entire state of the simulator at the point in which the program was hibernated. \paragraph{Project management} It is a functionality that allows the IDE to remember certain set of source code files along with a set of configuration parameters. Projects are stored in XML (eXtensible Markup Language) files with extension \fileextension{.mcu8051ide}. These files are human readable and their precise formatting is described in their inline DTD (Document Type Declaration). Their encoding is UTF-8 (Unicode Transformation) and as EOL (End Of Line) character they use LF (Line Feed). The reason for that is to make it possible for the user to implement his or her own tools for manipulating with them. \paragraph{Scientific calculator} MCU 8051 IDE scientific calculator is implemented as a simple scientific calculator capable of computation in four number systems: hexadecimal, decimal, octal and binary, and with three angle units: radians, degrees and grad. Integral part of the calculator is also a simple tool intended solely for computing preset values for MCU timers. \paragraph{Special calculator} The experience in MCU programming shows that it is very useful to have some tools at hand, capable of performing recurrent boring calculations that spend time to be done by hand. MCU 8051 IDE special calculator is intended for performing certain simple specialized calculations related to 8051. For instance, this calculator is capable of generating assembly language code implementing a wait loop with specified parameters. \paragraph{Hexadecimal editor} This utility is used here for watching and modifying large blocks of raw data in various memory types of the simulated MCU (Code, IDATA, XDATA, EEPROM, etc.). There is also hexadecimal editor intended for editing Intel\textregistered{}~HEX~8 files. Other hexadecimal editors are specially designed to fit specific needs of the given purpose; for example, there is an hexadecimal editor for viewing and editing code memory, which displays the current position of the program counter in the machine code of the simulated program. \paragraph{Disassembler} This tool can translate once assembled code back to source code. It is important to note that it is somewhat improbable that the resulting source code will look "reasonable" It is due to \texttt{DB} and \texttt{DW} and not fixed instruction word length on 8051. Nevertheless, such a generated source code must posses exactly the same functionality when it gets assembled again. Disassembler implemented in this IDE is frankly speaking only a little more that just a toy. If you want a really capable disassembler, maybe you should try some tool like D52 \url{http://www.8052.com/users/disasm/}. \paragraph{Notepad} In this IDE, it is a simple rich text editor for writing user notes of whatever kind. Originally, it was intended for writing a list of things which remain to be done in your project. \paragraph{Command Line Interface (CLI)} It is a tool that allows the use of some IDE functions without entering it's GUI. You can get list of available options by typing \texttt{mcu8051ide -h} or \texttt{mcu8051ide --help} to your terminal emulator. You can, for example, use just the assembler of the IDE or convert an Intel\textregistered{}~HEX~8 file to a raw binary file. \section{What is MCS-51} \begin{wrapfigure}{r}{120pt} \centering{} \includegraphics[width=110pt]{img/545px-Intel_8051_arch.png} \caption{i8051 micro-architecture} \end{wrapfigure} The Intel MCS-51 is a Harvard architecture, single chip microcontroller series which was developed by Intel in 1980 for use in embedded systems. Today there is a vast range of enhanced 8051-compatible devices manufactured by a number of independent manufacturers. They have 8-bit ALU, accumulator and 8-bit Registers (hence they are an 8-bit microcontrollers), they have 16-bit address bus, 8-bit data bus, boolean processing engine which allows bit-level boolean logic operations to be carried out directly and efficiently on select internal registers and select RAM locations, etc. \enlargethispage{10\baselineskip} \section{What is the Assembly language} An assembly language is a low-level programming language for computers, microprocessors, microcontrollers and other integrated circuits. It implements a symbolic representation of the binary machine codes and other constants needed to program a given CPU architecture. Processors based on MSC-51 have compatible instruction set, similar registers and many other things are generally very similar among them. Here is an example of how a piece of 8051 assembly code looks like: \begin{code}[h] \mysmallfont{} {\color{highlight_label}\verb' main:'}\\ {\color{highlight_directive}\verb' if'}\verb' '{\color{highlight_constant}\verb'test'}\verb''{\color{highlight_symbol}\verb'='}\verb''{\color{highlight_unknown_base}\verb'2'}\\ \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}\verb''{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#25h'}\\ \verb' '{\color{highlight_comment}\verb'; Configure EEPROM'}\\ \verb' '{\color{highlight_instruction}\verb'orl'}\verb' '{\color{highlight_sfr}\verb'EECON'}\verb''{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#38h'}\\ \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\ {\color{highlight_directive}\verb' endif'}\\ {\color{highlight_label}\verb' X0MI:'}\\ \verb' '{\color{highlight_instruction}\verb'anl'}\verb' '{\color{highlight_sfr}\verb'EECON'}\verb''{\color{highlight_oper_sep}\verb','}\verb' #'{\color{highlight_symbol}\verb'('}\verb''{\color{highlight_hex}\verb'0FFh'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_hex}\verb'020h'}\verb''{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'movx'}\verb' '{\color{highlight_indirect}\verb'@R0'}\verb''{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'A'} \caption{An example piece of code written in 8051 assembly language} \end{code} \chapter{Quick start} \section{Demonstration project} The aim of the demonstration project is to provide an easy way to explore the IDE without reading long and boring documents like this one. :) The demonstration project can be opened from the welcome dialog ( ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{Help}'' $\rightarrow$ ``\includegraphics[height=8pt]{img/messagebox_info.png}~\menuitem{Welcome dialog}'' $\rightarrow$ ``\menuitem{Open demonstration project}''. ) Demonstration project should introduce new user into usage of the most common functions of the IDE like assembling the code, running simulator and so on. Demonstration project cannot be modified by the user in order to make it ``less volatile''. \begin{figure}[h!] \centering{} \includegraphics[width=\textwidth]{img/024.png} \caption{MCU~8051~IDE with the demonstration project opened within it} \end{figure} \section{Your first project in MCU~8051~IDE} \begin{wrapfigure}{r}{160pt} \centering{} \includegraphics[width=150pt]{img/025.png} \caption{Project creation dialog} \end{wrapfigure} At first let me explain what the MCU~8051~IDE's project really is. It is a set of some files in some directory, let's call this directory the project directory. And this along with the file with extension \fileextension{.mcu8051ide} forms the project. The file with \fileextension{.mcu8051ide} extension defines what source code files belongs to the project and contains additional information about the project, like who is the project author or for what exact MCU is the project intended. To create you project you have to specify the project directory and the MCU type for which you will develop your code. This is done in project creation dialog. This dialog can be accessed from main menu ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{Project}'' $\rightarrow$ ``\includegraphics[height=8pt]{img/filenew.png} \menuitem{New}''. After this step you can specify some additional information about the project in project editing dialog. Once you have created a new project you can begin to develop you code from your chosen processor. When you want to save your code press Ctrl+S, Ctrl+N creates a new file and an existing file can be opened by Ctrl+O. Each opened file can be added or removed to/from your current project. Ctrl+B creates or deletes bookmark and Ctrl+Shift+B creates or deletes breakpoint. Project files, the files which are parts of the project, are opened each time you open the project. You can have more than one project opened at the time. Simulator can be started and shut down by pressing F2 key and assembler or compiler is run when F11 is pressed. Output from assembler or compiler is displayed on the bottom panel in tab ``Messages''. And main MCU simulator panel is also available on the bottom panel in tab ``Simulator''. On the left side you can find list of currently opened source code files and list of project files. And on the right side probably most useful tool at the beginning might be ``Instruction~details'', this tool displays help for instruction in the code editor on line with cursor. In the right panel you can find for example also list of bookmarks and breakpoints. \chapter{Detailed introduction to GUI} \section{Source code editor} \subsection{Syntax highlight and validation} \begin{wrapfigure}{r}{100pt} \centering{} \includegraphics[width=90pt]{img/036.png} \caption{Syntax validation configuration button} \end{wrapfigure} The editor is equipped with an implementation of a syntax highlighting algorithm based on simplified syntax analysis. And that enables a limited on-line syntax validation. That means that as the user writes down the code, editor tries to check it for syntactical correctness. Syntax validator marks ``strange looking'' lines with exclamation mark and tries to underline exact point of potential syntax errors. This feature can be disabled as well as syntax highlighting can be disabled. By disabling these features you can make the editor work faster, but it would probably mean only a unnecessary limitation. There are three levels of syntax validation:\\ \begin{itemize} \item 0: Disabled \item 1: Fast basic validation \item 2: Slow advanced validation \end{itemize} Syntax validation configuration button react to left and right click with the mouse pointer. Right button click decreases the level of validation and the left button click increases it. \subsection{Spell checking} \begin{wrapfigure}{l}{100pt} \centering{} \includegraphics[width=90pt]{img/037.png} \caption{Spell checker configuration button} \end{wrapfigure} There is also configurable spell checking function available. It underlines words which are marked by Hunspell\footnote{Hunspell is a spell checker and morphological analyzer. See \url{http://hunspell.sourceforge.net} for details.} as incorrectly spelled. This function applies to comments in the code or the entire code in case that the syntax highlight function has been disabled. User can choose from any of Hunspell or Myspell dictionaries installed on his or her system. This feature can also be turned off. It makes sense that this function is completely dependent on the Hunspell program, if it is not installed, spell checking won't work here. \subsection{Auto-completion} \begin{wrapfigure}{r}{180pt} \centering{} \includegraphics[width=170pt]{img/038.png} \caption{Syntax highlight, syntax validation and the pop-up based auto-completion all in action} \end{wrapfigure} Pop-up based auto-completion is function which should make it easier to use long names for labels, macros, variables, functions, constants, etc. This function is interconnected with syntax editor's analyzer used for syntax highlight and validation and for the table of symbols in the right panel. So it maintains an overview of all symbols defined in your source code file and then when you write just a few characters which a symbol starts with, this function will pop-up window offering you all defined symbols beginning with that letters. Note that this feature can be disabled in editor configuration dialog and note also that besides symbols it offers also list of assembly language instruction mnemonics and assembler directives. \subsection{Editor command line} Editor is featured with a command line, which can be invoked by pressing F10 key by default, and dismissed by pressing Esc. The command line appears below the editor above its status bar. From the command line you can perform variety of operations like conversions between various numerical bases, run simulator, insert current date and many more. In the command line it is sufficient to write just a few characters which the requested command starts with and which are sufficient to uniquely identify the command and press enter. You can see help for each command by running command \texttt{help list}. Command line is featured with its own color highlight, history and auto-completion. { \mysmallfont{} \begin{longtable}{l|ll} \textbf{Command} & \textbf{Arguments} & \textbf{Description} \\\hline \endhead \texttt{d2h} & & Convert decimal number into hexadecimal \\ \texttt{d2o} & & Convert decimal number into octal \\ \texttt{d2b} & & Convert decimal number into binary \\ \texttt{h2d} & & Convert hexadecimal number into decimal \\ \texttt{h2o} & & Convert hexadecimal number into octal \\ \texttt{h2b} & & Convert hexadecimal number into binary \\ \texttt{o2h} & & Convert octal number into hexadecimal \\ \texttt{o2d} & & Convert octal number into decimal \\ \texttt{o2b} & & Convert octal number into binary \\ \texttt{b2h} & & Convert binary number into hexadecimal \\ \texttt{b2d} & & Convert binary number into decimal \\ \texttt{b2o} & & Convert binary number into octal \\ \texttt{animate} & & Animate simulated program \\ \texttt{assemble} & & Run assembler \\ \texttt{auto-indent} & & Automatically indent the edited code \\ \texttt{bookmark} & & Create or delete bookmark on the current line \\ \texttt{breakpoint} & & Create or delete breakpoint on the current line \\ \texttt{capitalize} & & Capitalize selected text \\ \texttt{clear} & & Clear history \\ \texttt{comment} & & Comment selection \\ \texttt{copy} & & Copy selection \\ \texttt{custom} & & Run user command \\ \texttt{cut} & & Cut selection \\ \texttt{date} & & Insert current time and/or date \\ \texttt{exit} & & Leave command line \\ \texttt{exit-program} & & Exit the IDE \\ \texttt{find} & & Find a string \\ \texttt{goto} & & Go to the specified line \\ \texttt{help} & & Display help for the specified command \\ \texttt{char} & & Insert a character \\ \texttt{indent} & & Indent selection \\ \texttt{kill-line} & & Delete current line \\ \texttt{open} & & Open the specified file \\ \texttt{paste} & & Paste text from clipboard \\ \texttt{redo} & & Take back last undo \\ \texttt{reload} & & Reload current document \\ \texttt{replace} & & Replace a string with another string \\ \texttt{run} & & Run simulator in animation mode \\ \texttt{save} & & Save the current file \\ \texttt{set-icon-border}& & Show/Hide icon border \\ \texttt{set-line-numbers}& & Show/Hide line numbers \\ \texttt{sim} & & Engage/Disengage simulator \\ \texttt{step} & & Step simulated program \\ \texttt{tolower} & & Convert selected text to lowercase \\ \texttt{toupper} & & Convert selected text to uppercase \\ \texttt{uncomment} & & Comment current line \\ \texttt{undo} & & Undo the last text editing operation \\ \texttt{unindent} & & Decrease indentation level of the current line \\ \texttt{hibernate} & [] & Hibernate simulated program \\ \texttt{resume} & [] & Resume hibernated program \\ \texttt{switch-mcu} & & Switch current MCU simulation mode to another MCU \\ \texttt{set-xcode} & & Set size external data memory for simulated MCU \\ \texttt{set-xdata} & & Set size external program memory for simulated MCU \\ % Caption: \caption{Available commands} \end{longtable} } \section{Bottom panel} \subsection{Main panel of the MCU simulator} This panel is the main part of the simulator user interface. It shows all MCU registers along with content of internal data memory. And contains small toolbar with 6 buttons: ``\includegraphics[height=8pt]{img/launch.png}~Start''/``\includegraphics[height=8pt]{img/exit.png}~Shutdown'', ``\includegraphics[height=8pt]{img/rebuild.png}~Reset'', ``\includegraphics[height=8pt]{img/undo.png}~Step~back'', ``\includegraphics[height=8pt]{img/goto.png}~Step'', ``\includegraphics[height=8pt]{img/goto2.png}~Step~over'', ``\includegraphics[height=8pt]{img/1rightarrow.png}~Animate'' and ``\includegraphics[height=8pt]{img/2rightarrow.png}~Run''. All visible registers can be modified from here and most SFR registers are represented by enumeration of bits, where each particular bit can be modified separately, green color means logical one and red means zero. Each bit has its own tooltip help with short description of its purpose and status bar tip with bit address and bit name. \begin{figure}[h!] \centering{} \caption{Main panel of the simulator} \includegraphics[width=\textwidth]{img/001.png} \end{figure} \begin{figure}[h!] \begin{minipage}[b]{.3\textwidth} \centering{} \includegraphics[width=50pt]{img/002.png} \caption{Highlighted SFR register} \end{minipage} \begin{minipage}[b]{.3\textwidth} \centering{} \includegraphics[width=130pt]{img/003.png} \caption{Tool tip help for a special function bit} \end{minipage} \begin{minipage}[b]{.3\textwidth} \centering{} \includegraphics[width=50pt]{img/004.png} \caption{Representation of a register value in various numeric bases} \end{minipage} \end{figure} \subsection{C variables} This panel is a part of simulator user interface that maintains a list of global static variables defined in your C language code. Names of variables are displayed along with their current values in simulated MCU. If you program is not written in C language then this tool has no purpose for you at all. Otherwise the purpose of this panel is to make it easier to simulate a program for 8051 written in C language and see what is ``really'' happening in there. This tool is capable of extracting variable values from multiple registers and the displaying them as one variable, one value. Alteration of variable values is also possible. And search panel in the top right corner of the panel might help you with finding exact variable which you need to see. But note that functionality of this tool is in fact severely limited, it supports only global static variables, integers and floats, but variable value modification is allowed only for integer variables, no floats. \subsection{Graph showing voltage levels} This panel might help you to see what is happening on simulated GPIO\footnote{General Purpose Input Output} lines. Resolution and grid can be adjusted to better fit your needs. There are three graphs, one for port latches, one for port outputs (without any virtual HW) and one for the most realistic GPIO simulation which this IDE can do. \begin{figure}[h!] \centering{} \includegraphics[width=\textwidth]{img/005.png} \caption{GPIO Graph} \end{figure} \subsection{Messages panel} This panel displays output from the build-in assembler, external assemblers, C compiler and other external tools used in this IDE, which prints something important to standard output. Output from assemblers and SDCC (C compiler) is parsed to highlight warnings and errors and convert them to hyperlinks pointing to source code if possible. The panel also implements a tool for searching strings in the displayed text. User can make this tools visible by pressing Ctrl+F. \begin{figure}[h!] \centering{} \includegraphics[width=\textwidth]{img/007.png} \caption{Messages panel} \end{figure} \subsection{Notes} This is your personal notes for whatever you want. Originally it was intended for writing down a list of things which you need to finish in your work, so some sort of a to do list. But it is just a simple rich text editor with separate file specific notepad. User can use it as he or she consider appropriate. \begin{figure}[h!] \centering{} \includegraphics[width=\textwidth]{img/006.png} \caption{Personal notes} \end{figure} \subsection{Calculator} Calculator is here more or less just for completeness. But you might still find it to a real asset to your efforts. This calculator is capable of performing common arithmetical operations, computing trigonometric functions, logical operations, etc. Supported numeral systems are hexadecimal, decimal, octal and binary in both integer and real numbers. Supported angular measurement units are degrees, radians and gradians. The calculator is also equipped with three memory cells where you can save arbitrary numbers for future computations. On the right side there is a simple calculator dedicated to calculation timers preset values for the specified time, clock frequency, etc. \footnote{Essentially the same but much more advanced function has also the special calculator.} \begin{figure}[h!] \centering{} \includegraphics[width=\textwidth]{img/009.png} \caption{Calculator} \end{figure} \subsection{Find in files} With this tool you can search all files in certain directory which names matches specified GLOB\footnote{An instance of pattern matching behavior, for example ``*.c++'' matches all files with ``.c++'' extension.} pattern. The search is made for a plain string or regular expression match. This tool might be very useful when you are dealing with many, possibly large, source code files and you suddenly want to find something specific in them. Each line printed in the list of found entries is a hypertext link which opens the file mentioned in it in the source code editor and navigates the editor to line matching the item. In other words it generally the same as well known Unix command ``grep''\footnote{A command line text search utility originally written for Unix. The name is taken from the first letters in global/regular expression/print. Its official date of creation is given as March 3, 1973.}, but with graphical user interface. \subsection{Terminal emulator} This is a common color VT102\footnote{A video terminal that was made by Digital Equipment Corporation (DEC). Its detailed attributes became the de facto standard for terminal emulators.} terminal emulator for the X Window System\footnote{Computer software system and network protocol that provides a basis for graphical user interfaces.} as you probably know. More precisely It's embedded \href{http://software.schmorp.de/pkg/rxvt-unicode.html}{rxvt-unicode} terminal emulator by Marc A. Lehmann and others. Background and foreground colors used in the terminal emulator are configurable in ``Terminal~configuration~Dialog''. Note that this feature in not available on Microsoft\textregistered{} Windows\textregistered{} operating system and probably will never be, because terminal emulator would have only a little use there. \begin{figure}[h!] \centering{} \includegraphics[width=\textwidth]{img/031.png} \caption{Embedded \href{http://software.schmorp.de/pkg/rxvt-unicode.html}{rxvt-unicode} terminal emulator, with the \href{http://www.midnight-commander.org/}{Midnight Commander} running in it} \end{figure} \section{Left panel} \subsection{List of opened files} Shows list of all files opened withing the current project. Each entry has its own pop-up menu. Noteworthy features are search bar, sorting by name, size, etc. and open with an external editor. Each file can be added or removed from the list of project files. There is not much to say about it, it's just a simple list with a few nice features but nothing complex. \subsection{List of project files} Shows list of all files assigned to the current project. Each entry has its own pop-up menu. Noteworthy features are search bar, sorting by name, size, etc. and open with an external editor. Each file can be excluded from the list of project files, opened or close withing the project. \subsection{SFR watches} \begin{wrapfigure}{l}{130pt} \centering{} \includegraphics[width=110pt]{img/032.png} \caption{SFR watches} \end{wrapfigure} From here you can see all special function registers on your chosen MCU in one compact list. Search panel might help you locating particular SFR in this panel and also in the main simulator panel. Each register has two numerical representations of its value in the simulated MCU, decimal and hexadecimal. \subsection{File system browser} This panel should help you quickly navigate in your file system in order to open files you want to see as quickly as possible. But many people generally don't like panels like this and will always use only file selection dialog instead. \section{Right panel} \subsection{List of bookmarks} From here you can easily navigate trough all bookmarks made in the current source code file. The panel also highlights item in the list which corresponds to the current line (line with cursor) in the source code editor. You can also remove all bookmarks at once by pressing the ``\includegraphics[height=8pt]{img/editdelete.png}~Clear~all'' button. \subsection{List of breakpoints} Pretty much the same as list of bookmarks, but this panel shows breakpoints instead of bookmarks, that is the only difference. \subsection{Instruction details} \begin{wrapfigure}{r}{210pt} \centering{} \includegraphics[width=200pt]{img/008.png} \caption{Instruction details} \end{wrapfigure} When you are writing a code in the assembly language, this panel might be a great help for you. It shows all valid sets of operands for the instruction on your current cursor position in the source code and highlights the set which you are probably using. The same works also for directives. Each line in list has its own help window which appears when user points at it by the pointer. This help window shows additional details regarding the exact instruction. Note also the ``\includegraphics[height=8pt]{img/help.png}~Show~legend'' button in the upper right corner of the panel. \subsection{Data register watches} \begin{wrapfigure}{l}{130pt} \centering{} \includegraphics[width=120pt]{img/033.png} \caption{Data register watches} \end{wrapfigure} This panel might help you to keep track of specific data registers, except for SFR and EEPROM. User can add arbitrary data memory registers which he or she consider to be the most important for his or her current work. You can add a register in the bottom part of the panel. And you can search for specific register, configure the panel and save or load the list of register in the top panel. This tool is capable of extraction of used symbols from a code listing file\footnote{File with \fileextension{.lst} file name extension.} generated by an assembler. This feature can enabled or disabled in the panel's configuration menu. The current list of watched registers can be saved into a file and loaded from a file\footnote{These file usually have extension \fileextension{.wtc}}. Memory segments are distinguished by format of the addresses. As you can seen in the example, the meaning is this: \begin{table}[h!] \mysmallfont{} \centering{} \begin{tabular}{l|l} \textbf{Address format} & \textbf{Memory segment} \\ \hline 1 or 2 digits & Internal RAM (not SFR) \\ 3 digits & Expanded RAM \\ 4 digits & External RAM \\ dot and 2 digits & Bit (including SFR area) \\ \end{tabular} \caption{Data register watches: Register address} \end{table} \subsection{Subprograms call monitor} \begin{wrapfigure}{r}{130pt} \centering{} \includegraphics[width=120pt]{img/034.png} \caption{Subprograms call monitor} \end{wrapfigure} From here you can monitor all subprogram and interrupt calls in your program. For each entry there is mentioned the type of call, \texttt{acall}, \texttt{lcall} or interrupt, return address and address from which the call was invoked. And you can force each of them to premature return. \subsection{List of symbols} This tools shows a list of symbols defined in source code of your program, works for both assembly language and C language. The list is managed automatically as the user edit the code and is featured with search panel for easy navigation. Types of symbols can be distinguished by their colors and icons. Colors of particular symbols corresponds to the colors used in the source code editor to highlight them. \begin{table}[h] \mysmallfont{} \centering{} \begin{tabular}{ll} \includegraphics[height=8pt]{img/symbol1.png} & {\color{highlight_label} Label} \\ \includegraphics[height=8pt]{img/symbol3.png} & {\color{highlight_constant} Constant} \\ \includegraphics[height=8pt]{img/symbol2.png} & {\color{highlight_macro} Macro} \\ \includegraphics[height=8pt]{img/symbol4.png} & {\color{black} C variable} \\ \includegraphics[height=8pt]{img/symbol0.png} & {\color{blue} C function} \\ \includegraphics[height=8pt]{img/symbol5.png} & {\color{black} Other} \\ \end{tabular} \caption{Symbol colors and icons in default settings} \end{table} \subsection{HW plug-ins manager} This tool does just one thing, allows user to use plug-ins in MCU~8051~IDE. Primary purpose of these plug-ins should be implementation of inter-operation with certain hardware tools, most probably MCU programmers. if you are interested in writing these plug-ins, please refer to chapter \ref{sec:WritingHardwareToolControlPlugIns}. \section{Other tools} \subsection{SFR map} A tabular overview of all available SFRs on your MCU. This tool has similar graphical form as tables of SFR often used in 8051 manuals, but the most important difference is that this one is connected to the simulator and is capable of representing and modifying current values of SFRs in the MCU simulator. \subsection{Map of bit addressable area} \begin{wrapfigure}{l}{160pt} \centering{} \includegraphics[width=130pt]{img/017.png} \caption{Map of the bit addressable area} \end{wrapfigure} This tool is a part of the simulator user interface. It shows all bits in the bit addressable area of the simulated MCU. Each square represents one bit, when simulator is on, you can also change value of each one of them by clicking on it. Labels and color used here should be hopefully clear from the legend at the bottom. \subsection{Stack monitor} \begin{wrapfigure}{r}{90pt} \centering{} \includegraphics[width=80pt]{img/022.png} \caption{Stack monitor} \end{wrapfigure} This tool makes it possible to see entire MCU stack in one view. You can also push any value you want onto the stack or pop a value from it at any time. However this particular tool does not allow for changing the values on the tack in any other way than these. Each line in the stack monitor represents one octet in the stack, each octet is represented in four numerical bases, hexadecimal, decimal, binary and octal and also as a character according to ACII chart. Newly added values are pushed on the top of the list. And their origins are distinguished by background color of the address. These colors are explained in the legend on bottom. Note that button ``Clear'' doe not clear the stack but instead it clear only the monitor! Buttons ``POP'' and ``PUSH'' are intended for manipulation with the stack's content. \subsection{Symbol viewer} \begin{wrapfigure}{l}{160pt} \centering{} \includegraphics[width=140pt]{img/019.png} \caption{Symbol viewer} \end{wrapfigure} Symbol viewer shows the table of symbols defined in your program, it works only for assembly language. The table content is taken from code listing generated by assembler. In the top part of the window you can find search bar, and in the bottom part you can specify filter criteria for what you want to see in the table and specify sorting order of the symbols displayed. Symbol in this context are various constants and labels. \begin{figure}[h!] \begin{minipage}[t]{.5\textwidth} \centering{} \caption{ASCII chart} \includegraphics[width=.9\textwidth]{img/039.png} \end{minipage} \begin{minipage}[t]{.5\textwidth} \centering{} \caption{8051 Instruction Table} \includegraphics[width=.9\textwidth]{img/040.png} \end{minipage} \end{figure} \clearpage \subsection{ASCII chart} Colorful interactive ASCII chart, it may prove handy especially when you are dealing with serial communication and this sort of things. \subsection{8051 Instruction Table} Colorful interactive 8051 instruction table, very much alike the ASCII chart. But instead of ASCII code you can find there the complete table of 8051 instruction mnemonics, OP codes and related things. \subsection{8-segment editor} \begin{wrapfigure}{r}{140pt} \centering{} \includegraphics[width=120pt]{img/020.png} \caption{8-segment editor} \end{wrapfigure} With this tool you can easily determine what value you have to set on a port to display a digit on a numerical LED display. In the left part of the dialog window, you can find numerical values corresponding to the digit displayed in the middle part. These values are represented for both common cathode and anode and in three numerical bases, hexadecimal, decimal and octal. Buttons on left side from entry boxes copies value from adjacent entry box into clipboard. In the right part of the window you can set what port pin is connected to what LED segment. \subsection{Stopwatch} Stopwatch is a tool which can measure certain things in the simulated processor, such as number of instructions processed so far, number of microseconds which would it take for a real processor to execute, number of breakpoints met so far etc. User can also set it to stop the simulation when certain limit in the measurement has been met or exceeded. \subsection{Scribble notepad} This is something like a small whiteboard, where you can draw of write your notes. It is a little bit more free than conventional text editor. You can also insert images, supported image formats are PNG and a few others. But don't rely on the scribble notepad to much, this tool has no save or load functions, anything you draw or write there is just temporary and it will not recover upon next start of the IDE. \subsection{Base converter} \begin{wrapfigure}{l}{120pt} \centering{} \includegraphics[width=110pt]{img/021.png} \caption{Base convertor} \end{wrapfigure} When you are programming micro-controllers, you might want to convert numbers between various numeric bases. One could say that everyone dealing with such things as micro-controllers would be able to do these conversion without use of any tool. But this doesn't mean that such a tool can never be useful. Values written in the entry boxes of the base converter are saved when user leaved the IDE and are recovered upon next start along with all opened base converter tool windows. \subsection{RS-232 debugger} \begin{wrapfigure}{r}{190pt} \centering{} \includegraphics[width=180pt]{img/035.png} \caption{UART/RS-232 debugger} \end{wrapfigure} This tool is capable of transmitting and receiving data to/from RS-232 port in your computer, today personal computers usually do not have this type of port, but you can always use something like a USB to RS-232 bridge. I assume here that the reader is familiar with the RS-232 communication protocol and related terms. This tool acts as a \texttt{DTE}\footnote{Data Terminal Equipment, the other side is \texttt{DCE} (Data Circuit-terminating Equipment).}. On the diagram in the upper left corner you can see current logical level on each of RS-232 wires except for \texttt{RxD} and \texttt{TxD}. You can also set value for wires \texttt{DTR}\footnote{Data Terminal Ready} and \texttt{RTS}\footnote{Ready To Send} and trigger the break by button \texttt{BREAK}. Right upper corner contains configuration controls, their functions should be mostly obvious. Check-box ``Enable~reception'' enables or disables writing to hexadecimal editor ``Received~data''. Button ``Close'' closes the opened physical port. And button ``\includegraphics[height=8pt]{img/reload.png}'' refreshes the list of available physical ports. In the bottom part you can see two hexadecimal editors: ``Data~to~send'' and ``Received~data''. These are representations of data which we are dealing with. By button ``Receive~here'' you can set address in the hexadecimal editor where the received data will be written. And by button ``Send~selected'' you can trigger transmission over the opened physical port, selected chunk of the data will be send then. Button ``Clear~selected'' are intended for removing data from the hexadecimal editors editors. \subsection{Hexadecimal editors} \begin{wrapfigure}{l}{200pt} \centering{} \includegraphics[width=190pt]{img/023.png} \caption{MCU code memory editor} \end{wrapfigure} In this IDE there are several hexadecimal editors used for various purposes. Each of these editors is equipped with a string search tool and address bars of the left and top side. And in some cases with file saving and loading capability, numerical base switch, ASCII view and a navigation bar at the bottom. Editing is allowed only in overwrite mode, copy and paste works as usual, search dialog can be invoked by pressing Ctrl+F and user can switch between view (left and right) by pressing Tab key. Non printable characters in ASCII view are displayed in red color. \paragraph{MCU code memory editor} allows user to see and modify contents of the CODE memory of the simulated micro-controller. Special feature of this particular editor is that instruction OP code currently pointed by program counter (PC) is highlighted with dark orange background along with the instruction's operands. And the same applies also for the previously executed instruction but highlight color is light orange in this case. \paragraph{MCU data/xdata/eeprom memory editor} allows user to see and modify contents of the IDATA/XDATA/EEPROM memory of the simulated micro-controller. Special features of this editors are that recently changed octets are highlighted with light orange foreground color and octets currently being written into the memory are highlighted with gray background color. \paragraph{MCU eeprom write buffer editor} allows to see and modify EEPROM write buffer. Current EEPROM write offset is displayed as well. \paragraph{Independent hexadecimal editor} is universal hexadecimal editor with maximum capacity of 64kB and support for Intel\textregistered 8 HEX file format. This tool is completely independent from your project in the IDE. This too might be particularly useful when you want to and possibly modify content of a Intel\textregistered 8 hex file, but do not alter the simulated MCU. \subsection{Hibernation of simulated program} The IDE is capable of saving execution state of the simulated program into a file and resuming the program from it anytime later. The file, usually with extension \fileextension{.m5ihib}, contains values of all data registers including SFR in the simulated MCU along with other values determining MCU state as for example list of active interrupts. The file is in XML format, human readable and usually occupies a few tens of kilobytes.The file does not contain content of the CODE memory, so it has to be available somewhere else in a separate file. \subsection{Interrupt monitor} Interrupts monitor is a specialized tool intended for viewing and manipulating with interrupts in simulated MCU. With interrupt monitor you can invoke any interrupt you want at any time, force any interrupt at any time to return, change interrupt priorities or disable or enable particular interrupts. You can also see all interrupts synoptically in one window and alter values of their configuration flags. \begin{figure}[h!] \centering{} \includegraphics[width=300pt]{img/018.png} \caption{Interrupt monitor} \end{figure} \subsection{Conversions between *.hex, *.bin and *.adf files} Sometimes it might prove helpful to have some tool to convert a binary file to Intel\textregistered 8 Hex and vice versa. For this purpose MCU~8051~IDE is equipped with a simple tool set for this purpose. In the ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{Utilities}'' you can find these tools: \begin{itemize} \setlength{\itemsep}{-3pt} \item \includegraphics[height=8pt]{img/hb.png} \textbf{HEX $\rightarrow$ BIN} \\ Convert Intel\textregistered 8 Hex file to raw binary file \item \includegraphics[height=8pt]{img/bh.png} \textbf{BIN $\rightarrow$ HEX} \\ Convert raw binary file to Intel\textregistered 8 Hex \item \includegraphics[height=8pt]{img/sh.png} \textbf{SIM $\rightarrow$ HEX} \\ Convert simulator assembler debug file (\fileextension{.adf}) to Intel\textregistered 8 Hex file \item \includegraphics[height=8pt]{img/sb.png} \textbf{SIM $\rightarrow$ BIN} \\ Convert simulator assembler debug file (\fileextension{.adf}) to raw binary file \item \includegraphics[height=8pt]{img/hh.png} \textbf{Normalize Hex} \\ Read and rewrite the given Intel\textregistered 8 Hex file, so that all records satisfies specified maximum length (can be set in the assembler configuration dialog), all records are in incremental order and no records overlaps with others. \end{itemize} \subsection{Normalization of source code indentation} Uniformly intended code is always more aesthetically pleasing and more readable. When you don't have the luxury of having such a code from the first hand, perhaps you will find this feature helpful. This function is available for assembly language and C language if program indent is installed on your system. User can access this function from the ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{Tools}'' $\rightarrow$ ``\menuitem{Auto indent}''. \noindent \begin{center} \small{A small example of the auto indent function in action} \end{center} \begin{minipage}{\textwidth} \twocolumn \begin{minipage}[t]{.5\textwidth} \mysmallfont{} \textbf{Original code:}\\ \verb' '{\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_hex}\verb'7Fh'}\\ \verb' '{\color{highlight_comment}\verb'; Start at address 0x00'}\\ \verb' '{\color{highlight_directive}\verb'ORG'}\verb' '{\color{highlight_hex}\verb'0h'}\\ \verb' '{\color{highlight_label}\verb'label0:'}{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\ \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\ \verb' '{\color{highlight_instruction}\verb'cjne'}\verb' '{\color{highlight_sfr}\verb'R0'}\verb' '{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_constant}\verb'#abc'}\verb' '{\color{highlight_oper_sep}\verb','}{\color{highlight_constant}\verb'label0'}\\ \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0h'}\\ \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'label0'}\\ \verb' '{\color{highlight_comment}\verb'; End of assembly'}\\ \verb' '{\color{highlight_directive}\verb'END'}\\ \end{minipage}\begin{minipage}[t]{.5\textwidth} \mysmallfont{} \textbf{Automatically intended code:}\\ {\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_hex}\verb'7Fh'}\\ \verb' '{\color{highlight_comment}\verb'; Start at address 0x00'}\\ \verb' '{\color{highlight_directive}\verb'ORG'}\verb' '{\color{highlight_hex}\verb'0h'}\\ {\color{highlight_label}\verb'label0:'}\verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\ \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\ \verb' '{\color{highlight_instruction}\verb'cjne'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_constant}\verb'#abc'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_constant}\verb'label0'}\\ \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0h'}\\ \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'label0'}\\ \verb' '{\color{highlight_comment}\verb'; End of assembly'}\\ \verb' '{\color{highlight_directive}\verb'END'}\\ \end{minipage} \onecolumn \end{minipage} \subsection{Change letter case} \begin{wrapfigure}{r}{150pt} \centering{} \includegraphics[width=140pt]{img/042.png} \caption{Change letter case dialog} \end{wrapfigure} This tool can change letter casing to upper or lower case of certain types tokens which your source consists of of. For example you can easily convert all instruction mnemonics in the code to uppercase. It is intended for users who strictly prefers one or another convention of letter casing in assembly language. You can invoke the tool from ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{Tools}'' $\rightarrow$ ``\menuitem{Change letter case}''. \begin{itemize} \setlength{\itemsep}{-3pt} \item \includegraphics[height=8pt]{img/up0.png} Convert to uppercase \item \includegraphics[height=8pt]{img/down0.png} Convert to lowercase \item \includegraphics[height=8pt]{img/button_cancel.png} Keep current case \end{itemize} \subsection{User defined commands} \paragraph{Introduction} This feature was added in order to enable for use of any auxiliary tools which might useful while working in this IDE. For instance, some hardware tools or some sort of a source code management system like Git or SVN. These custom commands are basically mere Bash scripts with some kind of pseudo-variables available in it. These pseudo-variables are formed as strings beginning with ``\texttt{\%}''. Before each script execution they are expanded to values corresponding to their meaning. For instance ``\texttt{\%filename}'' expands to the name of the current file. Note that ``\texttt{\%\%}'' is expanded as single ``\texttt{\%}''.\\ \begin{table}[htp] \centering{} \mysmallfont{} \begin{tabular}{|l|l|} \hline \textbf{Pseudo-variable} & \textbf{Meaning} \\ \hline \%URL & The full URL of the current file \\ \%URLS & List of the URLs of all open documents \\ \%directory & Project directory \\ \%filename & The file name of the current document \\ \%basename & Same as \%filename, but without extension \\ \%mainfile & Name of project main file \\ \%line & Number of the current line \\ \%column & Number of the current column \\ \%selection & The selected text in the current file \\ \%text & The full text of the current file \\ \hline \end{tabular} \caption{List of pseudo-variables} \end{table} \paragraph{Configuration} There is specialized configuration dialog for these custom commands. \begin{wrapfigure}{r}{150pt} \centering{} \includegraphics[width=140pt]{img/010.png} \caption{Custom commands configuration dialog} \end{wrapfigure} \paragraph{Execution} After the script is executed successfully or not, dialog showing the results will appear upon completion of the script. This dialog contains all textual output from the script caught on standard output and standard error output. If the script outputs anything to the standard error output it is considered unsuccessful. \subsection{Clean-up project folder} This tool can proof useful particularly when your project directory gets ``polluted'' with lots of unnecessary files, and you want to get rid of them easily and first of all safely. It removes files with certain file name extensions from the project folder. The list of removed files is then written in results dialog. Available from ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{Tools}'' $\rightarrow$ ``\menuitem{Clean up project folder}''. \subsection{File statistic} Display certain statistical information about the current source code file. ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{File}'' $\rightarrow$ ``\menuitem{File statistic}''. \section{Configuration dialogues} Configuration dialogues are graphical tools for customization of this integrated development environment. And they comprises of these components: \paragraph{Editor configuration} \begin{wrapfigure}{l}{100pt} \centering{} \includegraphics[width=90pt]{img/027.png} \caption{Editor configuration dialog} \end{wrapfigure} In editor configuration dialog user can change preferred editor from default built-in editor to for example Vim or Emacs and modify configuration the built-in editor. Configurable are colors used for syntax highlight, colors for text area background and so on, font used by editor, indentation mode, auto-save interval and others. \paragraph{Compiler configuration} Compiler configuration dialog allows user to configure behavior of the built-in assembler, chose another assembler instead of this one. Configure the preferred assembler and configure the C compiler (SDCC). Compiler configuration is stored in the project file (the file with \fileextension{.mcu8051ide} extension). So these setting are specific to the one specific MCU~8051~IDE project. Currently supported external assemblers are these: \begin{itemize} \setlength{\itemsep}{-3pt} \item ASEM-51 \footnote{A really useful assembler written by W.W. Heinz. You can find it at \url{http://plit.de/asem-51/home.htm}} \item ASL \footnote{Available at http://linux.maruhn.com/sec/asl.html} \item AS51 \footnote{Available at http://www.pjrc.com/tech/8051} \end{itemize} How to link multiple files when using C language:\footnote{This feature is not yet supported on MS Windows.} \begin{enumerate} \item Write makefile, \item set the IDE to use your makefile instead of calling the C compiler directly (Configuration -> Compiler~configuration -> GNU~make~utility), \item start compilation as usual. \end{enumerate} \paragraph{Simulator configuration} Simulator configuration dialog configures these: \begin{enumerate} \item How to treat indeterminable values in simulator engine \item How many steps will be remembered during the simulation for later backward steps. \item What warning conditions will be ignored during the simulation \end{enumerate} \paragraph{Right panel configuration} Configures colors used in tools ``Instruction details'' and ``Register watches'' in the right panel. \paragraph{Main toolbar configuration} Configures contents of main application tool bar. \begin{figure}[h!] \centering{} \includegraphics[width=\textwidth]{img/041.png} \caption{Main toolbar} \end{figure} \paragraph{Custom commands configuration} Configures user defined commands, which are essentially Bash scripts. This feature is currently not available on MS\textregistered Windows\textregistered OS. \paragraph{Shortcuts configuration} Configures key shortcuts used in the IDE. \paragraph{Terminal emulator configuration} Configures terminal emulator at the bottom panel. This terminal emulator is embedded \href{http://software.schmorp.de/pkg/rxvt-unicode.html}{rxvt-unicode}. User can set foreground color and background color of the terminal emulator window and the font. This feature is currently not available on MS\textregistered Windows\textregistered OS. \paragraph{Global MCU~8051~IDE configuration} \begin{wrapfigure}{r}{100pt} \centering{} \includegraphics[width=90pt]{img/028.png} \caption{Global configuration dialog} \end{wrapfigure} Changes settings like GUI language, size of fonts used in the GUI, GUI widget style, whether splash screen should be displayed each time when the IDE is started and so on. \chapter{Build-in macro-assembler} In this chapter we will be concerned with MCU~8051~IDE build-in assembler. \footnote{This assembler manual is inspired by ASEM-51 manual, a great work done by W.W. Heinz} With syntax of its statements, directives and 8051 assembler instructions. I assume that the reader is familiar with general concepts of assembly language programming and 8051 architecture. So I will not explain these here. \section{Statements} Source code files for this assembler must be text files where lines are formed like these:\\\bigskip { \mysmallfont{} \texttt{} \begin{tabular}[h!]{llll} \verb'[' { \color{highlight_label} label: } \verb']' & \verb'[' { \color{highlight_instruction} instruction } & \verb'[' { \color{highlight_symbol} operand } \verb'[' , { \color{highlight_symbol} operand } \verb'[' , { \color{highlight_symbol} operand } \verb']' \verb']' \verb']' & \verb'[' { \color{highlight_comment} ;comment } \verb']' \\ \verb'[' { \color{highlight_label} label: } \verb']' & { \color{highlight_directive} directive } & \verb'[' { \color{highlight_symbol} argument } \verb']' & \verb'[' { \color{highlight_comment} ;comment } \verb']' \\ { \color{highlight_constant} symbol } & { \color{highlight_directive} directive } & { \color{highlight_symbol} argument } & \verb'[' { \color{highlight_comment} ;comment } \verb']' \\ \end{tabular} } \bigskip Everything in square brackets is optional. Compilation does not go beyond line containing ``\texttt{end}'' directive, so after that directive the code do not have to be syntactically valid. Empty lines are allowed as well as line containing only comment or label. Statements can be separated by spaces, NBSP characters\footnote{No Breaking Space (0xC2)} and tabs. Statements are case insensitive and their length is not limited, overall line length is also not limited. \begin{code}[h!] \mysmallfont{} {\color{highlight_label}\verb'start:'}\verb' '{\color{highlight_comment}\verb'; Start timer 0 in mode 2'}\\ \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R5'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0h'}\\ \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'IE'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0FFh'}\\ \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'TL0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#255d'}\\ \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'TMOD'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#03h'}\\ \verb' '{\color{highlight_instruction}\verb'setb'}\verb' '{\color{highlight_sfr}\verb'TR0'}\\ \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'main'}\\ \verb''\\ {\color{highlight_comment}\verb'; Main loop'}\\ {\color{highlight_label}\verb'main:'}\verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'$'}\verb' '{\color{highlight_comment}\verb'; Inifinite loop'}\\ \verb''\\ {\color{highlight_comment}\verb'; Program end'}\\ \verb' '{\color{highlight_directive}\verb'end'}\\ % Caption \caption{An example of well formed assembly language code} \end{code} \section{Symbols} Symbol names for numbers, macros or addresses defined by user in the code using appropriate directive. Like with ``\texttt{equ}'' directive you can define a new symbol and assign a value to it right away. Symbols may consist of upper and lower case letter, digits and underscore character (``\_''), their length is not limited, they are case insensitive and they can be the same as language keywords. Be aware of that there cannot coexists two or more symbols in the same memory segment which differs only by letter casing, in other words symbols ``\texttt{abc}'' and ``\texttt{ABC}'' are completely the same thing. \section{Constants} There are two types of constants numeric constants and character constants. Numeric constants consist of a sequence of digits allowed for the numeric base used and followed by the radix specifier. If the number begins with a letter, there must be the zero digit placed before the number. For example ``abh'' is not valid numeric constant, but ``0abh'' is. Character constants consist of sequence of one or more characters enclosed by quote character (\verb"'"). C escape sequences can be used in character constants. If you want to place quote character (\verb"'") into the constant, you can either place two quotes instead of one (``\verb"''''"'') or escape the quote, that means place backslash ``\\\\'' before it. There is significant difference between single character constant and multiple character one. Single character constant is regarded by assembler as 8 bin integer number and multiple character constant is a string, a sequence of characters. Since version 1.4.1 it is possible to use prefix ``0x'' (and ``0X'') as radix specifier for hexadecimal numbers, so ``0xaf'' is the same as ``0afh'', etc. \begin{table}[h!] \mysmallfont{} \centering{} \begin{tabular}{|l|l|l|} \hline Constant type & Allowed digits & Radix specifier \\ \hline Binary & 0 .. 1 & B \\ Octal & 0 .. 7 & O or Q \\ Decimal & 0 .. 9 & D or none \\ Hexadecimal & 0 .. 9, A .. F & H \\ \hline \end{tabular} \caption{Radix specifiers} \end{table} \begin{code}[h!] \mysmallfont{} {\color{highlight_comment}\verb'; These are the same number'}\\ {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_bin}\verb'100111b'}\verb' '{\color{highlight_comment}\verb'; Binary'}\\ {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_oct}\verb'47q'}\verb' '{\color{highlight_comment}\verb'; Octal'}\\ {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_dec}\verb'39d'}\verb' '{\color{highlight_comment}\verb'; Decimal'}\\ {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_hex}\verb'27h'}\verb' '{\color{highlight_comment}\verb'; Hexadecimal'}\\ {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_string}\verb''\verb"'"\verb''\verb"'"\verb''\verb"'"\verb''\verb"'"\verb''}\verb' '{\color{highlight_comment}\verb'; Character'}\\ \verb''\\ {\color{highlight_comment}\verb'; This is an example of string'}\\ {\color{highlight_directive}\verb'db'}\verb' '{\color{highlight_string}\verb''\verb"'"\verb'string'\verb"'"\verb''}\verb' '{\color{highlight_comment}\verb'; String'}\\ % Caption \caption{An example of constants} \end{code} \section{Expressions} Arithmetical expressions are evaluated at compilation time and replaced by assembler with constant corresponding the their resulting value. Expressions comprises of arithmetical operators, constants, symbols and another expressions. An example of such expression might be \texttt{(~X~XOR~0FF00H~)} \begin{table}[h!] \mysmallfont{} \centering{} \begin{tabular}{|l|l|l|} \hline Operator & Description & Example \\\hline \multicolumn{3}{|l|}{\textbf{Unary Operators}} \\\hline NOT & one's complement & NOT 0a55ah \\\hline HIGH & high order byte & HIGH 0a55ah \\\hline LOW & low order byte & LOW 0a55ah \\\hline \multicolumn{3}{|l|}{\textbf{Binary Operators}} \\\hline + & unsigned addition & 11 + 12 \\\hline - & unsigned subtraction & 13 + 11 \\\hline * & unsigned multiplication & 3 * 5 \\\hline / & unsigned division & 20 / 4 \\\hline MOD & unsigned remainder & 21 MOD 4 \\\hline SHL & logical shift left & 32 SHL 2 \\\hline SHR & logical shift right & 32 SHR 2 \\\hline AND & logical and & 48 AND 16 \\\hline OR & logical or & 370q OR 7 \\\hline XOR & exclusive or & 00fh XOR 005h \\\hline . & bit operator & P1.4 \\\hline EQ, = & equal to & 11 EQ 11 \\\hline NE, <> & not equal to & 11 NE 11 \\\hline LT, < & less than & 11 LT 12 \\\hline LE, <= & less or equal than & 11 LT 11 \\\hline GT, > & greater than & 12 GT 11 \\\hline GE, >= & greater or equal than & 12 GT 11 \\\hline \end{tabular} \caption{Expression operators} \end{table} \begin{code}[h!] \mysmallfont{} {\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_directive}\verb'EQU'}\verb' '{\color{highlight_symbol}\verb'('}\verb' '{\color{highlight_unknown_base}\verb'2000'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'3'}\verb' '{\color{highlight_symbol}\verb'/'}\verb' '{\color{highlight_unknown_base}\verb'100'}\verb' '{\color{highlight_symbol}\verb')'}\\ {\color{highlight_constant}\verb'xyz'}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_symbol}\verb'( LOW'}\verb' '{\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_symbol}\verb')'}\\ {\color{highlight_directive}\verb'IF'}\verb' '{\color{highlight_symbol}\verb'('}\verb' '{\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_symbol}\verb'>'}\verb' '{\color{highlight_symbol}\verb'('}\verb' '{\color{highlight_unknown_base}\verb'5'}{\color{highlight_symbol}\verb' MOD'}\verb' '{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb')'}\verb' '{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_symbol}\verb'#'}\verb' '{\color{highlight_symbol}\verb'('}\verb' '{\color{highlight_symbol}\verb'('}\verb' '{\color{highlight_hex}\verb'15h'}{\color{highlight_symbol}\verb' XOR'}\verb' '{\color{highlight_unknown_base}\verb'12'}\verb' '{\color{highlight_symbol}\verb') OR'}\verb' '{\color{highlight_constant}\verb'xyz'}\verb' '{\color{highlight_symbol}\verb')'}\\ {\color{highlight_directive}\verb'ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'ADDC'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_symbol}\verb'#'}\verb' '{\color{highlight_symbol}\verb'( HIGH'}\verb' '{\color{highlight_hex}\verb'1234h'}\verb' '{\color{highlight_symbol}\verb')'}\\ {\color{highlight_directive}\verb'ENDIF'} % Caption \caption{An example of expressions} \end{code} \section{The instruction set processing} This assembler is capable of translating all 8051 instructions with all possible sets of operands. And extends this set with 2 pseudo-instructions: ``CALL'' and ``JMP'' which do not stand for any operation code, but are translated according to the used operand. ``CALL'' can be translated as ``ACALL'' or ``LCALL'', ``JMP addr'' can be translated as ``SJMP'', ``AJMP'' or ``LJMP''. \twocolumn \section{Assembler directives} \begin{description} \mysmallfont{} \item[ifn] IF Not, conditional assembly\\ Syntax:\\ \verb' '{\color{highlight_directive}\verb'IFN'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IF'}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_constant}\verb'CND'}{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[ifdef] IF DEFined\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'IFDEF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'symbol'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IFDEF'}\verb' '{\color{highlight_constant}\verb'CND'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[ifndef] IF Not DEFined\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'IFNDEF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'symbol'}{\color{highlight_symbol}\verb'>'}\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IFNDEF'}\verb' '{\color{highlight_constant}\verb'CND'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[rept] REPeaT Macro\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'REPT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'REPT'}\verb' '{\color{highlight_unknown_base}\verb'5'}\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \verb' '{\color{highlight_directive}\verb'ENDM'}\\ \item[times] REPeaT Macro\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'TIMES'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'TIMES'}\verb' '{\color{highlight_unknown_base}\verb'5'}\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \verb' '{\color{highlight_directive}\verb'ENDM'}\\ \item[if] Conditional assembly\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'IF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IF'}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_constant}\verb'CND'}{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[else] Conditional assembly\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'ELSE'}\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IF'}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_constant}\verb'CND'}{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[elseif] Conditional assembly\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IF'}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_constant}\verb'CND'}{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_constant}\verb'SOMETHING_ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[elseifn] Conditional assembly\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IF'}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_constant}\verb'CND'}{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_constant}\verb'SOMETHING_ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[elseifdef] Conditional assembly\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IF'}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_constant}\verb'CND'}{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSEIFDEF'}\verb' '{\color{highlight_constant}\verb'SOMETHING_ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[elseifndef] Conditional assembly\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IF'}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_constant}\verb'CND'}{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSEIFNDEF'}\verb' '{\color{highlight_constant}\verb'SOMETHING_ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[endif] Conditional assembly\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'IF'}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'-'}\verb' '{\color{highlight_constant}\verb'CND'}{\color{highlight_symbol}\verb')'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\ \verb' '{\color{highlight_directive}\verb'ELSE'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\ \verb' '{\color{highlight_directive}\verb'ENDIF'}\\ \item[endm] END of Macro definition\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'ENDM'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_macro}\verb'ABC'}\verb' '{\color{highlight_directive}\verb'MACRO'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'B'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#12d'}\\ \verb' '{\color{highlight_directive}\verb'ENDM'}\\ \item[end] END of the program\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'END'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'END'}\\ \item[list] enable code LISTing\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'LIST'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \verb' '{\color{highlight_directive}\verb'NOLIST'}\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \verb' '{\color{highlight_directive}\verb'LIST'}\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \item[nolist] disabled code listing\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'NOLIST'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \verb' '{\color{highlight_directive}\verb'NOLIST'}\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \verb' '{\color{highlight_directive}\verb'LIST'}\\ \verb' '{\color{highlight_instruction}\verb'NOP'}\\ \item[dseg] switch to DATA segment [at address]\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'DSEG'}\verb' '{\color{highlight_constant}\verb'[AT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}{\color{highlight_constant}\verb']'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'DSEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'20d'}\\ \item[iseg] switch to IDATA segment [at address]\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'ISEG'}\verb' '{\color{highlight_constant}\verb'[AT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}{\color{highlight_constant}\verb']'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'ISEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'10d'}\\ \item[bseg] switch to BIT segment [at address]\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'BSEG'}\verb' '{\color{highlight_constant}\verb'[AT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}{\color{highlight_constant}\verb']'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'BSEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'5d'}\\ \item[xseg] switch to XDATA segment [at address]\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'XSEG'}\verb' '{\color{highlight_constant}\verb'[AT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}{\color{highlight_constant}\verb']'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'XSEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'30d'}\\ \item[cseg] switch to CODE segment [at address]\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'CSEG'}\verb' '{\color{highlight_constant}\verb'[AT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}{\color{highlight_constant}\verb']'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'CSEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'40d'}\\ \item[flag] define a FLAG bit\\ Syntax:\\\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'FLAG'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_constant}\verb'F4'}\verb' '{\color{highlight_directive}\verb'FLAG'}\verb' '{\color{highlight_hex}\verb'16h'}\\ \verb''\\ {\color{highlight_label}\verb'Note:'}\\ \verb' '{\color{highlight_macro}\verb'Deprecated'}\verb' '{\color{highlight_constant}\verb'directive. Consider directive BIT instead.}'}\\ \item[skip] SKIP bytes in the code memory\\ Syntax:\\\\ \verb' '{\color{highlight_directive}\verb'SKIP'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_directive}\verb'SKIP'}\verb' '{\color{highlight_unknown_base}\verb'5'}\\ \item[equ] EQUivalent\\ Syntax:\\\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'EQU'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_constant}\verb'ABC'}\verb' '{\color{highlight_directive}\verb'EQU'}\verb' '{\color{highlight_sfr}\verb'R0'}\\ \verb' '{\color{highlight_constant}\verb'XYZ'}\verb' '{\color{highlight_directive}\verb'EQU'}\verb' '{\color{highlight_hex}\verb'4Eh'}{\color{highlight_symbol}\verb'+'}{\color{highlight_unknown_base}\verb'12'}\\ \item[bit] define BIT address\\ Syntax:\\\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'BIT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_constant}\verb'ABC'}\verb' '{\color{highlight_directive}\verb'BIT'}\verb' '{\color{highlight_sfr}\verb'P4'}{\color{highlight_symbol}\verb'.'}{\color{highlight_unknown_base}\verb'5'}\\ \item[set] SET numeric variable or variable register\\ Syntax:\\\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'register'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_constant}\verb'ALPHA'}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_sfr}\verb'R0'}\\ \verb' '{\color{highlight_constant}\verb'ALPHA'}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_unknown_base}\verb'42'}{\color{highlight_symbol}\verb'*'}{\color{highlight_constant}\verb'BETA'}\\ \item[code] define address in the CODE memory\\ Syntax:\\\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'CODE'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ \verb''\\ Example:\\ \verb' '{\color{highlight_constant}\verb'TBL'}\verb' '{\color{highlight_directive}\verb'CODE'}\verb' '{\color{highlight_hex}\verb'600h'}\\ \item[data] define address in the DATA memory\\ Syntax:\\\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ Example:\\ \verb' '{\color{highlight_constant}\verb'UIV'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_hex}\verb'20h'}\\ \item[idata] define address in the Internal DATA memory\\ Syntax:\\\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'IDATA'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ Example:\\ \verb' '{\color{highlight_constant}\verb'UIV'}\verb' '{\color{highlight_directive}\verb'IDATA'}\verb' '{\color{highlight_hex}\verb'20h'}\\ \item[xdata] define address in the External DATA memory\\ Syntax:\\\\ \verb' '{\color{highlight_constant}\verb''}\verb' '{\color{highlight_directive}\verb'XDATA'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\ Example:\\ \verb' '{\color{highlight_constant}\verb'UIV'}\verb' '{\color{highlight_directive}\verb'XDATA'}\verb' '{\color{highlight_hex}\verb'400h'}\\ \item[macro] MACRO definition\\ Syntax:\\\\ \verb' '{\color{highlight_macro}\verb''}\verb' '{\color{highlight_directive}\verb'MACRO'}\verb' '{\color{highlight_constant}\verb'[ ['}{\color{highlight_oper_sep}\verb','}{\color{highlight_constant}\verb' ... ]'}\\ Example:\\ \verb' '{\color{highlight_macro}\verb'ABC'}\verb' '{\color{highlight_directive}\verb'MACRO'}\verb' '{\color{highlight_constant}\verb'X'}\\ \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_constant}\verb'X'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#12d'}\\ \verb' '{\color{highlight_directive}\verb'ENDM'}\\ \item[local] define a LOCAL label inside a macro\\ Syntax:\\ \verb' '{\color{highlight_directive}\verb'LOCAL'}\verb' '{\color{highlight_label}\verb'