0
我試圖掃描程序集中的100號字符串並使用scanf和printf打印它。程序集中的scanf字符串
.data
strString: .string "%s"
stringToRev: .space 100
.text #the beginning of the code
.globl main #the label "main" is used to state the initial point of this program
.type main, @function # the label "main" representing the beginning of a function
main: # the main function:
pushl %ebp #save the old frame pointer
movl %esp, %ebp #create the new frame pointer
pushl %ebx #saving a callee save register.
leal -12(%ebp), %edx #choice will be saved in edx
pushl %edx
pushl $strString
call scanf
movl (%edx), $stringToRev
pushl -12(%ebp)
pushl $strString
call printf
call Reverse
pushl %eax
pushl $strString
call printf
如果我輸入一個字符串,例如「asfdg」,它將打印0(而不是此字符串)。 我對此感到絕望 - 在網上沒有任何答案!
當您通過調試器完成此任務時發現了什麼? –
我是裝配初學者。我在調試器中不流利...... – zvika
然後,你應該花一些時間學習使用調試器。調試可能是編程的50%。 –