为什么 int 10h / AH = 0Eh BIOS 电传打字机输出中不使用 BH?

问题描述 投票:0回答:1

中断 int 10h 0Eh 在屏幕上显示一个字符,它有几个参数,其中包括 BH,本来应该表示页码,但是经过多次测试我发现 BH 完全没有用,即使我更改页码无论如何,字符都会显示在活动页面上。

拉尔夫·布朗的中断列表说

“1981/4/24 和 1981/10/19 的 IBM PC ROM 要求 BH 与当前活动页面相同”

互联网上的一个页面这样写:https://www.ic.unicamp.br/~celio/mc404-2004/service_interrupts#int10h_0Eh

此功能在屏幕上显示一个字符,根据需要前进光标并滚动屏幕。打印始终在当前活动页面完成。

我必须相信哪个来源,我使用没有操作系统的虚拟盒子,并且我使用引导加载程序

我指定我不理解此信息““日期为 1981/4/24 和 1981/10/19 的 IBM PC ROM 要求 BH 与当前活动页面相同””知道我使用虚拟框,但我不明白不认为 virtualbox 使用 1981 年 IMG PC 的 ROM 吗?

assembly interrupt x86-16 bios
1个回答
4
投票

服务

ah = 0x0e
int 0x10
仅在活动页面上打印。您可以使用服务
ah = 0x05
al = page number
int 0x10
更改活动页面。

BH
不应该是此 BIOS 功能的输入。 Ralf Brown 的中断列表仅将其显示为记录其提到的两个早期 IBM-PC BIOS 版本(1981/4/24 和 1981/10/19)中的 bug 的一部分,其中 BH 需要保存活动页码。否则根本就不是输入。


我查看了BIOS 1981-04-24、1981-10-19和1982-10-27的代码以及前两个BIOS中的服务

ah = 0x0e
(write_tty) 像这样开始:

WRITE_TTY   PROC    NEAR
    PUSH    AX      ; SAVE REGISTERS
    PUSH    AX      ; SAVE CHAR TO WRITE
    MOV AH,3
    INT 10H         ; READ THE CURRENT CURSOR POSITION
    POP AX          ; RECOVER CHAR

    . . .

;------ WRITE THE CHAR TO THE SCREEN

    MOV BH,ACTIVE_PAGE  ; GET THE CURRENT ACTIVE PAGE
    MOV AH,10       ; WRITE CHAR ONLY
    MOV CX,1        ; ONLY ONE CHAR
    INT 10H

开头有服务

ah = 0x03
(read_cursor)需要
bh = page number
来计算 活动页面上光标位置的偏移量,该值在
dx
中返回并存储在此处:

    CURSOR_POSN DW  8 DUP(?)    ; CURSOR FOR EACH OF UP TO 8 PAGES

稍后我们有指示

mov bh,active_page
。例如我们要写入第0页,我们计算第0页上的光标位置 但 active_page = 1 所以我们不匹配。所以也许这就是 RBIL 页面谈论它的原因,bh 应该与 active_page 相同。

    IBM PC ROMs dated 1981/4/24 and 1981/10/19 require that BH be the same as the current active page

在上一个 BIOS 1982-10-27 中,行

MOV BH,ACTIVE_PAGE
更改了位置

WRITE_TTY   PROC    NEAR
    PUSH    AX          ; SAVE REGISTERS
    PUSH    AX          ; SAVE CHAR TO WRITE
    MOV AH,3
    MOV BH,ACTIVE_PAGE      ; GET THE CURRENT ACTIVE PAGE
    INT 10H         ; READ THE CURRENT CURSOR POSITION
    POP AX          ; RECOVER CHAR

BH
与 active_page 相同。因此程序计算正确页面的位置。


这是在 BIOS MBR 引导加载程序中使用它的示例。这在 QEMU 中效果很好。

[org 0x7c00]

section .text
    global main

main:   
    mov ax,0
    mov dx,ax
    mov ss,ax
    mov sp,0x7c00

    mov ax,0x0003
    int 0x10

    mov ah, 0x0e  
    mov si, msg1    
    
Msg_1:
    lodsb                
    or al,al
    jz WaitKeyPress1
    int 0x10        
    jmp Msg_1

WaitKeyPress1:
    mov ah,0x00
    int 0x16
    
    mov ah,0x05
    mov al,0x01
    int 0x10
    
    mov ah,0x0e
    mov si,msg2
    
Msg_2:
    lodsb                
    or al,al
    jz WaitKeyPress2
    int 0x10        
    jmp Msg_2   

WaitKeyPress2:
    mov ah,0x00
    int 0x16
    
    mov ah,0x05
    mov al,0x00
    int 0x10


msg1 db "This message is printed on page 0."
        db 13,10,"Press any key to change page to 1...",0
    msg2 db "And this message is printed on page 1."
        db 13,10,"Press any key to go back to page 0.",0

;Done:  
;   mov ax,4c00h
;   int 21h
    
    times 510 - ($ - $$) db 0
    dw 0xaa55

这可以在命令行中工作,作为 DOS .com

[org 100h]
    
section .data
    msg1 db "This message is printed on page 0."
        db 13,10,"Press any key to change page to 1...",0
    msg2 db "And this message is printed on page 1."
        db 13,10,"Press any key to go back to page 0.",0
        

section .text
    global main

main:   
    mov ax,0x0003
    int 0x10

    mov ah, 0x0e  
    mov si, msg1    
    
Msg_1:
    lodsb                
    or al,al
    jz WaitKeyPress1
    int 0x10        
    jmp Msg_1

WaitKeyPress1:
    mov ah,0x08
    int 0x21
    
    mov ah,0x05
    mov al,0x01
    int 0x10
    
    mov ah,0x0e
    mov si,msg2
    
Msg_2:
    lodsb                
    or al,al
    jz WaitKeyPress2
    int 0x10        
    jmp Msg_2   

WaitKeyPress2:
    mov ah,0x08
    int 0x21
    
    mov ah,0x05
    mov al,0x00
    int 0x10

Done:   
    mov ax,4c00h
    int 21h
© www.soinside.com 2019 - 2024. All rights reserved.