How does INT 10, 13h work with attributes?

狂风中的少年 提交于 2019-12-01 06:41:48

With int 10h, the BL register is used for the colour attributes.

Unless you're dealing with CGA, where the BL value is the palette number, the BL value is a number representing the foreground color (4 bits - low part) and the background color (4 bits - high part).

For instance, if you want a blue (0x01) background with red (0x04) text colour, you'll need to put 0x14 into the BL register - in binary that is 00010100.

      0001             0100
|_ Background _| |_ Foreground _|

Colours are usually:

 - Black            0x00
 - Blue             0x01
 - Green            0x02
 - Cyan             0x03
 - Red              0x04
 - Magenta          0x05
 - Brown            0x06
 - LightGray        0x07
 - DarkGray         0x08
 - LightBlue        0x09
 - LightGreen       0x0A
 - LightCyan        0x0B
 - LightRed         0x0C
 - LightMagenta     0x0D
 - LightBrown       0x0E
 - White            0x0F
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!