Variable in section .data is initialized to wrong value
Closed this issue · 1 comments
Abod-Shashtari commented
CODE:
.model small
.8086
.data
v1 dw 4
.code
mov ax,0
mov ax,v1
.exit
end
Problem: AX value is not 4
NOTES: Assembler => MASM
Abod-Shashtari commented
I fix it by adding
mov ax,@data
mov ds,ax
The code will be like this:
.model small
.data
v1 dw 4
.code
mov ax,@data
mov ds,ax
mov ax,0
mov ax,v1
.exit
end