如何改变或设置8086程序集的背景颜色?
How to change or set background color in 8086 assembly?
我正在学习8086汇编。我需要使用 8086 组件更改屏幕的背景颜色。我看到一些教程,他们只能设置屏幕的一部分。我不想通过 DOS 中断来执行此操作,而所有教程都在 DOS 中断中。如果有人告诉我使用 BIOS 中断设置屏幕的整个部分(背景颜色)的代码,那就太好了。
您可以使用 BIOS 功能 06h 更改所有屏幕的背景和前景色
MOV AH, 06h ; Scroll up function
XOR AL, AL ; Clear entire screen
XOR CX, CX ; Upper left corner CH=row, CL=column
MOV DX, 184FH ; lower right corner DH=row, DL=column
MOV BH, 1Eh ; YellowOnBlue
INT 10H
数字适合80x25的文字视频模式。
有关 IBM PC 的 BIOS 和 DOS 中断的最佳信息来源之一是 Ralf Brown's Interrupt List. INT 10h is the general BIOS interrupt for video routines. A complete list of the INT 10h routines can be found here. I have used the BIOS routine INT 10h/AH=06,记录为:
VIDEO - SCROLL UP WINDOW
AH = 06h
AL = number of lines by which to scroll up (00h = clear entire window)
BH = attribute used to write blank lines at bottom of window
CH,CL = row,column of window's upper left corner
DH,DL = row,column of window's lower right corner
Return:
Nothing
这是蓝屏:
mov ah, 09h
mov cx, 1000h
mov al, 20h
mov bl, 17 ; This is Blue & White.
可以把17换成其他色号;
- 0 = 黑色
- 1 = 蓝色
- 2 = 绿色
- 3 = 水色
- 4 = 红色
- 5 = 紫色
- 6 = 黄色
- 7 = 白色
- 8 = 灰色,
- 9 = 淡蓝色。
示例:
mov bl, 47
这是红色和白色。
我正在学习8086汇编。我需要使用 8086 组件更改屏幕的背景颜色。我看到一些教程,他们只能设置屏幕的一部分。我不想通过 DOS 中断来执行此操作,而所有教程都在 DOS 中断中。如果有人告诉我使用 BIOS 中断设置屏幕的整个部分(背景颜色)的代码,那就太好了。
您可以使用 BIOS 功能 06h 更改所有屏幕的背景和前景色
MOV AH, 06h ; Scroll up function
XOR AL, AL ; Clear entire screen
XOR CX, CX ; Upper left corner CH=row, CL=column
MOV DX, 184FH ; lower right corner DH=row, DL=column
MOV BH, 1Eh ; YellowOnBlue
INT 10H
数字适合80x25的文字视频模式。
有关 IBM PC 的 BIOS 和 DOS 中断的最佳信息来源之一是 Ralf Brown's Interrupt List. INT 10h is the general BIOS interrupt for video routines. A complete list of the INT 10h routines can be found here. I have used the BIOS routine INT 10h/AH=06,记录为:
VIDEO - SCROLL UP WINDOW
AH = 06h AL = number of lines by which to scroll up (00h = clear entire window) BH = attribute used to write blank lines at bottom of window CH,CL = row,column of window's upper left corner DH,DL = row,column of window's lower right corner Return: Nothing
这是蓝屏:
mov ah, 09h
mov cx, 1000h
mov al, 20h
mov bl, 17 ; This is Blue & White.
可以把17换成其他色号;
- 0 = 黑色
- 1 = 蓝色
- 2 = 绿色
- 3 = 水色
- 4 = 红色
- 5 = 紫色
- 6 = 黄色
- 7 = 白色
- 8 = 灰色,
- 9 = 淡蓝色。
示例:
mov bl, 47
这是红色和白色。