Lab 12 - Assembly Language for x86 Processors by KIP R. IRVINE

Поделиться
HTML-код
  • Опубликовано: 2 янв 2025
  • Topics: Multiplication and Division in Assembly Language.
    .
    .
    Material Link: www.dropbox.co...
    .
    Sample Code:
    TITLE
    ; Name:
    ; Date:
    ; ID:
    ; Description:
    INCLUDE Irvine32.inc
    INCLUDELIB Irvine32.lib
    ; these two lines are only necessary if you're not using Visual Studio
    INCLUDELIB kernel32.lib
    INCLUDELIB user32.lib
    .data
    var1 SDWord 25
    var2 SDWord -16
    Var3 SDWord 11
    var4 SDWord ?
    .code
    main PROC
    mov eax, var2
    neg eax
    CDQ
    IDIV var3
    mov ebx, edx ;saved remainder
    mov eax, -5
    imul var1 ; iska answer EDX:EAX main para hai
    ;Check for division by zero
    cmp ebx, 0
    je Done ; Avoid division by zero
    IDIV ebx
    mov var4, eax
    Done:
    exit
    main ENDP
    END main

Комментарии •