代码就是下面的代码: 然后就是要让 'welcome to masm‘显示颜色。三行有不同的颜色。
assume cs:code,ds:data,ss:stack
data segment
db 'welcome to masm!'
db 02h,24h,71h
data ends
stack segment
dw 8 dup(0)
stack ends
code segment
start:
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,16
xor bx,bx
mov ax,0b872h
mov cx,3
s3:
push cx
push ax
push bx
mov di,0
mov si,0
mov es,ax
mov cx,16
s2:
mov al,ds:[di]
mov es:[si],al
inc di
add si,2
loop s2
pop bx
mov al,ds:10h[bx]
mov si,1
mov al,ds:[di]
mov cx,16
s1: mov es:[si],al
add si,2
loop s1
pop ax
add ax,0ah
inc bx
pop cx
loop s3
mov ax,4c00h
int 21h
code ends
end start
------解决方案--------------------------------------------------------
在DOS命令提示符下按Alt+Enter把界面切换到全屏运行上述程序就可以看到字符和颜色。