[英]creating a Loop Intel based Assembly x86
我目前正在開發一個用 32 位英特爾語法程序集編寫的項目。 這是一個使用 sys read 和 cmp 獲取輸入並檢查它是否是回文並繼續循環直到按下 Enter 的小程序。 我的問題是,我不知道如何清除我正在使用的變量的內存,它會移動 +1 並只打印單詞的其余部分,直到我 ctrl c 退出提示。 所以我的問題是你能幫我弄清楚如何對內存進行異或或其他方式嗎? 感謝代碼如下。 ;必須可以在ac程序中調用
BITS 32
global _start
section .data
userMsg: DW 'Please enter a String to check:'
lenUserMsg EQU $-userMsg
;usereMsg DB 'Is a Palindrome'
;lenUsereMSG EQU $-usereMsg
;usrMsg DB 'Is not a Palindrome'
;lenUsrMsg EQU $-usrMsg
Section .bss
s:RESB 1024
w:RESB 1024
section .text
_start:
;promping the user to enter a string in which to check for palindrome
Loop_Palindrome:
mov eax, 4
mov ebx, 1
mov ecx, userMsg
mov edx, lenUserMsg
int 80h
mov eax, 3
mov ebx, 0
mov ecx, w
mov edx, s
int 80h
cmp eax, 0
je exit
cmp BYTE [w], 0
je exit
print_exit:
mov eax, 4
mov ebx, 1
mov ecx, w
mov edx, s
int 80h
jmp Loop_Palindrome
exit:
mov eax, 1
mov ebx, 0
int 80h
發現我的問題,需要“ cmp byte [w], 10 ”。 我需要檢查新行而不是 0 哈哈。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.