I'm studying for a test in my digital design class and I don't understand some things. Here is the worksheet with the answers on it,
A) explains that 20 F8
is the raw machine code for bra loop
, and that it's not shown for the other instructions.
Apparently you're supposed to know enough about the machine-code format to figure out where that branches to.
I don't know 68HC12, but from experience with other ISAs (like x86), I assume 0x20 is the opcode and 0xF8 is a signed 2's complement relative displacement, probably relative to the end of the branch instruction.
Oh, yes the solution written in for part C confirms that. But 0x080D + 0xF8
only works if there's no carry from the low byte to high byte. Unless 68hc12 displacements are weird or there's segmentation, you have to sign extend that before adding, so it's 0x080D + 0xFFF8
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.