gpt4 book ai didi

assembly - INT 10, 13h 如何与属性一起使用?

转载 作者:行者123 更新时间:2023-12-03 06:36:21 26 4
gpt4 key购买 nike

嘿,我试图理解 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.

最佳答案

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

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

例如,如果您想要蓝色 (0x01) 背景和红色 (0x04) 文本颜色,则需要将 0x14 放入 BL 寄存器中 -二进制文件为 00010100

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

颜色通常是:

 - 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

关于assembly - INT 10, 13h 如何与属性一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12556973/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com