4 ms·
Can someone explain what "cmp.b @r13, 0x2400(r14)" does, and/or how I would find out myself? I looked through the manual and saw the instruction 'cmp' tests th
by gibybo 13y ago
Can someone explain what "cmp.b @r13, 0x2400(r14)" does, and/or how I would find out myself?
I looked through the manual and saw the instruction 'cmp' tests the two parameters for equivalence, but I don't see 'cmp.b' anywhere. I found the TI manual for the instruction set which happens to say something about '.B' being a byte operation, but I'm not sure if that's related.
The tutorial explained that @r13 uses the value in memory for the address in register 13, but '0x2400(r14)' is really confusing.
I was thinking it just meant register 14, but that doesn't seem to be the case because the comparison fails when r14 (which is the value 0x0000 at this point) and @r13 match. I thought it also could mean the literal value '0x2400', but the comparison still seems to fail when it should match, and that doesn't explain the r14 in parenthesis at the end of it.
- ohazi 13y ago0x2400(r14) is an offset syntax. Take the value in register 14, add 0x2400 to it, and look up what's in memory at that address.
- gibybo 13y agoAwesome, thanks :)
- tptacek 13y agoThe .b means the instruction operates on a byte, not a full 16 bit word.
- joshschreuder 13y agoBit late, but what does "cmp #0x7669, 0x0(r15)" mean on level two? I assume it's the same syntax for the second part (offset) but is the first part the constant value 7669?
- tptacek 13y agoIt's 7669 in hex.
- azernik 13y agoI'm not sure if this is the manual you're referring to, but I've found this [1] very helpful. This point is under the section "Byte and word issues". [1] http://mspgcc.sourceforge.net/manual/ http://mspgcc.sourceforge.net/manual/
- sanderjd 13y agoDoes it say somewhere that this is targeting an MSP430, or did you just recognize it? I thought it must be something with a real compiler targeting it, but I couldn't figure out what it was... In any case, thanks for the link!
- deleted 13y ago[deleted]
- sanderjd 13y agoCrap, I'm an idiot - there's a manual at https://microcorruption.com/manual.pdf https://microcorruption.com/manual.pdf that talks all about it.