次のコードでは
data segment
; add your data here!
num db 0,0,0,0
sum db 0
str db "Sum is : $"
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
;;read array from input
mov cx,4;set loop counter
L1:
mov ah,7;interupt 7 use for reading character without echo
int 21h
mov num,al;mov al to num
add sum,al
inc num;nex element
LOOP L1
sub num,4;go to first position
;;;;;;;;;;;;;;;;;;;;;;;;
;;show sum
lea dx,str;;-----------------I'm changing this line-----------------------
mov ah,9;interupt 9 for writing string
int 21h
;;;;;;;;;;;
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
dx を ax に変更した場合
lea dx,str --> lea ax,str
アウトプットになる1 'Sum is
けど、使えばlea ax,str
正解 >Sum is :
理由がわかりません!
dx を ax に変更すると間違った出力が発生するのはなぜですか?