编程:在屏幕中间分别显示绿色、绿底红色、白底蓝色的字符串'welcome to masm!'

assume cs:codesg , ds:datasg , ss:stacksg
datasg segment
        db 'welcome to masm!'
        db 2h , 24h , 71h 
datasg ends

stacksg segment stack
        dw 0h,0h,0h,0h,0h,0h,0h,0h          
stacksg ends

codesg segment
start:  mov ax , datasg
        mov ds , ax

        mov ax , stacksg
        mov ss , ax
        mov sp , 16 

        mov ax , 0B872h   
                                      
        mov cx , 3              
        mov bx , 0             
s:      mov es , ax                  
        push ax                       
        push cx                       
        mov si , 0                   
        mov di , 0                  
        mov cx , 16               
s0:   mov al , [si]                                  
        mov es:[di] , al  
        inc si       
        add di , 2      
        loop s0

        mov al , [bx+si]   
        mov cx , 16
        mov di , 1       
s1:   mov es:[di] , al
        add di , 2
        loop s1            
        pop cx              
        pop ax                
        add ax , 000ah   
        inc bx                  
        loop s  

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

参考链接: https://www.cnblogs.com/meihao1203/p/7292116.html

猜你喜欢

转载自www.cnblogs.com/gkp307/p/9921256.html