;在屏幕中间分别显示绿色、绿底红色、白底蓝色的字符串'welcome to masm!'
assume cs:codesg,ds:datasg
datasg segment
db 'welcome to masm!'
datasg ends
codesg segment
start:
mov ax,datasg
mov ds,ax
mov ax,0b800h ;0b800h是第0页
mov es,ax
mov ah,01110001b ;00000010b绿色,00100100b绿底红色,01110001b白底蓝色
mov bx,0
mov si,780h ;780h是第13行
mov cx,16 ;共16个字符,所以循环16次
s:
mov al,ds:[bx] ;把字符的ascii值写入al中
mov es:[si+40h],ax ;40h是第32列
add si,2
inc bx
loop s
mov ax,4c00h
int 21h
codesg ends
end start |