enter image description here

This is a simple program in dos-assembly for x86-processor. It's a simple helloworld-program.

What I do not undertand is the succesive memory-addresses below in the image. The program seems to start at address 0100 in hex that is 256. The next address is 258. The difference seems to be 2 bytes. Is it so that the instruction (opcode + address) is 2 bytes?

Then further down - the mov dx instruction seems to occupy 3 bytes (0117 - 011A) while the mov ah instruction occupy 2 bytes.

I thought instructions (opcode + address) should occupy the same amount of bytes in memory. But obviously I do not understand this correctly

有帮助吗?

解决方案

Yes, x86 is an architecture with variable machine code size. Size of a command may vary from 1 byte to more than 10 and decoding rules are quite complicated.

Here is an introduction to x86 encoding/decoding. For the exhaustive reference, use Intel Software Developer Manual, though it is focused on 32-bit and 64-bit modes.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top