I need to make a simple 4 functions calculator for 2 numbers coding with Linux Assembler, however the programm works not fully ok because sometimes fails on reading the 2 numbers.
My setup and data:
bits 32
global main
extern scanf
extern printf
extern exit
section .data
    menu:   db ; truncated, but essentially a string            
    msg1:   db "El resultado de la suma es: %d", 10, 0
    msg2:   db "El resultado de la resta es: %d", 10, 0
    msg3:   db "El resultado de la multiplicacion es: %d", 10, 0
    msg4:   db "El resultado de la division es: %d", 10, 0
    in1:    db "Proporciona dato 1: ", 10
    in2:    db "Proporciona dato 2: ", 10   
    fmt:    db "%d"
    x:      dd 0
    y:      dd 0
The function I believe isn't always working:
leer:
    push dword in1
    call printf
    add esp, 4
    push dword x
    push dword fmt
    call scanf
    add esp, 8
    push dword in2
    call printf
    add esp, 4
    push dword y
    push dword fmt
    call scanf
    add esp, 开发者_运维问答8
    ret
The original code can be found here: http://notepad.cc/piloobru13
Some of your strings are not zero terminated.
That will likely confuse printf and scanf.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论