feng smith
feng smith

Reputation: 1537

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.

Upvotes: 5

Views: 88

Answers (1)

rkhb
rkhb

Reputation: 14409

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

mov al, ds:[0006]

Upvotes: 3

Related Questions