ASM改变CMD的背景颜色 [英] asm change cmd background color

查看:103
本文介绍了ASM改变CMD的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的,改变文字颜色的部分,但我不能找到一种方法来改变背景颜色,这code是TASM汇编:

 模型小
堆叠256
。数据
耳鼻喉科分贝0AH,0DH,$
阵列分贝2,4,5,6
       DB 7,8,9,5
       DB 1,2,3,4
       DB 5,6,7,8
临时DW 0
。code
主营:
    MOV AX,@数据
    MOV DS,AX    MOV啊,06H
    MOV人,0
    MOV CX,0
    MOV DH,79
    MOV DL,79
    MOV BH,4H    INT 10H

这是一个我的code,但它不工作:

  MOV啊,0BH
    MOV BH,01H
    MOV BL,2H    INT 10H    MOV啊,02H
    MOV DL,34H    INT 21H
 MOV AX,4c00h;从程序退出
 INT 21H最终主


解决方案

在BIOS功能6,BH包含一个8位色彩。其低4位指定前景颜色,而高4位指定背景颜色。试一下,比如, MOV BH的,14H 而不是 MOV BH,4H 。它应该开始写的蓝色,而不是红色的红黑色。

I wrote the part that changes the text color, but I can't find a way to change the background color, this code is for tasm assembly:

model small
stack 256
.data
ent db 0ah,0dh,'$'
array  db 2,4,5,6
       db 7,8,9,5
       db 1,2,3,4
       db 5,6,7,8
temp dw 0
.code
main :
    mov  ax,@data
    mov  ds,ax

    mov ah, 06h
    mov al, 0
    mov cx, 0
    mov dh, 79
    mov dl, 79
    mov bh, 4h

    int 10h

This is a my code but it doesn't work:

  mov ah, 0bh
    mov bh, 01h
    mov bl, 2h

    int 10h

    mov ah, 02h
    mov dl, 34h

    int 21h


 mov ax,4c00h ; exit from program
 int 21h

end main

解决方案

In BIOS function 6, BH contains an 8-bit color. Its lower 4 bits specify the foreground color while the upper 4 bits specify the background color. Try, for example, mov bh, 14h instead of mov bh, 4h. It should start writing red on blue instead of red on black.

这篇关于ASM改变CMD的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆