Starting at address $0800,

CE 00 31 9E 00 2D 01 08 18 06 3F A7

Determine the assembly instructions and indicate the addressing mode of each instruction.

CE 00 31 =====> ldx #$ 01 ;x <-- 0031

9E 00 =====> cpx $0000

2D 01 =====> BLT $0001 ..? I'm stuck from this part ..

I need help ..

Thank you


I assume you must already have the 68HC12 instruction set reference; the big table that lists the address modes, machine coding, number of bytes, and affected flags for each instruction. And you already decoded 0x2D as BLT (branch if less than).

enter image description here

The address mode REL means that the next byte is a relative offset from the program counter. Since the offset is 2's complement, it can be positive (skipping ahead) or negative (looping back).

The tricky part is you have to be careful about whether it's relative to the program counter address of the BLT instruction itself, or the address of the next instruction. (This can be different for different types of microcontrollers.) This is explained in the reference manual.

enter image description here

  • \$\begingroup\$ Does BLT $0001 means 'if x is less than $0001, branch "? or does $0001 represent new location? (org $0001)? \$\endgroup\$ – SMLJ Apr 6 '15 at 4:41
  • \$\begingroup\$ the $01 represents the new location (relative to the PC as shown in the operation section). The condition (whether or not to branch) depends on the flags (N xor V in this case). \$\endgroup\$ – MarkU Apr 6 '15 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.