9/20/6Lecture 3 - Instruction Set - Al1 Project Description
9/20/6Lecture 3 - Instruction Set - Al2 Semester Project Specification Will interactive develop the specification and description for the semester simulation project. Target is the Easy 68K assembler/simulator Brings into focus and practice the topics discussed so far and many yet to come.
What is the objective The objective is to write an 68k assembler written in 68K assembler. Will not be for the full 68K assembler language, but a large subset to start. Assemblers are 2 pass programs On the first pass lexical analysis is done and symbols are resolved into values. On the second pass, using the resolved symbols, code is generated. 9/20/6Lecture 3 - Instruction Set - Al3
The first step Develop a dictionary of words and symbols For example: A label starts with a letter and then has up to xxx letters, numerals, and ‘_’s. LABEL == LETTER {[LETTER|NUMERAL|_]} LETTER == A|B|C|… NUMERAL == 1|2|3|4|5|6|7|8|9 RESERVED_WORD == MOVE|ADDA| As part of the start of the project define a dictionary. 9/20/6Lecture 3 - Instruction Set - Al4
Lexical Analysis How to start the project Create a dictionary STEP 1 of coding Read the input file and be able to write it back out. Will use TRAP 15 to do this D0 has a value which indicates which task to perform. Write a program to output the file you just read in. 9/20/6Lecture 3 - Instruction Set - Al5
Step 1 completed Should now be able to read input file and mirror it to an output file. 9/20/6Lecture 3 - Instruction Set - Al6
Once text file read in Start scanning line to find elements in your dictionary When a character/number/symbol is encountered you move into a decision chart to determine which element of you dictionary you have found 9/20/6Lecture 3 - Instruction Set - Al7
Actions Scan the line read character by character, i.e., byte by byte At the start, skip over white space, i.e., blank characters, a hexadecimal 20 until a non space character is found. Then branch on what character is Build up a decision tree 9/20/6Lecture 3 - Instruction Set - Al8
Next step Create the state table for identifying know names (in dictionary) If user defined name find full name and enter into a table Create a file with “some program in it” to allow development of code to start scanning it. Scan the line to identify the reserved words and user defined names, special symbols, and numbers User defined names are entered in a table and they will be linked with a value by the end of the 1 st pass. Project a due date of about Feb 21. For reserved words output a code that will be easier to identify on the 2 nd pass when the temp file is read in again. 9/20/6Lecture 3 - Instruction Set - Al9
Instructions to include INSTRUCTIONS Assembler Directives ADD ORG AND DC Bcc DS BRA END CLR CMP CMPA JMP LEA LSR,LSL MOVE MOVEA NOT OR PEA SUB 9/20/6Lecture 3 - Instruction Set - Al10
9/20/6Lecture 3 - Instruction Set - Al11
9/20/6Lecture 3 - Instruction Set - Al12
9/20/6Lecture 3 - Instruction Set - Al13
9/20/6Lecture 3 - Instruction Set - Al14
9/20/6Lecture 3 - Instruction Set - Al15
9/20/6Lecture 3 - Instruction Set - Al16
9/20/6Lecture 3 - Instruction Set - Al17
9/20/6Lecture 3 - Instruction Set - Al18
9/20/6Lecture 3 - Instruction Set - Al19
9/20/6Lecture 3 - Instruction Set - Al20