向屏幕中间显示不同颜色字符串(汇编

时间:2021-12-06 22:12:49
assume cs:code
date segment
 db 'welcome to masm!'
date ends
code segment
  
 start :mov ax,date
        mov ds,ax
       
        mov ax,11
        mov es,ax
        mov ah,01000010b
        mov bx,40h
       mov si,0
        mov cx,16
       s:mov al,ds:[si]
         mov es:[bx+si],al
         mov es:[bx+si+1],ah
         inc si
         inc bx
        loop s
      mov bx,40h
       add bx,00a0h
       mov si,0
       mov cx,16
       mov ah,00000111b 
             s0:mov al,[si]
         mov es:[bx+si],al
         mov es:[bx+si+1],ah
         inc si
         inc bx
        loop s0
   
code ends
 end start
         

上面是我的

assume cs:code 

data segment  

db 'welcome to masm!'  

data ends 

code segment 

start: mov ax,data 

mov ds,ax 

mov ax,0b800h 

mov es,ax  

mov si,0  

mov di,10*160+80 

mov cx,16  

s1: mov al,ds:[si] 

mov ah,00000010B 

mov es:[di],ax 

inc si 

inc di 

inc di 

loop s1  

mov si,0  

mov di,11*160+80 

mov cx,16  

s2: mov al,ds:[si]  

mov ah,00100100B 

mov es:[di],ax 

inc si 

inc di 

inc di 

loop s2  

mov si,0  

mov di,12*160+80 

mov cx,16  

s3: mov al,ds:[si]  

mov ah,01110001B 


mov es:[di],ax 

inc si 

inc di 

inc di 

loop s3  

mov ax,4c00h  

int 21h 


code ends 

end start  

 答案的