Frage

I've started to learn asm, and I wondered what is the difference between these two different ways of using the MOV instruction into AL:

First:

MOV AL,5H

Second:

MOV SI,5H
MOV AL,[SI]
War es hilfreich?

Lösung

Those two do different things.

; let me use friendlier syntax; IMHO, lower case and 0x5 instead of 5h is more
; readable in case of assembly
mov al, 0x5 ; al = 0x5

mov si, 0x5 ; si = 0x5
mov al, [si] ; al = *si; that is, al is now what was in memory at address 0x5

There is easy wikibook about x86 assembly that will better explain the concepts and syntax to you: x86 Assembly. Assembly is generally easy language, but it's best to just follow tutorial/book about it, to first fully understand syntax, and then - and only then - jump into wild world of assembly reading and writing.

Also, for other resources, you can look here.

Andere Tipps

  1. Simply sets the value of the AL register to 5H
  2. First it sets the SI register to 5H Then it moves the value dereferenced by SI into AL (i.e. whatever was in memory address 5H is now moved into AL).

You can also apply a non-zero base offset when using the index registers like SI, for instance:

MOV AL,[BX + SI]

After first setting BX to the appropriate base offset address.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top