2
我正在爲我的計算機體系結構類的任務,我不明白大會。我應該從鍵盤上輸入一個字符串,並檢查它是否是迴文。我不允許使用INT 21h
。我編寫的程序爲db string value
而不是鍵盤輸入,但我仍然無法讓我的CMP
正常工作。我很確定我做錯了。希望有人能幫助。檢查字符串迴文沒有INT 21h在em 8086
#make_COM#
include emu8086.inc
org 100h
jmp init
msg db "kayak",0
init:
Mov SI,5
mov di,0
start:
mov al,msg[si]
dEC si
inc di
mov ah ,0eh
int 10h
cmp si, -1
jg start
check:
mov al, msg[si]
mov ah, msg[di]
cmp al, ah
jmp notpalin
inc si
dec di
cmp si, 5
jl check
palin:
call pthis
db "This is a palindrome", 0
jmp stop
notpalin:
call pthis
db "This is not a palindrome", 0
jmp stop
stop:
mov ah, 0
int 16h ; wait for any key....
ret ; return to operating system.
DEFINE_PTHIS
哇哦,我很多接近然後我意識到。監督失誤。感謝您的解決方案@Sep Roland,幫助我瞭解自己出錯的地方。 – remedy