assume cs:codesg,ds:datasg,ss:stacksg
datasg segment
db 'welcome to masm!'
;准备打印五行,每行不同的属性
db 00000010b ;F:green
db 00100100b ;B:green F:red
db 01110001b ;B:white F:blue
db 11000010b ;B:red F:green flash
db 01001010b ;B:red F:green gaoliang
datasg ends
stacksg segment
dw 8 dup(0)
stacksg ends
codesg segment
start:mov ax,datasg
mov ds,ax
mov ax,stacksg
mov ss,ax
mov sp,10h
mov ax,0B8A0h ;第十行开始打印
mov es,ax
mov bx,40h ;每行的中间列
mov bp,0
mov cx,5
s1:push cx
mov cx,10h
mov si,0
mov di,0
s2:mov al,[si]
mov es:[bx+di],al
mov al,ds:[10h+bp]
mov es:[bx+di+1],al
inc si
add di,2
loop s2
add bx,0A0h ;下一行
inc bp
pop cx
loop s1
mov ax,4c00h
int 21h
codesg ends
end start |