int 10 在汇编中做什么?

Woj*_*cel 0 assembly dos interrupt masm x86-16

我正在尝试为学校学习汇编,示例代码的开头有这部分:

mov al, 0
mov ah, 5
int 10
Run Code Online (Sandbox Code Playgroud)

在此之前有一个程序:

.386
instructions SEGMENT use16
        ASSUME  CS:instructions

interrupt_handler PROC
; some code
interrupt_handler ENDP
Run Code Online (Sandbox Code Playgroud)

什么是int 10线在做什么?它是调用interrupt_handler程序吗?为什么正好是10?

这一切都在 DoSBox 中运行,并使用 masm 组装。

Mic*_*tch 6

我发现似乎是 OP 母语(波兰语)中代码的完整副本。https://ideone.com/fork/YQG7y。有这一段代码(通过谷歌翻译运行):

; ================================================= =======

; 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
Run Code Online (Sandbox Code Playgroud)

从这段代码可以清楚地看出这是一个错误。它应该是int 10h而不是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
Run Code Online (Sandbox Code Playgroud)

int 10 是完全不同的东西:

IRQ2 - LPT2 (PC), VERTICAL RETRACE INTERRUPT (EGA,VGA)
Run Code Online (Sandbox Code Playgroud)

int 10从程序的角度来看,调用 IRQ2 中断处理程序实际上什么也不做。由于默认文本页面可能已经为 0,因此程序按预期工作。


正确的代码:

mov al, 0
mov ah, 5
int 10h
Run Code Online (Sandbox Code Playgroud)

将使用 BIOS 服务 10h 功能 5 将文本模式显示页面设置为 0。