I'm working through the Microcorruption CTF which uses an emulated MSP430 CPU.
I've seen several mov instruction examples like:
mov sp, r4 ; move value of stack pointer to register 4
mov #0xfffc, r15 ; move hex value fffc to r15
I'm trying to interpret:
mov.b #0x4f, 0x0(r15)
I assume mov.b is binary value of #0x4f, but I'm not sure what 0x0(r15)
indicates.
The mov instruction copies the data item referred to by its second operand (i.e. register contents, memory contents, or a constant value) into the location referred to by its first operand (i.e. a register or memory).
bl is the name of the low 8 bits (bits 7-0) in the ebx register. There is also bh which is the bits 15-8 of ebx , and bx is the low 16 bits (bits 15-0). There is no name for the higher 16 bits. This applies to all of the registers eax , ebx , ecx and edx .
The MOV instruction has a few limitations: an immediate value cannot be moved into a segment register directly (i.e. mov ds,10) segment registers cannot be copied directly (i.e. mov es,ds) a memory location cannot be copied into another memory location (i.e. mov aNumber,aDigit)
@curlywei yes, a mov in assembly is a copy, not a move.
It means use a byte operation:
The suffix .B at the instruction memonic will result in a byte operation
So only a byte of data will be copied from the source to the destination.
0x0(r15) is an indexed addressing mode, so use r15 + 0 bytes to specify the destination.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With