思路:把上面材料读懂,主要思想就是,把待显示的数据写入显存对应区域就行了。
assume ds:data, cs:code, ss:stack
data segment
db 'welcome to masm!'
db 2H,24H,71H ;字符串属性值
data ends
stack segment
dw 8 dup(0)
stack ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,10h
mov ax,data
mov ds,ax ;字符串的段地址送入ds
mov ax,0B800H
mov es,ax ;80×25彩色字符模式显示缓冲区段地址送入es
mov di,10h ;字符串和颜色都是用这个偏移
mov bx,0
mov cx,3
s0: push cx ; cx暂存
mov ah,ds:[di]
push di
mov di,0
mov si,0
mov cx,16
s: mov al,ds:[di]
mov es:[bx+si],al
mov es:[bx+si+1],ah
add si,2
inc di
loop s
pop di
inc di
pop cx
add bx,0a0h ;换行,每行80字符,160个字节
loop s0
all:
jmp short all ;一直循环,为了看效果
mov ax,4c00h
int 21h
code ends
end start