Debian Codegraph @

doc/handbook/mcu8051ide.en.tex

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 \documentclass[a4paper,twoside,12pt]{book}
2 \usepackage[utf8]{inputenc}
3
4 \title{MCU 8051 IDE handbook}
5 \author{Martin Ošmera <[email protected]>}
6
7 \newcommand{\mysubject}{MCU~8051~IDE handbook}
8 \newcommand{\mykeywords}{8051, IDE, Linux}
9
10 % \usepackage[light,condensed,math]{iwona}
11
12 %\usepackage{lmodern}
13 %\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif
14
15 \usepackage[T1]{fontenc}
16 \usepackage{float}
17 \usepackage{graphicx}
18 \usepackage{fancyhdr}
19 \usepackage{longtable}
20 \usepackage[usenames,dvipsnames]{color}
21 \usepackage{pifont}
22 \usepackage{wrapfig}
23 \usepackage[footnotesize,bf]{caption}
24 \usepackage[pdftex,colorlinks=true,linkcolor=blue,urlcolor=blue,pdftitle={\title{}},pdfauthor={\author{}},pdfsubject={\mysubject{}},pdfkeywords={\mykeywords{}},bookmarksopen=false,pdfpagemode=None]{hyperref}
25
26 \floatstyle{ruled}
27 \newfloat{code}{thp}{lop}
28 \floatname{code}{Code}
29
30 \definecolor{highlight_constant}{rgb}{0.333, 0.666, 0.0}
31 \definecolor{highlight_unknown_base}{rgb}{0.533, 0.133, 0.133}
32 \definecolor{highlight_comment}{rgb}{0.533, 0.533, 0.533}
33 \definecolor{highlight_symbol}{rgb}{0.666, 0.0, 1.0}
34 \definecolor{highlight_oper_sep}{rgb}{0.866, 0.533, 0.0}
35 \definecolor{highlight_directive}{rgb}{0.533, 0.533, 1.0}
36 \definecolor{highlight_label}{rgb}{0.533, 0.333, 0.0}
37 \definecolor{highlight_instruction}{rgb}{0.0, 0.0, 1.0}
38 \definecolor{highlight_sfr}{rgb}{0.0, 0.0, 0.866}
39 \definecolor{highlight_indirect}{rgb}{0.866, 0.0, 0.0}
40 \definecolor{highlight_imm_hex}{rgb}{0.666, 0.0, 0.866}
41 \definecolor{highlight_macro}{rgb}{0.8, 0.0, 0.866}
42 \definecolor{highlight_imm_dec}{rgb}{0.0, 0.533, 0.866}
43 \definecolor{highlight_hex}{rgb}{0.533, 0.0, 0.733}
44 \definecolor{highlight_oct}{rgb}{0.533, 0.0, 0.0}
45 \definecolor{highlight_dec}{rgb}{0.0, 0.333, 0.666}
46 \definecolor{highlight_bin}{rgb}{0.2, 0.2, 0.333}
47 \definecolor{highlight_string}{rgb}{0.533, 0.533, 0.0}
48 \definecolor{highlight_control}{rgb}{1.0, 0.0, 0.0}
49 \definecolor{highlight_imm_oct}{rgb}{0.666, 0.0, 0.0}
50 \definecolor{highlight_imm_bin}{rgb}{0.333, 0.333, 0.666}
51 \definecolor{highlight_char}{rgb}{0.0, 1.0, 1.0}
52 \definecolor{highlight_imm_constant}{rgb}{0.937, 0.737, 0.168}
53 \definecolor{highlight_imm_unknown}{rgb}{0.666, 0.2, 0.2}
54 \definecolor{highlight_lst_number}{rgb}{0.0, 0.882, 1.0}
55 \definecolor{highlight_lst_code}{rgb}{1.0, 0.2, 0.968}
56 \definecolor{highlight_lst_address}{rgb}{0.349, 0.356, 1.0}
57 \definecolor{highlight_lst_line}{rgb}{0.074, 0.003, 0.513}
58 \definecolor{highlight_lst_macro}{rgb}{0.533, 0.533, 0.533}
59 \definecolor{highlight_lst_include}{rgb}{0.533, 0.533, 0.533}
60 \definecolor{highlight_lst_msg}{rgb}{0.0, 0.0, 0.0}
61
62 \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ \MakeUppercase{#1}}{}}
63 \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
64
65 \newcommand{\menuitem}[1]{\texttt{#1}}
66 \newcommand{\fileextension}[1]{\texttt{#1}}
67 \newcommand{\mysmallfont}{\fontsize{8pt}{10pt} \selectfont{}}
68 \newcommand{\uC}{$\mu$C }
69
70 \pdfadjustspacing=1
71 \raggedbottom
72
73 \pagestyle{fancy}
74 \fancyhf{}
75 \fancyhead[EL,OR]{\bfseries\thepage}
76 \fancyhead[LO]{\bfseries\rightmark}
77 \fancyhead[RE]{\bfseries\leftmark}
78
79 \fancypagestyle{plain}{
80 \fancyhead{}
81 \fancyhead[EL,OR]{\bfseries\thepage}
82 \renewcommand{\headrulewidth}{0pt}
83 }
84
85
86
87 \begin{document}
88 \maketitle
89 \thanks{
90 I would like to thank to the following people for their support during the project development:
91
92 \begin{itemize}
93 \item \textbf{Andre Cunha}~\textit{(Brazil)} for review of this document.
94 \item \textbf{Yuanhui Zhang}~\textit{(China)} for bug reports and help with debugging.
95 \item \textbf{Kara Blackowiak}~\textit{(USA)} for certain code reviews.
96 \item \textbf{Marek Nožka}~\textit{(Moravia, CZ, EU)} for help with debugging.
97 \item \textbf{Kostya V. Ivanov}~\textit{(Russia)} for bug fixes in the simulator engine.
98 \item \textbf{Shakthi Kannan}~\textit{(India)} for adding this software to the FEL project and for a few patches.
99 \item \textbf{Trevor Spiteri}~ for help with debugging (patches) the HD44780 simulator.
100 \item \textbf{Miroslav Hradílek}~\textit{(EU)} for bug reports and suggestions
101 \item \textbf{Fabricio Alcalde}~\textit{(Argentina)} for suggestions and bug reports.
102 \item \textbf{Francisco Albani}~\textit{(Argentina)} for suggestions and a few bug reports.
103 \end{itemize}
104 }
105
106 \tableofcontents
107 \newpage
108
109 \chapter*{Preface}
110 \addcontentsline{toc}{chapter}{Preface}
111 \section*{Goals of the project}
112 \addcontentsline{toc}{section}{Goals of the project}
113 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
114 people with common interest, in this case 8051.
115
116 \subsection*{MCU 8051 IDE should offer:}
117 \begin{dingautolist}{172}
118 \setlength{\itemsep}{-3pt}
119 \item A transparent view on a simulated program for 8051;
120 \item Easy source code editing even for an user with small knowledge of the assembly language;
121 \item User friendly advanced IDE for MCS-51.
122 \end{dingautolist}
123
124 \subsection*{List of the most important parts of MCU 8051 IDE:}
125 \begin{dinglist}{43}
126 \setlength{\itemsep}{-3pt}
127 \item Source code editor;
128 \item Optimization capable macro-assembler;
129 \item Advanced MCU simulator;
130 \item Hexadecimal editor;
131 \item Interface for hardware tool control plug-ins;
132 \item Scientific calculator and special calculator optimized for 8051.
133 \end{dinglist}
134
135 \section*{Requirements}
136 \addcontentsline{toc}{section}{Requirements}
137 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).
138 \begin{table}[h]
139 \centering{}
140 \mysmallfont{}
141 \begin{tabular}{|l|c|l|}
142 \hline
143 \textbf{Package} & \textbf{Min. version} & \textbf{Download location} \\\hline
144 \multicolumn{2}{|l}{\textbf{Required packages:}}
145 & (The IDE will not run without these packages) \\\hline
146 tcl & 8.5 & \url{http://www.tcl.tk/software/tcltk/downloadnow85.html} \\\hline
147 tk & 8.5 & \url{http://www.tcl.tk/software/tcltk/downloadnow85.html} \\\hline
148 bwidget & 1.8 & \url{http://sourceforge.net/projects/tcllib} \\\hline
149 itcl & 3.4 & \url{http://sourceforge.net/projects/incrtcl} \\\hline
150 tdom & 0.8 & \url{http://www.tdom.org} \\\hline
151 tkimg & 1.3 & \url{http://sourceforge.net/projects/tkimg} \\\hline
152 tcllib & 1.6 & \url{http://sourceforge.net/projects/tcllib} \\\hline
153
154 \multicolumn{2}{|l}{\textbf{Optional packages:}}
155 & (Functionality might be unnecessarily limited without these packages) \\\hline
156 Tclx & 8.4 & \url{http://tclx.sourceforge.net} \\
157 & \multicolumn{2}{l|}{\textit{(Signal handling (signals like SIGINT)}} \\\hline
158 cmake & 2.6 & \url{http://www.cmake.org/HTML/Download.html} \\
159 & \multicolumn{2}{l|}{
160 \textit{(If you prefer this way of installation:}
161 \texttt{``./configure \&\& make \&\& make install''})
162 } \\\hline
163 rxvt-unicode & 8.3 & \url{http://software.schmorp.de} \\\hline
164 & \multicolumn{2}{l|}{\textit{(If you want terminal emulator)}} \\\hline
165 asem-51 & 1.3 & \url{http://plit.de/asem-51/download.htm} \\\hline
166 & \multicolumn{2}{l|}{\textit{(If you want to use a really good assembler :) )}} \\\hline
167 sdcc & 2.9 & \url{http://sdcc.sourceforge.net/} \\\hline
168 & \multicolumn{2}{l|}{\textit{(If you want to used C language compiler)}} \\\hline
169 doxygen & 1.3 & \url{www.doxygen.org/} \\\hline
170 & \multicolumn{2}{l|}{\textit{(If you want to use doxygen directly from the IDE)}} \\\hline
171 indent & 1.2 & \url{http://www.gnu.org/software/indent/} \\\hline
172 & \multicolumn{2}{l|}{\textit{(If you want to use auto-indent function for C language)}}\\\hline
173 hunspell & 1.2 & \url{http://hunspell.sourceforge.net} \\\hline
174 & \multicolumn{2}{l|}{\textit{(If you want to have spell checker function available)}} \\\hline
175 bash & 4.0 & \url{http://tiswww.case.edu/php/chet/bash/bashtop.html} \\\hline
176 & \multicolumn{2}{l|}{\textit{(If you want to have spell checker function available)}} \\\hline
177 gawk & 3.1 & \url{http://www.gnu.org/software/gawk/} \\\hline
178 & \multicolumn{2}{l|}{\textit{(If you want to have spell checker function available)}} \\\hline
179 \end{tabular}
180 \caption{Software requirements}
181 \end{table}
182
183
184 \section*{Intended Audience}
185 \addcontentsline{toc}{section}{Intended Audience}
186 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.
187 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.
188
189 % 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
190
191 Thanks for your cooperation which helps to make this software better.
192
193 \chapter{Brief introduction}
194
195 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.
196
197 \section{Main components of MCU 8051 IDE}
198 \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.
199
200 \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
201 assembler is capable of generating four kinds of output code:
202 \begin{dinglist}{43}
203 \setlength{\itemsep}{-3pt}
204 \item Object code (machine code) as an hexadecimal file, with \fileextension{.hex} extension and in Intel\textregistered\ 8 HEX format;
205 \item Object code (machine code) as a binary file, with \fileextension{.bin} extension and in format of raw binary data;
206 \item Code listing, in \fileextension{.lst} extension;
207 \item Code for integrated MCU simulator, in \fileextension{.adf} extension.
208 \end{dinglist}
209
210 \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
211 really sorry.
212 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
213 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.
214
215 \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.
216
217 \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.
218
219 \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.
220
221 \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.
222
223 \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/}.
224
225 \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.
226
227 \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.
228
229 \section{What is MCS-51}
230 \begin{wrapfigure}{r}{120pt}
231 \centering{}
232 \includegraphics[width=110pt]{img/545px-Intel_8051_arch.png}
233 \caption{i8051 micro-architecture}
234 \end{wrapfigure}
235 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.
236 \enlargethispage{10\baselineskip}
237
238 \section{What is the Assembly language}
239 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.
240
241 Here is an example of how a piece of 8051 assembly code looks like:
242 \begin{code}[h]
243 \mysmallfont{}
244 {\color{highlight_label}\verb' main:'}\\
245 {\color{highlight_directive}\verb' if'}\verb' '{\color{highlight_constant}\verb'test'}\verb''{\color{highlight_symbol}\verb'='}\verb''{\color{highlight_unknown_base}\verb'2'}\\
246 \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'}\\
247 \verb' '{\color{highlight_comment}\verb'; Configure EEPROM'}\\
248 \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'}\\
249 \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\
250 {\color{highlight_directive}\verb' endif'}\\
251 {\color{highlight_label}\verb' X0MI:'}\\
252 \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')'}\\
253 \verb' '{\color{highlight_instruction}\verb'movx'}\verb' '{\color{highlight_indirect}\verb'@R0'}\verb''{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'A'}
254 \caption{An example piece of code written in 8051 assembly language}
255 \end{code}
256
257 \chapter{Quick start}
258 \section{Demonstration project}
259 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''.
260 \begin{figure}[h!]
261 \centering{}
262 \includegraphics[width=\textwidth]{img/024.png}
263 \caption{MCU~8051~IDE with the demonstration project opened within it}
264 \end{figure}
265
266 \section{Your first project in MCU~8051~IDE}
267 \begin{wrapfigure}{r}{160pt}
268 \centering{}
269 \includegraphics[width=150pt]{img/025.png}
270 \caption{Project creation dialog}
271 \end{wrapfigure}
272 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.
273
274 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.
275
276 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.
277
278 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''.
279
280 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.
281
282 \chapter{Detailed introduction to GUI}
283 \section{Source code editor}
284 \subsection{Syntax highlight and validation}
285 \begin{wrapfigure}{r}{100pt}
286 \centering{}
287 \includegraphics[width=90pt]{img/036.png}
288 \caption{Syntax validation configuration button}
289 \end{wrapfigure}
290 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.
291 There are three levels of syntax validation:\\
292 \begin{itemize}
293 \item 0: Disabled
294 \item 1: Fast basic validation
295 \item 2: Slow advanced validation
296 \end{itemize}
297 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.
298 \subsection{Spell checking}
299 \begin{wrapfigure}{l}{100pt}
300 \centering{}
301 \includegraphics[width=90pt]{img/037.png}
302 \caption{Spell checker configuration button}
303 \end{wrapfigure}
304 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.
305 \subsection{Auto-completion}
306 \begin{wrapfigure}{r}{180pt}
307 \centering{}
308 \includegraphics[width=170pt]{img/038.png}
309 \caption{Syntax highlight, syntax validation and the pop-up based auto-completion all in action}
310 \end{wrapfigure}
311 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.
312 \subsection{Editor command line}
313 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.
314 {
315 \mysmallfont{}
316 \begin{longtable}{l|ll}
317 \textbf{Command} & \textbf{Arguments} & \textbf{Description} \\\hline
318 \endhead
319 \texttt{d2h} & <decimal number> & Convert decimal number into hexadecimal \\
320 \texttt{d2o} & <decimal number> & Convert decimal number into octal \\
321 \texttt{d2b} & <decimal number> & Convert decimal number into binary \\
322 \texttt{h2d} & <hexadecimal number> & Convert hexadecimal number into decimal \\
323 \texttt{h2o} & <hexadecimal number> & Convert hexadecimal number into octal \\
324 \texttt{h2b} & <hexadecimal number> & Convert hexadecimal number into binary \\
325 \texttt{o2h} & <octal number> & Convert octal number into hexadecimal \\
326 \texttt{o2d} & <octal number> & Convert octal number into decimal \\
327 \texttt{o2b} & <octal number> & Convert octal number into binary \\
328 \texttt{b2h} & <binary number> & Convert binary number into hexadecimal \\
329 \texttt{b2d} & <binary number> & Convert binary number into decimal \\
330 \texttt{b2o} & <binary number> & Convert binary number into octal \\
331 \texttt{animate} & & Animate simulated program \\
332 \texttt{assemble} & & Run assembler \\
333 \texttt{auto-indent} & & Automatically indent the edited code \\
334 \texttt{bookmark} & & Create or delete bookmark on the current line \\
335 \texttt{breakpoint} & & Create or delete breakpoint on the current line \\
336 \texttt{capitalize} & & Capitalize selected text \\
337 \texttt{clear} & & Clear history \\
338 \texttt{comment} & & Comment selection \\
339 \texttt{copy} & & Copy selection \\
340 \texttt{custom} & <command number> & Run user command \\
341 \texttt{cut} & & Cut selection \\
342 \texttt{date} & <date format> & Insert current time and/or date \\
343 \texttt{exit} & & Leave command line \\
344 \texttt{exit-program} & & Exit the IDE \\
345 \texttt{find} & <string> & Find a string \\
346 \texttt{goto} & <line number> & Go to the specified line \\
347 \texttt{help} & <command name> & Display help for the specified command \\
348 \texttt{char} & <character code> & Insert a character \\
349 \texttt{indent} & & Indent selection \\
350 \texttt{kill-line} & & Delete current line \\
351 \texttt{open} & <file name> & Open the specified file \\
352 \texttt{paste} & & Paste text from clipboard \\
353 \texttt{redo} & & Take back last undo \\
354 \texttt{reload} & & Reload current document \\
355 \texttt{replace} & <string> <replacement>& Replace a string with another string \\
356 \texttt{run} & & Run simulator in animation mode \\
357 \texttt{save} & & Save the current file \\
358 \texttt{set-icon-border}& & Show/Hide icon border \\
359 \texttt{set-line-numbers}& & Show/Hide line numbers \\
360 \texttt{sim} & & Engage/Disengage simulator \\
361 \texttt{step} & & Step simulated program \\
362 \texttt{tolower} & & Convert selected text to lowercase \\
363 \texttt{toupper} & & Convert selected text to uppercase \\
364 \texttt{uncomment} & & Comment current line \\
365 \texttt{undo} & & Undo the last text editing operation \\
366 \texttt{unindent} & & Decrease indentation level of the current line \\
367 \texttt{hibernate} & [<target file>] & Hibernate simulated program \\
368 \texttt{resume} & [<source file>] & Resume hibernated program \\
369 \texttt{switch-mcu} & <MCU name> & Switch current MCU simulation mode to another MCU \\
370 \texttt{set-xcode} & <size of XCODE mem.> & Set size external data memory for simulated MCU \\
371 \texttt{set-xdata} & <size of XDATA mem.> & Set size external program memory for simulated MCU \\
372 % Caption:
373 \caption{Available commands}
374 \end{longtable}
375 }
376
377 \section{Bottom panel}
378 \subsection{Main panel of the MCU simulator}
379 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.
380 \begin{figure}[h!]
381 \centering{}
382 \caption{Main panel of the simulator}
383 \includegraphics[width=\textwidth]{img/001.png}
384 \end{figure}
385 \begin{figure}[h!]
386 \begin{minipage}[b]{.3\textwidth}
387 \centering{}
388 \includegraphics[width=50pt]{img/002.png}
389 \caption{Highlighted SFR register}
390 \end{minipage}
391 \begin{minipage}[b]{.3\textwidth}
392 \centering{}
393 \includegraphics[width=130pt]{img/003.png}
394 \caption{Tool tip help for a special function bit}
395 \end{minipage}
396 \begin{minipage}[b]{.3\textwidth}
397 \centering{}
398 \includegraphics[width=50pt]{img/004.png}
399 \caption{Representation of a register value in various numeric bases}
400 \end{minipage}
401 \end{figure}
402
403 \subsection{C variables}
404 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.
405
406 \subsection{Graph showing voltage levels}
407 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.
408 \begin{figure}[h!]
409 \centering{}
410 \includegraphics[width=\textwidth]{img/005.png}
411 \caption{GPIO Graph}
412 \end{figure}
413
414 \subsection{Messages panel}
415 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.
416 \begin{figure}[h!]
417 \centering{}
418 \includegraphics[width=\textwidth]{img/007.png}
419 \caption{Messages panel}
420 \end{figure}
421
422 \subsection{Notes}
423 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.
424 \begin{figure}[h!]
425 \centering{}
426 \includegraphics[width=\textwidth]{img/006.png}
427 \caption{Personal notes}
428 \end{figure}
429
430 \subsection{Calculator}
431 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.}
432 \begin{figure}[h!]
433 \centering{}
434 \includegraphics[width=\textwidth]{img/009.png}
435 \caption{Calculator}
436 \end{figure}
437
438 \subsection{Find in files}
439 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.
440
441 \subsection{Terminal emulator}
442 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.
443 \begin{figure}[h!]
444 \centering{}
445 \includegraphics[width=\textwidth]{img/031.png}
446 \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}
447 \end{figure}
448
449 \section{Left panel}
450 \subsection{List of opened files}
451 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.
452
453 \subsection{List of project files}
454 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.
455
456 \subsection{SFR watches}
457 \begin{wrapfigure}{l}{130pt}
458 \centering{}
459 \includegraphics[width=110pt]{img/032.png}
460 \caption{SFR watches}
461 \end{wrapfigure}
462 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.
463
464 \subsection{File system browser}
465 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.
466
467 \section{Right panel}
468 \subsection{List of bookmarks}
469 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.
470
471 \subsection{List of breakpoints}
472 Pretty much the same as list of bookmarks, but this panel shows breakpoints instead of bookmarks, that is the only difference.
473
474 \subsection{Instruction details}
475 \begin{wrapfigure}{r}{210pt}
476 \centering{}
477 \includegraphics[width=200pt]{img/008.png}
478 \caption{Instruction details}
479 \end{wrapfigure}
480 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.
481
482 \subsection{Data register watches}
483 \begin{wrapfigure}{l}{130pt}
484 \centering{}
485 \includegraphics[width=120pt]{img/033.png}
486 \caption{Data register watches}
487 \end{wrapfigure}
488 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.
489
490 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}}.
491
492 Memory segments are distinguished by format of the addresses. As you can seen in the example, the meaning is this:
493 \begin{table}[h!]
494 \mysmallfont{}
495 \centering{}
496 \begin{tabular}{l|l}
497 \textbf{Address format} & \textbf{Memory segment} \\
498 \hline
499 1 or 2 digits & Internal RAM (not SFR) \\
500 3 digits & Expanded RAM \\
501 4 digits & External RAM \\
502 dot and 2 digits & Bit (including SFR area) \\
503 \end{tabular}
504 \caption{Data register watches: Register address}
505 \end{table}
506
507 \subsection{Subprograms call monitor}
508 \begin{wrapfigure}{r}{130pt}
509 \centering{}
510 \includegraphics[width=120pt]{img/034.png}
511 \caption{Subprograms call monitor}
512 \end{wrapfigure}
513 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.
514
515 \subsection{List of symbols}
516 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.
517 \begin{table}[h]
518 \mysmallfont{}
519 \centering{}
520 \begin{tabular}{ll}
521 \includegraphics[height=8pt]{img/symbol1.png} & {\color{highlight_label} Label} \\
522 \includegraphics[height=8pt]{img/symbol3.png} & {\color{highlight_constant} Constant} \\
523 \includegraphics[height=8pt]{img/symbol2.png} & {\color{highlight_macro} Macro} \\
524 \includegraphics[height=8pt]{img/symbol4.png} & {\color{black} C variable} \\
525 \includegraphics[height=8pt]{img/symbol0.png} & {\color{blue} C function} \\
526 \includegraphics[height=8pt]{img/symbol5.png} & {\color{black} Other} \\
527 \end{tabular}
528 \caption{Symbol colors and icons in default settings}
529 \end{table}
530
531
532 \subsection{HW plug-ins manager}
533 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}.
534
535 \section{Other tools}
536 \subsection{SFR map}
537 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.
538
539 \subsection{Map of bit addressable area}
540 \begin{wrapfigure}{l}{160pt}
541 \centering{}
542 \includegraphics[width=130pt]{img/017.png}
543 \caption{Map of the bit addressable area}
544 \end{wrapfigure}
545 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.
546
547 \subsection{Stack monitor}
548 \begin{wrapfigure}{r}{90pt}
549 \centering{}
550 \includegraphics[width=80pt]{img/022.png}
551 \caption{Stack monitor}
552 \end{wrapfigure}
553 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.
554
555 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.
556
557 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.
558
559 \subsection{Symbol viewer}
560 \begin{wrapfigure}{l}{160pt}
561 \centering{}
562 \includegraphics[width=140pt]{img/019.png}
563 \caption{Symbol viewer}
564 \end{wrapfigure}
565 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.
566
567 \begin{figure}[h!]
568 \begin{minipage}[t]{.5\textwidth}
569 \centering{}
570 \caption{ASCII chart}
571 \includegraphics[width=.9\textwidth]{img/039.png}
572 \end{minipage}
573 \begin{minipage}[t]{.5\textwidth}
574 \centering{}
575 \caption{8051 Instruction Table}
576 \includegraphics[width=.9\textwidth]{img/040.png}
577 \end{minipage}
578 \end{figure}
579
580 \clearpage
581 \subsection{ASCII chart}
582 Colorful interactive ASCII chart, it may prove handy especially when you are dealing with serial communication and this sort of things.
583
584 \subsection{8051 Instruction Table}
585 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.
586
587 \subsection{8-segment editor}
588 \begin{wrapfigure}{r}{140pt}
589 \centering{}
590 \includegraphics[width=120pt]{img/020.png}
591 \caption{8-segment editor}
592 \end{wrapfigure}
593 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.
594
595 \subsection{Stopwatch}
596 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.
597
598 \subsection{Scribble notepad}
599 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.
600
601 \subsection{Base converter}
602 \begin{wrapfigure}{l}{120pt}
603 \centering{}
604 \includegraphics[width=110pt]{img/021.png}
605 \caption{Base convertor}
606 \end{wrapfigure}
607 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.
608
609 \subsection{RS-232 debugger}
610 \begin{wrapfigure}{r}{190pt}
611 \centering{}
612 \includegraphics[width=180pt]{img/035.png}
613 \caption{UART/RS-232 debugger}
614 \end{wrapfigure}
615 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.
616
617 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).}.
618
619 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}.
620
621 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.
622
623 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.
624
625 \subsection{Hexadecimal editors}
626 \begin{wrapfigure}{l}{200pt}
627 \centering{}
628 \includegraphics[width=190pt]{img/023.png}
629 \caption{MCU code memory editor}
630 \end{wrapfigure}
631 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.
632
633 \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.
634
635 \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.
636
637 \paragraph{MCU eeprom write buffer editor} allows to see and modify EEPROM write buffer. Current EEPROM write offset is displayed as well.
638
639 \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.
640
641 \subsection{Hibernation of simulated program}
642 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.
643
644 \subsection{Interrupt monitor}
645 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.
646 \begin{figure}[h!]
647 \centering{}
648 \includegraphics[width=300pt]{img/018.png}
649 \caption{Interrupt monitor}
650 \end{figure}
651
652 \subsection{Conversions between *.hex, *.bin and *.adf files}
653 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:
654 \begin{itemize}
655 \setlength{\itemsep}{-3pt}
656 \item \includegraphics[height=8pt]{img/hb.png} \textbf{HEX $\rightarrow$ BIN} \\
657 Convert Intel\textregistered 8 Hex file to raw binary file
658 \item \includegraphics[height=8pt]{img/bh.png} \textbf{BIN $\rightarrow$ HEX} \\
659 Convert raw binary file to Intel\textregistered 8 Hex
660 \item \includegraphics[height=8pt]{img/sh.png} \textbf{SIM $\rightarrow$ HEX} \\
661 Convert simulator assembler debug file (\fileextension{.adf}) to Intel\textregistered 8 Hex file
662 \item \includegraphics[height=8pt]{img/sb.png} \textbf{SIM $\rightarrow$ BIN} \\
663 Convert simulator assembler debug file (\fileextension{.adf}) to raw binary file
664 \item \includegraphics[height=8pt]{img/hh.png} \textbf{Normalize Hex} \\
665 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.
666 \end{itemize}
667
668 \subsection{Normalization of source code indentation}
669 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}''.
670
671 \noindent
672 \begin{center}
673 \small{A small example of the auto indent function in action}
674 \end{center}
675 \begin{minipage}{\textwidth}
676 \twocolumn
677 \begin{minipage}[t]{.5\textwidth}
678 \mysmallfont{}
679 \textbf{Original code:}\\
680 \verb' '{\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_hex}\verb'7Fh'}\\
681 \verb' '{\color{highlight_comment}\verb'; Start at address 0x00'}\\
682 \verb' '{\color{highlight_directive}\verb'ORG'}\verb' '{\color{highlight_hex}\verb'0h'}\\
683 \verb' '{\color{highlight_label}\verb'label0:'}{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\
684 \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
685 \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'}\\
686 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0h'}\\
687 \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'label0'}\\
688 \verb' '{\color{highlight_comment}\verb'; End of assembly'}\\
689 \verb' '{\color{highlight_directive}\verb'END'}\\
690 \end{minipage}\begin{minipage}[t]{.5\textwidth}
691 \mysmallfont{}
692 \textbf{Automatically intended code:}\\
693 {\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_hex}\verb'7Fh'}\\
694 \verb' '{\color{highlight_comment}\verb'; Start at address 0x00'}\\
695 \verb' '{\color{highlight_directive}\verb'ORG'}\verb' '{\color{highlight_hex}\verb'0h'}\\
696 {\color{highlight_label}\verb'label0:'}\verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\
697 \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
698 \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'}\\
699 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0h'}\\
700 \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'label0'}\\
701 \verb' '{\color{highlight_comment}\verb'; End of assembly'}\\
702 \verb' '{\color{highlight_directive}\verb'END'}\\
703 \end{minipage}
704 \onecolumn
705 \end{minipage}
706
707 \subsection{Change letter case}
708 \begin{wrapfigure}{r}{150pt}
709 \centering{}
710 \includegraphics[width=140pt]{img/042.png}
711 \caption{Change letter case dialog}
712 \end{wrapfigure}
713 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}''.
714 \begin{itemize}
715 \setlength{\itemsep}{-3pt}
716 \item \includegraphics[height=8pt]{img/up0.png} Convert to uppercase
717 \item \includegraphics[height=8pt]{img/down0.png} Convert to lowercase
718 \item \includegraphics[height=8pt]{img/button_cancel.png} Keep current case
719
720 \end{itemize}
721
722 \subsection{User defined commands}
723 \paragraph{Introduction}
724 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{\%}''.\\
725 \begin{table}[htp]
726 \centering{}
727 \mysmallfont{}
728 \begin{tabular}{|l|l|}
729 \hline
730 \textbf{Pseudo-variable} & \textbf{Meaning} \\
731 \hline
732 \%URL & The full URL of the current file \\
733 \%URLS & List of the URLs of all open documents \\
734 \%directory & Project directory \\
735 \%filename & The file name of the current document \\
736 \%basename & Same as \%filename, but without extension \\
737 \%mainfile & Name of project main file \\
738 \%line & Number of the current line \\
739 \%column & Number of the current column \\
740 \%selection & The selected text in the current file \\
741 \%text & The full text of the current file \\
742 \hline
743 \end{tabular}
744 \caption{List of pseudo-variables}
745 \end{table}
746
747 \paragraph{Configuration}
748 There is specialized configuration dialog for these custom commands.
749 \begin{wrapfigure}{r}{150pt}
750 \centering{}
751 \includegraphics[width=140pt]{img/010.png}
752 \caption{Custom commands configuration dialog}
753 \end{wrapfigure}
754
755 \paragraph{Execution}
756 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.
757
758 \subsection{Clean-up project folder}
759 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}''.
760
761 \subsection{File statistic}
762 Display certain statistical information about the current source code file. ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{File}'' $\rightarrow$ ``\menuitem{File statistic}''.
763
764 \section{Configuration dialogues}
765 Configuration dialogues are graphical tools for customization of this integrated development environment. And they comprises of these components:
766
767 \paragraph{Editor configuration}
768 \begin{wrapfigure}{l}{100pt}
769 \centering{}
770 \includegraphics[width=90pt]{img/027.png}
771 \caption{Editor configuration dialog}
772 \end{wrapfigure}
773 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.
774
775 \paragraph{Compiler configuration}
776 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.
777
778 Currently supported external assemblers are these:
779 \begin{itemize}
780 \setlength{\itemsep}{-3pt}
781 \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}}
782 \item ASL \footnote{Available at http://linux.maruhn.com/sec/asl.html}
783 \item AS51 \footnote{Available at http://www.pjrc.com/tech/8051}
784 \end{itemize}
785
786 How to link multiple files when using C language:\footnote{This feature is not yet supported on MS Windows.}
787 \begin{enumerate}
788 \item Write makefile,
789 \item set the IDE to use your makefile instead of calling the C compiler directly (Configuration -> Compiler~configuration -> GNU~make~utility),
790 \item start compilation as usual.
791 \end{enumerate}
792
793 \paragraph{Simulator configuration}
794 Simulator configuration dialog configures these:
795 \begin{enumerate}
796 \item How to treat indeterminable values in simulator engine
797 \item How many steps will be remembered during the simulation for later backward steps.
798 \item What warning conditions will be ignored during the simulation
799 \end{enumerate}
800
801 \paragraph{Right panel configuration}
802 Configures colors used in tools ``Instruction details'' and ``Register watches'' in the right panel.
803
804 \paragraph{Main toolbar configuration}
805 Configures contents of main application tool bar.
806 \begin{figure}[h!]
807 \centering{}
808 \includegraphics[width=\textwidth]{img/041.png}
809 \caption{Main toolbar}
810 \end{figure}
811
812 \paragraph{Custom commands configuration}
813 Configures user defined commands, which are essentially Bash scripts. This feature is currently not available on MS\textregistered Windows\textregistered OS.
814
815 \paragraph{Shortcuts configuration}
816 Configures key shortcuts used in the IDE.
817
818 \paragraph{Terminal emulator configuration}
819 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.
820
821 \paragraph{Global MCU~8051~IDE configuration}
822 \begin{wrapfigure}{r}{100pt}
823 \centering{}
824 \includegraphics[width=90pt]{img/028.png}
825 \caption{Global configuration dialog}
826 \end{wrapfigure}
827 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.
828
829 \chapter{Build-in macro-assembler}
830 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.
831
832 \section{Statements}
833 Source code files for this assembler must be text files where lines are formed like these:\\\bigskip
834 {
835 \mysmallfont{}
836 \texttt{}
837 \begin{tabular}[h!]{llll}
838 \verb'[' { \color{highlight_label} label: } \verb']' &
839 \verb'[' { \color{highlight_instruction} instruction } &
840 \verb'[' { \color{highlight_symbol} operand } \verb'[' , { \color{highlight_symbol} operand } \verb'[' , { \color{highlight_symbol} operand } \verb']' \verb']' \verb']' &
841 \verb'[' { \color{highlight_comment} ;comment } \verb']' \\
842
843 \verb'[' { \color{highlight_label} label: } \verb']' &
844 { \color{highlight_directive} directive } &
845 \verb'[' { \color{highlight_symbol} argument } \verb']' &
846 \verb'[' { \color{highlight_comment} ;comment } \verb']' \\
847
848 { \color{highlight_constant} symbol } &
849 { \color{highlight_directive} directive } &
850 { \color{highlight_symbol} argument } &
851 \verb'[' { \color{highlight_comment} ;comment } \verb']' \\
852 \end{tabular}
853 }
854 \bigskip
855
856 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.
857
858 \begin{code}[h!]
859 \mysmallfont{}
860 {\color{highlight_label}\verb'start:'}\verb' '{\color{highlight_comment}\verb'; Start timer 0 in mode 2'}\\
861 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R5'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0h'}\\
862 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'IE'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0FFh'}\\
863 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'TL0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#255d'}\\
864 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'TMOD'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#03h'}\\
865 \verb' '{\color{highlight_instruction}\verb'setb'}\verb' '{\color{highlight_sfr}\verb'TR0'}\\
866 \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'main'}\\
867 \verb''\\
868 {\color{highlight_comment}\verb'; Main loop'}\\
869 {\color{highlight_label}\verb'main:'}\verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'$'}\verb' '{\color{highlight_comment}\verb'; Inifinite loop'}\\
870 \verb''\\
871 {\color{highlight_comment}\verb'; Program end'}\\
872 \verb' '{\color{highlight_directive}\verb'end'}\\
873
874 % Caption
875 \caption{An example of well formed assembly language code}
876 \end{code}
877
878 \section{Symbols}
879 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.
880
881 \section{Constants}
882 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
883 ``0X'') as radix specifier for hexadecimal numbers, so ``0xaf'' is the same as ``0afh'', etc.
884
885 \begin{table}[h!]
886 \mysmallfont{}
887 \centering{}
888 \begin{tabular}{|l|l|l|}
889 \hline
890 Constant type & Allowed digits & Radix specifier \\
891 \hline
892 Binary & 0 .. 1 & B \\
893 Octal & 0 .. 7 & O or Q \\
894 Decimal & 0 .. 9 & D or none \\
895 Hexadecimal & 0 .. 9, A .. F & H \\
896 \hline
897 \end{tabular}
898 \caption{Radix specifiers}
899 \end{table}
900
901 \begin{code}[h!]
902 \mysmallfont{}
903 {\color{highlight_comment}\verb'; These are the same number'}\\
904 {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_bin}\verb'100111b'}\verb' '{\color{highlight_comment}\verb'; Binary'}\\
905 {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_oct}\verb'47q'}\verb' '{\color{highlight_comment}\verb'; Octal'}\\
906 {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_dec}\verb'39d'}\verb' '{\color{highlight_comment}\verb'; Decimal'}\\
907 {\color{highlight_constant}\verb'a'}\verb' '{\color{highlight_directive}\verb'set'}\verb' '{\color{highlight_hex}\verb'27h'}\verb' '{\color{highlight_comment}\verb'; Hexadecimal'}\\
908 {\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'}\\
909 \verb''\\
910 {\color{highlight_comment}\verb'; This is an example of string'}\\
911 {\color{highlight_directive}\verb'db'}\verb' '{\color{highlight_string}\verb''\verb"'"\verb'string'\verb"'"\verb''}\verb' '{\color{highlight_comment}\verb'; String'}\\
912
913 % Caption
914 \caption{An example of constants}
915 \end{code}
916
917 \section{Expressions}
918 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~)}
919
920 \begin{table}[h!]
921 \mysmallfont{}
922 \centering{}
923 \begin{tabular}{|l|l|l|}
924 \hline
925 Operator & Description & Example \\\hline
926 \multicolumn{3}{|l|}{\textbf{Unary Operators}} \\\hline
927 NOT & one's complement & NOT 0a55ah \\\hline
928 HIGH & high order byte & HIGH 0a55ah \\\hline
929 LOW & low order byte & LOW 0a55ah \\\hline
930 \multicolumn{3}{|l|}{\textbf{Binary Operators}} \\\hline
931 + & unsigned addition & 11 + 12 \\\hline
932 - & unsigned subtraction & 13 + 11 \\\hline
933 * & unsigned multiplication & 3 * 5 \\\hline
934 / & unsigned division & 20 / 4 \\\hline
935 MOD & unsigned remainder & 21 MOD 4 \\\hline
936 SHL & logical shift left & 32 SHL 2 \\\hline
937 SHR & logical shift right & 32 SHR 2 \\\hline
938 AND & logical and & 48 AND 16 \\\hline
939 OR & logical or & 370q OR 7 \\\hline
940 XOR & exclusive or & 00fh XOR 005h \\\hline
941 . & bit operator & P1.4 \\\hline
942 EQ, = & equal to & 11 EQ 11 \\\hline
943 NE, <> & not equal to & 11 NE 11 \\\hline
944 LT, < & less than & 11 LT 12 \\\hline
945 LE, <= & less or equal than & 11 LT 11 \\\hline
946 GT, > & greater than & 12 GT 11 \\\hline
947 GE, >= & greater or equal than & 12 GT 11 \\\hline
948 \end{tabular}
949 \caption{Expression operators}
950 \end{table}
951
952 \begin{code}[h!]
953 \mysmallfont{}
954 {\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')'}\\
955 {\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')'}\\
956 {\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')'}\\
957 \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')'}\\
958 {\color{highlight_directive}\verb'ELSE'}\\
959 \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')'}\\
960 {\color{highlight_directive}\verb'ENDIF'}
961
962 % Caption
963 \caption{An example of expressions}
964 \end{code}
965
966 \section{The instruction set processing}
967 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''.
968
969 \twocolumn
970 \section{Assembler directives}
971 \begin{description}
972 \mysmallfont{}
973 \item[ifn] IF Not, conditional assembly\\
974 Syntax:\\
975 \verb' '{\color{highlight_directive}\verb'IFN'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
976 \verb''\\
977 Example:\\
978 \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')'}\\
979 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
980 \verb' '{\color{highlight_directive}\verb'ELSE'}\\
981 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
982 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
983 \item[ifdef] IF DEFined\\
984 Syntax:\\\\
985 \verb' '{\color{highlight_directive}\verb'IFDEF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'symbol'}{\color{highlight_symbol}\verb'>'}\\
986 \verb''\\
987 Example:\\
988 \verb' '{\color{highlight_directive}\verb'IFDEF'}\verb' '{\color{highlight_constant}\verb'CND'}\\
989 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
990 \verb' '{\color{highlight_directive}\verb'ELSE'}\\
991 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
992 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
993 \item[ifndef] IF Not DEFined\\
994 Syntax:\\\\
995 \verb' '{\color{highlight_directive}\verb'IFNDEF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'symbol'}{\color{highlight_symbol}\verb'>'}\\
996 Example:\\
997 \verb' '{\color{highlight_directive}\verb'IFNDEF'}\verb' '{\color{highlight_constant}\verb'CND'}\\
998 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
999 \verb' '{\color{highlight_directive}\verb'ELSE'}\\
1000 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
1001 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1002 \item[rept] REPeaT Macro\\
1003 Syntax:\\\\
1004 \verb' '{\color{highlight_directive}\verb'REPT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1005 \verb''\\
1006 Example:\\
1007 \verb' '{\color{highlight_directive}\verb'REPT'}\verb' '{\color{highlight_unknown_base}\verb'5'}\\
1008 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1009 \verb' '{\color{highlight_directive}\verb'ENDM'}\\
1010 \item[times] REPeaT Macro\\
1011 Syntax:\\\\
1012 \verb' '{\color{highlight_directive}\verb'TIMES'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1013 \verb''\\
1014 Example:\\
1015 \verb' '{\color{highlight_directive}\verb'TIMES'}\verb' '{\color{highlight_unknown_base}\verb'5'}\\
1016 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1017 \verb' '{\color{highlight_directive}\verb'ENDM'}\\
1018 \item[if] Conditional assembly\\
1019 Syntax:\\\\
1020 \verb' '{\color{highlight_directive}\verb'IF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1021 \verb''\\
1022 Example:\\
1023 \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')'}\\
1024 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
1025 \verb' '{\color{highlight_directive}\verb'ELSE'}\\
1026 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
1027 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1028 \item[else] Conditional assembly\\
1029 Syntax:\\\\
1030 \verb' '{\color{highlight_directive}\verb'ELSE'}\\
1031 Example:\\
1032 \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')'}\\
1033 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
1034 \verb' '{\color{highlight_directive}\verb'ELSE'}\\
1035 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
1036 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1037 \item[elseif] Conditional assembly\\
1038 Syntax:\\\\
1039 \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1040 Example:\\
1041 \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')'}\\
1042 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
1043 \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_constant}\verb'SOMETHING_ELSE'}\\
1044 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
1045 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1046 \item[elseifn] Conditional assembly\\
1047 Syntax:\\\\
1048 \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1049 Example:\\
1050 \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')'}\\
1051 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
1052 \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_constant}\verb'SOMETHING_ELSE'}\\
1053 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
1054 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1055 \item[elseifdef] Conditional assembly\\
1056 Syntax:\\\\
1057 \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1058 Example:\\
1059 \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')'}\\
1060 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
1061 \verb' '{\color{highlight_directive}\verb'ELSEIFDEF'}\verb' '{\color{highlight_constant}\verb'SOMETHING_ELSE'}\\
1062 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
1063 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1064 \item[elseifndef] Conditional assembly\\
1065 Syntax:\\\\
1066 \verb' '{\color{highlight_directive}\verb'ELSEIF'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1067 Example:\\
1068 \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')'}\\
1069 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
1070 \verb' '{\color{highlight_directive}\verb'ELSEIFNDEF'}\verb' '{\color{highlight_constant}\verb'SOMETHING_ELSE'}\\
1071 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
1072 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1073 \item[endif] Conditional assembly\\
1074 Syntax:\\\\
1075 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1076 \verb''\\
1077 Example:\\
1078 \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')'}\\
1079 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#20h'}\\
1080 \verb' '{\color{highlight_directive}\verb'ELSE'}\\
1081 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#40h'}\\
1082 \verb' '{\color{highlight_directive}\verb'ENDIF'}\\
1083 \item[endm] END of Macro definition\\
1084 Syntax:\\\\
1085 \verb' '{\color{highlight_directive}\verb'ENDM'}\\
1086 \verb''\\
1087 Example:\\
1088 \verb' '{\color{highlight_macro}\verb'ABC'}\verb' '{\color{highlight_directive}\verb'MACRO'}\\
1089 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_sfr}\verb'B'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#12d'}\\
1090 \verb' '{\color{highlight_directive}\verb'ENDM'}\\
1091 \item[end] END of the program\\
1092 Syntax:\\\\
1093 \verb' '{\color{highlight_directive}\verb'END'}\\
1094 \verb''\\
1095 Example:\\
1096 \verb' '{\color{highlight_directive}\verb'END'}\\
1097 \item[list] enable code LISTing\\
1098 Syntax:\\\\
1099 \verb' '{\color{highlight_directive}\verb'LIST'}\\
1100 \verb''\\
1101 Example:\\
1102 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1103 \verb' '{\color{highlight_directive}\verb'NOLIST'}\\
1104 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1105 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1106 \verb' '{\color{highlight_directive}\verb'LIST'}\\
1107 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1108 \item[nolist] disabled code listing\\
1109 Syntax:\\\\
1110 \verb' '{\color{highlight_directive}\verb'NOLIST'}\\
1111 \verb''\\
1112 Example:\\
1113 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1114 \verb' '{\color{highlight_directive}\verb'NOLIST'}\\
1115 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1116 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1117 \verb' '{\color{highlight_directive}\verb'LIST'}\\
1118 \verb' '{\color{highlight_instruction}\verb'NOP'}\\
1119 \item[dseg] switch to DATA segment [at address]\\
1120 Syntax:\\\\
1121 \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']'}\\
1122 \verb''\\
1123 Example:\\
1124 \verb' '{\color{highlight_directive}\verb'DSEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'20d'}\\
1125 \item[iseg] switch to IDATA segment [at address]\\
1126 Syntax:\\\\
1127 \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']'}\\
1128 \verb''\\
1129 Example:\\
1130 \verb' '{\color{highlight_directive}\verb'ISEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'10d'}\\
1131 \item[bseg] switch to BIT segment [at address]\\
1132 Syntax:\\\\
1133 \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']'}\\
1134 \verb''\\
1135 Example:\\
1136 \verb' '{\color{highlight_directive}\verb'BSEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'5d'}\\
1137 \item[xseg] switch to XDATA segment [at address]\\
1138 Syntax:\\\\
1139 \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']'}\\
1140 \verb''\\
1141 Example:\\
1142 \verb' '{\color{highlight_directive}\verb'XSEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'30d'}\\
1143 \item[cseg] switch to CODE segment [at address]\\
1144 Syntax:\\\\
1145 \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']'}\\
1146 \verb''\\
1147 Example:\\
1148 \verb' '{\color{highlight_directive}\verb'CSEG'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'40d'}\\
1149 \item[flag] define a FLAG bit\\
1150 Syntax:\\\\
1151 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'FLAG'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1152 \verb''\\
1153 Example:\\
1154 \verb' '{\color{highlight_constant}\verb'F4'}\verb' '{\color{highlight_directive}\verb'FLAG'}\verb' '{\color{highlight_hex}\verb'16h'}\\
1155 \verb''\\
1156 {\color{highlight_label}\verb'Note:'}\\
1157 \verb' '{\color{highlight_macro}\verb'Deprecated'}\verb' '{\color{highlight_constant}\verb'directive. Consider directive BIT instead.}'}\\
1158 \item[skip] SKIP bytes in the code memory\\
1159 Syntax:\\\\
1160 \verb' '{\color{highlight_directive}\verb'SKIP'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1161 \verb''\\
1162 Example:\\
1163 \verb' '{\color{highlight_directive}\verb'SKIP'}\verb' '{\color{highlight_unknown_base}\verb'5'}\\
1164 \item[equ] EQUivalent\\
1165 Syntax:\\\\
1166 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'EQU'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1167 \verb''\\
1168 Example:\\
1169 \verb' '{\color{highlight_constant}\verb'ABC'}\verb' '{\color{highlight_directive}\verb'EQU'}\verb' '{\color{highlight_sfr}\verb'R0'}\\
1170 \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'}\\
1171 \item[bit] define BIT address\\
1172 Syntax:\\\\
1173 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'BIT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1174 \verb''\\
1175 Example:\\
1176 \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'}\\
1177 \item[set] SET numeric variable or variable register\\
1178 Syntax:\\\\
1179 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1180 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'register'}{\color{highlight_symbol}\verb'>'}\\
1181 \verb''\\
1182 Example:\\
1183 \verb' '{\color{highlight_constant}\verb'ALPHA'}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_sfr}\verb'R0'}\\
1184 \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'}\\
1185 \item[code] define address in the CODE memory\\
1186 Syntax:\\\\
1187 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'CODE'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1188 \verb''\\
1189 Example:\\
1190 \verb' '{\color{highlight_constant}\verb'TBL'}\verb' '{\color{highlight_directive}\verb'CODE'}\verb' '{\color{highlight_hex}\verb'600h'}\\
1191 \item[data] define address in the DATA memory\\
1192 Syntax:\\\\
1193 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1194 Example:\\
1195 \verb' '{\color{highlight_constant}\verb'UIV'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_hex}\verb'20h'}\\
1196 \item[idata] define address in the Internal DATA memory\\
1197 Syntax:\\\\
1198 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'IDATA'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1199 Example:\\
1200 \verb' '{\color{highlight_constant}\verb'UIV'}\verb' '{\color{highlight_directive}\verb'IDATA'}\verb' '{\color{highlight_hex}\verb'20h'}\\
1201 \item[xdata] define address in the External DATA memory\\
1202 Syntax:\\\\
1203 \verb' '{\color{highlight_constant}\verb'<symbol>'}\verb' '{\color{highlight_directive}\verb'XDATA'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1204 Example:\\
1205 \verb' '{\color{highlight_constant}\verb'UIV'}\verb' '{\color{highlight_directive}\verb'XDATA'}\verb' '{\color{highlight_hex}\verb'400h'}\\
1206 \item[macro] MACRO definition\\
1207 Syntax:\\\\
1208 \verb' '{\color{highlight_macro}\verb'<macro>'}\verb' '{\color{highlight_directive}\verb'MACRO'}\verb' '{\color{highlight_constant}\verb'[<arg0> ['}{\color{highlight_oper_sep}\verb','}{\color{highlight_constant}\verb'<arg1> ... ]'}\\
1209 Example:\\
1210 \verb' '{\color{highlight_macro}\verb'ABC'}\verb' '{\color{highlight_directive}\verb'MACRO'}\verb' '{\color{highlight_constant}\verb'X'}\\
1211 \verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_constant}\verb'X'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#12d'}\\
1212 \verb' '{\color{highlight_directive}\verb'ENDM'}\\
1213 \item[local] define a LOCAL label inside a macro\\
1214 Syntax:\\
1215 \verb' '{\color{highlight_directive}\verb'LOCAL'}\verb' '{\color{highlight_label}\verb'<label>'}\\\\
1216 Example:\\
1217 \verb' '{\color{highlight_macro}\verb'ABC'}\verb' '{\color{highlight_directive}\verb'MACRO'}\verb' '{\color{highlight_constant}\verb'X'}\\
1218 \verb' '{\color{highlight_directive}\verb'LOCAL'}\verb' '{\color{highlight_label}\verb'xyz'}\\
1219 \verb' '{\color{highlight_label}\verb'xyz:'}\verb' '{\color{highlight_instruction}\verb'MOV'}\verb' '{\color{highlight_constant}\verb'X'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#12d'}\\
1220 \verb' '{\color{highlight_directive}\verb'ENDM'}\\
1221 \item[ds] Define Space\\
1222 Syntax:\\\\
1223 \verb' '{\color{highlight_directive}\verb'DS'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1224 Example:\\
1225 \verb' '{\color{highlight_directive}\verb'DS'}\verb' '{\color{highlight_unknown_base}\verb'2'}{\color{highlight_symbol}\verb'+'}{\color{highlight_unknown_base}\verb'4'}\\
1226 \item[dw] Define Words\\
1227 Syntax:\\\\
1228 \verb' '{\color{highlight_directive}\verb'DW'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr1'}{\color{highlight_symbol}\verb'>'}\verb' '{\color{highlight_constant}\verb'[,'}{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr2'}{\color{highlight_symbol}\verb'>'}\verb' '{\color{highlight_constant}\verb'...'}\verb' '{\color{highlight_constant}\verb']'}\\
1229 Example:\\
1230 \verb' '{\color{highlight_directive}\verb'DW'}\verb' '{\color{highlight_unknown_base}\verb'0,02009H,2009,4171'}\\
1231 \item[db] Define Bytes\\
1232 Syntax:\\\\
1233 \verb' '{\color{highlight_directive}\verb'DB'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr1'}{\color{highlight_symbol}\verb'>'}\verb' '{\color{highlight_constant}\verb'['}{\color{highlight_oper_sep}\verb','}{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr2'}{\color{highlight_symbol}\verb'>'}\verb' '{\color{highlight_constant}\verb'...'}\verb' '{\color{highlight_constant}\verb']'}\\
1234 Example:\\
1235 \verb' '{\color{highlight_directive}\verb'DB'}\verb' '{\color{highlight_unknown_base}\verb'24'}{\color{highlight_oper_sep}\verb','}{\color{highlight_string}\verb''\verb"'"\verb'August'\verb"'"\verb''}{\color{highlight_oper_sep}\verb','}{\color{highlight_unknown_base}\verb'09'}{\color{highlight_oper_sep}\verb','}{\color{highlight_symbol}\verb'('}{\color{highlight_unknown_base}\verb'2'}{\color{highlight_symbol}\verb'*'}{\color{highlight_unknown_base}\verb'8'}{\color{highlight_symbol}\verb'+'}{\color{highlight_unknown_base}\verb'24'}{\color{highlight_symbol}\verb')/'}{\color{highlight_unknown_base}\verb'8'}\\
1236 \item[dbit] Define BITs\\
1237 Syntax:\\\\
1238 \verb' '{\color{highlight_directive}\verb'DBIT'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1239 Example:\\
1240 \verb' '{\color{highlight_directive}\verb'DBIT'}\verb' '{\color{highlight_unknown_base}\verb'4'}{\color{highlight_symbol}\verb'+'}{\color{highlight_unknown_base}\verb'2'}\\
1241 \item[include] INCLUDE an external source code\\
1242 Syntax:\\\\
1243 \verb' '{\color{highlight_directive}\verb'INCLUDE'}\verb' '{\color{highlight_string}\verb'<filename>'}\\
1244 Example:\\
1245 \verb' '{\color{highlight_directive}\verb'INCLUDE'}\verb' '{\color{highlight_string}\verb''\verb"'"\verb'my file.asm'\verb"'"\verb''}\\
1246 \item[org] ORiGin of segment location\\
1247 Syntax:\\\\
1248 \verb' '{\color{highlight_directive}\verb'ORG'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1249 Example:\\
1250 \verb' '{\color{highlight_directive}\verb'ORG'}\verb' '{\color{highlight_hex}\verb'0Bh'}\\
1251 \item[using] USING register banks\\
1252 Syntax:\\\\
1253 \verb' '{\color{highlight_directive}\verb'USING'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1254 Example:\\
1255 \verb' '{\color{highlight_directive}\verb'USING'}\verb' '{\color{highlight_unknown_base}\verb'2'}\\
1256 \item[byte] define BYTE address in the data memory\\
1257 Syntax:\\\\
1258 \verb' <symbol> '{\color{highlight_directive}\verb'BYTE'}\verb' '{\color{highlight_symbol}\verb'<'}{\color{highlight_constant}\verb'expr'}{\color{highlight_symbol}\verb'>'}\\
1259 Example:\\
1260 \verb' UIV '{\color{highlight_directive}\verb'BYTE'}\verb' '{\color{highlight_hex}\verb'20h'}\\
1261 {\color{highlight_label}\verb'Note:'}\\
1262 \verb' '{\color{highlight_macro}\verb'Deprecated'}\verb' '{\color{highlight_constant}\verb'directive. Consider directive DATA instead.'}\\
1263 \end{description}
1264 \onecolumn
1265
1266 \twocolumn
1267 \section{Assembler Controls}
1268 \begin{description}
1269 \mysmallfont{}
1270 \item[\$date] Inserts date string into page header\\
1271 Syntax:\\
1272 \verb' '{\color{highlight_control}\verb'$DATE'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'string'}{\color{highlight_symbol}\verb')'}\\
1273 Example:\\
1274 \verb' '{\color{highlight_control}\verb'$DATE'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'1965-12-31'}{\color{highlight_symbol}\verb')'}\\
1275 \item[\$da] Inserts date string into page header\\
1276 Syntax:\\
1277 \verb' ' {\color{highlight_control}\verb'$DA'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'string'}{\color{highlight_symbol}\verb')'}\\
1278 Example:\\
1279 \verb' ' {\color{highlight_control}\verb'$DA'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'1965-12-31'}{\color{highlight_symbol}\verb')'}\\
1280 \item[\$eject] Start a new page in list file\\
1281 Syntax:\\
1282 \verb' '{\color{highlight_control}\verb'$EJECT'}\\
1283 Example:\\
1284 \verb' '{\color{highlight_control}\verb'$EJECT'}\\
1285 \item[\$ej] Start a new page in list file\\
1286 Syntax:\\
1287 \verb' '{\color{highlight_control}\verb'$EJ'}\\
1288 Example:\\
1289 \verb' '{\color{highlight_control}\verb'$EJ'}\\
1290 \item[\$include] Include a source file\\
1291 Syntax:\\
1292 \verb' '{\color{highlight_control}\verb'$INCLUDE'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'string'}{\color{highlight_symbol}\verb')'}\\
1293 Example:\\
1294 \verb' '{\color{highlight_control}\verb'$INCLUDE'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'somefile.asm'}{\color{highlight_symbol}\verb')'}\\
1295 \item[\$inc] Include a source file\\
1296 Syntax:\\
1297 \verb' '{\color{highlight_control}\verb'$INC'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'string'}{\color{highlight_symbol}\verb')'}\\
1298 Example:\\
1299 \verb' '{\color{highlight_control}\verb'$INC'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'somefile.asm'}{\color{highlight_symbol}\verb')'}\\
1300 \item[\$list] List subsequent source lines\\
1301 Syntax:\\
1302 \verb' '{\color{highlight_control}\verb'$LIST'}\\
1303 Example:\\
1304 \verb' '{\color{highlight_control}\verb'$LIST'}\\
1305 \item[\$li] List subsequent source lines\\
1306 Syntax:\\
1307 \verb' '{\color{highlight_control}\verb'$LI'}\\
1308 Example:\\
1309 \verb' '{\color{highlight_control}\verb'$LI'}\\
1310 \item[\$noli] Don't list subsequent source lines\\
1311 Syntax:\\
1312 \verb' '{\color{highlight_control}\verb'$NOLI'}\\
1313 Example:\\
1314 \verb' '{\color{highlight_control}\verb'$NOLI'}\\
1315 \item[\$nolist] Don't list subsequent source lines\\
1316 Syntax:\\
1317 \verb' '{\color{highlight_control}\verb'$NOLIST'}\\
1318 Example:\\
1319 \verb' '{\color{highlight_control}\verb'$NOLIST'}\\
1320 \item[\$nomod] Disable predefined SFR symbols\\
1321 Syntax:\\
1322 \verb' '{\color{highlight_control}\verb'$NOMOD'}\\
1323 Example:\\
1324 \verb' '{\color{highlight_control}\verb'$NOMOD'}\\
1325 \item[\$nomo] Disable predefined SFR symbols\\
1326 Syntax:\\
1327 \verb' '{\color{highlight_control}\verb'$NOMO'}\\
1328 Example:\\
1329 \verb' '{\color{highlight_control}\verb'$NOMO'}\\
1330 \item[\$nomod51] Disable predefined SFR symbols\\
1331 Syntax:\\
1332 \verb' '{\color{highlight_control}\verb'$NOMOD51'}\\
1333 Example:\\
1334 \verb' '{\color{highlight_control}\verb'$NOMOD51'}\\
1335 \item[\$paging] Enable listing page formatting\\
1336 Syntax:\\
1337 \verb' '{\color{highlight_control}\verb'$PAGING'}\\
1338 Example:\\
1339 \verb' '{\color{highlight_control}\verb'$PAGING'}\\
1340 \item[\$pi] Enable listing page formatting\\
1341 Syntax:\\
1342 \verb' '{\color{highlight_control}\verb'$PI'}\\
1343 Example:\\
1344 \verb' '{\color{highlight_control}\verb'$PI'}\\
1345 \item[\$nopi] Disable listing page formatting\\
1346 Syntax:\\
1347 \verb' '{\color{highlight_control}\verb'$NOPI'}\\
1348 Example:\\
1349 \verb' '{\color{highlight_control}\verb'$NOPI'}\\
1350 \item[\$nopaging] Disable listing page formatting\\
1351 Syntax:\\
1352 \verb' '{\color{highlight_control}\verb'$NOPAGING'}\\
1353 Example:\\
1354 \verb' '{\color{highlight_control}\verb'$NOPAGING'}\\
1355 \item[\$pagelength] Set lines per page for listing\\
1356 Syntax:\\
1357 \verb' '{\color{highlight_control}\verb'$PAGELENGTH'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'int'}{\color{highlight_symbol}\verb')'}\\
1358 Example:\\
1359 \verb' '{\color{highlight_control}\verb'$PAGELENGTH'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'64'}{\color{highlight_symbol}\verb')'}\\
1360 \item[\$pl] Set lines per page for listing\\
1361 Syntax:\\
1362 \verb' '{\color{highlight_control}\verb'$PL'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'int'}{\color{highlight_symbol}\verb')'}\\
1363 Example:\\
1364 \verb' '{\color{highlight_control}\verb'$PL'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'64'}{\color{highlight_symbol}\verb')'}\\
1365 \item[\$pagewidth] Set columns per line for listing\\
1366 Syntax:\\
1367 \verb' '{\color{highlight_control}\verb'$PAGEWIDTH'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'int'}{\color{highlight_symbol}\verb')'}\\
1368 Example:\\
1369 \verb' '{\color{highlight_control}\verb'$PAGEWIDTH'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'132'}{\color{highlight_symbol}\verb')'}\\
1370 \item[\$pw] Set columns per line for listing\\
1371 Syntax:\\
1372 \verb' '{\color{highlight_control}\verb'$PW'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'int'}{\color{highlight_symbol}\verb')'}\\
1373 Example:\\
1374 \verb' '{\color{highlight_control}\verb'$PW'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'132'}{\color{highlight_symbol}\verb')'}\\
1375 \item[\$symbols] Create symbol table\\
1376 Syntax:\\
1377 \verb' '{\color{highlight_control}\verb'$SYMBOLS'}\\
1378 Example:\\
1379 \verb' '{\color{highlight_control}\verb'$SYMBOLS'}\\
1380 \item[\$sb] Create symbol table\\
1381 Syntax:\\
1382 \verb' '{\color{highlight_control}\verb'$SB'}\\
1383 Example:\\
1384 \verb' '{\color{highlight_control}\verb'$SB'}\\
1385 \item[\$nosymbols] Don't create symbol table\\
1386 Syntax:\\
1387 \verb' '{\color{highlight_control}\verb'$NOSYMBOLS'}\\
1388 Example:\\
1389 \verb' '{\color{highlight_control}\verb'$NOSYMBOLS'}\\
1390 \item[\$nosb] Don't create symbol table\\
1391 Syntax:\\
1392 \verb' '{\color{highlight_control}\verb'$NOSB'}\\
1393 Example:\\
1394 \verb' '{\color{highlight_control}\verb'$NOSB'}\\
1395 \item[\$title] Inserts title string into page header\\
1396 Syntax:\\
1397 \verb' '{\color{highlight_control}\verb'$TITLE'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'string'}{\color{highlight_symbol}\verb')'}\\
1398 Example:\\
1399 \verb' '{\color{highlight_control}\verb'$TITLE'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'My firts code'}{\color{highlight_symbol}\verb')'}\\
1400 \item[\$tt] Inserts title string into page header\\
1401 Syntax:\\
1402 \verb' '{\color{highlight_control}\verb'$TT'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'string'}{\color{highlight_symbol}\verb')'}\\
1403 Example:\\
1404 \verb' '{\color{highlight_control}\verb'$TT'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'My firts code'}{\color{highlight_symbol}\verb')'}\\
1405 \item[\$noobject] Do not create Intel HEX file\\
1406 Syntax:\\
1407 \verb' '{\color{highlight_control}\verb'$NOOBJECT'}\\
1408 Example:\\
1409 \verb' '{\color{highlight_control}\verb'$NOOBJECT'}\\
1410 \item[\$object] Specify file name for Intel HEX\\
1411 Syntax:\\
1412 \verb' '{\color{highlight_control}\verb'$OBJECT'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'string'}{\color{highlight_symbol}\verb')'}\\
1413 Example:\\
1414 \verb' '{\color{highlight_control}\verb'$OBJECT'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'my_hex.hex'}{\color{highlight_symbol}\verb')'}\\
1415 \item[\$print] Specify file name for list file\\
1416 Syntax:\\
1417 \verb' '{\color{highlight_control}\verb'$PRINT'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'string'}{\color{highlight_symbol}\verb')'}\\
1418 Example:\\
1419 \verb' '{\color{highlight_control}\verb'$PRINT'}{\color{highlight_symbol}\verb'('}{\color{highlight_string}\verb'my_list.lst'}{\color{highlight_symbol}\verb')'}\\
1420 \item[\$noprint] Do not create list file at all\\
1421 Syntax:\\
1422 \verb' '{\color{highlight_control}\verb'$NOPRINT'}\\
1423 Example:\\
1424 \verb' '{\color{highlight_control}\verb'$NOPRINT'}\\
1425 \item[\$nomacrosfirst] Define and expand macro instructions after! conditional assembly and definitions of constants\\
1426 Syntax:\\
1427 \verb' '{\color{highlight_control}\verb'$NOMACROSFIRST'}\\
1428 Example:\\
1429 \verb' '{\color{highlight_control}\verb'$NOMACROSFIRST'}\\
1430 \end{description}
1431 \onecolumn
1432
1433 \section{Predefined Symbols}
1434 There are symbols which are defined by default by assembler. The aim is to make it a little easier to write code in assembly language for 8051, because user don not have to define all these symbols in his or her code. This feature can be turned of by ``\texttt{\$NOMOD}'' control sequence.
1435
1436 \begin{table}[h!]
1437 \centering{}
1438 \mysmallfont{}
1439 \caption{Code addresses}
1440 \begin{tabular}{|ll|ll|ll|ll|}
1441 \hline
1442 \textbf{Symbol} & \textbf{Value}
1443 & \textbf{Symbol} & \textbf{Value}
1444 & \textbf{Symbol} & \textbf{Value}
1445 & \textbf{Symbol} & \textbf{Value} \\
1446 \hline
1447 RESET & 000h & EXTI0 & 003h & TIMER0& 00Bh & EXTI1 & 013h \\
1448 TIMER1 & 01Bh & SINT & 023h & TIMER2& 02Bh & CFINT & 033h \\
1449 \hline
1450 \end{tabular}
1451 \end{table}
1452
1453 \begin{table}[h!]
1454 \centering{}
1455 \mysmallfont{}
1456 \caption{Plain numbers, these symbols are always defined!}
1457 \begin{tabular}{|ll|}
1458 \hline
1459 \textbf{Symbol} & \textbf{Value} \\
1460 \hline
1461 ??MCU\_8051\_IDE & 8051h \\
1462 ??VERSION & 0139h \footnote{0139h stands for version 1.3.9} \\
1463 \hline
1464 \end{tabular}
1465 \end{table}
1466
1467 \begin{table}[h!]
1468 \centering{}
1469 \mysmallfont{}
1470 \caption{Predefined SFR bit addresses}
1471 \begin{tabular}{|ll|ll|ll|ll|}
1472 \hline
1473 \textbf{Symbol} & \textbf{Value}
1474 & \textbf{Symbol} & \textbf{Value}
1475 & \textbf{Symbol} & \textbf{Value}
1476 & \textbf{Symbol} & \textbf{Value} \\
1477 \hline
1478 IT0 & 088h & IE0 & 089h & IT1 & 08Ah & IE1 & 08Bh \\
1479 TR0 & 08Ch & TF0 & 08Dh & TR1 & 08Eh & TF1 & 08Fh \\
1480 RI & 098h & TI & 099h & RB8 & 09Ah & TB8 & 09Bh \\
1481 REN & 09Ch & SM2 & 09Dh & SM1 & 09Eh & SM0 & 09Fh \\
1482 FE & 09Fh & & & & & & \\
1483 EX0 & 0A8h & ET0 & 0A9h & EX1 & 0AAh & ET1 & 0ABh \\
1484 ES & 0ACh & ET2 & 0ADh & EC & 0AEh & EA & 0AFh \\
1485 RXD & 0B0h & TXD & 0B1h & INT0 & 0B2h & INT1 & 0B3h \\
1486 T0 & 0B4h & T1 & 0B5h & WR & 0B6h & RD & 0B7h \\
1487 PX0 & 0B8h & PT0 & 0B9h & PX1 & 0BAh & PT1 & 0BBh \\
1488 PS & 0BCh & PT2 & 0BDh & PC & 0BEh & & \\
1489 PPCL & 0BEh & PT2L & 0BDh & PSL & 0BCh & & \\
1490 PT1L & 0BBh & PX1L & 0BAh & PT0L & 0B9h & PX0L & 0B8h \\
1491 TF2 & 0CFh & EXF2 & 0CEh & RCLK & 0CDh & TCLK & 0CCh \\
1492 EXEN2 & 0CBh & TR2 & 0CAh & CT2 & 0C9h & CPRL2 & 0C8h \\
1493 P & 0D0h & OV & 0D2h & RS0 & 0D3h & & \\
1494 RS1 & 0D4h & F0 & 0D5h & AC & 0D6h & CY & 0D7h \\
1495 CR & 0DEh & CCF4 & 0DCh & & & & \\
1496 CCF3 & 0DBh & CCF2 & 0DAh & CCF1 & 0D9h & CCF0 & 0D8h \\
1497 \hline
1498 \end{tabular}
1499 \end{table}
1500
1501 \begin{table}[h!]
1502 \centering{}
1503 \mysmallfont{}
1504 \caption{Predefined SFR addresses}
1505 \begin{tabular}{|ll|ll|ll|ll|}
1506 \hline
1507 \textbf{Symbol} & \textbf{Value}
1508 & \textbf{Symbol} & \textbf{Value}
1509 & \textbf{Symbol} & \textbf{Value}
1510 & \textbf{Symbol} & \textbf{Value} \\
1511 \hline
1512 P0 & 080h & SP & 081h & DPL & 082h & DPH & 083h \\
1513 PCON & 087h & TCON & 088h & TMOD & 089h & TL0 & 08Ah \\
1514 TL1 & 08Bh & TH0 & 08Ch & TH1 & 08Dh & P1 & 090h \\
1515 SCON & 098h & SBUF & 099h & P2 & 0A0h & IE & 0A8h \\
1516 P3 & 0B0h & IP & 0B8h & PSW & 0D0h & ACC & 0E0h \\
1517 B & 0F0h & P4 & 0C0h & WDTCON& 0A7h & EECON & 096h \\
1518 DP0H & 083h & DP0L & 082h & DP1H & 085h & DP1L & 084h \\
1519 T2CON & 0C8h & T2MOD & 0C9h & RCAP2L& 0CAh & RCAP2H& 0CBh \\
1520 TL2 & 0CCh & TH2 & 0CDh & AUXR1 & 0A2h & WDTRST& 0A6h \\
1521 CLKREG & 08Fh & ACSR & 097h & IPH & 0B7h & SADDR & 0A9h \\
1522 SADEN & 0B9h & SPCR & 0D5h & SPSR & 0AAh & SPDR & 086h \\
1523 AUXR & 08Eh & CKCON & 08Fh & WDTPRG& 0A7h & & \\
1524 \hline
1525 CH & 0F9h & CCAP0H& 0FAh & CCAP1H& 0FBh & CCAP2H& 0FCh \\
1526 CCAP3H & 0FDh & CCAP4H& 0FEh &CCAPL2H& 0FCh &CCAPL3H& 0FDh \\
1527 CCAPL4H & 0FEh & ADCLK & 0F2h & ADCON & 0F3h & ADDL & 0F4h \\
1528 ADDH & 0F5h & ADCF & 0F6h & P5 & 0E8h & CL & 0E9h \\
1529 CCAP0L & 0EAh & CCAP1L& 0EBh &CCAPL2L& 0ECh &CCAPL3L& 0EDh \\
1530 CCAPL4L & 0EEh & CCON & 0D8h & CMOD & 0D9h & CCAPM0& 0DAh \\
1531 CCAPM1 & 0DBh & CCAPM2& 0DCh & CCAPM3& 0DDh & CCAPM4& 0DEh \\
1532 P1M2 & 0E2h & P3M2 & 0E3h & P4M2 & 0E4h & P1M1 & 0D4h \\
1533 P3M1 & 0D5h & P4M1 & 0D6h & SPCON & 0C3h & SPSTA & 0C4h \\
1534 SPDAT & 0C5h & IPL0 & 0B8h & IPL1 & 0B2h & IPH1 & 0B3h \\
1535 IPH0 & 0B7h & BRL & 09Ah & BDRCON& 09Bh &BDRCON\_1& 09Ch \\
1536 KBLS & 09Ch & KBE & 09Dh & KBF & 09Eh &SADEN\_0& 0B9h \\
1537 SADEN\_1& 0BAh &SADDR\_0& 0A9h &SADDR\_1& 0AAh & CKSEL & 085h \\
1538 OSCCON & 086h & CKRL & 097h & CKCON0& 08Fh & & \\
1539 \hline
1540 \end{tabular}
1541 \end{table}
1542
1543 \clearpage
1544 \section{Segment type}
1545 Segment type specifies the address space to which a symbol is assigned. For example if you define symbol ABC using ``XDATA'' directive, then ABS is assigned to XDATA segment. Purpose of this is to semantically distinguish between different types of symbols. For example if we use a symbol as address to program memory it has different meaning that if we used it as address to bit addressable area.
1546 \begin{table}[h!]
1547 \centering{}
1548 \mysmallfont{}
1549 \begin{tabular}{|ll|}
1550 \hline
1551 DATA & Internal data memory and SFR \\
1552 IDATA & Internal data memory only \\
1553 XDATA & External data memory only \\
1554 BIT & Bit addressable area only \\
1555 CODE & Program memory only \\
1556 NUMBER & Arbitrary value \\
1557 \hline
1558 \end{tabular}
1559 \caption{Segment types}
1560 \end{table}
1561
1562 Symbols might be assigned to these segment types by these directives:
1563 \begin{itemize}
1564 \setlength{\itemsep}{-3pt}
1565 \item DATA (segment DATA)
1566 \item IDATA (segment IDATA)
1567 \item XDATA (segment XDATA)
1568 \item BIT (segment BIT)
1569 \item CODE (segment CODE)
1570 \item EQU, SET (segment NUMBER)
1571 \end{itemize}
1572 \begin{code}[h!]
1573 \mysmallfont{}
1574 {\color{highlight_constant}\verb'MY_A'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_char}\verb''\verb"'"\verb'\n'\verb"'"\verb''}\verb' '{\color{highlight_comment}\verb'; DATA segment (internal data memory and SFR)'}\\
1575 {\color{highlight_constant}\verb'MY_B'}\verb' '{\color{highlight_directive}\verb'IDATA'}\verb' '{\color{highlight_hex}\verb'0AAH'}\verb' '{\color{highlight_comment}\verb'; IDATA segment (internal data memory only)'}\\
1576 {\color{highlight_constant}\verb'MY_C'}\verb' '{\color{highlight_directive}\verb'XDATA'}\verb' '{\color{highlight_oct}\verb'14Q'}\verb' '{\color{highlight_comment}\verb'; XDATA segment (external data memory only)'}\\
1577 {\color{highlight_constant}\verb'MY_D'}\verb' '{\color{highlight_directive}\verb'BIT'}\verb' '{\color{highlight_sfr}\verb'P1'}{\color{highlight_symbol}\verb'.'}{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_comment}\verb'; BIT segment (bit addressable area only)'}\\
1578 {\color{highlight_constant}\verb'MY_E'}\verb' '{\color{highlight_directive}\verb'CODE'}\verb' '{\color{highlight_dec}\verb'62348D'}\verb' '{\color{highlight_comment}\verb'; CODE segment (program memory only)'}\\
1579 {\color{highlight_constant}\verb'MY_F'}\verb' '{\color{highlight_directive}\verb'EQU'}\verb' '{\color{highlight_oct}\verb'242Q'}\verb' '{\color{highlight_comment}\verb'; Segment NUMBER (arbitrary value)'}\\
1580 \verb''\\
1581 {\color{highlight_comment}\verb'; Segment NUMBER (arbitrary value)'}\\
1582 {\color{highlight_constant}\verb'MY_G'}\verb' '{\color{highlight_directive}\verb'SET'}\verb' '{\color{highlight_constant}\verb'MY_A'}\verb' '{\color{highlight_symbol}\verb'+'}\verb' '{\color{highlight_constant}\verb'MY_B'}\verb' '{\color{highlight_symbol}\verb'+'}\verb' '{\color{highlight_constant}\verb'MY_C'}\verb' '{\color{highlight_symbol}\verb'+'}\verb' '{\color{highlight_constant}\verb'MY_D'}\verb' '{\color{highlight_symbol}\verb'+'}\verb' '{\color{highlight_constant}\verb'MY_E'}\verb' '{\color{highlight_symbol}\verb'+'}\verb' '{\color{highlight_constant}\verb'MY_F'}\\
1583 \caption{Example of symbol definitions}
1584 \end{code}
1585
1586 \clearpage
1587 \begin{code}[h!]
1588 \mysmallfont{}
1589 {\color{highlight_comment}\verb'; CODE segment'}\\
1590 \verb' '{\color{highlight_directive}\verb'cseg'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_hex}\verb'40h'}\verb' '{\color{highlight_comment}\verb'; Start this segment at address 40 hexadecimal (64d)'}\\
1591 {\color{highlight_constant}\verb'my_c'}\verb' '{\color{highlight_directive}\verb'CODE'}\verb' '{\color{highlight_hex}\verb'00abch'}\verb' '{\color{highlight_comment}\verb'; Define an address in code memory'}\\
1592 {\color{highlight_label}\verb'word:'}\verb' '{\color{highlight_directive}\verb'DW'}\verb' '{\color{highlight_hex}\verb'01234h'}\verb' '{\color{highlight_comment}\verb'; Define a word in code memory, will be written to code memory'}\\
1593 {\color{highlight_label}\verb'my_cs:'}\verb' '{\color{highlight_directive}\verb'DB'}\verb' '{\color{highlight_string}\verb''\verb"'"\verb'abcdef'\verb"'"\verb''}{\color{highlight_comment}\verb'; Define a string in code memory, will be written to code memory'}\\
1594 \verb''\\
1595 {\color{highlight_comment}\verb'; DATA segment'}{\color{highlight_macro}\\
1596 }\verb' '{\color{highlight_directive}\verb'dseg'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_oct}\verb'10q'}\verb' '{\color{highlight_comment}\verb'; Start this segment at address 10 octal (8d)'}\\
1597 {\color{highlight_constant}\verb'my_d'}\verb' '{\color{highlight_directive}\verb'DATA'}\verb' '{\color{highlight_char}\verb''\verb"'"\verb'd'\verb"'"\verb''}\verb' '{\color{highlight_comment}\verb'; Define address in internal data memory or SFR area'}\\
1598 {\color{highlight_label}\verb'my_ds:'}\verb' '{\color{highlight_directive}\verb'DS'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_comment}\verb'; Reserve 4 bytes here and set ``my_ds'\verb"'"\verb''\verb"'"\verb' to point there'}\\
1599 \verb''\\
1600 {\color{highlight_comment}\verb'; IDATA segment'}{\color{highlight_constant}\\
1601 }\verb' '{\color{highlight_directive}\verb'iseg'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_dec}\verb'10d'}\verb' '{\color{highlight_comment}\verb'; Start this segment at address 10 decimal'}\\
1602 {\color{highlight_constant}\verb'my_i'}\verb' '{\color{highlight_directive}\verb'IDATA'}\verb' '{\color{highlight_char}\verb''\verb"'"\verb'i'\verb"'"\verb''}\verb' '{\color{highlight_comment}\verb'; Define address in internal data memory'}\\
1603 {\color{highlight_label}\verb'my_is:'}\verb' '{\color{highlight_directive}\verb'DS'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_comment}\verb'; Reserve 4 bytes here and set ``my_is'\verb"'"\verb''\verb"'"\verb' to point there'}\\
1604 \verb''\\
1605 {\color{highlight_comment}\verb'; BIT segment'}\\
1606 \verb' '{\color{highlight_directive}\verb'bseg'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_bin}\verb'10b'}\verb' '{\color{highlight_comment}\verb'; Start this segment at address 10 binary (2d)'}\\
1607 {\color{highlight_constant}\verb'my_bit'}\verb' '{\color{highlight_directive}\verb'BIT'}\verb' '{\color{highlight_char}\verb''\verb"'"\verb'b'\verb"'"\verb''}\verb' '{\color{highlight_comment}\verb'; Define address in bit addressable area'}\\
1608 {\color{highlight_label}\verb'my_bs:'}\verb' '{\color{highlight_directive}\verb'dbit'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_comment}\verb'; Reserve 4 bits here and set ``my_bs'\verb"'"\verb''\verb"'"\verb' to point there'}\\
1609 \verb''\\
1610 {\color{highlight_comment}\verb'; XDATA segment'}{\color{highlight_constant}\\
1611 }\verb' '{\color{highlight_directive}\verb'xseg'}\verb' '{\color{highlight_constant}\verb'at'}\verb' '{\color{highlight_unknown_base}\verb'10'}\verb' '{\color{highlight_comment}\verb'; Start this segment at address 10 decimal'}\\
1612 {\color{highlight_constant}\verb'my_x'}\verb' '{\color{highlight_directive}\verb'XDATA'}\verb' '{\color{highlight_char}\verb''\verb"'"\verb'x'\verb"'"\verb''}\verb' '{\color{highlight_comment}\verb'; Define address in external data memory'}\\
1613 {\color{highlight_label}\verb'my_xs:'}\verb' '{\color{highlight_directive}\verb'DS'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_comment}\verb'; Reserve 4 bytes here and set ``my_xs'\verb"'"\verb''\verb"'"\verb' to point there'}\\
1614 \verb''\\
1615 \verb''\\
1616 {\color{highlight_constant}\verb'address'}\verb' '{\color{highlight_directive}\verb'equ'}\verb' '{\color{highlight_hex}\verb'0h'}\verb' '{\color{highlight_comment}\verb'; Define symbol ``address'\verb"'"\verb' in the NUMBER segment'}\\
1617 \verb''\\
1618 \verb' '{\color{highlight_directive}\verb'org'}\verb' '{\color{highlight_constant}\verb'address'}\verb' '{\color{highlight_comment}\verb'; Start writing program code at address defined by symbol ``address'\verb"'"\verb''\verb"'"\verb''}\\
1619 \verb''\\
1620 \verb' '{\color{highlight_comment}\verb'; Clear 1st bit in BIT array ``my_bs'\verb"'"\verb''\verb"'"\verb''}\\
1621 \verb' '{\color{highlight_instruction}\verb'clr'}\verb' '{\color{highlight_constant}\verb'my_bs'}{\color{highlight_symbol}\verb'+'}{\color{highlight_unknown_base}\verb'1'}\\
1622 \verb''\\
1623 \verb' '{\color{highlight_comment}\verb'; Move 10d to 2nd byte in DATA array ``my_ds'\verb"'"\verb''\verb"'"\verb''}\\
1624 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_constant}\verb'my_ds'}{\color{highlight_symbol}\verb'+'}{\color{highlight_unknown_base}\verb'2'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#10d'}\\
1625 \verb''\\
1626 \verb' '{\color{highlight_comment}\verb'; Move 88d to 3rd byte in IDATA array ``my_is'\verb"'"\verb''\verb"'"\verb''}\\
1627 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_constant}\verb'my_is'}{\color{highlight_symbol}\verb'+'}{\color{highlight_unknown_base}\verb'3'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#88d'}\\
1628 \verb''\\
1629 \verb' '{\color{highlight_comment}\verb'; Move 55h to 0th byte in XDATA array ``my_xs'\verb"'"\verb''\verb"'"\verb''}\\
1630 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#55h'}\\
1631 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'DPTR'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_symbol}\verb'#('}\verb' '{\color{highlight_constant}\verb'my_xs'}\verb' '{\color{highlight_symbol}\verb'+'}\verb' '{\color{highlight_unknown_base}\verb'0'}\verb' '{\color{highlight_symbol}\verb')'}\\
1632 \verb' '{\color{highlight_instruction}\verb'movx'}\verb' '{\color{highlight_indirect}\verb'@DPTR'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'A'}\\
1633 \verb''\\
1634 \verb' '{\color{highlight_comment}\verb'; Read 1st byte from CODE array ``my_cs'\verb"'"\verb''\verb"'"\verb''}\\
1635 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'DPTR'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_constant}\verb'#my_cs'}\\
1636 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_unknown}\verb'#1'}\\
1637 \verb' '{\color{highlight_instruction}\verb'movc'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_indirect}\verb'@A+DPTR'}\\
1638 \verb''\\
1639 \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'$'}\verb' '{\color{highlight_comment}\verb'; Infinite loop (``$'\verb"'"\verb''\verb"'"\verb' stands for address of current instruction)'}\\
1640 \verb''\\
1641 \verb' '{\color{highlight_directive}\verb'end'}\verb' '{\color{highlight_comment}\verb'; End of assembly, everything after this directive is ignored'}\\
1642 \caption{Example of address space reservation}
1643 \end{code}
1644
1645 \section{Conditional Assembly}
1646 The aim of conditional assembly to to assemble certain parts of the code if and only if certain arithmetically expressed condition is met. This feature can prove useful particularly when the user want to make the code somehow ``configurable''. This assembler provides these instructions to work with conditional assembly:
1647 \begin{itemize}
1648 \setlength{\itemsep}{-3pt}
1649 \item IF <condition>
1650 \item IFN <condition>
1651 \item IFDEF <symbol>
1652 \item IFNDEF <symbol>
1653 \item ELSE
1654 \item ELSEIF <condition>
1655 \item ELSEIFN <condition>
1656 \item ELSEIFDEF <symbol>
1657 \item ELSEIFNDEF <symbol>
1658 \item ENDIF
1659 \end{itemize}
1660
1661 This can be best demonstrated on an example:
1662 \begin{code}[h!]
1663 \mysmallfont{}
1664 {\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_directive}\verb'equ'}\verb' '{\color{highlight_unknown_base}\verb'16'}\verb' '{\color{highlight_comment}\verb'; Assign number 14 to symbol abc'}\\
1665 {\color{highlight_constant}\verb'xyz'}\verb' '{\color{highlight_directive}\verb'equ'}\verb' '{\color{highlight_unknown_base}\verb'10'}\verb' '{\color{highlight_comment}\verb'; Assign number 10 to symbol abc'}\\
1666 \verb''\\
1667 {\color{highlight_directive}\verb'ifdef'}\verb' '{\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_comment}\verb';<--+ Assemble only if symbol abc has been defined'}\\
1668 \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_unknown_base}\verb'13'}\verb' '{\color{highlight_symbol}\verb')'}\verb' '{\color{highlight_comment}\verb'; | <--+ Assemble if 13 has been assigned to symbol abc'}\\
1669 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_bin}\verb'#01010101b'}\verb' '{\color{highlight_comment}\verb'; | |'}\\
1670 \verb' '{\color{highlight_directive}\verb'elseif'}\verb' '{\color{highlight_symbol}\verb'('}\verb' '{\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_symbol}\verb'='}\verb' '{\color{highlight_unknown_base}\verb'14'}\verb' '{\color{highlight_symbol}\verb')'}\verb' '{\color{highlight_comment}\verb'; | <--+ Assemble if 14 has been assigned to symbol abc'}\\
1671 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0aah'}\verb' '{\color{highlight_comment}\verb'; | |'}\\
1672 \verb' '{\color{highlight_directive}\verb'elseifn'}\verb' '{\color{highlight_symbol}\verb'('}\verb' '{\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_symbol}\verb'%'}\verb' '{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb')'}\verb' '{\color{highlight_comment}\verb'; | <--+ Assemble if the value assigned to symbol abc is even'}\\
1673 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_constant}\verb'#abc'}\verb' '{\color{highlight_comment}\verb'; | |'}\\
1674 \verb' '{\color{highlight_directive}\verb'else'}\verb' '{\color{highlight_comment}\verb'; | <--+ Else ..'}\\
1675 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_oct}\verb'#377q'}\verb' '{\color{highlight_comment}\verb'; | |'}\\
1676 \verb' '{\color{highlight_directive}\verb'endif'}\verb' '{\color{highlight_comment}\verb'; | <--+'}\\
1677 {\color{highlight_directive}\verb'elseifndef'}\verb' '{\color{highlight_constant}\verb'xyz'}\verb' '{\color{highlight_comment}\verb';<--+ Assemble if symbol xyz has NOT been defined'}\\
1678 \verb' '{\color{highlight_instruction}\verb'clr'}\verb' '{\color{highlight_sfr}\verb'A'}\verb' '{\color{highlight_comment}\verb'; |'}\\
1679 {\color{highlight_directive}\verb'else'}\verb' '{\color{highlight_comment}\verb';<--+ Else ...'}\\
1680 \verb' '{\color{highlight_directive}\verb'ifn'}\verb' '{\color{highlight_symbol}\verb'('}{\color{highlight_constant}\verb'xyz'}{\color{highlight_symbol}\verb' mod'}\verb' '{\color{highlight_unknown_base}\verb'2'}{\color{highlight_symbol}\verb')'}\verb' '{\color{highlight_comment}\verb'; | <--+ Assemble if ( yxz modulo 2 ) is 0'}\\
1681 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#128d'}\verb' '{\color{highlight_comment}\verb'; | |'}\\
1682 \verb' '{\color{highlight_directive}\verb'endif'}\verb' '{\color{highlight_comment}\verb'; | <--+'}\\
1683 {\color{highlight_directive}\verb'endif'}\verb' '{\color{highlight_comment}\verb';<--+'}\\
1684 \verb''\\
1685 {\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'$'}\verb' '{\color{highlight_comment}\verb'; Infinite loop'}\\
1686 {\color{highlight_directive}\verb'end'}\verb' '{\color{highlight_comment}\verb'; End of assembly'}\\
1687 \caption{An example of conditional assembly usage}
1688 \end{code}
1689
1690 \clearpage
1691 \section{Macro Processing}
1692 Macro is a sequence of instructions which can be expanded anywhere in the code and for any number of times. That may reduce necessity of repeating code fragments as well as source code size and make the solved task easier to comprehend and solve. Unlike subprograms macros do not add extra run-time overhead and repeating usage of macros may significantly increase size of the resulting machine code. Macros supported by this assembler are divided to named and unnamed ones.
1693
1694 \begin{table}[h!]
1695 \centering{}
1696 \mysmallfont{}
1697 \begin{tabular}{|ll|}
1698 \hline
1699 MACRO & Define a new named macro \\
1700 REPT & Define a new unnamed macro and expand it right away for the specified number of times \\
1701 TIMES & Exactly the same as ``REPT'' \\
1702 ENDM & End of macro definition \\
1703 \hline
1704 \end{tabular}
1705 \caption{Directives directly related to macros}
1706 \end{table}
1707
1708 This can be well demonstrated on examples:
1709 \begin{code}[h!]
1710 \mysmallfont{}
1711 {\color{highlight_directive}\verb'rept'}\verb' '{\color{highlight_unknown_base}\verb'3'}\verb' '{\color{highlight_comment}\verb'; Repeat the code 3 times'}\\
1712 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1713 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1714 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1715 {\color{highlight_directive}\verb'endm'}\\
1716 \verb''\\
1717 {\color{highlight_comment}\verb'; This is the same as if you wrote this:'}\\
1718 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1719 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1720 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1721 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1722 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1723 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1724 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1725 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1726 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1727 \caption{An exaple of REPT directive}
1728 \end{code}
1729 \begin{code}[h!]
1730 \mysmallfont{}
1731 {\color{highlight_macro}\verb'abc'}\verb' '{\color{highlight_directive}\verb'macro'}\verb' '{\color{highlight_comment}\verb'; Define named macro ``abc'\verb"'"\verb''\verb"'"\verb''}\\
1732 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1733 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1734 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1735 {\color{highlight_directive}\verb'endm'}\\
1736 \verb''\\
1737 {\color{highlight_macro}\verb'abc'}\verb' '{\color{highlight_comment}\verb'; Expand macro ``abc'\verb"'"\verb''\verb"'"\verb' here'}\\
1738 {\color{highlight_macro}\verb'abc'}\verb' '{\color{highlight_comment}\verb'; Expand macro ``abc'\verb"'"\verb''\verb"'"\verb' here'}\\
1739 \verb''\\
1740 {\color{highlight_comment}\verb'; This is the same as if you wrote this:'}\\
1741 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1742 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1743 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1744 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1745 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1746 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1747 \caption{An exaple of simple named macro}
1748 \end{code}
1749 \begin{code}[h!]
1750 \mysmallfont{}
1751 {\color{highlight_comment}\verb'; Define macro named as ``xyz'\verb"'"\verb''\verb"'"\verb' with 2 mandatory parameters'}\\
1752 {\color{highlight_macro}\verb'xyz'}\verb' '{\color{highlight_directive}\verb'macro'}\verb' '{\color{highlight_constant}\verb'foo'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_constant}\verb'bar'}\\
1753 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_constant}\verb'foo'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#10h'}\\
1754 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_constant}\verb'bar'}\\
1755 {\color{highlight_directive}\verb'endm'}\\
1756 \verb''\\
1757 {\color{highlight_macro}\verb'xyz'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'c'}\verb' '{\color{highlight_comment}\verb'; Expand macro ``xyz'\verb"'"\verb''\verb"'"\verb' here'}\\
1758 {\color{highlight_macro}\verb'xyz'}\verb' '{\color{highlight_sfr}\verb'p0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_symbol}\verb'.'}{\color{highlight_unknown_base}\verb'0'}\verb' '{\color{highlight_comment}\verb'; Expand macro ``xyz'\verb"'"\verb''\verb"'"\verb' here'}\\
1759 \verb''\\
1760 {\color{highlight_comment}\verb'; This is the same as if you wrote this:'\\
1761 }\verb' '{\color{highlight_comment}\verb'; xyz a, c'\\
1762 }\verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#10h'}\\
1763 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'c'}\\
1764 \verb' '{\color{highlight_comment}\verb'; xyz p0, p1.0'}\\
1765 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#10h'}\\
1766 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_symbol}\verb'.'}{\color{highlight_unknown_base}\verb'0'}\\
1767 \caption{An exaple of named macro with two parameters}
1768 \end{code}
1769 \begin{code}[h!]
1770 \mysmallfont{}{\color{highlight_macro}\verb'ijk'}\verb' '{\color{highlight_directive}\verb'macro'}\verb' '{\color{highlight_constant}\verb'foo'}\\
1771 \verb' '{\color{highlight_instruction}\verb'add'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
1772 \verb''\\
1773 \verb' '{\color{highlight_directive}\verb'if'}\verb' '{\color{highlight_constant}\verb'foo'}\verb' '{\color{highlight_symbol}\verb'='}\verb' '{\color{highlight_dec}\verb'4d'}\\
1774 \verb' '{\color{highlight_instruction}\verb'nop'}\\
1775 \verb' '{\color{highlight_directive}\verb'endif'}\\
1776 \verb''\\
1777 \verb' '{\color{highlight_instruction}\verb'subb'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_constant}\verb'#foo'}\\
1778 {\color{highlight_directive}\verb'endm'}\\
1779 \verb''\\
1780 {\color{highlight_macro}\verb'ijk'}\verb' '{\color{highlight_unknown_base}\verb'5'}\\
1781 {\color{highlight_macro}\verb'ijk'}\verb' '{\color{highlight_unknown_base}\verb'4'}\\
1782 \verb''\\
1783 {\color{highlight_comment}\verb'; This is the same as if you wrote this:'}\\
1784 \verb' '{\color{highlight_comment}\verb'; ijk 5'}\\
1785 \verb' '{\color{highlight_instruction}\verb'add'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
1786 \verb' '{\color{highlight_directive}\verb'if'}\verb' '{\color{highlight_unknown_base}\verb'5'}\verb' '{\color{highlight_symbol}\verb'='}\verb' '{\color{highlight_dec}\verb'4d'}\\
1787 \verb' '{\color{highlight_instruction}\verb'nop'}\\
1788 \verb' '{\color{highlight_directive}\verb'endif'}\\
1789 \verb' '{\color{highlight_instruction}\verb'subb'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_unknown}\verb'#5'}\\
1790 \verb' '{\color{highlight_comment}\verb'; ijk 4'}\\
1791 \verb' '{\color{highlight_instruction}\verb'add'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
1792 \verb' '{\color{highlight_directive}\verb'if'}\verb' '{\color{highlight_unknown_base}\verb'4'}\verb' '{\color{highlight_symbol}\verb'='}\verb' '{\color{highlight_dec}\verb'4d'}\\
1793 \verb' '{\color{highlight_instruction}\verb'nop'}\\
1794 \verb' '{\color{highlight_directive}\verb'endif'}\\
1795 \verb' '{\color{highlight_instruction}\verb'subb'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_unknown}\verb'#4'}\\
1796 \caption{An exaple of named macro used with if statement}
1797 \end{code}
1798 \begin{code}[h!]
1799 \mysmallfont{}
1800 {\color{highlight_comment}\verb'; Suppose we have these macros:'}\\
1801 {\color{highlight_macro}\verb'abc'}\verb' '{\color{highlight_directive}\verb'macro'}\\
1802 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1803 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1804 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1805 {\color{highlight_directive}\verb'endm'}\\
1806 {\color{highlight_macro}\verb'ijk'}\verb' '{\color{highlight_directive}\verb'macro'}\verb' '{\color{highlight_constant}\verb'foo'}\\
1807 \verb' '{\color{highlight_instruction}\verb'add'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
1808 \verb''\\
1809 \verb' '{\color{highlight_directive}\verb'if'}\verb' '{\color{highlight_constant}\verb'foo'}\verb' '{\color{highlight_symbol}\verb'='}\verb' '{\color{highlight_dec}\verb'4d'}\\
1810 \verb' '{\color{highlight_instruction}\verb'nop'}\\
1811 \verb' '{\color{highlight_directive}\verb'endif'}\\
1812 \verb''\\
1813 \verb' '{\color{highlight_instruction}\verb'subb'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_constant}\verb'#foo'}\\
1814 {\color{highlight_directive}\verb'endm'}\\
1815 {\color{highlight_macro}\verb'xyz'}\verb' '{\color{highlight_directive}\verb'macro'}\verb' '{\color{highlight_constant}\verb'foo'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_constant}\verb'bar'}\\
1816 \verb' '{\color{highlight_macro}\verb'ijk'}\verb' '{\color{highlight_constant}\verb'foo'}\\
1817 \verb' '{\color{highlight_macro}\verb'ijk'}\verb' '{\color{highlight_constant}\verb'bar'}\\
1818 \verb''\\
1819 \verb' '{\color{highlight_macro}\verb'abc'}\\
1820 {\color{highlight_directive}\verb'endm'}\\
1821 \verb''\\
1822 {\color{highlight_comment}\verb'; And we expand ``xyz'\verb"'"\verb''\verb"'"\verb' like this:'}\\
1823 {\color{highlight_macro}\verb'xyz'}\verb' '{\color{highlight_unknown_base}\verb'4'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_unknown_base}\verb'5'}\\
1824 \verb''\\
1825 {\color{highlight_comment}\verb'; Then we get this result:'}\\
1826 \verb' '{\color{highlight_comment}\verb'; ijk 4'}\\
1827 \verb' '{\color{highlight_instruction}\verb'add'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
1828 \verb' '{\color{highlight_instruction}\verb'nop'}\verb' '{\color{highlight_comment}\verb'; <-- Note this'}\\
1829 \verb' '{\color{highlight_instruction}\verb'subb'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_unknown}\verb'#4'}\\
1830 \verb' '{\color{highlight_comment}\verb'; ijk 5'}\\
1831 \verb' '{\color{highlight_instruction}\verb'add'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
1832 \verb' '{\color{highlight_instruction}\verb'subb'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_unknown}\verb'#5'}\\
1833 \verb' '{\color{highlight_comment}\verb'; abc'}\\
1834 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1835 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1836 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1837 \caption{An exaple of nested macros}
1838 \end{code}
1839 \begin{code}[h!]
1840 \mysmallfont{}
1841 {\color{highlight_macro}\verb'abc'}\verb' '{\color{highlight_directive}\verb'macro'}\\
1842 {\color{highlight_comment}\verb' ; Unnamed macro cannot be contained inside a named one'}\\
1843 \verb' '{\color{highlight_directive}\verb'times'}\verb' '{\color{highlight_unknown_base}\verb'2'}\\
1844 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1845 \verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1846 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p1'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
1847 \verb' '{\color{highlight_directive}\verb'endm'}\\
1848 {\color{highlight_directive}\verb'endm'}\\
1849 \caption{An exaple of nested macros, which will not work}
1850 \end{code}
1851
1852 \clearpage
1853 \section{Reserved keywords}
1854 \flushbottom
1855 \begin{table}[h!]
1856 \centering{}
1857 \mysmallfont{}
1858 \caption{Special instruction operands}
1859 \begin{tabular}{|ll|}
1860 \hline
1861 \$ & Location counter \\
1862 A & Accumulator \\
1863 AB & A/B register pair \\
1864 C & Carry flag (in PSW register) \\
1865 DPTR & Data pointer \\
1866 PC & Program counter \\
1867 R0..R7 & Registers \\
1868 \hline
1869 \end{tabular}
1870 \end{table}
1871 \begin{table}[h!]
1872 \centering{}
1873 \mysmallfont{}
1874 \caption{Instruction mnemonics}
1875 \begin{tabular}{|lllllllll|}
1876 \hline
1877 ACALL & ADD & ADDC & AJMP & ANL & CJNE & CLR & CPL & DA \\
1878 DEC & DIV & DJNZ & INC & JB & JBC & JC & JMP & JNB \\
1879 JNZ & SJMP & JNC & CALL & JZ & LCALL & LJMP & MOV & MOVC \\
1880 MOVX & MUL & NOP & ORL & POP & PUSH & RET & RETI & RL \\
1881 RLC & RR & RRC & SETB & SUBB & SWAP & XCH & XCHD & XRL \\
1882 \hline
1883 \end{tabular}
1884 \end{table}
1885 \begin{table}[h!]
1886 \centering{}
1887 \mysmallfont{}
1888 \caption{Directives}
1889 \begin{tabular}{|lllll|}
1890 \hline
1891 BIT & BSEG & BYTE & CODE & CSEG \\
1892 DATA & DB & DBIT & DS & DSEG \\
1893 DW & ELSE & ELSEIF & ELSEIFDEF & ELSEIFN \\
1894 ELSEIFNDEF & END & ENDIF & ENDM & EQU \\
1895 FLAG & IDATA & IF & IFDEF & IFN \\
1896 IFNDEF & INCLUDE & ISEG & LIST & MACRO \\
1897 NAME & NOLIST & ORG & REPT & SET \\
1898 SKIP & TIMES & USING & XDATA & XSEG \\
1899 \hline
1900 \end{tabular}
1901 \end{table}
1902 \begin{table}[h!]
1903 \centering{}
1904 \mysmallfont{}
1905 \caption{Expression operators}
1906 \begin{tabular}{|lllll|}
1907 \hline
1908 AND & EQ & GE & GT & HIGH \\
1909 LE & LOW & LT & MOD & NE \\
1910 NOT & OR & SHL & SHR & XOR \\
1911 \hline
1912 \end{tabular}
1913 \end{table}
1914 \begin{table}[h!]
1915 \centering{}
1916 \mysmallfont{}
1917 \caption{Assembler controls}
1918 \begin{tabular}{|llll|}
1919 \hline
1920 DA & DATE & EJ & EJECT \\
1921 LI & LIST & NOLI & NOLIST \\
1922 NOMACROSFIRST & NOMO & NOMOD & NOMOD51 \\
1923 NOOBJECT & NOPAGING & NOPI & NOPRINT \\
1924 NOSB & NOSYMBOLS & OBJECT & PAGELENGTH \\
1925 PAGEWIDTH & PAGING & PI & PL \\
1926 PRINT & PW & SB & SYMBOLS \\
1927 TITLE & TT & & \\
1928 \hline
1929 \end{tabular}
1930 \end{table}
1931
1932 \clearpage
1933 \section{Compatibility with ASEM-51}
1934 Not yet specified.
1935
1936 \clearpage
1937 \section{List File Format}
1938 Code listing serves as an additional information about the assembled code and the progress of the assembly process. It contains information about all symbols defined in the code. Where and how were they were defined, what are their values and whether they were used in the code. Also detailed information about all macros defined in the code and/or expanded in the code. Conditional compilation configuration, instruction OP codes, address space reservations, inclusion of code from another files. And all warnings, errors and notes generated during the assembly by the assembler. There are assembler control sequences which alters formatting of the code listing file. These control sequences will be discussed here. Format of code listing generated by this assembler is very similar to the one generated Metalink\textregistered ASM51.
1939 \begin{code}[h]
1940 \mysmallfont{}
1941 \verb'demo0 '{\color{highlight_macro}\verb'PAGE'}\verb' '{\color{highlight_unknown_base}\verb'1'}\\
1942 {\color{highlight_lst_line}\verb' 1'}\verb' '{\color{highlight_comment}\verb'; MCU 8051 IDE - Demostration code'}\\
1943 {\color{highlight_lst_line}\verb' 2'}\verb' '{\color{highlight_comment}\verb'; Very simple code'}\\
1944 {\color{highlight_lst_line}\verb' 3'}\\
1945 {\color{highlight_lst_line}\verb' 4'}\verb' '{\color{highlight_comment}\verb'; Press F2 and F6 to run the program (start simulator and animate)'}\\
1946 {\color{highlight_lst_line}\verb' 5'}\\
1947 {\color{highlight_lst_line}\verb' 6'}\verb' '{\color{highlight_directive}\verb'org'}\verb' '{\color{highlight_hex}\verb'0h'}\\
1948 {\color{highlight_lst_line}\verb' 7'}\\
1949 {\color{highlight_lst_address}\verb'0000'}{\color{highlight_lst_code}\verb' 08'}{\color{highlight_lst_line}\verb' 8'}\verb' '{\color{highlight_label}\verb'main:'}\verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\
1950 {\color{highlight_lst_address}\verb'0001'}{\color{highlight_lst_code}\verb' 06'}{\color{highlight_lst_line}\verb' 9'}\verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
1951 {\color{highlight_lst_address}\verb'0002'}{\color{highlight_lst_code}\verb' B87FFB'}{\color{highlight_lst_line}\verb' 10'}\verb' '{\color{highlight_instruction}\verb'cjne'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#07Fh'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_constant}\verb'main'}\\
1952 {\color{highlight_lst_address}\verb'0005'}{\color{highlight_lst_code}\verb' 7800'}{\color{highlight_lst_line}\verb' 11'}\verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#0d'}\\
1953 {\color{highlight_lst_address}\verb'0007'}{\color{highlight_lst_code}\verb' 80F7'}{\color{highlight_lst_line}\verb' 12'}\verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'main'}\\
1954 {\color{highlight_lst_line}\verb' 13'}\\
1955 {\color{highlight_lst_line}\verb' 14'}\verb' '{\color{highlight_directive}\verb'end'}\\
1956 {\color{highlight_lst_msg}\verb'ASSEMBLY COMPLETE,'}\verb' NO ERRORS FOUND, NO WARNINGS'\\
1957 \caption{A simple code listing}
1958 \end{code}
1959 Code listing contains entire source code which was assembled but with each line prefixed with line number and some additional information which will be explained later. Besides the original code there is also table of symbols defined during the assembly unless it was turned off. Code listing is divided into pages separated by form feed character, this behavior may be altered by certain assembler control sequences as well as page height and width.
1960
1961 Each line of code listing which contains original source code line may contain beside line number also some additional information regarding the compilation of the given line of code. Such a additional information might look like this and is composed of these parts:
1962
1963 \begin{code}[h]
1964 \verb' '\texttt{\colorbox{Lavender}{0055}}\verb' '\texttt{\colorbox{Goldenrod}{18}}\verb' '\texttt{\colorbox{Gray}{X data 55h}} \\
1965 \texttt{\colorbox{Apricot}{0014}}\verb' '\texttt{\colorbox{GreenYellow}{1122}}\verb' '\texttt{\colorbox{LimeGreen}{=1}}\verb' '\texttt{\colorbox{Goldenrod}{33}}\verb' '\texttt{\colorbox{Gray}{l: inc A}} \\
1966 \verb' '\texttt{\colorbox{Goldenrod}{35}}\verb' '\texttt{\colorbox{ProcessBlue}{+1}}\verb' '\texttt{\colorbox{Gray}{abc ; Expand macro ``abc'' here}} \\
1967 \texttt{\colorbox{Apricot}{001E}}\verb' '\texttt{\colorbox{GreenYellow}{E580}}\verb' '\texttt{\colorbox{Goldenrod}{36}}\verb' '\texttt{\colorbox{ProcessBlue}{+1}}\verb' '\texttt{\colorbox{Gray}{ mov a, p0}} \\
1968 \texttt{\colorbox{Apricot}{0020}}\verb' '\texttt{\colorbox{GreenYellow}{F4}}\verb' '\texttt{\colorbox{Goldenrod}{37}}\verb' '\texttt{\colorbox{ProcessBlue}{+1}}\verb' '\texttt{\colorbox{Gray}{ cpl a}} \\
1969 \texttt{\colorbox{Apricot}{0021}}\verb' '\texttt{\colorbox{GreenYellow}{F590}}\verb' '\texttt{\colorbox{Goldenrod}{38}}\verb' '\texttt{\colorbox{ProcessBlue}{+1}}\verb' '\texttt{\colorbox{Gray}{ mov p1, a}} \\\\
1970 \colorbox{Goldenrod}{\color{Goldenrod}X} Line number \\
1971 \colorbox{LimeGreen}{\color{LimeGreen}X} Level of file inclusion \\
1972 \colorbox{ProcessBlue}{\color{ProcessBlue}X} Level of macro expansion \\
1973 \colorbox{Apricot}{\color{Apricot}X} Address in code memory \\
1974 \colorbox{GreenYellow}{\color{GreenYellow}X} Machine code or another value to be stored in the code memory \\
1975 \colorbox{Lavender}{\color{Lavender}X} Value of a symbol \\
1976 \colorbox{Gray}{\color{Gray}X} Original line \\
1977
1978 \caption{Explanation code listing format}
1979 \end{code}
1980
1981 \begin{code}[h]
1982 \mysmallfont{}
1983 \verb'complicated_lst '{\color{highlight_macro}\verb'PAGE'}\verb' '{\color{highlight_unknown_base}\verb'1'}\\
1984 {\color{highlight_lst_number}\verb' 001C'}{\color{highlight_lst_line}\verb' 1'}\verb' '{\color{highlight_constant}\verb'abc'}\verb' '{\color{highlight_directive}\verb'equ'}\verb' '{\color{highlight_symbol}\verb'('}\verb' '{\color{highlight_unknown_base}\verb'14'}\verb' '{\color{highlight_symbol}\verb'*'}\verb' '{\color{highlight_unknown_base}\verb'2'}\verb' '{\color{highlight_symbol}\verb')'}\verb' '{\color{highlight_comment}\verb'; Define symbol abc'}\\
1985 {\color{highlight_lst_line}\verb' 2'}\verb' '{\color{highlight_directive}\verb'org'}\verb' '{\color{highlight_unknown_base}\verb'0'}\verb' '{\color{highlight_comment}\verb'; Start writing code at address 0'}\\
1986 {\color{highlight_lst_line}\verb' 3'}\\
1987 {\color{highlight_lst_include}\verb' =1'}{\color{highlight_lst_line}\verb' 4'}\verb' '{\color{highlight_directive}\verb'include'}\verb' '{\color{highlight_string}\verb''\verb"'"\verb'my_macros.asm'\verb"'"\verb' '{\color{highlight_comment}\verb'; Include file my_macros.asm'}}\\
1988 {\color{highlight_lst_include}\verb' =1'}{\color{highlight_lst_line}\verb' 5'}\verb' '{\color{highlight_comment}\verb'; This is the beginning of file my_macros.asm'}\\
1989 {\color{highlight_lst_include}\verb' =1'}{\color{highlight_lst_line}\verb' 6'}\verb' '{\color{highlight_macro}\verb'my_cpl'}\verb' '{\color{highlight_directive}\verb'macro'}\verb' '{\color{highlight_constant}\verb'foo'}\\
1990 {\color{highlight_lst_include}\verb' =1'}{\color{highlight_lst_line}\verb' 7'}\verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_constant}\verb'foo'}\\
1991 {\color{highlight_lst_include}\verb' =1'}{\color{highlight_lst_line}\verb' 8'}\verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'A'}\\
1992 {\color{highlight_lst_include}\verb' =1'}{\color{highlight_lst_line}\verb' 9'}\verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_constant}\verb'foo'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'A'}\\
1993 {\color{highlight_lst_include}\verb' =1'}{\color{highlight_lst_line}\verb' 10'}\verb' '{\color{highlight_directive}\verb'endm'}\\
1994 {\color{highlight_lst_include}\verb' =1'}{\color{highlight_lst_line}\verb' 11'}\verb' '{\color{highlight_comment}\verb'; This is the end of file my_macros.asm'}\\
1995 {\color{highlight_lst_line}\verb' 12'}\\
1996 {\color{highlight_lst_line}\verb' 13'}{\color{highlight_lst_macro}\verb' +1'}\verb' '{\color{highlight_label}\verb'main:'}\verb' '{\color{highlight_macro}\verb'my_cpl'}\verb' '{\color{highlight_sfr}\verb'P0'}\verb' '{\color{highlight_comment}\verb'; Expand macro my_cpl here'}\\
1997 {\color{highlight_lst_address}\verb'0000'}{\color{highlight_lst_code}\verb' E580'}{\color{highlight_lst_line}\verb' 14'}{\color{highlight_lst_macro}\verb' +1'}\verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'a'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'p0'}\\
1998 {\color{highlight_lst_address}\verb'0002'}{\color{highlight_lst_code}\verb' F4'}{\color{highlight_lst_line}\verb' 15'}{\color{highlight_lst_macro}\verb' +1'}\verb' '{\color{highlight_instruction}\verb'cpl'}\verb' '{\color{highlight_sfr}\verb'a'}\\
1999 {\color{highlight_lst_address}\verb'0003'}{\color{highlight_lst_code}\verb' F580'}{\color{highlight_lst_line}\verb' 16'}{\color{highlight_lst_macro}\verb' +1'}\verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'p0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'a'}\\
2000 {\color{highlight_lst_address}\verb'0005'}{\color{highlight_lst_code}\verb' 80F9'}{\color{highlight_lst_line}\verb' 17'}\verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'main'}\verb' '{\color{highlight_comment}\verb'; Jump back to label main'}\\
2001 {\color{highlight_lst_line}\verb' 18'}\verb' '{\color{highlight_directive}\verb'end'}\verb' '{\color{highlight_comment}\verb'; End of assembly'}\\
2002 {\color{highlight_lst_msg}\verb'ASSEMBLY COMPLETE,'}\verb' NO ERRORS FOUND, NO WARNINGS'\\
2003 \caption{A more complicated example of code listing}
2004 \end{code}
2005
2006 Control sequences affecting format of the generated code listing.
2007 \begin{table}[h!]
2008 \centering{}
2009 \mysmallfont{}
2010 \caption{Control sequences affecting code listing}
2011 \begin{tabular}{|llll|}
2012 \hline
2013 \$eject & \$ej & \$nolist & \$noli \\
2014 \$list & \$li & \$paging & \$pi \\
2015 \$nopaging & \$nopi & \$pagewidth & \$pw \\
2016 \$pagelength & \$pl & \$title & \$tt \\
2017 \$date & \$da & \$nosb & \$nosymbols \\
2018 \$noprint & \$symbols & \$sb & \$print \\
2019 \hline
2020 \end{tabular}
2021 \end{table}
2022
2023 \clearpage
2024 \section{Specification of Intel\textregistered 8 HEX Format}
2025 Intel\textregistered 8 HEX is a popular object file format capable of containing up to 64kB of data. Hex files have usually extension \fileextension{.hex} or \fileextension{.ihx}. These files are text files consisting of a sequence of records, each line line can contain at most one record. Records starts with ``:'' (colon) character at the beginning of the line and ends by end of the line. Everything else besides records should be ignored. Records consist of a sequence of 8-bit hexadecimal numbers (e.g. ``a2'' or ``8c''). These numbers are divided into ``fields'' with different meaning, see the example below.
2026
2027 \begin{code}[h]
2028 \caption{An example of an Intel\textregistered 8 hex code}
2029 \texttt{\colorbox{Goldenrod}{:}\colorbox{LimeGreen}{0F}\colorbox{ProcessBlue}{0000}\colorbox{Apricot}{00}\colorbox{GreenYellow}{E580F4F590E580F4F590E580F4F590}\colorbox{Lavender}{57}}\\
2030 \texttt{\colorbox{Goldenrod}{:}\colorbox{LimeGreen}{0F}\colorbox{ProcessBlue}{000F}\colorbox{Apricot}{00}\colorbox{GreenYellow}{E580F4F590E580F4F590E580F4F590}\colorbox{Lavender}{48}}\\
2031 \texttt{\colorbox{Goldenrod}{:}\colorbox{LimeGreen}{0F}\colorbox{ProcessBlue}{001E}\colorbox{Apricot}{00}\colorbox{GreenYellow}{E580F4F590E580F4F590E580F4F590}\colorbox{Lavender}{39}}\\
2032 \texttt{\colorbox{Goldenrod}{:}\colorbox{LimeGreen}{10}\colorbox{ProcessBlue}{002D}\colorbox{Apricot}{00}\colorbox{GreenYellow}{E580F4F5907410B3758010B2907410B3}\colorbox{Lavender}{30}}\\
2033 \texttt{\colorbox{Goldenrod}{:}\colorbox{LimeGreen}{10}\colorbox{ProcessBlue}{003D}\colorbox{Apricot}{00}\colorbox{GreenYellow}{758010B2902694052600940426940526}\colorbox{Lavender}{0A}}\\
2034 \texttt{\colorbox{Goldenrod}{:}\colorbox{LimeGreen}{10}\colorbox{ProcessBlue}{004D}\colorbox{Apricot}{00}\colorbox{GreenYellow}{00940426009404269405E580F4F59026}\colorbox{Lavender}{8A}}\\
2035 \texttt{\colorbox{Goldenrod}{:}\colorbox{LimeGreen}{0B}\colorbox{ProcessBlue}{005D}\colorbox{Apricot}{00}\colorbox{GreenYellow}{009404269405E580F4F590}\colorbox{Lavender}{63}}\\
2036 \texttt{\colorbox{Goldenrod}{:}\colorbox{LimeGreen}{00}\colorbox{ProcessBlue}{0000}\colorbox{Apricot}{01}\colorbox{Lavender}{FF}}\\\\
2037 \colorbox{Goldenrod}{\color{Goldenrod}X} Start code\\
2038 \colorbox{LimeGreen}{\color{LimeGreen}X} Byte count\\
2039 \colorbox{ProcessBlue}{\color{ProcessBlue}X} Address\\
2040 \colorbox{Apricot}{\color{Apricot}X} Record type\\
2041 \colorbox{GreenYellow}{\color{GreenYellow}X} Data\\
2042 \colorbox{Lavender}{\color{Lavender}X} Checksum (two's complement of 8-bit sum of entire record, except for the start code and the checksum itself)
2043 \end{code}
2044
2045 Record types available in Intel\textregistered 8 HEX
2046 \begin{description}
2047 \item[00] Data record
2048 \item[01] End of file record
2049 \end{description}
2050
2051 \chapter{Disassembler}
2052 Disassembler is a tool intended to generate assembly language code from an object file. In other words it has certain level of capability of reversing the assembly process and regaining the original source code from any object code. But there are some restriction to that capability and the whole thing is not so simple after all. So let's discuss disassembly process deeper. In MCU~8051~IDE you can invoke disassembler from the main menu ``\menuitem{Main Menu}'' $\rightarrow$ ``\menuitem{Tools}'' $\rightarrow$ ``\menuitem{Disassemble}''.
2053
2054 \bigskip
2055 \noindent
2056 \begin{center}
2057 \small{A simple example of a code generated by disassembler}
2058 \end{center}
2059 \begin{minipage}{\textwidth}
2060 \twocolumn
2061 \begin{minipage}[t]{.6\textwidth}
2062 \mysmallfont{}
2063 \textbf{Original code:}\\
2064 \verb' '{\color{highlight_directive}\verb'org'}\verb' '{\color{highlight_hex}\verb'0h'}\verb' '{\color{highlight_comment}\verb'; Start at address 0x00'}\\
2065 \verb''\\
2066 {\color{highlight_label}\verb'main:'}\verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\verb' '{\color{highlight_comment}\verb'; Increment R0'}\\
2067 \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
2068 \verb' '{\color{highlight_instruction}\verb'cjne'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#07Fh'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_constant}\verb'main'}\\
2069 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#0d'}\verb' '{\color{highlight_comment}\verb';'}\\
2070 \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'main'}\verb' '{\color{highlight_comment}\verb'; Jump back to label main'}\\
2071 \verb''\\
2072 \verb' '{\color{highlight_directive}\verb'end'}\verb' '{\color{highlight_comment}\verb'; End of assembly'}\\
2073 \end{minipage}\begin{minipage}[t]{.4\textwidth}
2074 \mysmallfont{}
2075 \textbf{Code generated by disassembler}\\
2076 \verb' '{\color{highlight_directive}\verb'ORG'}\verb' '{\color{highlight_hex}\verb'0h'}\\
2077 {\color{highlight_label}\verb'label0:'}\verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\
2078 \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
2079 \verb' '{\color{highlight_instruction}\verb'cjne'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#7Fh'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_constant}\verb'label0'}\\
2080 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0h'}\\
2081 \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'label0'}\\
2082 \verb''\\
2083 \verb' '{\color{highlight_directive}\verb'END'}\\
2084 \end{minipage}
2085 \onecolumn
2086 \end{minipage}
2087
2088 As you can see from the example above, the code generated by disassembler is the same as the original code. But of course original symbol names have vanished as well as comments, indentation and other tiny details which cannot be determined from the object code. This is caused by the simple fact that the object code contains only the machine code. It contains no information regarding how exactly the original code looked like. Just instructions with their operands and data directly written to the code memory by ``DB'' and ``DW'' directives. And here we are getting to the real problem which emerges every time when you try to disassemble ``not exactly a simple'' code.
2089
2090 8051 instructions comprises of 1, 2 or 3 bytes, the first byte determinates what instruction are we dealing with and so what is its length in bytes. But if the original code contained directives ``DB'' or ``DW'' then the disassembler ``thinks'' that these values are instructions too. If the disassembler consider a arbitrary value given by ``DB'' or ``DW'' instruction to be an instruction, it determinates its length according to its OP code (the 1st argument to the directive). And so it takes 0, 1 or 2 bytes next and interprets them as operands to that instruction. Then when it encounters a real instruction OP code it might think of it as another operand to something and so misinterpret it. Then you might end up with a code that is completely different from the original code and makes no sense at all to human. But if you reassemble such a ``non sense'' code with disabled peep hole optimization you must get the original object code back, and its functionality must not be changed. Even if the code seems to be
2091 absolutely non sense. In that case I strongly recommend to use another disassembler than is the built-in one. Consider for example D52 \url{http://www.8052.com/users/disasm/}. The built-in diassembler is provided just for ``completeness'', but its suitability for a real reverse engineering is highly questionable.
2092
2093 \bigskip
2094 \noindent
2095 \begin{center}
2096 \small{A simple example of a BADLY generated code by disassembler}
2097 \end{center}
2098 \begin{minipage}{\textwidth}
2099 \twocolumn
2100 \begin{minipage}[t]{.6\textwidth}
2101 \mysmallfont{}
2102 \textbf{Original code:}\\
2103 \verb' '{\color{highlight_directive}\verb'org'}\verb' '{\color{highlight_hex}\verb'0h'}\verb' '{\color{highlight_comment}\verb'; Start at address 0x00'}\\
2104 \verb''\\
2105 {\color{highlight_label}\verb'main:'}\verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\verb' '{\color{highlight_comment}\verb'; Increment R0'}\\
2106 \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
2107 \verb' '{\color{highlight_instruction}\verb'jmp'}\verb' '{\color{highlight_constant}\verb'cont'}\\
2108 \verb' '{\color{highlight_directive}\verb'db'}\verb' '{\color{highlight_string}\verb''\verb"'"\verb'some stringx'\verb"'"\verb''}\\
2109 {\color{highlight_label}\verb'cont:'}\verb' '{\color{highlight_instruction}\verb'cjne'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#07Fh'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_constant}\verb'main'}\\
2110 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_dec}\verb'#0d'}\verb' '{\color{highlight_comment}\verb';'}\\
2111 \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'main'}\verb' '{\color{highlight_comment}\verb'; Jump back to label main'}\\
2112 \verb''\\
2113 \verb' '{\color{highlight_directive}\verb'end'}\verb' '{\color{highlight_comment}\verb'; End of assembly'}\\
2114 \end{minipage}\begin{minipage}[t]{.4\textwidth}
2115 \mysmallfont{}
2116 \textbf{Code generated by disassembler}\\
2117 {\color{highlight_constant}\verb'label0'}\verb' '{\color{highlight_directive}\verb'CODE'}\verb' '{\color{highlight_hex}\verb'11h'}\\
2118 \verb''\\
2119 \verb' '{\color{highlight_directive}\verb'ORG'}\verb' '{\color{highlight_hex}\verb'0h'}\\
2120 {\color{highlight_label}\verb'label1:'}\verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_sfr}\verb'R0'}\\
2121 \verb' '{\color{highlight_instruction}\verb'inc'}\verb' '{\color{highlight_indirect}\verb'@R0'}\\
2122 \verb' '{\color{highlight_instruction}\verb'ljmp'}\verb' '{\color{highlight_constant}\verb'label0'}\\
2123 \verb' '{\color{highlight_instruction}\verb'jmp'}\verb' '{\color{highlight_indirect}\verb'@A+DPTR'}\\
2124 \verb' '{\color{highlight_instruction}\verb'xrl'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'R7'}\\
2125 \verb' '{\color{highlight_instruction}\verb'xrl'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'R5'}\\
2126 \verb' '{\color{highlight_instruction}\verb'xrl'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_hex}\verb'20h'}\\
2127 \verb' '{\color{highlight_instruction}\verb'jmp'}\verb' '{\color{highlight_indirect}\verb'@A+DPTR'}\\
2128 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#72h'}\\
2129 \verb' '{\color{highlight_instruction}\verb'xrl'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'R1'}\\
2130 \verb' '{\color{highlight_instruction}\verb'xrl'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_sfr}\verb'R6'}\\
2131 \verb' '{\color{highlight_instruction}\verb'xrl'}\verb' '{\color{highlight_sfr}\verb'A'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_indirect}\verb'@R1'}\\
2132 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0B8h'}\\
2133 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R7'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0ECh'}\\
2134 \verb' '{\color{highlight_instruction}\verb'mov'}\verb' '{\color{highlight_sfr}\verb'R0'}{\color{highlight_oper_sep}\verb','}\verb' '{\color{highlight_imm_hex}\verb'#0h'}\\
2135 \verb' '{\color{highlight_instruction}\verb'sjmp'}\verb' '{\color{highlight_constant}\verb'label1'}\\
2136 \verb''\\
2137 \verb' '{\color{highlight_directive}\verb'END'}\\
2138 \end{minipage}
2139 \onecolumn
2140 \end{minipage}
2141
2142 \chapter{MCU simulator}
2143 \section{Short introduction}
2144 The MCU simulator is a tool designed to mimics behavior of a real MCU as much as possible. But it can have certain limitations, the most expectable limitation is of course the speed of simulation. This simulator is very slow, but offers some extra features.
2145
2146 \section{Modes of simulation}
2147 There are 4 modes of simulation:
2148 \begin{description}
2149 \item[Step]
2150 Execute exactly one intruction, no matter how many machine cycles it will take. This does not apply for macro-instruction, in that case each instruction of the macro is executed separately.
2151 \item[Step over]
2152 Execute as many instructions as possible until simulator cursor changes its location from one line of source code to another.
2153 \item[Animate]
2154 Do the same as ``step'' but in a loop, one after another until stopped by a waring condition or user request.
2155 \item[Run]
2156 This is generally the same as ``animate'', but much faster, because GUI is not updated so offten as in the ``animate'' mode.
2157 \item[(Step Back)]
2158 Take back the last performed step. There is limited number of step which can be taken back.
2159 \end{description}
2160
2161 Virual HW can be enabled or disabled, it significantly affects speed of the simulation. Of course simulation is slower when virtual HW is on.
2162
2163 \section{Waring conditions}
2164 \begin{itemize}
2165 \setlength{\itemsep}{-3pt}
2166 \item Stack overflow
2167 \item Stack underflow
2168 \item Invalid instructions
2169 \item Watchdog overflow
2170 \item Invalid return from interrupt
2171 \item Reading from write only register
2172 \item Invalid access to IDATA/SFR
2173 \item Invalid access to EDATA
2174 \item Invalid access to XDATA
2175 \item Invalid access to bit
2176 \item Invalid access to CODE
2177 \item EEPROM write failure
2178 \item EEPROM write abort
2179 \item UART frame discard
2180 \item Illegal UART mode change
2181 \item Illegal Timer/Counter mode change
2182 \end{itemize}
2183
2184 \section{Limitations}
2185 \begin{enumerate}
2186 \setlength{\itemsep}{-3pt}
2187 \item UART simualation is limited in current version
2188 \item SPI simulation is not implemented
2189 \item Simulation of reduced power consumption modes is not supported
2190 \item Simulated MCU is many times slower the real one would be on ``normal'' conditions
2191 \end{enumerate}
2192
2193 \clearpage
2194 \section{Virtual hardware}
2195 MCU~8051~IDE simulator is also equipped with a few simulated simple hardware devices, which can be connected to the simulated MCU. These virtual hardware components are intended primarily to offer a better insight into programs interacting with things like LEDs or keys.
2196
2197 All wires connected to specific GPIO lines are colored according to the voltage level present on them, colors are the same as for graph in the bottom panel ({\color{Green}\small{GREEN}} == log. 0; {\color{Red}\small{RED}} == log. 1; {\color{Gray}\small{GRAY}} == not connected, etc.) Each of these virtual HW components has its own configuration menu and help text available trough that menu. Configuration can be saved to a file with extension \fileextension{.vhc}, and can be loaded from that file later. The configuration menu is accessible trough the button with this icon: ``\includegraphics[height=8pt]{img/configure.png}''. The \small{``\texttt{\colorbox{Green}{ON}}''/``\texttt{\colorbox{Red}{OFF}}''} button enables or disables entire subsystem of virtual hardware simulation including the graph of GPIO wires on the bottom panel.
2198
2199 \subsection{DS1620 temperature sensor}
2200 \begin{wrapfigure}{r}{150pt}
2201 \centering{}
2202 \includegraphics[width=110pt]{img/049.png}
2203 \includegraphics[width=110pt]{img/050.png}
2204 \caption{DS1620 simulator and its log window}
2205 \end{wrapfigure}
2206 Simulates DALLAS\textregistered DS1620 thermometer along with its 3-wire communication interface. Temperature which this simulated device should measure can be set by used on the scale in DS1620 simulator window. All internal registers of the device are displayed to the user and are modifiable by the user, current configuration of the device simulator including DS1620 non-volatile registers can be save into a file for further use. All communications with the simulated MCU and internal operation of the simulated thermometer are displayed in simulator log, log can be accessed via the DS1620 simulator configuration menu (``\includegraphics[height=8pt]{img/configure.png}'').
2207
2208 % \subsection{Virtual UART terminal}
2209 % This tool simulated UART device connected to the main MCU simulator, it's purpose is to make it easier to properly simulate programs using the 8051 UART interface. User can set where the TxD and RxD wire are connected to the MCU, baud rate, number of stop bits, etc. and send arbitrary data and see received data.
2210
2211 \subsection{File interface}
2212 \begin{wrapfigure}{l}{185pt}
2213 \centering{}
2214 \includegraphics[width=110pt]{img/048.png}
2215 \caption{PALE I/O interface}
2216 \end{wrapfigure}
2217 This tool can automatically switch states of GPIO lines of the simulated according to certain definition file and it can also record all changes occurring on arbitrary GPIO line to a specified output file. This function can be particularly useful when you are dealing with a 8051 program which extensively works with I/O ports.
2218
2219 \subsection{LED Panel}
2220 \begin{wrapfigure}{r}{180pt}
2221 \centering{}
2222 \includegraphics[width=110pt]{img/015.png}
2223 \caption{LED Panel}
2224 \end{wrapfigure}
2225 This is the simplest example of such a virtual hardware component. A simple panel consisting of 8 independent LEDs with common anode. Each LED can be connected to separate port and pin and react immediately to any change in voltage level on that line. Connections with the \uC are made with combo boxes on the bottom side of the panel.
2226
2227 \subsection{Single LED Display}
2228 \begin{wrapfigure}{l}{180pt}
2229 \centering{}
2230 \includegraphics[width=70pt]{img/012.png}
2231 \caption{LED Display}
2232 \end{wrapfigure}
2233 Single 8 segment LED display with one decimal point. Common electrode for the LEDs can be configured as well as the LED color. Each LED can be independently connected to any port and pin and reacts immediately to any change in voltage level on that pin. Common electrode is statically connected to either common ground or Vcc.
2234
2235 \subsection{Multiplexed LED Display}
2236 \begin{wrapfigure}{r}{155pt}
2237 \centering{}
2238 \includegraphics[width=130pt]{img/011.png}
2239 \caption{M LED Display}
2240 \end{wrapfigure}
2241 4 digits LED displays indented for run in multiplexed mode, LEDs are fading with configurable delay. Each digit has its own common electrode which polarity is configurable, this common electrode is connected to output from an inverter or transistor. There are four color shades for each LED segment, one for inactive, one for active, one for fast blinking and one for segment which was recently dimmed, that makes it possible to see an image which would probably appear on a real display when viewed just by the eye. Unit for the fading interval is one instruction cycle.
2242 \clearpage
2243 \subsection{LED Matrix}
2244 \begin{wrapfigure}{l}{150pt}
2245 \centering{}
2246 \includegraphics[width=80pt]{img/014.png}
2247 \caption{LED Matrix}
2248 \end{wrapfigure}
2249 Simple one color 8 x 8 LED matrix indented for run in multiplexed mode, LEDs are fading with configurable delay. Everything here is the same as for the Multiplexed LED Display, except for one thing, mapping. Mapping can be set to row, column or random, which is default. Row mapping means that row which has been activated right now immediately forgets which LEDs were shinning last time and which were not. Column mapping is the same but for columns and random mapping means that each LED will dim after specified interval and not when its row or column is activated. So in random mapping you have to wait until all LEDs are gray before you can draw a new image without being affected by the last one.
2250
2251 \subsection{Matrix Keypad}
2252 \begin{wrapfigure}{r}{200pt}
2253 \centering{}
2254 \includegraphics[width=80pt]{img/013.png}
2255 \caption{Matrix Keypad}
2256 \end{wrapfigure}
2257 4 x 4 Matrix keypad, each row and column can be connected to any GPIO line. Connections with the \uC are made with the combo boxes. Keys can be configured to behave as radio button\footnote{Radio buttons that means that one one key can be pressed at the time and when you press another key, the originally pressed key will return back to non pressed state}. Note that this tool can be also used to interconnect some port pins together statically, like wires in a bread board. Any key press takes effect immediately in all other virtual hardware components connected to the same line.
2258
2259 \clearpage
2260 \subsection{Simple Keypad}
2261 \begin{wrapfigure}{l}{180pt}
2262 \centering{}
2263 \includegraphics[width=110pt]{img/016.png}
2264 \caption{Simple Keypad}
2265 \end{wrapfigure}
2266 Array of 8 independent keys, each one of them can connect any GPIO line to the ground. Any key press takes effect immediately in all other virtual hardware components connected to the same line. Keys can also be configured to behave as radio buttons.
2267
2268 \enlargethispage{6\baselineskip}
2269 \subsection{LCD display controlled by HD44780}
2270 This tool simulates a HD44780 character LCD of any size up to 2 rows and 40 columns. There are 11 I/O lines serving as interface for the MCU, ``E'', ``RS'', ``R/W'' and ``D0''..``D7''. User can view and modify content of the display data RAM (DDRAM), the character generator RAM (CGRAM) and certain HD44780 registers: instruction register (IR), data register (DR), address counter (AC) and display shift, these registers are shown in hexadecimal representation.
2271 User can also view content of character generator ROM (CGROM) and set font to use. All of the driver commands are fully supported and all important events occurring in the simulated driver (HD44780) are recorded in the simulator log. User can also see and modify certain HD44780 configuration flags like ``B'', ``S'', ``D'' and so on. And the window is collapsible.
2272 \begin{figure}[h!]
2273 \begin{minipage}[b]{.5\textwidth}
2274 \begin{minipage}[b]{\textwidth}
2275 \centering{}
2276 \includegraphics[width=1\textwidth]{img/043.png}
2277 \caption{Simulated LCD display}
2278 \end{minipage}
2279
2280 \begin{minipage}[b]{\textwidth}
2281 \centering{}
2282 \includegraphics[width=1\textwidth]{img/044.png}
2283 \caption{HD44780 Log}
2284 \end{minipage}
2285
2286 \begin{minipage}[b]{\textwidth}
2287 \begin{minipage}[b]{.45\textwidth}
2288 \centering{}
2289 \includegraphics[width=.9\textwidth]{img/045.png}
2290 \caption{CGRAM}
2291 \end{minipage}
2292 \begin{minipage}[b]{.45\textwidth}
2293 \centering{}
2294 \includegraphics[width=.9\textwidth]{img/046.png}
2295 \caption{DDRAM}
2296 \end{minipage}
2297 \end{minipage}
2298 \end{minipage}
2299 \begin{minipage}[b]{.5\textwidth}
2300 \centering{}
2301 \includegraphics[width=\textwidth]{img/047.png}
2302 \caption{View on CGROM}
2303 \end{minipage}
2304 \end{figure}
2305
2306 \chapter{Writing hardware tool control plug-ins}
2307 \label{sec:WritingHardwareToolControlPlugIns}
2308 \section{Foreword}
2309 \begin{wrapfigure}{r}{120pt}
2310 \centering{}
2311 \includegraphics[width=110pt]{img/ssp89s_sceenshot.png}
2312 \caption{An example of HW control plug-in}
2313 \end{wrapfigure}
2314 It is not surprising that IDE for micro-controllers should be capable of inter-operation with certain hardware tools. MCU~8051~IDE has tool named HW plug-ins manager which is responsible for loading and managing plug-ins written in order to to ``integrate'' exiting hardware tools into this IDE. With this feature every author of a 8051 programmer, ICD, ICE etc. who knows Tcl/Tk language has the opportunity to make his or her own tool working in direct cooperation with the IDE. These plug-ins have to be written at least partially in the TCL language and use the Tk library along with API of MCU~8051~IDE. But that doesn't mean that they should be written entirely in Tcl/Tk. On the contrary I would encourage usage of another languages for example SSP89S, also a part of MCU~8051~IDE project, is written almost completely in C++/Qt4, but only a ``small'' piece of the software is written in Tcl/Tk. Tcl/Tk can easily inter-operate with C and C++, also it is possible to run arbitrary separate process from inside of
2315 Tcl/Tk program and control it vie for example TCP sockets or its stdin/stdout or something else.
2316
2317 \section{How to write your own plug-in}
2318 At first take these steps:
2319 \begin{enumerate}
2320 \item \textbf{Create the plug-in directory}\label{plug-in directory} \\
2321 On POSIX system the plug-in directory have to be placed in\\
2322 ``/usr/share/mcu8051ide/hwplugins'', on Microsoft\textregistered Windows\textregistered the directory is ``<YourInstallationDirectory>\verb'\'hwplugins''. The plug-in directory must carry the name of your plug-in, where spaces are replaced with ``\_'' (underscore) characters. For example suppose you want to create a plug-in named as ``My~First~Plug-in~v1.0'', then your plug-in directory directory is ``My\_First\_Plug-in\_v1.0''.
2323 \item \textbf{Create the plug-in initialization file} \\
2324 Plug-in initialization file tells the IDE that there is some plug-in at all. The file contains basic initialization of the plug-in environment and must follow certain rules. The file name must also follow name of the plug-in in the same way as the plug-in directory. But the initialization file have to be placed in directory hwplugins. And must have extension \fileextension{.tcl}! For example consider again our ``My~First~Plug-in~v1.0'' plug-in, as we mentioned before. The plug-in directory is: ``/usr/share/mcu8051ide/\underline{hwplugins}/My\_First\_Plug-in\_v1.0'' then the initialization file is:\\
2325 ``/usr/share/mcu8051ide/\underline{hwplugins}/My\_First\_Plug-in\_v1.0\underline{.tcl}''.
2326 \item \textbf{Define mandatory variables} \\
2327 {
2328 \mysmallfont{}
2329 \begin{verbatim}
2330 set AUTHOR "<your name>" ;# e.g. "Homer Simpson"
2331 set EMAIL "<[email protected]>" ;# e.g. "[email protected]"
2332 set P_VERSION "<version_of_your_plug-in>" ;# e.g. "1.2.3" or "0.9"
2333 set MIN_IDE_VER "1.1" ;# Mimimal required version of MCU 8051 IDE
2334 \end{verbatim}
2335 }
2336 \item \textbf{Define mandatory functions} \\
2337 {
2338 \mysmallfont{}
2339 \begin{verbatim}
2340 # Free resources occupied by this plugin
2341 proc dispose {} { ... }
2342
2343 # Initialize the plug-in
2344 proc init {main_frame current_namespace directory} { ... }
2345
2346 # Restore previous session
2347 proc restore_session {session_data} { ... }
2348
2349 # Save plug-in session
2350 proc save_session {} { ...; return <String> }
2351
2352 # Is plugin busy ?
2353 proc is_busy {} { ...; return <BooleanValue> }
2354 \end{verbatim}
2355 }
2356
2357 ``...'' means any code you want there. See ``/usr/share/mcu8051ide/\underline{hwplugins}/plug-in\_template.txt'' or ``<YourInstallationDirectory>\verb'\'hwplugins\verb'\'plug-in\_template.txt'' for more details and for a template for such file.
2358 \end{enumerate}
2359
2360 When you have these steps completed you have prepared basic environment for the plug-in. Then the ``HW plug-ins manager'' in the right panel in IDE's GUI should now recognize your plug-in and be able to attempt to load it. If it is not so, then there is definitely something wrong. Any other files which your plug-in consist of and just whatever you want there should be placed in your plug-in directory (\ref{plug-in directory}). And the initialization file should do nothing else than source some real plug-in's file(s) and call appropriate functions inside them. One more important thing, the plug-in runs it \textbf{dynamically assigned namespace}. Take it into account, otherwise your plug-in wont work! Function ``init'' takes the name of this namespace in parameter ``current\_namespace''. So as you can see, it's quite easy you have just to define 4 variables and 5 functions and you can interface with the IDE.
2361
2362 \section{Using MCU~8051~IDE API}
2363 You can used any part the API you want, but the entire IDE's API is wast and may change in future without notice. So there is special API dedicated to use in hardware control plug-ins, it is located in ``\texttt{::HwManager}'' namespace and consists of merely 10 simple functions. This API is available since version 1.4. Here is the list of its functions:
2364
2365 {
2366 \mysmallfont{}
2367 \begin{verbatim}
2368 ## Check whether there is some project opened in the IDE
2369 # @return Bool - 1 == Yes, there is; 0 == No there is not
2370 proc is_project_opened {}
2371
2372 ## Check whether MCU simulator is engaged
2373 # @return Bool - 0 == 1 == Yes, it is; No it is not (or no project is opened)
2374 proc is_simulator_engaged {}
2375
2376 ## Get full name of file which is currently displayed in the source code editor
2377 # @return String - Full file name including path or empty string in case there is no project opened
2378 proc get_current_file {}
2379
2380 ## Get full name of file which has been chosen as the project main file
2381 # @return String - Full file name or empty string
2382 proc get_project_main_file {}
2383
2384 ## Get path the directory of currently active project
2385 # @return String - Directory path or empty string in case there is no project opened
2386 proc get_project_dir {}
2387
2388 ## Get name of the current project
2389 # @return String - Name of the current project or empty string in case there is no project opened
2390 proc get_project_name {}
2391
2392 ## Initiate compilation if at least one of the source files was modified
2393 # @parm String success_callback - Any command to execute after successful compilation
2394 # @parm String failure_callback - Any command to execute after unsuccessful compilation
2395 # @return Bool - 1 == Process successfully started; 0 == Unable to comply (no project is opened)
2396 proc compile_if_nessesary_and_callback {success_callback failure_callback}
2397
2398 ## Open the specified Intel® 8 hex file in hexadecimal editor
2399 # @parm String filename - Name of file to open (including path)
2400 # @return Bool - 1 == Success; 0 == Failure
2401 proc open_in_hexeditor {filename}
2402
2403 ## Start MCU simulator if possible
2404 # @return Bool - 1 == Success; 0 == Unable to comply
2405 proc start_simulator {}
2406
2407 ## Shutdown MCU simulator if possible
2408 # @return Bool - 1 == Success; 0 == Unable to comply
2409 proc shutdown_simulator {}
2410 \end{verbatim}
2411 }
2412
2413 \section{A basic example}
2414 Lets write just a simple plug-in which merely demonstrates usage of some of the above mentioned functions.
2415 \begin{figure}[h!]
2416 \centering{}
2417 \includegraphics[width=120pt]{img/029.png}
2418 \caption{A basic example of a plug-in}
2419 \end{figure}
2420
2421 {
2422 \fontsize{7pt}{9pt} \selectfont{}
2423 \begin{verbatim}
2424 set AUTHOR "Homer Simpson"
2425 set EMAIL "[email protected]"
2426 set P_VERSION "1.0"
2427 set MIN_IDE_VER "1.3.11"
2428
2429 proc dispose {} {
2430 tk_messageBox \
2431 -title "My First Plug-in" \
2432 -message "Called: dispose {}"
2433 }
2434
2435 proc init {main_frame project_object current_namespace directory} {
2436 pack [label $main_frame.l0 -text $current_namespace] -anchor w
2437 pack [label $main_frame.l1 -text $directory] -anchor w
2438
2439 set f [labelframe $main_frame.f -text "My First Plug-in"]
2440 pack [label $f.l0 -text "is_project_opened : [::HwManager::is_project_opened]"] -anchor w
2441 pack [label $f.l1 -text "is_simulator_engaged : [::HwManager::is_simulator_engaged]"] -anchor w
2442 pack [label $f.l2 -text "get_current_file : [::HwManager::get_current_file]"] -anchor w
2443 pack [label $f.l3 -text "get_project_main_file : [::HwManager::get_project_main_file]"] -anchor w
2444 pack [label $f.l4 -text "get_project_dir : [::HwManager::get_project_dir]" ] -anchor w
2445 pack [label $f.l5 -text "l : [::HwManager::get_project_name]"] -anchor w
2446
2447 pack [ttk::button $f.b0 -text "update" -command "
2448 $f.l0 configure -text \"is_project_opened : \[::HwManager::is_project_opened\]\"
2449 $f.l1 configure -text \"is_simulator_engaged : \[::HwManager::is_simulator_engaged\]\"
2450 $f.l2 configure -text \"get_current_file : \[::HwManager::get_current_file\]\"
2451 $f.l3 configure -text \"get_project_main_file : \[::HwManager::get_project_main_file\]\"
2452 $f.l4 configure -text \"get_project_dir : \[::HwManager::get_project_dir\]\"
2453 $f.l5 configure -text \"get_project_name : \[::HwManager::get_project_name\]\"
2454 "] -anchor w
2455 pack $f -fill both -expand 1
2456
2457 pack [ttk::button $main_frame.b1 \
2458 -text "start_simulator" \
2459 -command {::HwManager::start_simulator} \
2460 ] -side left
2461 pack [ttk::button $main_frame.b2 \
2462 -text "shutdown_simulator" \
2463 -command {::HwManager::shutdown_simulator} \
2464 ] -side left
2465 }
2466
2467 proc restore_session {session_data} {
2468 tk_messageBox \
2469 -title "My First Plug-in" \
2470 -message "Called: restore_session {$session_data}"
2471 }
2472
2473 proc save_session {} {
2474 tk_messageBox \
2475 -title "My First Plug-in" \
2476 -message "Called: save_session {}"
2477 return "my data, time: [clock format [clock seconds] -format {%T}]"
2478 }
2479
2480 proc is_busy {} {
2481 return [expr {
2482 [tk_messageBox \
2483 -title "My First Plug-in" \
2484 -message "Called: is_busy {}" \
2485 -type {yesno}
2486 ]
2487 == {yes}}]
2488 }
2489 \end{verbatim}
2490 }
2491
2492 \section{Random remarks}
2493 \begin{itemize}
2494 \item Don't forget that your plug-in runs the main thread as well as the GUI of the entire IDE. So if your plug-in does some time expensive operations and it is probable that it does. Then these operations have to be performed in either separate thread or have to run in separate process. It is also possible to regularly ``update'' the application by reentering the event loop using Tcl's \textbf{update} command.
2495 \item Plug-in files must use encoding UTF-8 and should use LF (Line Feed) character as line end delimiter. In other words Unix line termination sequence.
2496 \item Although it is possible to name the plug-in directory in any way what your OS accept. It is generally a good idea to follow the mentioned recommendation. At least the name of the initialization file have to follow the mentioned recommendation.
2497 \item Plug-ins have unrestricted access to the entire application. So they should be written carefully, because plug-ins can theoretically crash down the entire IDE.
2498 \item Program errors which occurs during loading or unloading of a plug-in are reported via a special dialog. In this dialog plug-in author and his or her email address are mentioned.
2499 \item The above mentioned API provided by ``\texttt{::HwManager}'' is just a facade\footnote{A design pattern as described in the GOF book}. Before version 1.4 plug-ins must have had to be written to access directly the functionality currently hidden behind ``\texttt{::HwManager}'', so it was much more complicated.
2500 \item Each instance of a hardware plug-ins manager is bond to its project. But actual plug-ins don't have to be. That's the reason why there is function ``::HwManager::is\_project\_opened {}''. All functions inside the above mentioned API (\texttt{::HwManager::*}) works with the current project, not necessaryly with the project which is the HW manager bond with.
2501 \end{itemize}
2502
2503 \chapter{Command Line Interface}
2504 MCU~8051~IDE's CLI makes it possible to use entire IDE just as an assembler, disassembler or converter between \fileextension{.hex} files and binary files. MCU~8051~IDE supports these switches:\\
2505 {
2506 \mysmallfont{}
2507 \begin{longtable}{ll}
2508 \textbf{\normalsize{Switch}} & \textbf{\normalsize{Meaning}} \\\hline
2509 \endhead
2510 \\\multicolumn{2}{l}{\textbf{General}} \\\hline
2511 \texttt{--help, -h} & Show help for CLI \\
2512 \texttt{--quiet, -q} & Do not who initialization progress on start-up \\
2513 \texttt{--nosplash} & Do not show the splash screen \\
2514 \texttt{--nocolor, -n} & Do not show colorful output in console \\
2515 \texttt{--version, -V} & Show program version and exit \\
2516 \texttt{--defaults} & Ru program in empty session \\
2517 \texttt{--minimalized} & Run in minimalized window \\
2518 \texttt{--config-file filename} & Specify path to an alternative configuration file \\
2519 \texttt{--check-libraries} & Verify whether all required libraries are available \\
2520 \texttt{--ignore-last-session} & Start with an empty session \\
2521 \texttt{--open-project project} & Open just this project \\
2522 \texttt{--reset-user-settings} & Reset all user setting to defaults \\
2523 \\\multicolumn{2}{l}{\textbf{Data conversions}} \\\hline
2524 \texttt{--auto-indent input} & Reformat indentation the specified file \\
2525 \texttt{--hex2bin input output} & Convert Intel 8 Hex into a binary file \\
2526 \texttt{--bin2hex input output} & Convert a binary file in Intel 8 HEX \\
2527 \texttt{--sim2hex input output} & Convert MCU~8051~IDE simulator file to Intel 8 Hex file \\
2528 \texttt{--sim2bin input output} & Convert MCU~8051~IDE simulator file to binary file \\
2529 \texttt{--normalize-hex input} & Normalize Intel 8 HEX (force incremental addressing order) \\
2530 \\\multicolumn{2}{l}{\textbf{Assembler/Disassembler}} \\\hline
2531 \texttt{--disassemble hex\_file}& Disassemble Intel 8 HEX file to hex\_file.asm \\
2532 \texttt{--assemble asm\_file} & Assemble the specified file \\
2533 \texttt{--compile asm\_file} & The same as ``--assemble'' \\
2534 \texttt{--iram-size size} & Set size of internal data memory for assembler \\
2535 \texttt{--code-size size} & Set size of program data memory for assembler \\
2536 \texttt{--xram-size size} & Set size of external data memory for assembler \\
2537 \texttt{--no-opt} & Disable peephole optimization \\
2538 \texttt{--comp-quiet} & Suppress text output from the assembler \\
2539 \texttt{--no-sim} & Disable generation of .adf file \\
2540 \texttt{--no-bin} & Disable generation of .bin file \\
2541 \texttt{--no-lst} & Disable generation of .lst file \\
2542 \texttt{--no-hex} & Disable generation of .hex file \\
2543 \texttt{--warning-level} 0-3 & Set warning level to the specified level \\
2544 \end{longtable}
2545 }
2546
2547 \noindent
2548 Interesting examples:
2549 {
2550 \mysmallfont{}
2551 \begin{verbatim}
2552 # Reset all IDE settings to defaults
2553 mcu8051ide --reset-user-settings
2554
2555 # Use MCU 8051 IDE as assembler (without GUI)
2556 mcu8051ide --compile /some_directory/my_file.asm
2557
2558 # Use MCU 8051 IDE as disssembler (without GUI)
2559 mcu8051ide --disassemble /some_directory/my_file.hex
2560
2561 # Use MCU 8051 IDE as convertor from binary files to Intel 8 HEX (without GUI)
2562 mcu8051ide --bin2hex /some_directory/my_file /some_directory/my_file.hex
2563 \end{verbatim}
2564 }
2565
2566 \chapter{Translating the IDE into different languages}
2567 The IDE can be translated to almost any language. The translation can be accomplished by creating of a translation definition file. Such a file must follow certain strict rules in order to work properly. Translation files are normally located in directory ``/usr/share/mcu8051ide/translations'', on Microsoft\textregistered Windows\textregistered the directory is ``<YourInstallationDirectory>\verb'\'translations''. There you can find file ``template.txt'' which is template of MCU 8051 IDE translation file. Along with it there is also file ``languages.txt'' which defines names of languages to which the IDE was already translated. These names are written in these languages. Translation files look like this ``ru.msg'' (Russian translation) or ``cs.msg'' (Czech translation), these files need to be regularly updated. Note also that these files are quite big, each about 0.5MB and each contains about 4500 translated sentences. Further details regarding the translation are mentioned directly in the files related to
2568 translation, particularly in file ``template.txt''. Refer to them if you are interested in making your own translation of the IDE. This is an open-source project so any help is appreciated.
2569
2570 \bigskip
2571 \noindent
2572 {
2573 The first several lines in file ``template.txt'':\\
2574 \mysmallfont{}
2575 \begin{verbatim}
2576 # This is a template of MCU 8051 IDE translation file
2577 #
2578 # This file allows to localize the the user environment of the IDE to almost any
2579 # language.
2580 #
2581 # HOW TO MAKE IT WORK:
2582 # 1) Copy this file (template.txt) to <lang_code>.msg in the same directory.
2583 # Where ``<lang_code>'' is supposed to be replaced with language code of
2584 # the translation. For example ``ru'' means Russian, or ``cs'' means Czech.
2585 # The language code must be lowercase.
2586 # 2) Translate all sentences enclosed by ``§'' (paragraph) character. And be
2587 # sure to remove the ``§'' character.
2588 # 3) Modify file ``languages.tcl'' and add name of language which you are
2589 # making the translation for. Name should be specified in that language.
2590 #
2591 # IMPORTANT RULES FOR TRANSLATION:
2592 # 1) Be aware of that this file is very sensitive.
2593 # 2) Everything besides actual sentences for translation must not be modified
2594 # in any way! Otherwise the file might cause serious program instability.
2595 # 3) Escape sequences and all special characters must be preserved.
2596 # 4) Sentences enclosed with ``"'' (double quote) character, can be translated
2597 # into sentences with different length. But the same does not apply for
2598 # sentences enclosed with ``{'' and ``}'' (curly brackets) characters,
2599 # their lengths must stay preserved.
2600 # 5) Do not translate ``$'' dollar symbol, it has a special meaning here, not
2601 # related to currency.
2602 # 6) Keep UTF-8 encoding and if possible, please keep also Unix line ends.
2603 #
2604 # NOTES:
2605 # 1) `` ;# <-- NOT TRANSLATED YET'' is just a comment and can be removed at
2606 # any time
2607 # 2) Nothing is perfect ... if you find anything strange or not functional
2608 # here, please report it as a regular bug.
2609 # 3) Recommended syntax highlight pattern for this file is "Tcl/Tk"
2610 # 4) Please don't hesitate to ask any questions.
2611 #
2612 # Thank you for your cooperation, which helps us make the software better!
2613 #
2614 \end{verbatim}
2615 }
2616
2617 \bigskip
2618 \noindent
2619 {
2620 A random piece of the translation definition file template\\
2621 \mysmallfont{}
2622 \begin{verbatim}
2623 mcset $l "Replace all" \
2624 "§Replace all§" ;# <-- NOT TRANSLATED YET
2625 mcset $l "Find next" \
2626 "§Find next§" ;# <-- NOT TRANSLATED YET
2627 mcset $l "Close" \
2628 "§Close§" ;# <-- NOT TRANSLATED YET
2629 mcset $l "Replace confirmation - %s" \
2630 "§Replace confirmation - %s§" ;# <-- NOT TRANSLATED YET
2631 mcset $l "Go to line" \
2632 "§Go to line§" ;# <-- NOT TRANSLATED YET
2633 mcset $l "Ok" \
2634 "§Ok§" ;# <-- NOT TRANSLATED YET
2635 mcset $l "Cancel" \
2636 "§Cancel§" ;# <-- NOT TRANSLATED YET
2637 mcset $l "Go to line - MCU 8051 IDE" \
2638 "§Go to line - MCU 8051 IDE§" ;# <-- NOT TRANSLATED YET
2639 mcset $l "Choose directory - MCU 8051 IDE" \
2640 "§Choose directory - MCU 8051 IDE§" ;# <-- NOT TRANSLATED YET
2641 \end{verbatim}
2642 }
2643
2644 \appendix
2645 \twocolumn
2646 \chapter{License}
2647 MCU~8051~IDE and all its components is distributed under terms of GNU GPLv2.
2648 {
2649 \fontsize{5pt}{6pt}\selectfont{}
2650 \enlargethispage{10\baselineskip}
2651 \begin{verbatim}
2652 GNU GENERAL PUBLIC LICENSE
2653 Version 2, June 1991
2654
2655 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
2656 675 Mass Ave, Cambridge, MA 02139, USA
2657 Everyone is permitted to copy and distribute verbatim copies
2658 of this license document, but changing it is not allowed.
2659
2660 Preamble
2661
2662 The licenses for most software are designed to take away your
2663 freedom to share and change it. By contrast, the GNU General Public
2664 License is intended to guarantee your freedom to share and change free
2665 software--to make sure the software is free for all its users. This
2666 General Public License applies to most of the Free Software
2667 Foundations software and to any other program whose authors commit to
2668 using it. (Some other Free Software Foundation software is covered by
2669 the GNU Library General Public License instead.) You can apply it to
2670 your programs, too.
2671
2672 When we speak of free software, we are referring to freedom, not
2673 price. Our General Public Licenses are designed to make sure that you
2674 have the freedom to distribute copies of free software (and charge for
2675 this service if you wish), that you receive source code or can get it
2676 if you want it, that you can change the software or use pieces of it
2677 in new free programs; and that you know you can do these things.
2678
2679 To protect your rights, we need to make restrictions that forbid
2680 anyone to deny you these rights or to ask you to surrender the rights.
2681 These restrictions translate to certain responsibilities for you if you
2682 distribute copies of the software, or if you modify it.
2683
2684 For example, if you distribute copies of such a program, whether
2685 gratis or for a fee, you must give the recipients all the rights that
2686 you have. You must make sure that they, too, receive or can get the
2687 source code. And you must show them these terms so they know their
2688 rights.
2689
2690 We protect your rights with two steps: (1) copyright the software, and
2691 (2) offer you this license which gives you legal permission to copy,
2692 distribute and/or modify the software.
2693
2694 Also, for each authors protection and ours, we want to make certain
2695 that everyone understands that there is no warranty for this free
2696 software. If the software is modified by someone else and passed on, we
2697 want its recipients to know that what they have is not the original, so
2698 that any problems introduced by others will not reflect on the original
2699 authors reputations.
2700
2701 Finally, any free program is threatened constantly by software
2702 patents. We wish to avoid the danger that redistributors of a free
2703 program will individually obtain patent licenses, in effect making the
2704 program proprietary. To prevent this, we have made it clear that any
2705 patent must be licensed for everyones free use or not licensed at all.
2706
2707 The precise terms and conditions for copying, distribution and
2708 modification follow.
2709
2710 GNU GENERAL PUBLIC LICENSE
2711 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
2712
2713 0. This License applies to any program or other work which contains
2714 a notice placed by the copyright holder saying it may be distributed
2715 under the terms of this General Public License. The "Program", below,
2716 refers to any such program or work, and a "work based on the Program"
2717 means either the Program or any derivative work under copyright law:
2718 that is to say, a work containing the Program or a portion of it,
2719 either verbatim or with modifications and/or translated into another
2720 language. (Hereinafter, translation is included without limitation in
2721 the term "modification".) Each licensee is addressed as "you".
2722
2723 Activities other than copying, distribution and modification are not
2724 covered by this License; they are outside its scope. The act of
2725 running the Program is not restricted, and the output from the Program
2726 is covered only if its contents constitute a work based on the
2727 Program (independent of having been made by running the Program).
2728 Whether that is true depends on what the Program does.
2729
2730 1. You may copy and distribute verbatim copies of the Programs
2731 source code as you receive it, in any medium, provided that you
2732 conspicuously and appropriately publish on each copy an appropriate
2733 copyright notice and disclaimer of warranty; keep intact all the
2734 notices that refer to this License and to the absence of any warranty;
2735 and give any other recipients of the Program a copy of this License
2736 along with the Program.
2737
2738 You may charge a fee for the physical act of transferring a copy, and
2739 you may at your option offer warranty protection in exchange for a fee.
2740
2741 2. You may modify your copy or copies of the Program or any portion
2742 of it, thus forming a work based on the Program, and copy and
2743 distribute such modifications or work under the terms of Section 1
2744 above, provided that you also meet all of these conditions:
2745
2746 a) You must cause the modified files to carry prominent notices
2747 stating that you changed the files and the date of any change.
2748
2749 b) You must cause any work that you distribute or publish, that in
2750 whole or in part contains or is derived from the Program or any
2751 part thereof, to be licensed as a whole at no charge to all third
2752 parties under the terms of this License.
2753
2754 c) If the modified program normally reads commands interactively
2755 when run, you must cause it, when started running for such
2756 interactive use in the most ordinary way, to print or display an
2757 announcement including an appropriate copyright notice and a
2758 notice that there is no warranty (or else, saying that you provide
2759 a warranty) and that users may redistribute the program under
2760 these conditions, and telling the user how to view a copy of this
2761 License. (Exception: if the Program itself is interactive but
2762 does not normally print such an announcement, your work based on
2763 the Program is not required to print an announcement.)
2764
2765 These requirements apply to the modified work as a whole. If
2766 identifiable sections of that work are not derived from the Program,
2767 and can be reasonably considered independent and separate works in
2768 themselves, then this License, and its terms, do not apply to those
2769 sections when you distribute them as separate works. But when you
2770 distribute the same sections as part of a whole which is a work based
2771 on the Program, the distribution of the whole must be on the terms of
2772 this License, whose permissions for other licensees extend to the
2773 entire whole, and thus to each and every part regardless of who wrote it.
2774
2775 Thus, it is not the intent of this section to claim rights or contest
2776 your rights to work written entirely by you; rather, the intent is to
2777 exercise the right to control the distribution of derivative or
2778 collective works based on the Program.
2779
2780 In addition, mere aggregation of another work not based on the Program
2781 with the Program (or with a work based on the Program) on a volume of
2782 a storage or distribution medium does not bring the other work under
2783 the scope of this License.
2784
2785 3. You may copy and distribute the Program (or a work based on it,
2786 under Section 2) in object code or executable form under the terms of
2787 Sections 1 and 2 above provided that you also do one of the following:
2788
2789 a) Accompany it with the complete corresponding machine-readable
2790 source code, which must be distributed under the terms of Sections
2791 1 and 2 above on a medium customarily used for software interchange; or,
2792
2793 b) Accompany it with a written offer, valid for at least three
2794 years, to give any third party, for a charge no more than your
2795 cost of physically performing source distribution, a complete
2796 machine-readable copy of the corresponding source code, to be
2797 distributed under the terms of Sections 1 and 2 above on a medium
2798 customarily used for software interchange; or,
2799
2800 c) Accompany it with the information you received as to the offer
2801 to distribute corresponding source code. (This alternative is
2802 allowed only for noncommercial distribution and only if you
2803 received the program in object code or executable form with such
2804 an offer, in accord with Subsection b above.)
2805
2806 The source code for a work means the preferred form of the work for
2807 making modifications to it. For an executable work, complete source
2808 code means all the source code for all modules it contains, plus any
2809 associated interface definition files, plus the scripts used to
2810 control compilation and installation of the executable. However, as a
2811 special exception, the source code distributed need not include
2812 anything that is normally distributed (in either source or binary
2813 form) with the major components (compiler, kernel, and so on) of the
2814 operating system on which the executable runs, unless that component
2815 itself accompanies the executable.
2816
2817 If distribution of executable or object code is made by offering
2818 access to copy from a designated place, then offering equivalent
2819 access to copy the source code from the same place counts as
2820 distribution of the source code, even though third parties are not
2821 compelled to copy the source along with the object code.
2822
2823 4. You may not copy, modify, sublicense, or distribute the Program
2824 except as expressly provided under this License. Any attempt
2825 otherwise to copy, modify, sublicense or distribute the Program is
2826 void, and will automatically terminate your rights under this License.
2827 However, parties who have received copies, or rights, from you under
2828 this License will not have their licenses terminated so long as such
2829 parties remain in full compliance.
2830
2831 5. You are not required to accept this License, since you have not
2832 signed it. However, nothing else grants you permission to modify or
2833 distribute the Program or its derivative works. These actions are
2834 prohibited by law if you do not accept this License. Therefore, by
2835 modifying or distributing the Program (or any work based on the
2836 Program), you indicate your acceptance of this License to do so, and
2837 all its terms and conditions for copying, distributing or modifying
2838 the Program or works based on it.
2839
2840 6. Each time you redistribute the Program (or any work based on the
2841 Program), the recipient automatically receives a license from the
2842 original licensor to copy, distribute or modify the Program subject to
2843 these terms and conditions. You may not impose any further
2844 restrictions on the recipients exercise of the rights granted herein.
2845 You are not responsible for enforcing compliance by third parties to
2846 this License.
2847
2848 7. If, as a consequence of a court judgment or allegation of patent
2849 infringement or for any other reason (not limited to patent issues),
2850 conditions are imposed on you (whether by court order, agreement or
2851 otherwise) that contradict the conditions of this License, they do not
2852 excuse you from the conditions of this License. If you cannot
2853 distribute so as to satisfy simultaneously your obligations under this
2854 License and any other pertinent obligations, then as a consequence you
2855 may not distribute the Program at all. For example, if a patent
2856 license would not permit royalty-free redistribution of the Program by
2857 all those who receive copies directly or indirectly through you, then
2858 the only way you could satisfy both it and this License would be to
2859 refrain entirely from distribution of the Program.
2860
2861 If any portion of this section is held invalid or unenforceable under
2862 any particular circumstance, the balance of the section is intended to
2863 apply and the section as a whole is intended to apply in other
2864 circumstances.
2865
2866 It is not the purpose of this section to induce you to infringe any
2867 patents or other property right claims or to contest validity of any
2868 such claims; this section has the sole purpose of protecting the
2869 integrity of the free software distribution system, which is
2870 implemented by public license practices. Many people have made
2871 generous contributions to the wide range of software distributed
2872 through that system in reliance on consistent application of that
2873 system; it is up to the author/donor to decide if he or she is willing
2874 to distribute software through any other system and a licensee cannot
2875 impose that choice.
2876
2877 This section is intended to make thoroughly clear what is believed to
2878 be a consequence of the rest of this License.
2879
2880 8. If the distribution and/or use of the Program is restricted in
2881 certain countries either by patents or by copyrighted interfaces, the
2882 original copyright holder who places the Program under this License
2883 may add an explicit geographical distribution limitation excluding
2884 those countries, so that distribution is permitted only in or among
2885 countries not thus excluded. In such case, this License incorporates
2886 the limitation as if written in the body of this License.
2887
2888 9. The Free Software Foundation may publish revised and/or new versions
2889 of the General Public License from time to time. Such new versions will
2890 be similar in spirit to the present version, but may differ in detail to
2891 address new problems or concerns.
2892
2893 Each version is given a distinguishing version number. If the Program
2894 specifies a version number of this License which applies to it and "any
2895 later version", you have the option of following the terms and conditions
2896 either of that version or of any later version published by the Free
2897 Software Foundation. If the Program does not specify a version number of
2898 this License, you may choose any version ever published by the Free Software
2899 Foundation.
2900
2901 10. If you wish to incorporate parts of the Program into other free
2902 programs whose distribution conditions are different, write to the author
2903 to ask for permission. For software which is copyrighted by the Free
2904 Software Foundation, write to the Free Software Foundation; we sometimes
2905 make exceptions for this. Our decision will be guided by the two goals
2906 of preserving the free status of all derivatives of our free software and
2907 of promoting the sharing and reuse of software generally.
2908
2909 NO WARRANTY
2910
2911 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
2912 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
2913 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
2914 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
2915 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2916 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
2917 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
2918 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
2919 REPAIR OR CORRECTION.
2920
2921 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
2922 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
2923 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
2924 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
2925 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
2926 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
2927 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
2928 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
2929 POSSIBILITY OF SUCH DAMAGES.
2930
2931 END OF TERMS AND CONDITIONS
2932
2933 Appendix: How to Apply These Terms to Your New Programs
2934
2935 If you develop a new program, and you want it to be of the greatest
2936 possible use to the public, the best way to achieve this is to make it
2937 free software which everyone can redistribute and change under these terms.
2938
2939 To do so, attach the following notices to the program. It is safest
2940 to attach them to the start of each source file to most effectively
2941 convey the exclusion of warranty; and each file should have at least
2942 the "copyright" line and a pointer to where the full notice is found.
2943
2944 <one line to give the programs name and a brief idea of what it does.>
2945 Copyright (C) 19yy <name of author>
2946
2947 This program is free software; you can redistribute it and/or modify
2948 it under the terms of the GNU General Public License as published by
2949 the Free Software Foundation; either version 2 of the License, or
2950 (at your option) any later version.
2951
2952 This program is distributed in the hope that it will be useful,
2953 but WITHOUT ANY WARRANTY; without even the implied warranty of
2954 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2955 GNU General Public License for more details.
2956
2957 You should have received a copy of the GNU General Public License
2958 along with this program; if not, write to the Free Software
2959 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2960
2961 Also add information on how to contact you by electronic and paper mail.
2962
2963 If the program is interactive, make it output a short notice like this
2964 when it starts in an interactive mode:
2965
2966 Gnomovision version 69, Copyright (C) 19yy name of author
2967 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w.
2968 This is free software, and you are welcome to redistribute it
2969 under certain conditions; type `show c for details.
2970
2971 The hypothetical commands `show w and `show c should show the appropriate
2972 parts of the General Public License. Of course, the commands you use may
2973 be called something other than `show w and `show c; they could even be
2974 mouse-clicks or menu items--whatever suits your program.
2975
2976 You should also get your employer (if you work as a programmer) or your
2977 school, if any, to sign a "copyright disclaimer" for the program, if
2978 necessary. Here is a sample; alter the names:
2979
2980 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
2981 `Gnomovision (which makes passes at compilers) written by James Hacker.
2982
2983 <signature of Ty Coon>, 1 April 1989
2984 Ty Coon, President of Vice
2985
2986 This General Public License does not permit incorporating your program into
2987 proprietary programs. If your program is a subroutine library, you may
2988 consider it more useful to permit linking proprietary applications with the
2989 library. If this is what you want to do, use the GNU Library General
2990 Public License instead of this License.
2991 \end{verbatim}
2992 }
2993 \onecolumn
2994
2995 \chapter{Regression testing}
2996 \begin{wrapfigure}{r}{180pt}
2997 \centering{}
2998 \includegraphics[width=170pt]{img/030.png}
2999 \caption{Assembler regression test run in terminal emulator}
3000 \end{wrapfigure}
3001
3002 \section{Foreword}
3003 The IDE is featured with a regression testing environment, the aim of this to make the software as reliable as possible. Currently there is prepared environment for testing the simulator engine and the built-in assembler. This allows to write test cases for specific software features and check whether the results of these tests conform to expected results. Regretfully the test cases are \textbf{NOT PREPARED YET}. Each time when a change is made to the IDE's code, these regression test should be run in order to detect possible bug introductions caused by recent changes. Regression test also serves as a proof of certain software functionality and reliability.
3004
3005 \section{More about the implementation}
3006 Additional details can be found in the MCU~8051~IDE development snapshot downloaded from the project's GIT repository in directory ``regression\_tests'' in various ``README'' files. Here we will mention just general overview.
3007
3008 Each test have its own directory, like 'test\_something' or 'another\_test', let's call this directory the test directory. Each test consist of a set of test cases. Each test case should test one and only one specific function of the tested software. Test cases are represented by files with extension \fileextension{.in} located in directory named 'testcases' inside the test directory.
3009
3010 Directory ``results'' inside the test directory should be left empty. It is used by the testing environment for storing temporary files generated during the tests. The ``testcases'' directory also contains files intended for comparison with files generated during the test and stored in the ``results'' directory, these files must have extension ``.<x>.exp''. Where ``<x>'' must be substituted with extension of a file which this file is supposed to be compared to. In another words, if I want to check whether for example ``./results/something.abc'' was generated as it should be, I have to create file ``./testcases/something.abc.exp'' and this file will be automatically compared with ``./results/something.abc''.
3011
3012 And that's it! This is simple, isn't it? It's just about comparing files. But how are the tests run and how the files in the ``results'' directory gets generated? For that we need some Bash script, which is used to run the test, let's call this script the runtest script. The runtest script must be located in the test directory and must include the ``rte.lib.sh'' file, using the ``source'' command (or '.' command). This script should have set permissions to be executable and this script specifies how exactly should be the test performed and also runs the test itself.
3013
3014 When the script is about to exit, this condition is trapped and the 'rte.lib.sh' reacts by starting the test. So there is no need to explicitly run the test by invoking some function or something like that. It runs the test automatically when there is nothing else left to do.
3015
3016 \chapter{Project web page and other media}
3017 \section{Official project web page}
3018 Official web page of the MCU~8051~IDE project provides basic presentation of the project. Contains news about the project development, users comments and forums for users. Also the project's hardware tools are described here and there is some personal information about authors of the project. All components of the IDE can be downloaded from \href{www.sourceforge.net}{sourceforge.net}, which provides hosting for the web pages and entire project. The address is \url{http://mcu8051ide.sf.net}.
3019 \begin{figure}[h!]
3020 \centering{}
3021 \includegraphics[width=\textwidth]{img/026.png}
3022 \caption{Official web page of the MCU~8051~IDE project}
3023 \end{figure}
3024
3025 \section{Other media}
3026 Project has also its own page on Source Forge, ohloh and Fresh meat. Installation packages are in official Fedora repositories and Ubuntu repositories. There is currently also one Gentoo overlay providing ebuild for the IDE. Project has its own IRC channel, although it is rarely used. And wiki pages. Not yet in a good shape. Project is also mentioned on Wikipedia. Project official web page is written in PHP5, XHTML-1.1, CSS2 and JavaScript and uses MySQL as database. Volunteers who would like to improve the web page are also welcomed as contributors to the project.
3027
3028 \section{GIT repository}
3029 GIT is a distributed revision control system originally developed by Linus Torvalds. MCU~8051~IDE also takes advantage of GIT and uses it as its tool for managing current development version. The project's GIT repository is hosted by Source Forge and is available at address ``{\tiny{}git://mcu8051ide.git.sourceforge.net/gitroot/mcu8051ide/mcu8051ide}''. Access to the repository is for reading only unless you posses the required clearance. In the GIT repository you can always find the newest development version with the newest bug fixes and features. List of latest changes is available on \url{http://mcu8051ide.git.sourceforge.net}. Here is a short description to download and install the latest development version of the IDE:
3030 \begin{enumerate}
3031 \setlength{\itemsep}{-3pt}
3032 \small
3033 \item Install GIT
3034 \item Run ``{\footnotesize{}\texttt{git clone git://mcu8051ide.git.sourceforge.net/gitroot/mcu8051ide/mcu8051ide}}''.\\
3035 It will create your own copy of the Git repository in the current directory.
3036 \item Once you have an existing copy of the repository you can just update it each time when you want the fresh version by this command:\\
3037 ``\texttt{git fetch origin master}''
3038 \item Then you can try the downloaded IDE version without installation using the following sequence of commands (for POSIX only)
3039 \begin{enumerate}
3040 \setlength{\itemsep}{-3pt}
3041 \small
3042 \item \texttt{cd mcu8051ide/lib}
3043 \item \texttt{./main.tcl}
3044 \end{enumerate}
3045 \item Or install it and the use it using the following sequence of commands (for POSIX only)
3046 \begin{enumerate}
3047 \setlength{\itemsep}{-3pt}
3048 \small
3049 \item \texttt{cd mcu8051ide}
3050 \item \texttt{./configure \&\& make}
3051 \item \texttt{sudo su \# or just "su"}
3052 \item \texttt{make install}
3053 \end{enumerate}
3054 \end{enumerate}
3055
3056 \chapter{8051 Instructions in numerical Order}
3057 {
3058 \mysmallfont{}
3059 \begin{longtable}{|c|l|lll|c|llll|c|}
3060 % Table header:
3061 \hline
3062 \textbf{Opcode} &
3063 \textbf{Mnemonic} &
3064 \multicolumn{3}{c|}{\textbf{Operands}} &
3065 \textbf{Bytes} &
3066 \multicolumn{4}{c|}{\textbf{Flags}} &
3067 \textbf{Cycles} \\\hline
3068 \endhead
3069
3070 % Table body:
3071 0x00 & NOP & & & & 1 & & & & & 1 \\\hline
3072 0x01 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3073 0x02 & LJMP & code16& & & 3 & & & & & 2 \\\hline
3074 0x03 & RR & A & & & 1 & & & & & 1 \\\hline
3075 0x04 & INC & A & & & 1 & & & & P & 1 \\\hline
3076 0x05 & INC & data & & & 2 & & & & & 1 \\\hline
3077 0x06 & INC & @R0 & & & 1 & & & & & 1 \\\hline
3078 0x07 & INC & @R1 & & & 1 & & & & & 1 \\\hline
3079 0x08 & INC & R0 & & & 1 & & & & & 1 \\\hline
3080 0x09 & INC & R1 & & & 1 & & & & & 1 \\\hline
3081 0x0A & INC & R2 & & & 1 & & & & & 1 \\\hline
3082 0x0B & INC & R3 & & & 1 & & & & & 1 \\\hline
3083 0x0C & INC & R4 & & & 1 & & & & & 1 \\\hline
3084 0x0D & INC & R5 & & & 1 & & & & & 1 \\\hline
3085 0x0E & INC & R6 & & & 1 & & & & & 1 \\\hline
3086 0x0F & INC & R7 & & & 1 & & & & & 1 \\\hline
3087 0x10 & JBC & bit & code8 & & 3 & & & & & 2 \\\hline
3088 0x11 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3089 0x12 & LCALL & code16& & & 3 & & & & & 2 \\\hline
3090 0x13 & RRC & A & & & 1 & CY & & & P & 1 \\\hline
3091 0x14 & DEC & A & & & 1 & & & & P & 1 \\\hline
3092 0x15 & DEC & data & & & 2 & & & & & 1 \\\hline
3093 0x16 & DEC & @R0 & & & 1 & & & & & 1 \\\hline
3094 0x17 & DEC & @R1 & & & 1 & & & & & 1 \\\hline
3095 0x18 & DEC & R0 & & & 1 & & & & & 1 \\\hline
3096 0x19 & DEC & R1 & & & 1 & & & & & 1 \\\hline
3097 0x1A & DEC & R2 & & & 1 & & & & & 1 \\\hline
3098 0x1B & DEC & R3 & & & 1 & & & & & 1 \\\hline
3099 0x1C & DEC & R4 & & & 1 & & & & & 1 \\\hline
3100 0x1D & DEC & R5 & & & 1 & & & & & 1 \\\hline
3101 0x1E & DEC & R6 & & & 1 & & & & & 1 \\\hline
3102 0x1F & DEC & R7 & & & 1 & & & & & 1 \\\hline
3103 0x20 & JB & bit & code8 & & 3 & & & & & 2 \\\hline
3104 0x21 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3105 0x22 & RET & & & & 1 & & & & & 2 \\\hline
3106 0x23 & RL & A & & & 1 & & & & & 1 \\\hline
3107 0x24 & ADD & A & \#imm8& & 2 & CY & AC & OV & P & 1 \\\hline
3108 0x25 & ADD & A & data & & 2 & CY & AC & OV & P & 1 \\\hline
3109 0x26 & ADD & A & @R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3110 0x27 & ADD & A & @R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3111 0x28 & ADD & A & R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3112 0x29 & ADD & A & R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3113 0x2A & ADD & A & R2 & & 1 & CY & AC & OV & P & 1 \\\hline
3114 0x2B & ADD & A & R3 & & 1 & CY & AC & OV & P & 1 \\\hline
3115 0x2C & ADD & A & R4 & & 1 & CY & AC & OV & P & 1 \\\hline
3116 0x2D & ADD & A & R5 & & 1 & CY & AC & OV & P & 1 \\\hline
3117 0x2E & ADD & A & R6 & & 1 & CY & AC & OV & P & 1 \\\hline
3118 0x2F & ADD & A & R7 & & 1 & CY & AC & OV & P & 1 \\\hline
3119 0x30 & JNB & bit & code8 & & 3 & & & & & 2 \\\hline
3120 0x31 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3121 0x32 & RETI & & & & 1 & & & & & 2 \\\hline
3122 0x33 & RLC & A & & & 1 & CY & & & P & 1 \\\hline
3123 0x34 & ADDC & A & \#imm8& & 2 & CY & AC & OV & P & 1 \\\hline
3124 0x35 & ADDC & A & data & & 2 & CY & AC & OV & P & 1 \\\hline
3125 0x36 & ADDC & A & @R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3126 0x37 & ADDC & A & @R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3127 0x38 & ADDC & A & R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3128 0x39 & ADDC & A & R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3129 0x3A & ADDC & A & R2 & & 1 & CY & AC & OV & P & 1 \\\hline
3130 0x3B & ADDC & A & R3 & & 1 & CY & AC & OV & P & 1 \\\hline
3131 0x3C & ADDC & A & R4 & & 1 & CY & AC & OV & P & 1 \\\hline
3132 0x3D & ADDC & A & R5 & & 1 & CY & AC & OV & P & 1 \\\hline
3133 0x3E & ADDC & A & R6 & & 1 & CY & AC & OV & P & 1 \\\hline
3134 0x3F & ADDC & A & R7 & & 1 & CY & AC & OV & P & 1 \\\hline
3135 0x40 & JC & code8 & & & 2 & & & & & 2 \\\hline
3136 0x41 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3137 0x42 & ORL & data & A & & 2 & & & & & 1 \\\hline
3138 0x43 & ORL & data & \#imm8& & 3 & & & & & 2 \\\hline
3139 0x44 & ORL & A & \#imm8& & 2 & & & & P & 1 \\\hline
3140 0x45 & ORL & A & data & & 2 & & & & P & 1 \\\hline
3141 0x46 & ORL & A & @R0 & & 1 & & & & P & 1 \\\hline
3142 0x47 & ORL & A & @R1 & & 1 & & & & P & 1 \\\hline
3143 0x48 & ORL & A & R0 & & 1 & & & & P & 1 \\\hline
3144 0x49 & ORL & A & R1 & & 1 & & & & P & 1 \\\hline
3145 0x4A & ORL & A & R2 & & 1 & & & & P & 1 \\\hline
3146 0x4B & ORL & A & R3 & & 1 & & & & P & 1 \\\hline
3147 0x4C & ORL & A & R4 & & 1 & & & & P & 1 \\\hline
3148 0x4D & ORL & A & R5 & & 1 & & & & P & 1 \\\hline
3149 0x4E & ORL & A & R6 & & 1 & & & & P & 1 \\\hline
3150 0x4F & ORL & A & R7 & & 1 & & & & P & 1 \\\hline
3151 0x50 & JNC & code8 & & & 2 & & & & & 2 \\\hline
3152 0x51 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3153 0x52 & ANL & data & A & & 2 & & & & & 1 \\\hline
3154 0x53 & ANL & data & \#imm8& & 3 & & & & & 2 \\\hline
3155 0x54 & ANL & A & \#imm8& & 2 & & & & P & 1 \\\hline
3156 0x55 & ANL & A & data & & 2 & & & & P & 1 \\\hline
3157 0x56 & ANL & A & @R0 & & 1 & & & & P & 1 \\\hline
3158 0x57 & ANL & A & @R1 & & 1 & & & & P & 1 \\\hline
3159 0x58 & ANL & A & R0 & & 1 & & & & P & 1 \\\hline
3160 0x59 & ANL & A & R1 & & 1 & & & & P & 1 \\\hline
3161 0x5A & ANL & A & R2 & & 1 & & & & P & 1 \\\hline
3162 0x5B & ANL & A & R3 & & 1 & & & & P & 1 \\\hline
3163 0x5C & ANL & A & R4 & & 1 & & & & P & 1 \\\hline
3164 0x5D & ANL & A & R5 & & 1 & & & & P & 1 \\\hline
3165 0x5E & ANL & A & R6 & & 1 & & & & P & 1 \\\hline
3166 0x5F & ANL & A & R7 & & 1 & & & & P & 1 \\\hline
3167 0x60 & JZ & code8 & & & 2 & & & & & 2 \\\hline
3168 0x61 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3169 0x62 & XRL & data & A & & 2 & & & & & 1 \\\hline
3170 0x63 & XRL & data & \#imm8& & 3 & & & & & 2 \\\hline
3171 0x64 & XRL & A & \#imm8& & 2 & & & & P & 1 \\\hline
3172 0x65 & XRL & A & data & & 2 & & & & P & 1 \\\hline
3173 0x66 & XRL & A & @R0 & & 1 & & & & P & 1 \\\hline
3174 0x67 & XRL & A & @R1 & & 1 & & & & P & 1 \\\hline
3175 0x68 & XRL & A & R0 & & 1 & & & & P & 1 \\\hline
3176 0x69 & XRL & A & R1 & & 1 & & & & P & 1 \\\hline
3177 0x6A & XRL & A & R2 & & 1 & & & & P & 1 \\\hline
3178 0x6B & XRL & A & R3 & & 1 & & & & P & 1 \\\hline
3179 0x6C & XRL & A & R4 & & 1 & & & & P & 1 \\\hline
3180 0x6D & XRL & A & R5 & & 1 & & & & P & 1 \\\hline
3181 0x6E & XRL & A & R6 & & 1 & & & & P & 1 \\\hline
3182 0x6F & XRL & A & R7 & & 1 & & & & P & 1 \\\hline
3183 0x70 & JNZ & code8 & & & 2 & & & & & 2 \\\hline
3184 0x71 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3185 0x72 & ORL & C & bit & & 2 & CY & & & & 2 \\\hline
3186 0x73 & JMP &@A+DPTR& & & 1 & & & & & 2 \\\hline
3187 0x74 & MOV & A & \#imm8& & 2 & & & & P & 1 \\\hline
3188 0x75 & MOV & data & \#imm8& & 3 & & & & & 2 \\\hline
3189 0x76 & MOV & @R0 & \#imm8& & 2 & & & & & 1 \\\hline
3190 0x77 & MOV & @R1 & \#imm8& & 2 & & & & & 1 \\\hline
3191 0x78 & MOV & R0 & \#imm8& & 2 & & & & & 1 \\\hline
3192 0x79 & MOV & R1 & \#imm8& & 2 & & & & & 1 \\\hline
3193 0x7A & MOV & R2 & \#imm8& & 2 & & & & & 1 \\\hline
3194 0x7B & MOV & R3 & \#imm8& & 2 & & & & & 1 \\\hline
3195 0x7C & MOV & R4 & \#imm8& & 2 & & & & & 1 \\\hline
3196 0x7D & MOV & R5 & \#imm8& & 2 & & & & & 1 \\\hline
3197 0x7E & MOV & R6 & \#imm8& & 2 & & & & & 1 \\\hline
3198 0x7F & MOV & R7 & \#imm8& & 2 & & & & & 1 \\\hline
3199 0x80 & SJMP & code8 & & & 2 & & & & & 2 \\\hline
3200 0x81 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3201 0x82 & ANL & C & bit & & 2 & CY & & & & 2 \\\hline
3202 0x83 & MOVC & A & @A+PC & & 1 & & & & P & 2 \\\hline
3203 0x84 & DIV & AB & & & 1 & CY & & OV & P & 4 \\\hline
3204 0x85 & MOV & data & data & & 3 & & & & & 2 \\\hline
3205 0x86 & MOV & data & @R0 & & 2 & & & & & 2 \\\hline
3206 0x87 & MOV & data & @R1 & & 2 & & & & & 2 \\\hline
3207 0x88 & MOV & data & R0 & & 2 & & & & & 2 \\\hline
3208 0x89 & MOV & data & R1 & & 2 & & & & & 2 \\\hline
3209 0x8A & MOV & data & R2 & & 2 & & & & & 2 \\\hline
3210 0x8B & MOV & data & R3 & & 2 & & & & & 2 \\\hline
3211 0x8C & MOV & data & R4 & & 2 & & & & & 2 \\\hline
3212 0x8D & MOV & data & R5 & & 2 & & & & & 2 \\\hline
3213 0x8E & MOV & data & R6 & & 2 & & & & & 2 \\\hline
3214 0x8F & MOV & data & R7 & & 2 & & & & & 2 \\\hline
3215 0x90 & MOV & DPTR &\#imm16& & 3 & & & & & 2 \\\hline
3216 0x91 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3217 0x92 & MOV & bit & C & & 2 & & & & & 2 \\\hline
3218 0x93 & MOVC & A &@A+DPTR& & 1 & & & & P & 2 \\\hline
3219 0x94 & SUBB & A & \#imm8& & 2 & CY & AC & OV & P & 1 \\\hline
3220 0x95 & SUBB & A & data & & 2 & CY & AC & OV & P & 1 \\\hline
3221 0x96 & SUBB & A & @R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3222 0x97 & SUBB & A & @R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3223 0x98 & SUBB & A & R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3224 0x99 & SUBB & A & R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3225 0x9A & SUBB & A & R2 & & 1 & CY & AC & OV & P & 1 \\\hline
3226 0x9B & SUBB & A & R3 & & 1 & CY & AC & OV & P & 1 \\\hline
3227 0x9C & SUBB & A & R4 & & 1 & CY & AC & OV & P & 1 \\\hline
3228 0x9D & SUBB & A & R5 & & 1 & CY & AC & OV & P & 1 \\\hline
3229 0x9E & SUBB & A & R6 & & 1 & CY & AC & OV & P & 1 \\\hline
3230 0x9F & SUBB & A & R7 & & 1 & CY & AC & OV & P & 1 \\\hline
3231 0xA0 & ORL & C & /bit & & 2 & CY & & & & 2 \\\hline
3232 0xA1 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3233 0xA2 & MOV & C & bit & & 2 & CY & & & & 1 \\\hline
3234 0xA3 & INC & DPTR & & & 1 & & & & & 2 \\\hline
3235 0xA4 & MUL & AB & & & 1 & CY & & OV & P & 4 \\\hline
3236 0xA5 & \multicolumn{10}{l|}{Invalid opcode} \\\hline
3237 0xA6 & MOV & @R0 & data & & 2 & & & & & 2 \\\hline
3238 0xA7 & MOV & @R1 & data & & 2 & & & & & 2 \\\hline
3239 0xA8 & MOV & R0 & data & & 2 & & & & & 2 \\\hline
3240 0xA9 & MOV & R1 & data & & 2 & & & & & 2 \\\hline
3241 0xAA & MOV & R2 & data & & 2 & & & & & 2 \\\hline
3242 0xAB & MOV & R3 & data & & 2 & & & & & 2 \\\hline
3243 0xAC & MOV & R4 & data & & 2 & & & & & 2 \\\hline
3244 0xAD & MOV & R5 & data & & 2 & & & & & 2 \\\hline
3245 0xAE & MOV & R6 & data & & 2 & & & & & 2 \\\hline
3246 0xAF & MOV & R7 & data & & 2 & & & & & 2 \\\hline
3247 0xB0 & ANL & C & /bit & & 2 & CY & & & & 2 \\\hline
3248 0xB1 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3249 0xB2 & CPL & bit & & & 2 & & & & & 1 \\\hline
3250 0xB3 & CPL & C & & & 1 & CY & & & & 1 \\\hline
3251 0xB4 & CJNE & A & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3252 0xB5 & CJNE & A & data & code8 & 3 & CY & & & & 2 \\\hline
3253 0xB6 & CJNE & @R0 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3254 0xB7 & CJNE & @R1 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3255 0xB8 & CJNE & R0 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3256 0xB9 & CJNE & R1 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3257 0xBA & CJNE & R2 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3258 0xBB & CJNE & R3 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3259 0xBC & CJNE & R4 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3260 0xBD & CJNE & R5 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3261 0xBE & CJNE & R6 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3262 0xBF & CJNE & R7 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3263 0xC0 & PUSH & data & & & 2 & & & & & 2 \\\hline
3264 0xC1 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3265 0xC2 & CLR & bit & & & 2 & & & & & 1 \\\hline
3266 0xC3 & CLR & C & & & 1 & CY & & & & 1 \\\hline
3267 0xC4 & SWAP & A & & & 1 & & & & & 1 \\\hline
3268 0xC5 & XCH & A & data & & 2 & & & & P & 1 \\\hline
3269 0xC6 & XCH & A & @R0 & & 1 & & & & P & 1 \\\hline
3270 0xC7 & XCH & A & @R1 & & 1 & & & & P & 1 \\\hline
3271 0xC8 & XCH & A & R0 & & 1 & & & & P & 1 \\\hline
3272 0xC9 & XCH & A & R1 & & 1 & & & & P & 1 \\\hline
3273 0xCA & XCH & A & R2 & & 1 & & & & P & 1 \\\hline
3274 0xCB & XCH & A & R3 & & 1 & & & & P & 1 \\\hline
3275 0xCC & XCH & A & R4 & & 1 & & & & P & 1 \\\hline
3276 0xCD & XCH & A & R5 & & 1 & & & & P & 1 \\\hline
3277 0xCE & XCH & A & R6 & & 1 & & & & P & 1 \\\hline
3278 0xCF & XCH & A & R7 & & 1 & & & & P & 1 \\\hline
3279 0xD0 & POP & data & & & 2 & & & & & 2 \\\hline
3280 0xD1 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3281 0xD2 & SETB & bit & & & 2 & & & & & 1 \\\hline
3282 0xD3 & SETB & C & & & 1 & CY & & & & 1 \\\hline
3283 0xD4 & DA & A & & & 1 & CY & & & P & 1 \\\hline
3284 0xD5 & DJNZ & data & code8 & & 3 & & & & & 2 \\\hline
3285 0xD6 & XCHD & A & @R0 & & 1 & & & & P & 1 \\\hline
3286 0xD7 & XCHD & A & @R1 & & 1 & & & & P & 1 \\\hline
3287 0xD8 & DJNZ & R0 & code8 & & 2 & & & & & 2 \\\hline
3288 0xD9 & DJNZ & R1 & code8 & & 2 & & & & & 2 \\\hline
3289 0xDA & DJNZ & R2 & code8 & & 2 & & & & & 2 \\\hline
3290 0xDB & DJNZ & R3 & code8 & & 2 & & & & & 2 \\\hline
3291 0xDC & DJNZ & R4 & code8 & & 2 & & & & & 2 \\\hline
3292 0xDD & DJNZ & R5 & code8 & & 2 & & & & & 2 \\\hline
3293 0xDE & DJNZ & R6 & code8 & & 2 & & & & & 2 \\\hline
3294 0xDF & DJNZ & R7 & code8 & & 2 & & & & & 2 \\\hline
3295 0xE0 & MOVX & A & @DPTR & & 1 & & & & P & 2 \\\hline
3296 0xE1 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3297 0xE2 & MOVX & A & @R0 & & 1 & & & & P & 2 \\\hline
3298 0xE3 & MOVX & A & @R1 & & 1 & & & & P & 2 \\\hline
3299 0xE4 & CLR & A & & & 1 & & & & P & 1 \\\hline
3300 0xE5 & MOV & A & data & & 2 & & & & P & 1 \\\hline
3301 0xE6 & MOV & A & @R0 & & 1 & & & & P & 1 \\\hline
3302 0xE7 & MOV & A & @R1 & & 1 & & & & P & 1 \\\hline
3303 0xE8 & MOV & A & R0 & & 1 & & & & P & 1 \\\hline
3304 0xE9 & MOV & A & R1 & & 1 & & & & P & 1 \\\hline
3305 0xEA & MOV & A & R2 & & 1 & & & & P & 1 \\\hline
3306 0xEB & MOV & A & R3 & & 1 & & & & P & 1 \\\hline
3307 0xEC & MOV & A & R4 & & 1 & & & & P & 1 \\\hline
3308 0xED & MOV & A & R5 & & 1 & & & & P & 1 \\\hline
3309 0xEE & MOV & A & R6 & & 1 & & & & P & 1 \\\hline
3310 0xEF & MOV & A & R7 & & 1 & & & & P & 1 \\\hline
3311 0xF0 & MOVX & @DPTR & A & & 1 & & & & & 2 \\\hline
3312 0xF1 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3313 0xF2 & MOVX & @R0 & A & & 1 & & & & & 2 \\\hline
3314 0xF3 & MOVX & @R1 & A & & 1 & & & & & 2 \\\hline
3315 0xF4 & CPL & A & & & 1 & & & & P & 1 \\\hline
3316 0xF5 & MOV & data & A & & 2 & & & & & 1 \\\hline
3317 0xF6 & MOV & @R0 & A & & 1 & & & & & 1 \\\hline
3318 0xF7 & MOV & @R1 & A & & 1 & & & & & 1 \\\hline
3319 0xF8 & MOV & R0 & A & & 1 & & & & & 1 \\\hline
3320 0xF9 & MOV & R1 & A & & 1 & & & & & 1 \\\hline
3321 0xFA & MOV & R2 & A & & 1 & & & & & 1 \\\hline
3322 0xFB & MOV & R3 & A & & 1 & & & & & 1 \\\hline
3323 0xFC & MOV & R4 & A & & 1 & & & & & 1 \\\hline
3324 0xFD & MOV & R5 & A & & 1 & & & & & 1 \\\hline
3325 0xFE & MOV & R6 & A & & 1 & & & & & 1 \\\hline
3326 0xFF & MOV & R7 & A & & 1 & & & & & 1 \\\hline
3327
3328 % Table caption:
3329 \caption{8051 Instructions in numerical Order}
3330 \end{longtable}
3331 }
3332
3333 \chapter{8051 Instructions in alphabetical order}
3334 {
3335 \mysmallfont{}
3336 \begin{longtable}{|c|l|lll|c|llll|c|}
3337 % Table header:
3338 \hline
3339 \textbf{Opcode} &
3340 \textbf{Mnemonic} &
3341 \multicolumn{3}{c|}{\textbf{Operands}} &
3342 \textbf{Bytes} &
3343 \multicolumn{4}{c|}{\textbf{Flags}} &
3344 \textbf{Cycles} \\\hline
3345 \endhead
3346
3347 % Table body:
3348 0x11 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3349 0x31 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3350 0x51 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3351 0x71 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3352 0x91 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3353 0xB1 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3354 0xD1 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3355 0xF1 & ACALL & code11& & & 2 & & & & & 2 \\\hline
3356 0x24 & ADD & A & \#imm8& & 2 & CY & AC & OV & P & 1 \\\hline
3357 0x25 & ADD & A & data & & 2 & CY & AC & OV & P & 1 \\\hline
3358 0x26 & ADD & A & @R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3359 0x27 & ADD & A & @R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3360 0x28 & ADD & A & R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3361 0x29 & ADD & A & R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3362 0x2A & ADD & A & R2 & & 1 & CY & AC & OV & P & 1 \\\hline
3363 0x2B & ADD & A & R3 & & 1 & CY & AC & OV & P & 1 \\\hline
3364 0x2C & ADD & A & R4 & & 1 & CY & AC & OV & P & 1 \\\hline
3365 0x2D & ADD & A & R5 & & 1 & CY & AC & OV & P & 1 \\\hline
3366 0x2E & ADD & A & R6 & & 1 & CY & AC & OV & P & 1 \\\hline
3367 0x2F & ADD & A & R7 & & 1 & CY & AC & OV & P & 1 \\\hline
3368 0x34 & ADDC & A & \#imm8& & 2 & CY & AC & OV & P & 1 \\\hline
3369 0x35 & ADDC & A & data & & 2 & CY & AC & OV & P & 1 \\\hline
3370 0x36 & ADDC & A & @R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3371 0x37 & ADDC & A & @R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3372 0x38 & ADDC & A & R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3373 0x39 & ADDC & A & R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3374 0x3A & ADDC & A & R2 & & 1 & CY & AC & OV & P & 1 \\\hline
3375 0x3B & ADDC & A & R3 & & 1 & CY & AC & OV & P & 1 \\\hline
3376 0x3C & ADDC & A & R4 & & 1 & CY & AC & OV & P & 1 \\\hline
3377 0x3D & ADDC & A & R5 & & 1 & CY & AC & OV & P & 1 \\\hline
3378 0x3E & ADDC & A & R6 & & 1 & CY & AC & OV & P & 1 \\\hline
3379 0x3F & ADDC & A & R7 & & 1 & CY & AC & OV & P & 1 \\\hline
3380 0x01 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3381 0x21 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3382 0x41 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3383 0x61 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3384 0x81 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3385 0xA1 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3386 0xC1 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3387 0xE1 & AJMP & code11& & & 2 & & & & & 2 \\\hline
3388 0x52 & ANL & data & A & & 2 & & & & & 1 \\\hline
3389 0x53 & ANL & data & \#imm8& & 3 & & & & & 2 \\\hline
3390 0x54 & ANL & A & \#imm8& & 2 & & & & P & 1 \\\hline
3391 0x55 & ANL & A & data & & 2 & & & & P & 1 \\\hline
3392 0x56 & ANL & A & @R0 & & 1 & & & & P & 1 \\\hline
3393 0x57 & ANL & A & @R1 & & 1 & & & & P & 1 \\\hline
3394 0x58 & ANL & A & R0 & & 1 & & & & P & 1 \\\hline
3395 0x59 & ANL & A & R1 & & 1 & & & & P & 1 \\\hline
3396 0x5A & ANL & A & R2 & & 1 & & & & P & 1 \\\hline
3397 0x5B & ANL & A & R3 & & 1 & & & & P & 1 \\\hline
3398 0x5C & ANL & A & R4 & & 1 & & & & P & 1 \\\hline
3399 0x5D & ANL & A & R5 & & 1 & & & & P & 1 \\\hline
3400 0x5E & ANL & A & R6 & & 1 & & & & P & 1 \\\hline
3401 0x5F & ANL & A & R7 & & 1 & & & & P & 1 \\\hline
3402 0x82 & ANL & C & bit & & 2 & CY & & & & 2 \\\hline
3403 0xB0 & ANL & C & /bit & & 2 & CY & & & & 2 \\\hline
3404 0xB4 & CJNE & A & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3405 0xB5 & CJNE & A & data & code8 & 3 & CY & & & & 2 \\\hline
3406 0xB6 & CJNE & @R0 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3407 0xB7 & CJNE & @R1 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3408 0xB8 & CJNE & R0 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3409 0xB9 & CJNE & R1 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3410 0xBA & CJNE & R2 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3411 0xBB & CJNE & R3 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3412 0xBC & CJNE & R4 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3413 0xBD & CJNE & R5 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3414 0xBE & CJNE & R6 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3415 0xBF & CJNE & R7 & \#imm8& code8 & 3 & CY & & & & 2 \\\hline
3416 0xC2 & CLR & bit & & & 2 & & & & & 1 \\\hline
3417 0xC3 & CLR & C & & & 1 & CY & & & & 1 \\\hline
3418 0xE4 & CLR & A & & & 1 & & & & P & 1 \\\hline
3419 0xB2 & CPL & bit & & & 2 & & & & & 1 \\\hline
3420 0xB3 & CPL & C & & & 1 & CY & & & & 1 \\\hline
3421 0xF4 & CPL & A & & & 1 & & & & P & 1 \\\hline
3422 0xD4 & DA & A & & & 1 & CY & & & P & 1 \\\hline
3423 0x14 & DEC & A & & & 1 & & & & P & 1 \\\hline
3424 0x15 & DEC & data & & & 2 & & & & & 1 \\\hline
3425 0x16 & DEC & @R0 & & & 1 & & & & & 1 \\\hline
3426 0x17 & DEC & @R1 & & & 1 & & & & & 1 \\\hline
3427 0x18 & DEC & R0 & & & 1 & & & & & 1 \\\hline
3428 0x19 & DEC & R1 & & & 1 & & & & & 1 \\\hline
3429 0x1A & DEC & R2 & & & 1 & & & & & 1 \\\hline
3430 0x1B & DEC & R3 & & & 1 & & & & & 1 \\\hline
3431 0x1C & DEC & R4 & & & 1 & & & & & 1 \\\hline
3432 0x1D & DEC & R5 & & & 1 & & & & & 1 \\\hline
3433 0x1E & DEC & R6 & & & 1 & & & & & 1 \\\hline
3434 0x1F & DEC & R7 & & & 1 & & & & & 1 \\\hline
3435 0x84 & DIV & AB & & & 1 & CY & & OV & P & 4 \\\hline
3436 0xD5 & DJNZ & data & code8 & & 3 & & & & & 2 \\\hline
3437 0xD8 & DJNZ & R0 & code8 & & 2 & & & & & 2 \\\hline
3438 0xD9 & DJNZ & R1 & code8 & & 2 & & & & & 2 \\\hline
3439 0xDA & DJNZ & R2 & code8 & & 2 & & & & & 2 \\\hline
3440 0xDB & DJNZ & R3 & code8 & & 2 & & & & & 2 \\\hline
3441 0xDC & DJNZ & R4 & code8 & & 2 & & & & & 2 \\\hline
3442 0xDD & DJNZ & R5 & code8 & & 2 & & & & & 2 \\\hline
3443 0xDE & DJNZ & R6 & code8 & & 2 & & & & & 2 \\\hline
3444 0xDF & DJNZ & R7 & code8 & & 2 & & & & & 2 \\\hline
3445 0x04 & INC & A & & & 1 & & & & P & 1 \\\hline
3446 0x05 & INC & data & & & 2 & & & & & 1 \\\hline
3447 0x06 & INC & @R0 & & & 1 & & & & & 1 \\\hline
3448 0x07 & INC & @R1 & & & 1 & & & & & 1 \\\hline
3449 0x08 & INC & R0 & & & 1 & & & & & 1 \\\hline
3450 0x09 & INC & R1 & & & 1 & & & & & 1 \\\hline
3451 0x0A & INC & R2 & & & 1 & & & & & 1 \\\hline
3452 0x0B & INC & R3 & & & 1 & & & & & 1 \\\hline
3453 0x0C & INC & R4 & & & 1 & & & & & 1 \\\hline
3454 0x0D & INC & R5 & & & 1 & & & & & 1 \\\hline
3455 0x0E & INC & R6 & & & 1 & & & & & 1 \\\hline
3456 0x0F & INC & R7 & & & 1 & & & & & 1 \\\hline
3457 0xA3 & INC & DPTR & & & 1 & & & & & 2 \\\hline
3458 0x20 & JB & bit & code8 & & 3 & & & & & 2 \\\hline
3459 0x10 & JBC & bit & code8 & & 3 & & & & & 2 \\\hline
3460 0x40 & JC & code8 & & & 2 & & & & & 2 \\\hline
3461 0x73 & JMP &@A+DPTR& & & 1 & & & & & 2 \\\hline
3462 0x30 & JNB & bit & code8 & & 3 & & & & & 2 \\\hline
3463 0x50 & JNC & code8 & & & 2 & & & & & 2 \\\hline
3464 0x70 & JNZ & code8 & & & 2 & & & & & 2 \\\hline
3465 0x60 & JZ & code8 & & & 2 & & & & & 2 \\\hline
3466 0x12 & LCALL & code16& & & 3 & & & & & 2 \\\hline
3467 0x02 & LJMP & code16& & & 3 & & & & & 2 \\\hline
3468 0x74 & MOV & A & \#imm8& & 2 & & & & P & 1 \\\hline
3469 0x75 & MOV & data & \#imm8& & 3 & & & & & 2 \\\hline
3470 0x76 & MOV & @R0 & \#imm8& & 2 & & & & & 1 \\\hline
3471 0x77 & MOV & @R1 & \#imm8& & 2 & & & & & 1 \\\hline
3472 0x78 & MOV & R0 & \#imm8& & 2 & & & & & 1 \\\hline
3473 0x79 & MOV & R1 & \#imm8& & 2 & & & & & 1 \\\hline
3474 0x7A & MOV & R2 & \#imm8& & 2 & & & & & 1 \\\hline
3475 0x7B & MOV & R3 & \#imm8& & 2 & & & & & 1 \\\hline
3476 0x7C & MOV & R4 & \#imm8& & 2 & & & & & 1 \\\hline
3477 0x7D & MOV & R5 & \#imm8& & 2 & & & & & 1 \\\hline
3478 0x7E & MOV & R6 & \#imm8& & 2 & & & & & 1 \\\hline
3479 0x7F & MOV & R7 & \#imm8& & 2 & & & & & 1 \\\hline
3480 0x85 & MOV & data & data & & 3 & & & & & 2 \\\hline
3481 0x86 & MOV & data & @R0 & & 2 & & & & & 2 \\\hline
3482 0x87 & MOV & data & @R1 & & 2 & & & & & 2 \\\hline
3483 0x88 & MOV & data & R0 & & 2 & & & & & 2 \\\hline
3484 0x89 & MOV & data & R1 & & 2 & & & & & 2 \\\hline
3485 0x8A & MOV & data & R2 & & 2 & & & & & 2 \\\hline
3486 0x8B & MOV & data & R3 & & 2 & & & & & 2 \\\hline
3487 0x8C & MOV & data & R4 & & 2 & & & & & 2 \\\hline
3488 0x8D & MOV & data & R5 & & 2 & & & & & 2 \\\hline
3489 0x8E & MOV & data & R6 & & 2 & & & & & 2 \\\hline
3490 0x8F & MOV & data & R7 & & 2 & & & & & 2 \\\hline
3491 0x90 & MOV & DPTR &\#imm16& & 3 & & & & & 2 \\\hline
3492 0x92 & MOV & bit & C & & 2 & & & & & 2 \\\hline
3493 0xA2 & MOV & C & bit & & 2 & CY & & & & 1 \\\hline
3494 0xA6 & MOV & @R0 & data & & 2 & & & & & 2 \\\hline
3495 0xA7 & MOV & @R1 & data & & 2 & & & & & 2 \\\hline
3496 0xA8 & MOV & R0 & data & & 2 & & & & & 2 \\\hline
3497 0xA9 & MOV & R1 & data & & 2 & & & & & 2 \\\hline
3498 0xAA & MOV & R2 & data & & 2 & & & & & 2 \\\hline
3499 0xAB & MOV & R3 & data & & 2 & & & & & 2 \\\hline
3500 0xAC & MOV & R4 & data & & 2 & & & & & 2 \\\hline
3501 0xAD & MOV & R5 & data & & 2 & & & & & 2 \\\hline
3502 0xAE & MOV & R6 & data & & 2 & & & & & 2 \\\hline
3503 0xAF & MOV & R7 & data & & 2 & & & & & 2 \\\hline
3504 0xE5 & MOV & A & data & & 2 & & & & P & 1 \\\hline
3505 0xE6 & MOV & A & @R0 & & 1 & & & & P & 1 \\\hline
3506 0xE7 & MOV & A & @R1 & & 1 & & & & P & 1 \\\hline
3507 0xE8 & MOV & A & R0 & & 1 & & & & P & 1 \\\hline
3508 0xE9 & MOV & A & R1 & & 1 & & & & P & 1 \\\hline
3509 0xEA & MOV & A & R2 & & 1 & & & & P & 1 \\\hline
3510 0xEB & MOV & A & R3 & & 1 & & & & P & 1 \\\hline
3511 0xEC & MOV & A & R4 & & 1 & & & & P & 1 \\\hline
3512 0xED & MOV & A & R5 & & 1 & & & & P & 1 \\\hline
3513 0xEE & MOV & A & R6 & & 1 & & & & P & 1 \\\hline
3514 0xEF & MOV & A & R7 & & 1 & & & & P & 1 \\\hline
3515 0xF5 & MOV & data & A & & 2 & & & & & 1 \\\hline
3516 0xF6 & MOV & @R0 & A & & 1 & & & & & 1 \\\hline
3517 0xF7 & MOV & @R1 & A & & 1 & & & & & 1 \\\hline
3518 0xF8 & MOV & R0 & A & & 1 & & & & & 1 \\\hline
3519 0xF9 & MOV & R1 & A & & 1 & & & & & 1 \\\hline
3520 0xFA & MOV & R2 & A & & 1 & & & & & 1 \\\hline
3521 0xFB & MOV & R3 & A & & 1 & & & & & 1 \\\hline
3522 0xFC & MOV & R4 & A & & 1 & & & & & 1 \\\hline
3523 0xFD & MOV & R5 & A & & 1 & & & & & 1 \\\hline
3524 0xFE & MOV & R6 & A & & 1 & & & & & 1 \\\hline
3525 0xFF & MOV & R7 & A & & 1 & & & & & 1 \\\hline
3526 0x83 & MOVC & A & @A+PC & & 1 & & & & P & 2 \\\hline
3527 0x93 & MOVC & A &@A+DPTR& & 1 & & & & P & 2 \\\hline
3528 0xE0 & MOVX & A & @DPTR & & 1 & & & & P & 2 \\\hline
3529 0xE2 & MOVX & A & @R0 & & 1 & & & & P & 2 \\\hline
3530 0xE3 & MOVX & A & @R1 & & 1 & & & & P & 2 \\\hline
3531 0xF0 & MOVX & @DPTR & A & & 1 & & & & & 2 \\\hline
3532 0xF2 & MOVX & @R0 & A & & 1 & & & & & 2 \\\hline
3533 0xF3 & MOVX & @R1 & A & & 1 & & & & & 2 \\\hline
3534 0xA4 & MUL & AB & & & 1 & CY & & OV & P & 4 \\\hline
3535 0x00 & NOP & & & & 1 & & & & & 1 \\\hline
3536 0x42 & ORL & data & A & & 2 & & & & & 1 \\\hline
3537 0x43 & ORL & data & \#imm8& & 3 & & & & & 2 \\\hline
3538 0x44 & ORL & A & \#imm8& & 2 & & & & P & 1 \\\hline
3539 0x45 & ORL & A & data & & 2 & & & & P & 1 \\\hline
3540 0x46 & ORL & A & @R0 & & 1 & & & & P & 1 \\\hline
3541 0x47 & ORL & A & @R1 & & 1 & & & & P & 1 \\\hline
3542 0x48 & ORL & A & R0 & & 1 & & & & P & 1 \\\hline
3543 0x49 & ORL & A & R1 & & 1 & & & & P & 1 \\\hline
3544 0x4A & ORL & A & R2 & & 1 & & & & P & 1 \\\hline
3545 0x4B & ORL & A & R3 & & 1 & & & & P & 1 \\\hline
3546 0x4C & ORL & A & R4 & & 1 & & & & P & 1 \\\hline
3547 0x4D & ORL & A & R5 & & 1 & & & & P & 1 \\\hline
3548 0x4E & ORL & A & R6 & & 1 & & & & P & 1 \\\hline
3549 0x4F & ORL & A & R7 & & 1 & & & & P & 1 \\\hline
3550 0x72 & ORL & C & bit & & 2 & CY & & & & 2 \\\hline
3551 0xA0 & ORL & C & /bit & & 2 & CY & & & & 2 \\\hline
3552 0xD0 & POP & data & & & 2 & & & & & 2 \\\hline
3553 0xC0 & PUSH & data & & & 2 & & & & & 2 \\\hline
3554 0x22 & RET & & & & 1 & & & & & 2 \\\hline
3555 0x32 & RETI & & & & 1 & & & & & 2 \\\hline
3556 0x23 & RL & A & & & 1 & & & & & 1 \\\hline
3557 0x33 & RLC & A & & & 1 & CY & & & P & 1 \\\hline
3558 0x03 & RR & A & & & 1 & & & & & 1 \\\hline
3559 0x13 & RRC & A & & & 1 & CY & & & P & 1 \\\hline
3560 0xD2 & SETB & bit & & & 2 & & & & & 1 \\\hline
3561 0xD3 & SETB & C & & & 1 & CY & & & & 1 \\\hline
3562 0x80 & SJMP & code8 & & & 2 & & & & & 2 \\\hline
3563 0x94 & SUBB & A & \#imm8& & 2 & CY & AC & OV & P & 1 \\\hline
3564 0x95 & SUBB & A & data & & 2 & CY & AC & OV & P & 1 \\\hline
3565 0x96 & SUBB & A & @R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3566 0x97 & SUBB & A & @R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3567 0x98 & SUBB & A & R0 & & 1 & CY & AC & OV & P & 1 \\\hline
3568 0x99 & SUBB & A & R1 & & 1 & CY & AC & OV & P & 1 \\\hline
3569 0x9A & SUBB & A & R2 & & 1 & CY & AC & OV & P & 1 \\\hline
3570 0x9B & SUBB & A & R3 & & 1 & CY & AC & OV & P & 1 \\\hline
3571 0x9C & SUBB & A & R4 & & 1 & CY & AC & OV & P & 1 \\\hline
3572 0x9D & SUBB & A & R5 & & 1 & CY & AC & OV & P & 1 \\\hline
3573 0x9E & SUBB & A & R6 & & 1 & CY & AC & OV & P & 1 \\\hline
3574 0x9F & SUBB & A & R7 & & 1 & CY & AC & OV & P & 1 \\\hline
3575 0xC4 & SWAP & A & & & 1 & & & & & 1 \\\hline
3576 0xC5 & XCH & A & data & & 2 & & & & P & 1 \\\hline
3577 0xC6 & XCH & A & @R0 & & 1 & & & & P & 1 \\\hline
3578 0xC7 & XCH & A & @R1 & & 1 & & & & P & 1 \\\hline
3579 0xC8 & XCH & A & R0 & & 1 & & & & P & 1 \\\hline
3580 0xC9 & XCH & A & R1 & & 1 & & & & P & 1 \\\hline
3581 0xCA & XCH & A & R2 & & 1 & & & & P & 1 \\\hline
3582 0xCB & XCH & A & R3 & & 1 & & & & P & 1 \\\hline
3583 0xCC & XCH & A & R4 & & 1 & & & & P & 1 \\\hline
3584 0xCD & XCH & A & R5 & & 1 & & & & P & 1 \\\hline
3585 0xCE & XCH & A & R6 & & 1 & & & & P & 1 \\\hline
3586 0xCF & XCH & A & R7 & & 1 & & & & P & 1 \\\hline
3587 0xD6 & XCHD & A & @R0 & & 1 & & & & P & 1 \\\hline
3588 0xD7 & XCHD & A & @R1 & & 1 & & & & P & 1 \\\hline
3589 0x62 & XRL & data & A & & 2 & & & & & 1 \\\hline
3590 0x63 & XRL & data & \#imm8& & 3 & & & & & 2 \\\hline
3591 0x64 & XRL & A & \#imm8& & 2 & & & & P & 1 \\\hline
3592 0x65 & XRL & A & data & & 2 & & & & P & 1 \\\hline
3593 0x66 & XRL & A & @R0 & & 1 & & & & P & 1 \\\hline
3594 0x67 & XRL & A & @R1 & & 1 & & & & P & 1 \\\hline
3595 0x68 & XRL & A & R0 & & 1 & & & & P & 1 \\\hline
3596 0x69 & XRL & A & R1 & & 1 & & & & P & 1 \\\hline
3597 0x6A & XRL & A & R2 & & 1 & & & & P & 1 \\\hline
3598 0x6B & XRL & A & R3 & & 1 & & & & P & 1 \\\hline
3599 0x6C & XRL & A & R4 & & 1 & & & & P & 1 \\\hline
3600 0x6D & XRL & A & R5 & & 1 & & & & P & 1 \\\hline
3601 0x6E & XRL & A & R6 & & 1 & & & & P & 1 \\\hline
3602 0x6F & XRL & A & R7 & & 1 & & & & P & 1 \\\hline
3603 0xA5 & \multicolumn{10}{l|}{Invalid opcode} \\\hline
3604
3605 % Table caption:
3606 \caption{8051 Instructions in lexical Order}
3607 \end{longtable}
3608 }
3609
3610 \chapter{List of supported micro-controllers}
3611 \subsection{Intel\textregistered}
3612 {
3613 \mysmallfont{}
3614 \begin{longtable}{ll}
3615 8051 & \url{http://download.intel.com/design/MCS51/MANUALS/27238302.pdf} \\
3616 80C51 & \url{http://download.intel.com/design/MCS51/MANUALS/27238302.pdf} \\
3617 8052 & \url{http://download.intel.com/design/MCS51/MANUALS/27238302.pdf} \\
3618 \end{longtable}
3619 }
3620 \subsection{Atmel\textregistered}
3621 {
3622 \mysmallfont{}
3623 \begin{longtable}{ll}
3624 \multicolumn{2}{l}{\textbf{\small{}Flash (Reprogramable)}} \\
3625 AT89C2051 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc0368.pdf} \\
3626 AT89C4051 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc1001.pdf} \\
3627 AT89C51 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc0265.pdf} \\
3628 AT89C51RC & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc1920.pdf} \\
3629 AT89C52 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc0313.pdf} \\
3630 AT89C55WD & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc1921.pdf} \\
3631 AT89LV51 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc0303.pdf} \\
3632 AT89LV52 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc0375.pdf} \\
3633 AT89LV55 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc0811.pdf} \\\\
3634
3635 \multicolumn{2}{l}{\textbf{\small{}Flash ISP (Programable via ISP)}} \\
3636 AT89S52 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc1919.pdf} \\
3637 AT89LS51 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc3053.pdf} \\
3638 AT89LS52 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc2601.pdf} \\
3639 AT89S8253 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc3286.pdf} \\
3640 AT89S2051 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc3390.pdf} \\
3641 AT89S4051 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc3390.pdf} \\\\
3642
3643 \multicolumn{2}{l}{\textbf{\small{}OTP (One-Time Programmable)}} \\
3644 T87C5101 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc3c0c80904bc57.pdf} \\
3645 T83C5101 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc3c0c80904bc57.pdf} \\
3646 AT80C32X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4184.pdf} \\
3647 TS87C52X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4184.pdf} \\
3648 AT87C52X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4184.pdf} \\
3649 AT80C54X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4431.pdf} \\\\
3650
3651 \multicolumn{2}{l}{\textbf{\small{}ROM}} \\
3652 T83C5102 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc3c0c80904bc57.pdf} \\
3653 TS80C32X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4184.pdf} \\
3654 TS80C52X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4184.pdf} \\
3655 AT80C58X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4431.pdf} \\
3656 AT87C54X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4431.pdf} \\
3657 AT87C58X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4431.pdf} \\
3658 TS80C54X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4431.pdf} \\
3659 TS80C58X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4431.pdf} \\
3660 TS87C54X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4431.pdf} \\
3661 AT80C52X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4184.pdf} \\
3662 TS87C58X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4431.pdf} \\\\
3663
3664 \multicolumn{2}{l}{\textbf{\small{}ROMless}} \\
3665 TS80C31X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4428.pdf} \\
3666 AT80C31X2 & \url{http://www.atmel.com/dyn/resources/prod\_documents/doc4428.pdf} \\
3667 \end{longtable}
3668 }
3669
3670 \chapter{Change log}
3671 {
3672 \mysmallfont{}
3673 \begin{verbatim}
3674 1.3.11 -> 1.4
3675 * Bug fixes
3676 * Added new Virtual HW component: LCD display controlled by HD44780
3677 * Added new Virtual HW component: simulated DS1620 temperature sensor
3678 * Added new Virtual HW component: File interface
3679 * Added AT89S51
3680 * Improved performance of Virtual HW
3681 * Added support for spelling checker (Hunspell)
3682 * Added 8051 Instruction table
3683 * Improved table of symbols on the right panel
3684 * Final draft of the handbook
3685
3686 1.3.10 -> 1.3.11
3687 * Bug fixes
3688 * New interface for hardware control plug-ins
3689 * Added new assembler directives: ELSEIF ELSEIFN ELSEIFDEF ELSEIFNDEF
3690 * Removed assembler directive: EXITM
3691
3692 1.3.9 -> 1.3.10
3693 * Bug fixes
3694 * Extended help menu
3695 * Extended global configuration dialog
3696 * Added support for multiple widget styles and GUI background colors
3697 * Added draft of handbook
3698 * Added basic support for assembler and simulator regression testing
3699 * Added regular support for i18n (internationalization)
3700 * Modified welcome dialog
3701 * Added support for external links in the GUI
3702
3703 1.3.8 -> 1.3.9
3704 * Bug fixes
3705
3706 1.3.7 -> 1.3.8
3707 * Bug fixes
3708 * Added feature "Global Font Size Factor" (see MCU 8051 IDE configuration dialog)
3709 * Added breakpoint validation
3710
3711 1.3.6 -> 1.3.7
3712 * Bug fixes
3713
3714 1.3.5 -> 1.3.6
3715 * Bug fixes
3716
3717 1.3.4 -> 1.3.5
3718 * Bug fixes
3719
3720 1.3.3 -> 1.3.4
3721 * "Modernized" GUI
3722 * Bug fixes
3723
3724 1.3.1 -> 1.3.3
3725 * Bug fixes
3726
3727 1.3.1 -> 1.3.2
3728 * Bug fixes
3729
3730 1.3 -> 1.3.1
3731 * Dependency on TclX is now only optional
3732 * Important chage !: Native assembler now expands macro instructions before doing conditional
3733 assembly and before defining constants and variables ! Control sequence $NOMACROSFIRST can
3734 be used to change this behavior to the state of previous versions.
3735 * Added support for AS31 assembler
3736 * Added files notepad
3737 * Improved instruction help panel
3738 * Native assembler was extended to support these directives: "IFN IFDEF IFNDEF BYTE FLAG REPT
3739 TIMES" and these constrol sequences: "$NOXR $NOXREF $XR $XREF $NOSB $SB $RESTORE $RS $SA
3740 $SAVE $PHILIPS $NOPI $PI $NOTABS $NOMOD51 $NOBUILTIN $NOMO $MO $MOD51 $NOMACRO $NOMR $LI
3741 $NOLI $GENONLY $GO $NOGEN $NOGE $GEN $GE $ $EJ $NODB $NODEBUG $DB $DEBUG $CONDONLY $NOCOND
3742 $COND $TT $PW $PL $MR $MACRO $INC $WARNING $ERROR $DA $NOMACROSFIRST"
3743 * Added stack monitor
3744 * Various bug fixes
3745
3746 1.2 -> 1.3
3747 * New dependency: TclX (tested with v8.4)
3748 * Added RS232/UART debugger
3749 * A few changes in assembler
3750 * Bug fixes (Thanks to Miroslav Hradílek for many useful bug reports)
3751
3752 1.1.1 -> 1.2
3753 * Bug fixes
3754 * Added tab bar
3755
3756 1.1 -> 1.1.1
3757 * Added "Special calculator"
3758 * Added "Base converter"
3759 * Many tiny improvements
3760
3761 1.0.9 -> 1.1
3762 * Added support for new MCUs from Intel®: 8031, 8751, 8032, 8752, 80C31, 87C51, 80C52,
3763 87C52, 80C32, 80C54, 87C54, 80C58, 87C58
3764 * Added support for simulating virtual hardware
3765 * Improved simulator (Implemented UART (experimental support), improved support for timers, etc.)
3766 * Improved register watches
3767 * Improved editor (improved autocompletion and many other things)
3768 * Improved panel "Instruction details"
3769 * Improved 8-segment editor
3770 * Bug fixes in assembler, disassembler and simulator engine
3771 * Some other bug fixes
3772 * Added utility "Scribble notepad"
3773 * Improved graph panel
3774
3775 1.0.7 -> 1.0.9
3776 * Added support for C language
3777 * Added map of bit addressable area
3778
3779 1.0.6 -> 1.0.7
3780 * Added Stopwatch
3781 * Improved code editor
3782 * Some bug fixes
3783
3784 1.0.5 -> 1.0.6
3785 * Fixed critical bug in Assembler v1.0.5 (related to peephole code optimization)
3786 * Added 8 segment LED display editor
3787 * Added ASCII chart
3788 * Added Assembly symbol table viewer
3789
3790 1.0 -> 1.0.5
3791 * Added support for external assemblers ("ASEM-51" and "ASL")
3792 * Added support for external editors ("emacs", "gvim", "kwrite" and "gedit")
3793 * Added support for embedded editors ("emacs", "vim", "nano", "dav" and "le")
3794 * Added embedded terminal emulator (rxvt-unicode)
3795 * Added function "File statistics"
3796 * Improved assembler
3797 * Added syntax highlight for code listing (*.lst)
3798 * Added search bars for "Messages" and "Todo"
3799 * Removed dependency on "tcl-thread" and "tclxml"
3800 * Added dependency on "TkImg" and "tdom"
3801 * Improved hex editor
3802 * Improved simulator (especially simulation across multiple files)
3803 * Added panel "Find in files"
3804 * Modified GUI
3805 * New error handling dialog
3806 * Some bug fixes (especially critical bug in disassembler and a few bugs in assembler)
3807 * All images are now in PNG (Portable Network Graphics) (Requires TkImg)
3808 * Some more improvements
3809
3810 0.9.5 -> 1.0
3811 * MANY BUG FIXES ! (including critical)
3812 * Added support for some new MCUs (
3813 AT89S52, AT89LS51, AT89LS52, AT89S8253, AT89S2051, AT89S4051,
3814 T87C5101, T83C5101, T83C5102, TS80C32X2, TS80C52X2, TS87C52X2,
3815 AT80C32X2, AT80C52X2, AT87C52X2, AT80C54X2, AT80C58X2, AT87C54X2,
3816 AT87C58X2, TS80C54X2, TS80C58X2, TS87C54X2, TS87C58X2, TS80C31X2,
3817 AT80C31X2
3818 )
3819 * Added support for peephole optimization
3820 * Faster project opening
3821 * Added interrupt monitor
3822 * Added subprograms monitor
3823 * Added SFR map
3824 * Added SFR watches
3825 * Extended command line interface
3826 * Compiler now checks for valid memory addressing (new CLI options --iram-size, --eram-size,
3827 --xram-size, --code-size)
3828 * Added program hibernation capability
3829 * Added editor commands hibernate, resume, switch-mcu, set-xcode and set-xdata
3830 * Added desktop file and application icon
3831 * Some more improvements
3832
3833 0.9.1 -> 0.9.5
3834 * Implemented support for 80C51, 8052, AT89C2051, AT89C4051, AT89C51, AT89C51RC, AT89C52,
3835 AT89C55WD, AT89LV51, AT89LV52 and AT89LV55
3836 * Simulator can now step back
3837 * Added popup-based completion for editor
3838 * Added tool tips for bits in simulator control panel
3839 * Added simulator configuration dialog
3840 * Added auto save function
3841 * Manual page
3842 * Added support for multi-view (editor can be now splitted vertically or horizontally)
3843 * Many bug fixes (in compiler, editor, file selection dialog, syntax highlight, simulator, etc.)
3844 * Some minor improvements (graph, disassembler, etc.)
3845 * Thread extension is no longer required to run this program (but custom commands will won't
3846 work without it)
3847
3848 0.9.0 -> 0.9.1
3849 * New hexadecimal editor
3850 * New file selection dialog
3851 * Added file system browser tab on left panel
3852 * Added tips on start-up
3853 * Added editor command line
3854 * Improved editor configuration dialog
3855 * A few bug fixes
3856 * Removed dependency on IWidgets and Tix
3857 * Some minor improvements
3858
3859 0.8.7 -> 0.9.0
3860 * Implemented graph
3861 * Many bug fixes (GUI, compiler, memory leaks)
3862 * Editable shortcuts
3863 * Bookmarks for opened and project files
3864 * Search panels in left and right panel
3865 * Modified GUI (checkboxes, radio buttons ...)
3866 * Support for various encodings and EOLs
3867 * Added "Tools" -> "Change letter case", "Normalize HEX" and "SIM -> BIN"
3868 * Added editor functions "Lowercase", "Uppercase" and "Capitalize"
3869 * Added help windows for opened and project files and opened projects
3870 * Added pop-up menus for entry and text widgets (globally)
3871 * Fixed problem with fonts (bad sizes)
3872 * Implemented support for line wrapping (experimental)
3873 * Added new command line options (see `mcu8051ide --help')
3874 * More status tips and tool tips
3875 * Added welcome dialog
3876 * Added demonstration project
3877 * Cleaner, faster and safer compiler
3878 * Some more minor improvements
3879
3880 0.8.5 -> 0.8.7
3881 * Implemented code validation
3882 * Added tab "Instruction details" (on the right panel)
3883 * Added Clean Up dialog
3884 * Added Right Panel configuration dialog
3885 * Added Toolbar configuration dialog
3886 * Added support for custom commands
3887 * Fixed some bugs (in GUI)
3888 * Fixed many memory leaks
3889 * Cleaner code
3890
3891 0.8.4 -> 0.8.5
3892 * Fixed many bugs in GUI
3893 * Improved editor
3894 * Extended calculator
3895 * Redesigned editor configuration dialog
3896 * Added functions "Tools -> Reformat code" and "Tools -> Sim2Hex"
3897 * Extended CLI (--reset-user-settings, --config-file, --compile, --hex2bin ...)
3898
3899 0.8.1 -> 0.8.4
3900 * Fixed many bugs ... (including critical)
3901 * Added compiler configuration dialog
3902 * Added calculator timers preset
3903 * Added dialog about
3904 * Added support for exporting highlighted source code to LaTeX source
3905 * Added many ToolTips
3906 * Added StatusBar tips
3907 * Added splash screen
3908 * Added support for command line options
3909 * All images are now *.XPM (X PixMap) (require Tix package)
3910 * Changed installation procedure
3911
3912 0.8.0 -> 0.8.1
3913 * Fixed some bugs in compiler (not critical)
3914 * Fixed bug in to do list (saving text as SGML)
3915 * Fixed bug in project management
3916 * Added pop-up menu to to do list
3917 \end{verbatim}
3918 }
3919
3920 \listoftables
3921 \listoffigures
3922 \end{document}