0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

8086実機で動作するBIOS割り込みを用いた入力・出力処理

Last updated at Posted at 2025-05-11

やりたいこと

BIOS割り込みの検証を行う。
int 0x16でキーボード入力を受け取り、int 0x10を使用して画面に文字を出力する。

プログラム

[BITS 16]
[ORG 0x7C00]

start:
    ; キーボードから入力される迄待機
    mov ah, 0x00      ; 
    int 0x16          ; ALに入力されたボタンのASCIIが入る

    ; 画面出力
    mov ah, 0x0E      ; 
    mov bh, 0x00      ; 
    int 0x10          ; AL中の文字を出力する

    ; CPU停止
    cli
    hlt

times 510-($-$$) db 0
dw 0xAA55

BIOS割り込みの説明

int 0x10

AH=0x0EAL=文字コード設定後、INT 0x10を実行するとALに入っている文字コードに対応した文字が画面上に表示されます。

int 0x16

AH=0x00設定後、int 0x16を実行するとキーが入力されるまで制御が戻ってこない(その先のプログラムを実行せず待機)。入力後ALに入力された文字の文字コードが格納される。

結果

入力した文字「u」が画面に表示されました。
int 0x10をコメントアウトすると何も表示されなくなったことから、画面出力はint 0x10によって行われていることが確認できました。
image.png

8086実機にて動作させる方法

以下の方法を用いて8086実機上から実行させています。
https://qiita.com/earthen94/items/10c012ae14545e9f4284

参考文献

林 高勲 (2019) 『x86系コンピューターを動かす理論と実装 作って理解するOS』技術評論社

追記

普段使いしているMSIのノートパソコンの起動設定をUEFIからBIOSにしたところ、こちらでも起動できました。
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?