1
請注意:我知道該程序可能有多個錯誤,它寫得不好,我只是想學計劃連接兩個字符串在8086彙編
我的計劃是在8086連接兩個字符串,我代碼: -
printmsg macro ms
mov ah,09h
lea dx,ms
int 21h
endm
printip macro ms
mov ah,09h
lea dx,ms+2
int 21h
endm
ipuser macro ms
mov ah,0ah
lea dx,ms
int 21h
endm
code segment
assume cs:code, ds:data
mov dx,data
mov ds,dx
printmsg ms1
ipuser input1
printmsg ms2
ipuser input2
lea si,input1+2
up: cmp [si],byte ptr '$'
je done
inc si
jmp up
done: lea di,input2+2
lbl: mov dl,[di]
mov [si],dl
cmp [si],byte ptr '$'
je endpr
inc di
inc si
loop lbl
endpr: printmsg ms3
printmsg nl
printip input1
mov ah,4ch
int 21h
code ends
data segment
ms1 db 10,13,'Enter first string:$'
ms2 db 10,13,'Enter second string:$'
ms3 db 10,13,'Concatenated string is:$'
nl db 0dh,0ah,'$'
input1 db 10 dup('$')
input2 db 10 dup('$')
data ends
end
我得到的輸出是: -
Enter first string:mihir Enter second string:kandoi Concatenated string is: kandoi
我想要的輸出是: -
Enter first string:mihir Enter second string:kandoi Concatenated string is: mihirkandoi
什麼似乎是問題?我是新來的絃樂器
請嘗試編寫代碼的時候,尤其是裝配遵循一些編碼標準。在你的例子中,如果你用空行來分隔函數並且在標籤中使用indendation,那將是非常有用的。 –
看起來像文本牆..不會讀入。嘗試重新格式化它,使用一些空行將邏輯部分組合在一起,使用縮進來區分標籤中的指令(大約40年的習慣,使標籤從第一列開始,並且指令縮進至少在第4列或更多,您可能不習慣它,但幾乎其他所有人都可以,只需檢查一些彙編示例以瞭解什麼是好的並使用它)。 – Ped7g