首页 > 代码库 > 汇编实验9

汇编实验9

1、输出三种不同颜色的字符串

  

assume cs:code,ds:string,es:color,ss:stack
string segment
    db welcome to masm!
string ends

color segment
    db 2,36,113
color ends

stack segment
    db 16 dup (0)
stack ends

code segment
start:
    mov ax,string
    mov ds,ax
    mov bx,0         
    mov si,16        

    mov ax,stack
    mov ss,ax
    mov sp,16        

    mov ax,0b800h
    mov es,ax
    mov bp,0720h     
    mov cx,3

s1:
    mov di,0         
    push cx          
    mov cx,16
s2:
    mov al,[bx]
    mov es:[bp+di],al
    mov al,[si]
    mov es:[bp+di+1],al
    add di,2         
    inc bx           
    loop s2

    mov bx,0         
    inc si          
    add bp,160      

    pop cx          
    loop s1

    mov ax,4c00h
    int 21h

code ends
end start

 

 

  技术分享

 

汇编实验9