assume cs:codesg
data segment
db 'Welcome to masm!',0
data ends
stack segment
dw 8 dup(0)
stack ends
codesg segment
start:
mov ax,stack
mov ss,ax
mov ax,data
mov ds,ax
mov sp,10H
mov dh,8
mov dl,3
mov cl,2
call show_str
mov ah,4ch
int 21h
show_str:
push bx
push ax
push es
push si
push di
push cx
show_str_show:
mov ax,0b800h
mov es,ax
mov si,0
mov bx,cx ;暂存颜色
mov ch,0
mov cl,dh
show_str_s1:
add si,0A0H
loop show_str_s1
mov cl,dl
show_str_s2:
add si,02H
loop show_str_s2
mov di,0
show_str_s3:
mov ch,0
mov cl,[di]
jcxz show_str_ok
mov es:[si],cl
mov es:[si+1],bl
inc di
add si,2
loop show_str_s3
show_str_ok:
pop cx
pop di
pop si
pop es
pop ax
pop bx
ret
codesg ends
end start