# HG changeset patch # User james # Date 1397843938 -3600 # Node ID db6b8c9552bb0fae512403db9c7c9370f4408c49 # Parent 8205f1734ff2108e7af48246318123a04bb6b255 couple of last minute bug fixes diff -r 8205f1734ff2 -r db6b8c9552bb dbg/dbg.py --- a/dbg/dbg.py Thu Apr 17 15:50:42 2014 +0100 +++ b/dbg/dbg.py Fri Apr 18 18:58:58 2014 +0100 @@ -78,27 +78,27 @@ return self.rcv(lenl | (lenh << 8)) def get_a(self): + self.snd(0x08) + return self.rcv(1) + + def get_flags(self): self.snd(0x09) return self.rcv(1) - def get_flags(self): + def get_ir(self): self.snd(0x0A) return self.rcv(1) - def get_ir(self): + def run_len(self, lenh, lenl): self.snd(0x0B) - return self.rcv(1) - - def run_len(self, lenh, lenl): - self.snd(0x0C) self.snd(lenh) self.snd(lenl) def free_run(self): - self.snd(0x0D) + self.snd(0x0C) def set_bp(self, i, addrh, addrl): - self.snd(0x0E) + self.snd(0x0D) self.snd(i) self.snd(addrh) self.snd(addrl) diff -r 8205f1734ff2 -r db6b8c9552bb docs/img/ede/system_overview.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/img/ede/system_overview.svg Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + UI + Assembler + Debugger + + + Host serial interface + + software emulator + emulated peripherals + + + + hardware emulator + peripheral drivers + + MCU serial interface Host Software MCU Software + + + + diff -r 8205f1734ff2 -r db6b8c9552bb docs/img/emu/ELB816_system.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/img/emu/ELB816_system.svg Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,4008 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + Internal control lines + + Address + + + ALU + TMP2 + + + + TMP1 + + + + + + + + + + + + + (TPL) (TPH) (TMPA) + + + + R0 R1 R2 (DPL) (DPH) + R3 + (SPL) (SPH) (PCL) (PCH) DPTR SP PC + + + MAR + + 16 + + + + + + + + + + MDR + + + + A + + + + + + FLAGS + + + + + IR + + InstructionDecoder + + + + + Timing and Control M RD WR + + + IO + INT + INTA + + Internal Data Bus + + + 8 8 8 + 8 + + 8-bit + + + + + + Data Bus Address Bus + + 8 16 + Main Memory64kB (65536 x 8-bit) RAM CE RD WR + + + Data Address + + + + + + + + + + + + + I/O Port + + + IN OUT CS RD WR + + Data + + + + + + + + Interrupt EN + + + + port address decode logic + + LS8 addr + + diff -r 8205f1734ff2 -r db6b8c9552bb docs/img/emu/controller.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/img/emu/controller.svg Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,945 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + Main Memory64kB (65536 x 8-bit) RAM Data Address + + + 8 + 16 + + + + + + + (TPL) (TPH) (TMPA) + + + + R0 R1 R2 (DPL) (DPH) + R3 (SPL) (SPH) (PCL) (PCH) DPTR SP PC + + + 8 + + IR flags + A + + + + ELB816 + + + + + 8 + Controller + + + + + + + 8 Command In + + diff -r 8205f1734ff2 -r db6b8c9552bb docs/img/emu/memory.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/img/emu/memory.svg Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,637 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + Main Memory64kB (65536 x 8-bit) RAM Data Address + + + 8 + 16 + + + + + + + (TPL) (TPH) (TMPA) + + + + R0 R1 R2 (DPL) (DPH) + R3 + (SPL) (SPH) (PCL) (PCH) DPTR SP PC + + + + 16 + 8 + diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/#emu.lyx# --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/#emu.lyx# Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,1808 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\begin_preamble +\usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox +% Resize figures that are too wide for the page. +\let\oldincludegraphics\includegraphics +\renewcommand\includegraphics[2][]{% + \oldincludegraphics[#1,max width=\linewidth,max height=\textheight]{#2} +} +\end_preamble +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Part +The Emulator +\end_layout + +\begin_layout Section +Emulator Design +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/ELB816_system.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +Above is block diagram of a micro-controller taken from the original ELB816 + specification. + Implementing this system as a piece of software is the goal of this section + of the project. +\end_layout + +\begin_layout Subsection +Memory and Registers +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/memory.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +The micro-controller is based on a Von Neumann architecture and has: +\end_layout + +\begin_layout Itemize +A single block of up to 64k byte addressable memory for storing both data + and code. +\end_layout + +\begin_layout Itemize +Two banks of four 8-bit general purpose registers (R0 to R3). +\end_layout + +\begin_layout Itemize +Four 16 bit-content specific (PC, SP, DPTR and TMPA) +\end_layout + +\begin_layout Itemize +Three 8-bit content specific registers (A, flags and IR) +\end_layout + +\begin_layout Standard +The general purpose and 16-bit registers can exist as a single sixteen byte + block of memory spaces with the following encoding: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +MSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +MSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +LSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible? +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +000 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R0 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R0 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +001 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R1 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R1 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +010 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R2 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R2 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +011 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R3 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R3 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +100 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +DPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +DPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Data Pointer +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +101 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +SPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +SPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Stack Pointer +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +110 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +PCH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +PCL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Program Counter +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +No +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +111 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +TPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +TPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Temp Address Register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +No +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage pagebreak +\end_inset + + +\end_layout + +\begin_layout Standard +The 8-bit flag register can exist as a single byte with the following format: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout +Bit +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +BS +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Select register bank +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +IE +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Enable Interrupts when 1 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +OV +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation has even parity +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +S +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation is negative +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +4 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +P +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation has even parity +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +5 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +AC +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation generates a carry or borrow + from bit 3 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +6 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Z +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation is Zero +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +7 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +C +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Set to 1 when result of arithmetic operation generates + a carry or borrow from bit 7. + Used in rotate through carry operations +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +There is also an 8-bit accumulator register for storing the result of various + operations and an 8-bit instruction register for the storing the instruction + currently being executed. +\end_layout + +\begin_layout Subsection +Control and Execution +\end_layout + +\begin_layout Standard +The emulator needs to be controlled externally. + This could be via a serial or a file buffer depending on the platform. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/controller.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Below is a control protocol which allows and control of the emulators memory + and execution. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout +Function +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Arguments +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Command Byte +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Length +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +step +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x00 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Execute Instruction at PC +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +run +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x01 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Execute instructions from PC until a break point is reached +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +register address, value +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x02 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set a register +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +register address +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x03 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get the value of a register +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +flag bit, 0 or 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x04 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Turn a flag bit on or off. + LSB = 0, MSB =7 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +flag bit +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x05 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get the value of a flag bit +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +write memory block +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +address high, address low, length high, length low, [byte array] +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x06 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +6+ +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set a block of memory of arbitrary length with the bytes in the byte array +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +read memory block +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +address high, address low, length high, length low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x07 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +5 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Read a block of memory of arbitrary length +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get A +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x08 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get value of A +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get flags +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x09 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get value of flags +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get IR +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0xA +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get Value of IR +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +run for length +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +length high, length low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0B +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Run for length number of instruction +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +free run +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0C +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Run forever - Bypass controller +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set break point +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +break point index, address high, address low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0D +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +4 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set 1 of 8 possible break points +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Subsection +Interrupt Controller +\end_layout + +\begin_layout Subsection +Timer +\end_layout + +\begin_layout Section +Emulator Implementation +\end_layout + +\begin_layout Section +Emulator Testing +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/asm.lyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/asm.lyx Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,79 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Part +The Assembler +\end_layout + +\begin_layout Section +Assembler Design +\end_layout + +\begin_layout Section +Assembler Implementation +\end_layout + +\begin_layout Section +Assembler Testing +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/dbg.lyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/dbg.lyx Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,79 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Part +The Debugger +\end_layout + +\begin_layout Section +Design +\end_layout + +\begin_layout Section +Implementation +\end_layout + +\begin_layout Section +Testing +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/ede.lyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/ede.lyx Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,79 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Part +The ELB816 Development Environment +\end_layout + +\begin_layout Section +EDE Overview +\end_layout + +\begin_layout Section +EDE Interfaces +\end_layout + +\begin_layout Section +EDE Improvements +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/emu.lyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/emu.lyx Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,1809 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\begin_preamble +\usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox +% Resize figures that are too wide for the page. +\let\oldincludegraphics\includegraphics +\renewcommand\includegraphics[2][]{% + \oldincludegraphics[#1,max width=\linewidth,max height=\textheight]{#2} +} +\end_preamble +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Part +The Emulator +\end_layout + +\begin_layout Section +Emulator Design +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/ELB816_system.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +Above is a block diagram of a micro-controller with the ELB816 micro-processor + at it's core. + This is taken from the original ELB816 specification. + Implementing a system similar to this as a piece of software is the goal + of this section of the project. +\end_layout + +\begin_layout Subsection +Memory and Registers +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/memory.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +The micro-controller is based on a Von Neumann architecture and has: +\end_layout + +\begin_layout Itemize +A single block of up to 64k byte addressable memory for storing both data + and code. +\end_layout + +\begin_layout Itemize +Two banks of four 8-bit general purpose registers (R0 to R3). +\end_layout + +\begin_layout Itemize +Four 16-bit content specific (PC, SP, DPTR and TMPA) +\end_layout + +\begin_layout Itemize +Three 8-bit content specific registers (A, flags and IR) +\end_layout + +\begin_layout Standard +The general purpose 8-bit registers and the 16-bit registers can exist as + a single sixteen byte block of memory spaces with the following encoding: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +MSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +MSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +LSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible? +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +000 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R0 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R0 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +001 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R1 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R1 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +010 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R2 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R2 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +011 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R3 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R3 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +100 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +DPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +DPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Data Pointer +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +101 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +SPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +SPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Stack Pointer +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +110 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +PCH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +PCL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Program Counter +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +No +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +111 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +TPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +TPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Temp Address Register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +No +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage pagebreak +\end_inset + + +\end_layout + +\begin_layout Standard +The 8-bit flag register can exist as a single byte with the following format: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout +Bit +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +BS +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Select register bank +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +IE +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Enable Interrupts when 1 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +OV +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation has even parity +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +S +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation is negative +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +4 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +P +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation has even parity +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +5 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +AC +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation generates a carry or borrow + from bit 3 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +6 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Z +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation is Zero +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +7 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +C +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Set to 1 when result of arithmetic operation generates + a carry or borrow from bit 7. + Used in rotate through carry operations +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +There is also an 8-bit accumulator register for storing the result of various + operations and an 8-bit instruction register for the storing the instruction + currently being executed. +\end_layout + +\begin_layout Subsection +Control and Execution +\end_layout + +\begin_layout Standard +The emulator needs to be controlled externally. + This could be via a serial or a file buffer depending on the platform. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/controller.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Below is a control protocol which allows and control of the emulators memory + and execution. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout +Function +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Arguments +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +CMD byte +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Length +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +step +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x00 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Execute instruction at PC +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +run +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x01 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Execute instructions from PC until a break point is reached +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +register address, value +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x02 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set a register +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +register address +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x03 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get the value of a register +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +flag bit, 0 or 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x04 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Turn a flag bit on or off. + LSB = 0, MSB =7 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +flag bit +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x05 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get the value of a flag bit +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +write memory block +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +address high, address low, length high, length low, [byte array] +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x06 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +6+ +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set a block of memory of arbitrary length with the bytes in the byte array +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +read memory block +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +address high, address low, length high, length low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x07 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +5 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Read a block of memory of arbitrary length +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get A +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x08 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get value of A +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get flags +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x09 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get value of flags +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get IR +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0A +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get Value of IR +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +run for length +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +length high, length low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0B +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Run for length number of instruction +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +free run +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0C +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Run forever - Bypass controller +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set break point +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +break point index, address high, address low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0D +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +4 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set 1 of 8 possible break points +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Subsection +Interrupt Controller +\end_layout + +\begin_layout Subsection +Timer +\end_layout + +\begin_layout Section +Emulator Implementation +\end_layout + +\begin_layout Section +Emulator Testing +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/emu.lyx~ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/emu.lyx~ Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,1809 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\begin_preamble +\usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox +% Resize figures that are too wide for the page. +\let\oldincludegraphics\includegraphics +\renewcommand\includegraphics[2][]{% + \oldincludegraphics[#1,max width=\linewidth,max height=\textheight]{#2} +} +\end_preamble +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Part +The Emulator +\end_layout + +\begin_layout Section +Emulator Design +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/ELB816_system.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +Above is a block diagram of a micro-controller with the ELB816 micro-processor + at it's core. + This is taken from the original ELB816 specification. + Implementing a system similar to this as a piece of software is the goal + of this section of the project. +\end_layout + +\begin_layout Subsection +Memory and Registers +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/memory.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +The micro-controller is based on a Von Neumann architecture and has: +\end_layout + +\begin_layout Itemize +A single block of up to 64k byte addressable memory for storing both data + and code. +\end_layout + +\begin_layout Itemize +Two banks of four 8-bit general purpose registers (R0 to R3). +\end_layout + +\begin_layout Itemize +Four 16-bit content specific (PC, SP, DPTR and TMPA) +\end_layout + +\begin_layout Itemize +Three 8-bit content specific registers (A, flags and IR) +\end_layout + +\begin_layout Standard +The general purpose 8-bit registers and the 16-bit registers can exist as + a single sixteen byte block of memory spaces with the following encoding: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +MSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +MSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +LSB +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible? +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +000 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R0 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R0 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +001 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R1 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R1 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +010 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R2 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R2 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +011 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R3 bank 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +R3 bank 0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +General Purpose +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +100 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +DPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +DPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Data Pointer +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +101 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +SPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +SPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Stack Pointer +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Yes +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +110 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +PCH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +PCL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Program Counter +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +No +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +111 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +TPH +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +TPL +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Temp Address Register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +No +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Newpage pagebreak +\end_inset + + +\end_layout + +\begin_layout Standard +The 8-bit flag register can exist as a single byte with the following format: +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout +Bit +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +BS +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Select register bank +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +IE +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Enable Interrupts when 1 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +OV +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation has even parity +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +S +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation is negative +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +4 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +P +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation has even parity +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +5 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +AC +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation generates a carry or borrow + from bit 3 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +6 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Z +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set to 1 when result of arithmetic operation is Zero +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +7 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +C +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +User Accessible: Set to 1 when result of arithmetic operation generates + a carry or borrow from bit 7. + Used in rotate through carry operations +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +There is also an 8-bit accumulator register for storing the result of various + operations and an 8-bit instruction register for the storing the instruction + currently being executed. +\end_layout + +\begin_layout Subsection +Control and Execution +\end_layout + +\begin_layout Standard +The emulator needs to be controlled externally. + This could be via a serial or a file buffer depending on the platform. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /home/jmz/qm/ede/docs/img/emu/controller.svg + display false + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Below is a control protocol which allows and control of the emulators memory + and execution. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +bigskip +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Tabular + + + + + + + + + +\begin_inset Text + +\begin_layout Plain Layout +Function +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Arguments +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +CMD byte +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Length +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Description +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +step +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x00 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Execute instruction at PC +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +run +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x01 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Execute instructions from PC until a break point is reached +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +register address, value +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x02 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set a register +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get register +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +register address +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x03 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get the value of a register +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +flag bit, 0 or 1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x04 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Turn a flag bit on or off. + LSB = 0, MSB =7 +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get flag +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +flag bit +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x05 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +2 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get the value of a flag bit +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +write memory block +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +address high, address low, length high, length low, [byte array] +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x06 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +6+ +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set a block of memory of arbitrary length with the bytes in the byte array +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +read memory block +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +address high, address low, length high, length low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x07 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +5 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Read a block of memory of arbitrary length +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get A +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x08 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get value of A +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get flags +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x09 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get value of flags +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +get IR +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0xA +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Get Value of IR +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +run for length +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +length high, length low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0B +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +3 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Run for length number of instruction +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +free run +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +- +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0C +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Run forever - Bypass controller +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Plain Layout +set break point +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +break point index, address high, address low +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +0x0D +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +4 +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Plain Layout +Set 1 of 8 possible break points +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Subsection +Interrupt Controller +\end_layout + +\begin_layout Subsection +Timer +\end_layout + +\begin_layout Section +Emulator Implementation +\end_layout + +\begin_layout Section +Emulator Testing +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/final_report.lyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/final_report.lyx Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,130 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\begin_preamble +\usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox +% Resize figures that are too wide for the page. +\let\oldincludegraphics\includegraphics +\renewcommand\includegraphics[2][]{% + \oldincludegraphics[#1,max width=\linewidth,max height=\textheight]{#2} +} +\end_preamble +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Title +EDE: ELB816 Development Environment +\end_layout + +\begin_layout Author +James Bowden (110104485) +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "intro.lyx" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "asm.lyx" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "emu.lyx" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "dbg.lyx" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "ede.lyx" + +\end_inset + + +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/final_report.lyx~ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/final_report.lyx~ Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,121 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Title +EDE: ELB816 Development Environment +\end_layout + +\begin_layout Author +James Bowden (110104485) +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "intro.lyx" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "asm.lyx" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "emu.lyx" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "dbg.lyx" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand include +filename "ede.lyx" + +\end_inset + + +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/intro.lyx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/intro.lyx Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,203 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Part +Introduction +\end_layout + +\begin_layout Section +Motivations +\end_layout + +\begin_layout Standard +The ELB816 architecture is designed to be a +\begin_inset Quotes eld +\end_inset + +simple to understand 8-bit microprocessor system to help learn about micro-proce +ssor electronics. +\begin_inset Quotes erd +\end_inset + +. + The combination of an ELB816 emulator, debugger and assembler could be + used as a set of tools for learning or teaching micro-processor programming + without the intricacies of real-world commercial microprocessors getting + in the way of a fundamental understanding of the subject. + A PC based emulator would allow students to quickly develop and debug programs + written in a simple assembly language on any modern desktop or laptop, + and an MCS-51 port running on an 8052 would allow students to test programs + in an actual circuit. + EDE aims to bring together these components in order to provide an environment + for using ELB816 as an educational tool. +\end_layout + +\begin_layout Section +Project Aims +\end_layout + +\begin_layout Itemize +Develop an assembler for the ELB816 assembly language. +\end_layout + +\begin_layout Itemize +Develop an emulated programmable micro-controller system based on the ELB816 + micro-processor architecture. +\end_layout + +\begin_layout Itemize +Develop a debugger that allows interactive debugging of programs running + on the emulator. +\end_layout + +\begin_layout Section +Methodology +\end_layout + +\begin_layout Subsection +Assembler +\end_layout + +\begin_layout Description +Language: Python +\end_layout + +\begin_layout Description +Priority: First +\end_layout + +\begin_layout Standard +The assembler will be developed before anything else so that it can subsequently + be used to assemble test programs during development of the emulator. + +\end_layout + +\begin_layout Subsection +Emulator +\end_layout + +\begin_layout Description +Language: C +\end_layout + +\begin_layout Description +Priority: Second +\end_layout + +\begin_layout Standard +The emulator will use only standard libraries in order to ensure it is portable + between compilers and platforms. + Specifically GCC for x86 and Keil C51 for Intel MCS-51. + The emulator will first be developed on Linux to facilitated rapid development. + It will be ported to MCS-51 once it is complete +\end_layout + +\begin_layout Subsection +Debugger +\end_layout + +\begin_layout Description +Language: C/Python +\end_layout + +\begin_layout Description +Priority: Second +\end_layout + +\begin_layout Standard +The debug interface will be developed along side the emulator. + It will communicate with a a simple control function, built into the emulator, + that will read commands using C's +\begin_inset listings +lstparams "basicstyle={\ttfamily}" +inline true +status open + +\begin_layout Plain Layout + +stdio.h +\end_layout + +\end_inset + + library. + This means that on Linux the commands will be issued using +\begin_inset listings +lstparams "basicstyle={\ttfamily}" +inline true +status open + +\begin_layout Plain Layout + +STDIN +\end_layout + +\end_inset + + and on the MCS-51 version they will be issued over a serial interface. + Python will be used to build a controller class for sending commands to + and receiving data from the emulator. + Python will also be used to build a text based user interface on top of + this. +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb docs/lyx/intro.lyx~ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/lyx/intro.lyx~ Fri Apr 18 18:58:58 2014 +0100 @@ -0,0 +1,203 @@ +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 +\begin_document +\begin_header +\textclass article +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding auto +\fontencoding global +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 + +\graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\use_hyperref false +\papersize default +\use_geometry false +\use_amsmath 1 +\use_esint 1 +\use_mhchem 1 +\use_mathdots 1 +\cite_engine basic +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\use_refstyle 1 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Part +Introduction +\end_layout + +\begin_layout Section +Motivations +\end_layout + +\begin_layout Standard +The ELB816 architecture is designed to be a +\begin_inset Quotes eld +\end_inset + +simple to understand 8-bit microprocessor system to help learn about micro-proce +ssor electronics. +\begin_inset Quotes erd +\end_inset + +. + The combination of an ELB816 emulator, debugger and assembler could be + used as a set of tools for learning or teaching micro-processor programming + without the intricacies of real-world commercial microprocessors getting + in the way of a fundamental understanding of the subject. + A PC based emulator would allow students to quickly develop and debug programs + written in a simple assembly language on any modern desktop or laptop and + an MCS-51 port running on an 8052 would allow students to test programs + in an actual circuit. + EDE aims to bring together these components in order to provide an environment + for using ELB816 as an educational tool. +\end_layout + +\begin_layout Section +Project Aims +\end_layout + +\begin_layout Itemize +Develop an assembler for the ELB816 assembly language. +\end_layout + +\begin_layout Itemize +Develop an emulated programmable micro-controller system based on the ELB816 + micro-processor architecture. +\end_layout + +\begin_layout Itemize +Develop a debugger that allows interactive debugging of programs running + on the emulator. +\end_layout + +\begin_layout Section +Methodology +\end_layout + +\begin_layout Subsection +Assembler +\end_layout + +\begin_layout Description +Language: Python +\end_layout + +\begin_layout Description +Priority: First +\end_layout + +\begin_layout Standard +The assembler will be developed before anything else so that it can subsequently + be used to assemble test programs during development of the emulator. + +\end_layout + +\begin_layout Subsection +Emulator +\end_layout + +\begin_layout Description +Language: C +\end_layout + +\begin_layout Description +Priority: Second +\end_layout + +\begin_layout Standard +The emulator will use only standard libraries in order to ensure it is portable + between compilers and platforms. + Specifically GCC for x86 and Keil C51 for Intel MCS-51. + The emulator will first be developed on Linux to facilitated rapid development. + It will be ported to MCS-51 once it is complete +\end_layout + +\begin_layout Subsection +Debugger +\end_layout + +\begin_layout Description +Language: C/Python +\end_layout + +\begin_layout Description +Priority: Second +\end_layout + +\begin_layout Standard +The debug interface will be developed along side the emulator. + It will communicate with a a simple control function built into the emulator + that will read commands using C's +\begin_inset listings +lstparams "basicstyle={\ttfamily}" +inline true +status open + +\begin_layout Plain Layout + +stdio.h +\end_layout + +\end_inset + + library. + This means that on Linux the commands will be issued using +\begin_inset listings +lstparams "basicstyle={\ttfamily}" +inline true +status open + +\begin_layout Plain Layout + +STDIN +\end_layout + +\end_inset + + and on the MCS-51 version they will be issued over a serial interface. + Python will be used to build a controller class for sending commands to + and receiving data from the emulator. + Python will also be used to build a text based user interface on top of + this. +\end_layout + +\end_body +\end_document diff -r 8205f1734ff2 -r db6b8c9552bb emu/.mem.h.swp Binary file emu/.mem.h.swp has changed diff -r 8205f1734ff2 -r db6b8c9552bb emu/main.c --- a/emu/main.c Thu Apr 17 15:50:42 2014 +0100 +++ b/emu/main.c Fri Apr 18 18:58:58 2014 +0100 @@ -162,21 +162,22 @@ break; /* get A */ - case 0x09: + case 0x08: snd(A); break; /* get flags */ - case 0x0A: + case 0x09: snd(flags); break; /* get instruction register */ - case 0x0B: + case 0x0A: snd(IR); break; - case 0x0C: + /* run for length */ + case 0x0B: args[0] = rcv(); /* length high */ args[1] = rcv(); /* length low */ tmpw = get_wide(PC); @@ -188,12 +189,12 @@ } break; - case 0x0D: + case 0x0C: free_run = 1; break; /* set break point */ - case 0x0E: + case 0x0D: args[0] = rcv(); /* bp index */ args[1] = rcv(); /* address high */ args[2] = rcv(); /* address low */ diff -r 8205f1734ff2 -r db6b8c9552bb emu52/main.c --- a/emu52/main.c Thu Apr 17 15:50:42 2014 +0100 +++ b/emu52/main.c Fri Apr 18 18:58:58 2014 +0100 @@ -159,21 +159,21 @@ break; /* get A */ - case 0x09: + case 0x08: snd(A); break; /* get flags */ - case 0x0A: + case 0x09: snd(flags); break; /* get instruction register */ - case 0x0B: + case 0x0A: snd(IR); break; - case 0x0C: + case 0x0B: args[0] = rcv(); /* length high */ args[1] = rcv(); /* length low */ tmpw = get_wide(PC); @@ -185,12 +185,12 @@ } break; - case 0x0D: + case 0x0C: free_run = 1; break; /* set break point */ - case 0x0E: + case 0x0D: args[0] = rcv(); /* bp index */ args[1] = rcv(); /* address high */ args[2] = rcv(); /* address low */