用汇编语言制作回文检查器时输出错误

问题描述 投票:0回答:0

我正在尝试制作回文检查器,但它一直说它不是回文。我得到了字符串并将其加载到堆栈中(作为我学校作业的一部分),所以现在我的程序检查字符串的外部对以查看它们是否相同。

endOfString:
mov x4, #2
sdiv X2, X2, X4 // divide x2 by 2 --> it is how many times we need to check the two outer pairs of the string
MOV X3, #0 // counter      
LDR X0, =output
LDR x5, =input      

compareChar:
LDRB W1, [SP], #16  // pop characters from the stack 
LDRB W2, [X5], #1 //load byte data from X5 and put it into W2, increment by 1
CMP W1, W2 // check the pair
B.NE Palno // is not a palindrome
B.EQ pal // it is a palindrome
ADD X3, X3, #1        
CMP X3, X2              
B.LE compareChar        
assembly arm64 palindrome
© www.soinside.com 2019 - 2024. All rights reserved.