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

Поделиться
HTML-код
  • Опубликовано: 23 сен 2024
  • Topic: How to use Variables, Integer Constants and Strings in Assembly Language.
    .
    .
    Material Link: www.dropbox.co...
    .
    Sample Code:
    ;-- Arithematic Expression
    ;-- (20+30) - (10+15)
    .386
    .model flat, stdcall
    .stack 4096
    include Irvine32.inc
    ;-- Data segment to make variables
    .data
    message db "Result is: ",0
    var1 db 20d
    var2 db 30d
    var3 db 10d
    var4 db 15d
    ;-- code segment starts here
    .code
    main proc
    mov eax,0
    mov ah, var1
    add ah, var2 ; (20+30)
    mov bl, var3
    add bl, var4; (10+15)
    sub ah,bl; (20+30) - (10+15)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    MOV eax, 50d
    ADD eax, 10
    call WriteDec ;Answer in Decimal
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    mov edx, offset message
    call WriteString
    call DumpRegs ;Answer in Hexa
    invoke ExitProcess,0
    main endp
    end main

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