INT 10,13h如何使用属性?

时间:2012-09-23 22:56:17

标签: assembly x86 bios interrupt

嘿我试着理解INT 10h,13h(19)写了一个字符串与BIOS中断10和13h啊。我已经找到了下面的信息,关于不同的标志放在不同的寄存器中。我仍然没有得到的一件事是BL应该是什么,如果我只是想用这个函数写一个字符串应该在BL中作为属性? 现在它写出了没有意义的奇怪的闪烁符号。先谢谢你

Writes a string of characters with specified attributes to any display
page.

   On entry:      AH         13h
                  AL         Subservice (0-3)
                  BH         Display page number
                  BL         Attribute (Subservices 0 and 1)
                  CX         Length of string
                  DH         Row position where string is to be written
                  DL         Column position where string is to be written
                  ES:BP      Pointer to string to write

   Returns:       None

   Notes:         This service is available only for XTs dated 1/19/86
                  and later, ATs, EGAs, and PC Convertibles.

                  The service has four subservices, as follows:

                  AL=00h: Assign all characters the attribute in BL;
                  do not update cursor
                  AL=01h: Assign all characters the attribute in BL;
                  update cursor
                  AL=02h: Use attributes in string; do not update
                  cursor
                  AL=03h: Use attributes in string; update cursor

                  In Subservices 0 and 1, all characters in the string
                  are written to the screen with the same attribute--
                  the attribute specified in BL.

                  In Subservices 2 and 3, the attribute byte for each
                  character is found in the string itself. The string
                  itself consists of a character followed by its
                  attribute, another character followed by its
                  attribute, and so on. The string is copied directly
                  to the video buffer as is.

                  In Subservices 0 and 2, the cursor position is not
                  updated after the string is written.

                  In Subservices 1 and 3, the cursor is moved to the
                  first position following the last character in the
                  string.

                  Like Service 0Eh, Service 13h responds appropriately
                  to ASCII 07h (bell), 08h (backspace), 10h (line
                  feed), and 0Dh (carriage return). All other
                  characters are printed.

1 个答案:

答案 0 :(得分:5)

使用int 10hBL寄存器用于颜色属性。

除非您正在处理CGA,其中BL值是调色板编号,BL值是表示前景色(4位 - 低部分)和背景色的数字( 4位 - 高位部分。

例如,如果你想要一个带有红色(0x04)文本颜色的蓝色(0x01)背景,你需要将0x14放入BL寄存器 - 二进制文件{{1 }}

00010100

颜色通常是:

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