官术网_书友最值得收藏!

Copying data

The MOV  instruction is used to move data. With this, data is moved either to or from a register or a memory address.

mov eax, 0xaabbccdd  places the 0xaabbccdd value in the eax register.

mov eax, edx places the data value from theedx register to the eax register.

Let's take the following memory entries as an example:

Address   Bytes
00000060: 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
00000070: 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
00000080: 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
00000090: 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F

Reading data may require using directives to help the assembler. We use byte ptr, word ptr, or dword ptr:

; the following lines reads from memory
mov al, byte ptr [00000071] ; al = 71h
mov cx, word ptr [00000071] ; cx = 7271h
mov edx, dword ptr [00000071] ; edx = 74737271h

; the following lines writes to memory
mov eax, 011223344h
mov byte ptr [00000080], al ; writes the value in al to address 00000080
mov word ptr [00000081], ax ; writes the value in ax to address 00000081
mov dword ptr [00000083], eax ; writes the value in eax to address 00000083

The memory will look like this afterward:

00000060: 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 
00000070: 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
00000080: 44 44 33 44 33 22 11 87 88 89 8A 8B 8C 8D 8E 8F
00000090: 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
主站蜘蛛池模板: 固安县| 博客| 宜州市| 延川县| 怀柔区| 和田市| 岢岚县| 策勒县| 兴业县| 枝江市| 庐江县| 东乌珠穆沁旗| 涟水县| 伽师县| 新巴尔虎左旗| 宁津县| 青川县| 苍梧县| 南乐县| 砚山县| 贡觉县| 浪卡子县| 多伦县| 高尔夫| 白山市| 尚义县| 台中县| 纳雍县| 昌宁县| 那坡县| 威宁| 青海省| 枣阳市| 澄迈县| 吕梁市| 当雄县| 威海市| 林周县| 鞍山市| 望城县| 织金县|