assume cs:codesg,ds:datasg
datasg segment
db 'welcome to masm!'
db 2h, 24h, 71h, 3 ;定义三种颜色 最后一个是颜色数量
datasg ends
codesg segment
start:
mov ax, datasg
mov ds, ax
mov ax, 0B800h
mov es, ax
mov si, 780h ;每行160个字节 25行 13行是中间 160*12=780h
add si, 40h ;(160-16*2)/2=40h
mov bx, 0
mov bp, 0
mov cx, 16
s:
mov al, ds:[bx]
mov es:[bp + si], al ;传入字符
mov dx, bx
mov ax, bx
div byte ptr ds:[13h] ;使颜色首尾循环
mov bl, ah
sub bh, bh
mov al, ds:[bx + 10h]
mov es:[bp + si + 1], al ;传入颜色
mov bx, dx
inc bx
add bp, 2
loop s
mov ah, 01h ;网上找的暂停用
int 21h
mov ah, 4ch
int 21h
codesg ends
end start |