MSP430 Disassembly

MSP430 Disassembly - How to Assemble/Disassemble(aka Hack...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS/ECEn 124 02/02/2011 How to Assemble/Disassemble (aka Hack) MSP430 Code To decode an instruction: 1. Begin with a “PC” pointing to the first word in program memory. 2. Retrieve instruction word and increment PC by 2. 3. Find and list the corresponding instruction mnemonic using the opcode (most significant 4/6/9 bits). 4. Append “.b” or “.w” using the b/w bit when appropriate. 5. If double operand instruction, decode and list source operand (Table 5). 6. If single or double operand instruction, decode and list destination operand (Tables 3 and 5). 7. If jump instruction, sign extend the 10-bit PC offset, multiply by 2, and add to the current PC. List that address. To decode an operand: 1. To decode a source operand: a. Decode the addressing mode from the “ As ” bits (00=register, 01=indexed, 10=indirect, or 11=indirect auto- increment) and source register from the “S-Reg” bits. b. If “ @R2 ”, “ @R2+ ”, “ R3 ”, “ x(R3) ”, “ @R3 ”, or “ @R3+ ”, list appropriate constant preceded by pound sign (ie #1). c. Else if “ x(R0) ”, change to symbolic mode, retrieve index (next code word), add index word to PC, increment PC, and list that address as operand (ie. 0x8023). d. Else if “ x(R2) ”, change to absolute mode, retrieve address (next code word), increment PC, and list address preceded by an ampersand symbol (ie. &addr). e. Else if “ @PC+ ”, change to immediate mode, retrieve immediate value (next code word), increment PC, and list immediate value preceded by the pound symbol (ie. #100). f. Else if register mode , list register (ie. Rn). g. Else if indexed mode , retrieve index (next code word), increment PC, and list index followed by the register in parentheses (ie. 0x0200(R4)).
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern