MSP430 Disassembly

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

Info iconThis 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)). h.
Background image of page 1

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

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

Page1 / 3

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

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online