如何从输入x86_64 nasm中乘以两个数字

时间:2017-05-01 16:21:07

标签: assembly x86-64

所以我试图从输入中将两个64位数相乘。

这是我到目前为止所尝试的内容,感谢您的帮助。

nasm给我的错误就是这样。

error: instruction not supported in 64-bit mode

section .bss
    input resb 100

section .data

section .text
    global _start

_start:
    call Mul


    mov rax, 60
    mov rdi, 1
    syscall

Mul:
    push eax ;Error given: can't do operation in 64-bit mode.
    call GetInput
    mov ebx, eax
    pop eax ;Error given: Can't do operation in 64-bit mode
    call GetInput
    mul ebx ;Multiply EAX by EBX.
    call PrintValue
    ret

GetInput:
    mov rax, 0
    mov rdi, 0
    mov rsi, input
    mov rdx, 100
    syscall
    ret

PrintValue:
    mov rax, 1
    mov rdi, 1 ;Error given: Invalid combination of opcode and operands.
    mov rsi, eax
    mov rdx, 100
    ret

0 个答案:

没有答案
相关问题