jb302@39: #LyX 2.0 created this file. For more info see http://www.lyx.org/ jb302@39: \lyxformat 413 jb302@39: \begin_document jb302@39: \begin_header jb302@39: \textclass article jb302@39: \use_default_options true jb302@39: \maintain_unincluded_children false jb302@39: \language english jb302@39: \language_package default jb302@39: \inputencoding auto jb302@39: \fontencoding global jb302@39: \font_roman default jb302@39: \font_sans default jb302@39: \font_typewriter default jb302@39: \font_default_family default jb302@39: \use_non_tex_fonts false jb302@39: \font_sc false jb302@39: \font_osf false jb302@39: \font_sf_scale 100 jb302@39: \font_tt_scale 100 jb302@39: jb302@39: \graphics default jb302@39: \default_output_format default jb302@39: \output_sync 0 jb302@39: \bibtex_command default jb302@39: \index_command default jb302@39: \paperfontsize default jb302@39: \use_hyperref false jb302@39: \papersize default jb302@39: \use_geometry false jb302@39: \use_amsmath 1 jb302@39: \use_esint 1 jb302@39: \use_mhchem 1 jb302@39: \use_mathdots 1 jb302@39: \cite_engine basic jb302@39: \use_bibtopic false jb302@39: \use_indices false jb302@39: \paperorientation portrait jb302@39: \suppress_date false jb302@39: \use_refstyle 1 jb302@39: \index Index jb302@39: \shortcut idx jb302@39: \color #008000 jb302@39: \end_index jb302@39: \secnumdepth 3 jb302@39: \tocdepth 3 jb302@39: \paragraph_separation indent jb302@39: \paragraph_indentation default jb302@39: \quotes_language english jb302@39: \papercolumns 1 jb302@39: \papersides 1 jb302@39: \paperpagestyle default jb302@39: \tracking_changes false jb302@39: \output_changes false jb302@39: \html_math_output 0 jb302@39: \html_css_as_file 0 jb302@39: \html_be_strict false jb302@39: \end_header jb302@39: jb302@39: \begin_body jb302@39: jb302@39: \begin_layout Part jb302@39: The Assembler jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Section jb302@39: Assembler Design jb302@39: \end_layout jb302@39: 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@39: The ELB816 specification defines an assembly language in Backus Naur form, jb302@39: however the assembler designed for this project differs slightly (more jb302@39: 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@41: \begin_inset ERT jb302@41: status open jb302@41: jb302@41: \begin_layout Plain Layout jb302@41: jb302@41: jb302@41: \backslash jb302@41: bigskip jb302@41: \end_layout jb302@41: jb302@41: \end_inset jb302@41: jb302@39: jb302@39: \end_layout jb302@39: jb302@39: \begin_layout Standard jb302@39: \begin_inset listings jb302@41: 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: ::= [