Assembly NASM和对POP的澄清
我最近一直在学习一些汇编语言,我正在编写一些非常简单的程序,只是为了看看它们是如何工作的,并更好地记住它们 无论如何,我决定只编写一个程序来打印您的输入。我正在使用SASM及其io宏Assembly NASM和对POP的澄清,assembly,nasm,32-bit,Assembly,Nasm,32 Bit,我最近一直在学习一些汇编语言,我正在编写一些非常简单的程序,只是为了看看它们是如何工作的,并更好地记住它们 无论如何,我决定只编写一个程序来打印您的输入。我正在使用SASM及其io宏 %include "io.inc" section .text global CMAIN CMAIN: segment .data message db "Input a number", 0 segment .bss input resb 4 input2 resb 4 segment
%include "io.inc"
section .text
global CMAIN
CMAIN:
segment .data
message db "Input a number", 0
segment .bss
input resb 4
input2 resb 4
segment .text
PRINT_STRING message ;prints message
GET_UDEC 4, eax ;gets 4bytes of user input and puts into eax
mov [input], eax ;moves eax into input's actual data
PRINT_UDEC 4, input ;prints input
NEWLINE
PRINT_UDEC 4, esp ;Prints 2686764
NEWLINE
push input ;pushes input onto the stack
PRINT_UDEC 4, esp ;Prints 2686760, we pushed a dw
NEWLINE
pop ebx ;pops (input) and puts it into ebx?
mov [input2], ebx ;moves ebx into input2
PRINT_UDEC 4, input2 ;prints input2. //Prints some crazy number.
GET_UDEC 4, eax ;Stops program from exiting.
xor eax, eax
ret
我一定错过了一些基本的东西,但我找不到它来救我的命。有人知道吗?你可能想要
推送[input]
否则你可能推送的是地址而不是值。被上帝抛弃的括号又来了推德沃德[输入]'行。被遗弃的上帝再次攻击!我每天都为这些括号感谢上帝!不使用它们的汇编程序总是让我困惑。