以下代码实现按一下键改变一次背景颜色,设置为10次,这个可以自己修改 
 
assume cs:code,ds:data
color record blink:1,back:3,intense:1,fore:3
data segment
char db 'A'
attr color <0,0,1,7>
data ends
code segment
start:mov ax,data
            mov ds,ax
            mov bp,10
next:mov ah,9
            mov bh,0
            mov al,char
            mov bl,attr
            mov cx,1
            int 10h
            mov al,attr
            mov ah,al
            and al,not mask back
            mov cl,width back
            shr ah,cl
            inc ah
            shl ah,cl
            and ah,mask back
            or ah,al
            mov attr,ah
            mov ah,0
            int 16h
            dec bp
            jnz next
            mov ax,4c00h
            int 21h
code ends
end start