Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an x86 opcode for moving an immediate byte to a direct memory location (without using registers)?

Is there a way to 'mov'e a specific immediate byte-size number into a direct memory location? I.e.

MOV 10h,ffffh

to write the value 16 into the memory address 65535? If so, which opcode is that, orwould I have to store a memory address into a register first?

like image 336
Nicholas Hill Avatar asked Sep 13 '11 21:09

Nicholas Hill


People also ask

What is x86 opcode?

The x86 opcode bytes are 8-bit equivalents of iii field that we discussed in simplified encoding. This provides for up to 512 different instruction classes, although the x86 does not yet use them all.

What size in bytes are opcodes on an x86 processor?

x86 opcodes are 1 byte for most common instructions, especially instructions which have existed since 8086. Instructions added later (e.g. like bsf and movsx in 386) often use 2-byte opcodes with a 0f escape byte.

What does the MOVB instruction do?

The mov instruction copies the data item referred to by its first operand (i.e. register contents, memory contents, or a constant value) into the location referred to by its second operand (i.e. a register or memory).

What is x86 assembly instructions?

The x86 instruction set refers to the set of instructions that x86-compatible microprocessors support. The instructions are usually part of an executable program, often stored as a computer file and executed on the processor.


1 Answers

Yes. The opcode is C6. You should download a copy of the Intel ISA documents, which are freely available.

To your follow-up question: the full encoding of your example is:

  c6      04      25   ff ff 00 00   10
opcode  modr/m   sib     address     immediate
like image 86
Stephen Canon Avatar answered Sep 21 '22 04:09

Stephen Canon