Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

my .exe program is not what I expected

my masm source file is as follows:

qq.asm

assume cs:codesegment
codesegment segment
mov ax, 0ffffh
mov ds, ax
mov al, 00ffh
mov bx, 0006h
mov [bx], al
mov al, [0006]
mov ah, 0
mov dx, 0
mov cx, 3
s: add dx, ax
loop s
mov ax, 4c00h
int 21h
codesegment ends
end

I use masm program generates a .exe file which named qq.exe.When I use debug qq.exe -u, the instructors are as follows in the picture: picture

I confused that "mov al, [0006]" instructor in my qq.asm turned to "mov AL,06" in qq.exe. Any help would be appreciate.

like image 689
feng smith Avatar asked Oct 19 '22 21:10

feng smith


1 Answers

[0006] was interpreted as an immediate constant. You can avoid it with a segment override:

mov al, ds:[0006]
like image 198
rkhb Avatar answered Oct 29 '22 13:10

rkhb