我必须询问一个选项,根据用户输入的内容,我可能需要其他输入。当用户输入“ 1”并且“ _comparison”选择“ _biConfig”例程时,该例程设法显示一条消息,但是在请求更多输入(按入input_bi,调用_gets)时失败。
在Windows 10下对NASM x86进行编程
nasm main.asm -f win32 -o file.o
gcc file.o -m32 -o run
./运行
global _main
extern _printf
extern _puts
extern _gets
extern _scanf
section .data
menu db "Enter...",10,"1 IEEE 754 configuration",10,"2 Normalized scientific notation in base 2",10,0
bi_config db "Enter the binary configuration",0
hex_config db "Enter the hexadecimal configuration",0
op_format db "%d"
section .bss
operation resd 1
input_bi resb 20
input_hex resb 8
section .text
_main:
call _menuPrint
call _enterOp
call _comparison
ret
_menuPrint:
push menu
call _printf
add esp,4
ret
_enterOp:
push operation
push op_format
call _scanf
add esp,8
ret
_comparison:
cmp dword[operation],1
je _biConfig
cmp dword[operation],2
je _hexConfig
ret
_biConfig:
push bi_config
call _printf
add esp,4
push input_bi
call _gets
add esp,4
ret
_hexConfig:
push hex_config
call _printf
add esp,4
ret