Quantcast
Channel: Basic use of immediates vs. square brackets in YASM/NASM x86 assembly - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Answer by Dirk Wolfgang Glomp for Basic use of immediates vs. square brackets in YASM/NASM x86 assembly

$
0
0

For all instruction with using immediate values as an operand for to write the value into a ram location (or for calculating within), we have to specify how many bytes we want to access. Because our assemble can not know if we want access only one byte, a word, or a doppleword for example if the immediate value is a lower value, like the following instructions shows.

array db 0FFh, 0FFh, 0FFh, 0FFhmov byte [array], 3

results:

array db 03h, 0FFh, 0FFh, 0FFh

....

mov word [array], 3

results:

array db 03h, 00h, 0FFh, 0FFh

....

mov dword [array], 3

results:

array db 03h, 00h, 00h, 00h

Dirk


Viewing all articles
Browse latest Browse all 5


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>