汇编语言(王爽第三版)实验9根据材料编程

时间:2022-05-20 01:18:51
assume es:data,ss:stack,cs:data
data segment
    db 'welcome to masm!'
    db 02h,24h,71h
data ends

stack segment
    db 10 dup(0)  
stack ends

code segment
start:  ;初始化data数据段  
        mov ax,data
        mov es,ax
        mov di,0
        mov si,16
        ;初始化显示缓存区
        mov ax,0b800h
        mov ds,ax
        mov bx,1980
        ;建栈
        mov ax,stack
        mov ss,ax
        mov sp,0
        
        mov cx,3  
        ;循环
      s:push cx
        mov cx,16
        
 output:mov al,es:[di]  
        mov [bx],al
        mov ah,es:[si]
        mov [bx+1],ah 
        inc di
        add bx,2
        loop output
        
        inc si
        mov di,0  
        add bx,128  
        pop cx
        loop s
        
        mov ax,4c00h
        int 21h
code ends
end