Design a simple assembly language instruction set that satisfies the following requirements:
(This part of the project does not have to be turned in because it will appear in Part 2.)
For each instruction, provide the following information:
List your instructions in alphabetical order.
Document each instruction using the following format. This is a sample of the MOV instruction:
| ASM syntax | MOV reg-d, reg-s |
| Description | Copy contents of register-s to register-d. |
| Example | mov R2,R1 |
| Opcode | 00011101 |
| Instruction format | 00011101 rrrr rrrr |
Instruction formats are always 16 bits. Use the following symbols in instruction formats to describe the operand fields:
Remember, it's perfectly OK for various instructions to have opcodes of different lengths, but no two instructions can have the same opcode. The CPU must be able to tell where an opcode ends and the operands begin. Suppose, for example, instruction-1 had a 4-bit opcode (1010), followed by a 12-bit address (000100001010). Then the machine instruction would look like this:
Instruction-1: 1010 000100001010
(a space was inserted for clarity, but is not part of the instruction word)
Suppose also that Instruction-2 had an 8-bit opcode (10101000) followed by two 4-bit registers (1000 and 0010). Then its machine instruction would be:
Instruction-2: 10101000 1000 0010
(the two spaces are for clarity, but are not part of the instruction word)
How would the CPU be able to determine the opcode length of the two instructions? Clearly, you must use a bit encoding scheme that will make it possible for the CPU to detect variable-length opcodes.
Now you will write several programs in your new assembly language. You will not be able to run them, of course. Be sure to add comments to each line. Remember, the reader does not know your particular instruction set.
Write a program using your new instruction set that calculates the sum of an array of fifty 16-bit integers and stores the sum in a variable. Use the following declarations, which we assume that your assembler recognizes:
COUNT = 50 .data array WORD COUNT DUP(?) sum WORD ? ; holds the sum
Write a program using your new instruction set that compares the contents of three variables named var1, var2, and var3, and moves the largest value of the three to the accumulator (R1).
Note that Program 3 has been simplified (4/4/03).
Write a program using your new instruction set that separates the hours, minutes, and seconds fields of a time stamp from a disk directory entry and moves the minutes field into a separate variable. The time format is shown on page 507. Note that the seconds field must be divided by 2, since it is originally represented by 2-second increments.
.data timeStamp WORD ? ; starting value minutes WORD ?
Write a program using your new instruction set that implements the following expression:
R6 = (var1 + var2) * var3
Do not permit var1, var2, or var3 to be modified. You can assume the following data definitions:
.data var1 WORD ? var2 WORD ? var3 WORD ?
Turn in an HTML file, ready for publication on the Web. I will post all student work (with identifying names) on the class Web site once the project deadline has passed. I will ask students to view the projects and give each a numerical rating between 1 and 5. Part of your grade will be based on the rating you receive from other students.
You can use an actual HTML editor, or you can use MS-Word and export the document to an HTML file. Program listings must use the Courier New font. You can make the font bold, if you wish.
Upload your HTML file to the class FTP site. Follow the same naming conventions as usual, except that your file extension must now be .htm.
You will be judged on the following criteria: