汇编语言(王爽 第三版)实验九

时间:2022-05-23 00:11:17
assume cs:code,ds:data,ss:stack

data segment
        db 'welcome to masm!'
        db 00000010b,00100100b,01110001b
        dw 1664,1824,1984
data ends

stack segment
        dw 8 dup (0)
stack ends

code segment
start:  mov ax,data
        mov ds,ax
        mov ax,stack
        mov ss,ax
        mov sp,10h
        mov ax,0b800h
        mov es,ax

        mov cx,3
        mov bx,0
        mov bp,0
        mov si,0
        mov di,0
    s1: push cx
        push si
        push di
        mov bp,ds:[19+di]     
        mov bl,ds:[16+si]
        mov bh,0
    
        mov cx,16
        mov si,0
        mov di,0

    s2: mov al,ds:[si]
        mov es:[bp+di],al
        mov es:[bp+di+1],bl
        inc si
        add di,2
        loop s2

        pop di
        pop si
        pop cx
        inc si
        add di,2
        loop s1

        mov ax,4c00h
        int 21h
code ends
end start