jb302@37: #LyX 2.0 created this file. For more info see http://www.lyx.org/ jb302@37: \lyxformat 413 jb302@37: \begin_document jb302@37: \begin_header jb302@37: \textclass article jb302@37: \use_default_options true jb302@37: \maintain_unincluded_children false jb302@37: \language english jb302@37: \language_package default jb302@37: \inputencoding auto jb302@37: \fontencoding global jb302@37: \font_roman default jb302@37: \font_sans default jb302@37: \font_typewriter default jb302@37: \font_default_family default jb302@37: \use_non_tex_fonts false jb302@37: \font_sc false jb302@37: \font_osf false jb302@37: \font_sf_scale 100 jb302@37: \font_tt_scale 100 jb302@37: jb302@37: \graphics default jb302@37: \default_output_format default jb302@37: \output_sync 0 jb302@37: \bibtex_command default jb302@37: \index_command default jb302@37: \paperfontsize default jb302@37: \use_hyperref false jb302@37: \papersize default jb302@37: \use_geometry false jb302@37: \use_amsmath 1 jb302@37: \use_esint 1 jb302@37: \use_mhchem 1 jb302@37: \use_mathdots 1 jb302@37: \cite_engine basic jb302@37: \use_bibtopic false jb302@37: \use_indices false jb302@37: \paperorientation portrait jb302@37: \suppress_date false jb302@37: \use_refstyle 1 jb302@37: \index Index jb302@37: \shortcut idx jb302@37: \color #008000 jb302@37: \end_index jb302@37: \secnumdepth 3 jb302@37: \tocdepth 3 jb302@37: \paragraph_separation indent jb302@37: \paragraph_indentation default jb302@37: \quotes_language english jb302@37: \papercolumns 1 jb302@37: \papersides 1 jb302@37: \paperpagestyle default jb302@37: \tracking_changes false jb302@37: \output_changes false jb302@37: \html_math_output 0 jb302@37: \html_css_as_file 0 jb302@37: \html_be_strict false jb302@37: \end_header jb302@37: jb302@37: \begin_body jb302@37: jb302@37: \begin_layout Part jb302@37: The Assembler jb302@37: \end_layout jb302@37: jb302@37: \begin_layout Section jb302@37: Assembler Design jb302@37: \end_layout jb302@37: jb302@39: \begin_layout Standard jb302@39: The assembler will take assembly source code as input and produce two output jb302@42: files: a binary executable and a debug file. jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset ERT jb302@39: status open jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: jb302@39: \backslash jb302@39: bigskip jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset Graphics jb302@39: filename /home/jmz/qm/ede/docs/img/asm/assembler.svg jb302@39: display false jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset ERT jb302@39: status open jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: jb302@39: \backslash jb302@39: bigskip jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: The binary executable will be a simple raw binary file in big-endian format. jb302@39: The debug file will be a tabulated text file with the following format: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset ERT jb302@39: status open jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: jb302@39: \backslash jb302@39: bigskip jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset Tabular jb302@39: jb302@39: jb302@39: jb302@39: jb302@39: jb302@39: jb302@39: jb302@39: jb302@39: jb302@39: \begin_inset Text jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: PC jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \begin_inset Text jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: OPCODE jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \begin_inset Text jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: DATA jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \begin_inset Text jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: MNEMONIC jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \begin_inset Text jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: ARGUMENTS jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset ERT jb302@39: status open jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: jb302@39: \backslash jb302@39: bigskip jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: This file will essentially be the plain text source side by side with the jb302@39: binary machine code and address for each instruction (represented as hexadecima jb302@39: l for greater readability). jb302@39: This file will provide the information needed for setting break pointers jb302@39: with the debugger later, it will also be generally useful for debugging jb302@42: programs written in the assembler, and the assembler itself. jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset Newpage pagebreak jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Subsection jb302@39: Language design in BNF syntax jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@42: The ELB816 specification [1] defines an assembly language in Backus Naur jb302@42: form, however the assembler designed for this project differs slightly jb302@42: (more details in Assembler Implementation below). jb302@39: Here is the language definition for this assembler: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset ERT jb302@39: status open jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: jb302@39: \backslash jb302@39: bigskip jb302@39: \end_layout jb302@39: jb302@39: \end_inset jb302@39: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset listings jb302@39: lstparams "basicstyle={\ttfamily},captionpos=b,keywordstyle={\color{blue}},tabsize=4" jb302@39: inline false jb302@39: status open jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: ::=   |   jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: ::= jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: ::= [ [";"]]  jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: ::= jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39:   jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Plain Layout jb302@39: jb302@39: ::= [