質問

Hello I am writing assembly code for 8086 but I am wondering how does CPU differentiate between for example

AND AX, [memoryaddress] and AND AX, memoryaddress

we are putting [] around it to indicate that it should be replaced by that addresses contents but CPU sees a instruction like that

00 01 1101001

How does it know if it should add the value 1101001 or the contents of the address 1101001.

I am thinking of there are more than one ADD command and their opcodes are different like (ADDTHECONTENTS and ADDTHEVALUE) but a86 allows us to just say ADD because we can easily differentiate the semantics from the [] syntax. This seems logical but I am not sure about that so I wanted to ask, if there are many opcodes for instructions corresponding to different addressing modes.

役に立ちましたか?

解決

The difference is in the opcode. There are multiple ADD opcodes (with numeric values 0, 1, 2, 3, 4, 5) and they differ exactly in how long arguments they expect, and what they do with the arguments.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top