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

Поделиться
HTML-код
  • Опубликовано: 19 янв 2025
  • Topics: Direct Offset Operands and Arrays + Status Flags.
    .
    .
    Material Link: www.dropbox.co...
    .
    Sample Code:
    ;-- Direct Offset Operands
    ;-- Status Flags
    .386
    .model flat, stdcall
    .stack 4096
    include Irvine32.inc
    ;-- Data segment to make variables
    .data
    myarray BYTE 10h, 12h, 13h, 15h
    WordArray WORD 1000h, 1800h, 1125h, 2565h
    msg1 BYTE "Before Swaping",0
    DoubleArray DWORD 12345678h, 87654321h
    ;-- code segment starts here
    .code
    main proc
    mov eax, DoubleArray
    ;mov ebx , DoubleArray+4
    XCHG eax,DoubleArray+4
    XCHG eax, DoubleArray
    mov ecx, DoubleArray
    mov edx, DoubleArray+4
    Call DumpRegs
    COMMENT !
    mov edx, offset msg1
    call writestring
    mov eax,0
    mov ebx,0
    mov ecx,0
    mov edx,0
    mov ax, WordArray+2
    mov bx, WordArray+4
    mov WordArray+2,bx
    mov WordArray+4, ax
    mov cx, WordArray+2
    mov dx, WordArray+4
    call dumpregs
    !
    COMMENT !
    ;mov ebx, 0
    ;mov bl, myarray ;10h
    ;add bl, myarray+1 ; 10+12h
    ;call dumpregs
    mov ah,myarray+3 ; 15h
    mov al, myarray+2 ; 13h
    mov bh, myarray+1 ; 12h
    mov bl, myarray+0 ; 10h
    mov myarray, ah
    mov myarray+1 , al
    mov myarray+2, bh
    mov myarray+3 , bl
    mov eax, 0
    mov ebx, 0
    mov ecx, 0
    mov edx, 0
    mov al,myarray
    mov bl,myarray+1
    mov cl,myarray+2
    mov dl, myarray+3
    call dumpregs
    !
    invoke ExitProcess,0
    main endp
    end main

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