Lab8 - Disassembler

Note

This is not a required lab. If you submit it, it will be for extra credit.

Since we have shown code to read an intel “hex” file, and the code needed to decode instructions, it makes sense to put those two parts together and see if we can build a tool that will dump assembly language from a hex file.

Don’t panic, this is not going to be bad. Most of the code is in the notes, you just need to patch things together. Feel free to work on this in your group, but submit your own version.

Step1: Sample AVR Code

Create a one file AVR program for something like “blink”. Change the machine definition to “attiny85” and make sure it compiles with no errors. (You will need to watch using jmp and call`. These are not supported in this chil. You need the relative version of those instuctions.

Warning

Do NOT use instructions that take two 16-bit words for this project. THat will simplify things a bit.

Be sure to limit your code to those instructions we have included in the simulator project.

Make sure you can successfully build a hex file from this code.

Step 2: Read the HEX file

Take the code in the notes that reads a hex file and complete breaking out the individualbytes. Save those bytes in a byte array for later decoding. Test this part by dumping the final instruction bytes in hex on the console.

Step 3: Decode the instructions

Finally, take the code shown in the notes that decodes the set of instructions we are using. Each instruction is two bytes from the data array you constructed in the previous step. You will need to combine those into one 16-bit instruction code to feed to the decoder.

Your final output should be the basic display of the instructions and operand forms shown in the notes.

Note

You do NOT need to decode the operands in this exercise.

What to Submit

The usual!