int 10 在汇编中做什么?
What is int 10 doing in assembly?
我正在尝试为学校学习汇编,示例代码的开头有这部分:
mov al, 0
mov ah, 5
int 10
在此之前有一个过程:
.386
instructions SEGMENT use16
ASSUME CS:instructions
interrupt_handler PROC
; some code
interrupt_handler ENDP
int 10
行在做什么?它是在调用 interrupt_handler
过程吗?为什么正好是 10?
这是DoSBox中的全部运行,使用masm组装而成
简单的答案是int 10h
(我认为您的代码有错字)通常在提供视频服务的向量处调用实模式中断处理程序。 int 10h
services 包括设置视频模式、字符和字符串输出以及图形基元(在图形模式下读取和写入像素)。
我发现似乎是 OP 母语(波兰语)代码的完整副本。 https://ideone.com/fork/YQG7y。有这段代码(运行 through Google 翻译):
; ================================================= =======
; main program - installation and uninstallation of the procedure
; interrupt handling
; determining page number 0 for text mode
start:
mov al, 0
mov ah, 5
int 10
从这段代码可以看出是bug。它应该是 int 10h
and not int 10
(与 int 0ah
相同)。 int 10h
记录为:
VIDEO - SELECT ACTIVE DISPLAY PAGE
AH = 05h
AL = new page number (00h to number of pages - 1) (see #00010)
Return:
Nothing
Desc: Specify which of possibly multiple display pages will be visible
int 10
完全不同:
IRQ2 - LPT2 (PC), VERTICAL RETRACE INTERRUPT (EGA,VGA)
使用 int 10
调用 IRQ2 中断处理程序从程序的角度来看实际上什么都不做。由于默认文本页面可能已经为 0,因此程序按预期工作。
正确代码:
mov al, 0
mov ah, 5
int 10h
将使用 BIOS 服务 10h 函数 5 将文本模式显示页面设置为 0。
我正在尝试为学校学习汇编,示例代码的开头有这部分:
mov al, 0
mov ah, 5
int 10
在此之前有一个过程:
.386
instructions SEGMENT use16
ASSUME CS:instructions
interrupt_handler PROC
; some code
interrupt_handler ENDP
int 10
行在做什么?它是在调用 interrupt_handler
过程吗?为什么正好是 10?
这是DoSBox中的全部运行,使用masm组装而成
简单的答案是int 10h
(我认为您的代码有错字)通常在提供视频服务的向量处调用实模式中断处理程序。 int 10h
services 包括设置视频模式、字符和字符串输出以及图形基元(在图形模式下读取和写入像素)。
我发现似乎是 OP 母语(波兰语)代码的完整副本。 https://ideone.com/fork/YQG7y。有这段代码(运行 through Google 翻译):
; ================================================= =======
; main program - installation and uninstallation of the procedure
; interrupt handling
; determining page number 0 for text mode
start:
mov al, 0
mov ah, 5
int 10
从这段代码可以看出是bug。它应该是 int 10h
and not int 10
(与 int 0ah
相同)。 int 10h
记录为:
VIDEO - SELECT ACTIVE DISPLAY PAGE AH = 05h AL = new page number (00h to number of pages - 1) (see #00010) Return: Nothing Desc: Specify which of possibly multiple display pages will be visible
int 10
完全不同:
IRQ2 - LPT2 (PC), VERTICAL RETRACE INTERRUPT (EGA,VGA)
使用 int 10
调用 IRQ2 中断处理程序从程序的角度来看实际上什么都不做。由于默认文本页面可能已经为 0,因此程序按预期工作。
正确代码:
mov al, 0
mov ah, 5
int 10h
将使用 BIOS 服务 10h 函数 5 将文本模式显示页面设置为 0。