An assembly program to divide integersΒΆ

    .intel_syntax noprefix

    .text
    .global main
main:   push    rbp
    mov rbp, rsp

    mov rax, [rip + b]
    mov rcx, [rip + a]
    mov rdx, 0
    div rcx
    mov [rip + quotient], rax
    mov [rip + remainder], rdx

    mov rax, 0
    pop rbp
    ret

    .data
a:  .quad   123
b:  .quad   456

    .bss
quotient:
    .zero   8
remainder:
    .zero   8
You have attempted of activities on this page