如何在启动加载程序上检测文本模式或图形模式?

时间:2011-11-21 16:29:30

标签: interrupt bootloader bios

我想在运行我写的bootloader时检测我刚刚使用BIOS intXX使用的模式。 现在如何检测文本模式或图形模式? 我应该使用哪种中断功能? 谢谢〜


我没弄清楚为什么当我运行int 10时,AL的值不会改变。

   (0) Breakpoint 1, 0x00007c00 in ?? ()
  Next at t=12943079
   (0) [0x00007c00] 0000:7c00 (unk. ctxt): mov ah, 0x0f              ; b40f
  <bochs:3> reg
  eax: 0x0000aa55 43605
  ecx: 0x00090000 589824
  edx: 0x00000000 0
  ebx: 0x00000000 0
  esp: 0x0000ffd6 65494
  ebp: 0x00000000 0
  esi: 0x000e476c 935788
  edi: 0x0000ffac 65452
  eip: 0x00007c00
  eflags 0x00000082: id vip vif ac vm rf nt IOPL=0 of df if tf SF zf af pf cf
  <bochs:4> n
  Next at t=12943080
   (0) [0x00007c02] 0000:7c02 (unk. ctxt): mov al, 0xaa              ; b0aa
  <bochs:5> reg
  eax: 0x00000f55 3925
  ecx: 0x00090000 589824
  edx: 0x00000000 0
  ebx: 0x00000000 0
  esp: 0x0000ffd6 65494
  ebp: 0x00000000 0
  esi: 0x000e476c 935788
  edi: 0x0000ffac 65452
  eip: 0x00007c02
  eflags 0x00000082: id vip vif ac vm rf nt IOPL=0 of df if tf SF zf af pf cf
  <bochs:6> n
  Next at t=12943081
   (0) [0x00007c04] 0000:7c04 (unk. ctxt): int 0x0a                  ; cd0a
  <bochs:7> reg
  eax: 0x00000faa 4010
  ecx: 0x00090000 589824
  edx: 0x00000000 0
  ebx: 0x00000000 0
  esp: 0x0000ffd6 65494
  ebp: 0x00000000 0
  esi: 0x000e476c 935788
  edi: 0x0000ffac 65452
  eip: 0x00007c04
  eflags 0x00000082: id vip vif ac vm rf nt IOPL=0 of df if tf SF zf af pf cf
  <bochs:8> n
  Next at t=12943083
   (0) [0x00007c06] 0000:7c06 (unk. ctxt): mov dl, al                ; 88c2
  <bochs:9> reg
  eax: 0x00000faa 4010
  ecx: 0x00090000 589824
  edx: 0x00000000 0
  ebx: 0x00000000 0
  esp: 0x0000ffd6 65494
  ebp: 0x00000000 0
  esi: 0x000e476c 935788
  edi: 0x0000ffac 65452
  eip: 0x00007c06
  eflags 0x00000082: id vip vif ac vm rf nt IOPL=0 of df if tf SF zf af pf cf
  <bochs:10>

1 个答案:

答案 0 :(得分:1)

INT10, F 
AH = 0F
on return:
AL = mode currently set(page mode)
BH = current display page
Page mode:
        AL = 00  40x25 B/W text (CGA,EGA,MCGA,VGA)
       = 01  40x25 16 color text (CGA,EGA,MCGA,VGA)
       = 02  80x25 16 shades of gray text (CGA,EGA,MCGA,VGA)
       = 03  80x25 16 color text (CGA,EGA,MCGA,VGA)
       = 04  320x200 4 color graphics (CGA,EGA,MCGA,VGA)
       = 05  320x200 4 color graphics (CGA,EGA,MCGA,VGA)
       = 06  640x200 B/W graphics (CGA,EGA,MCGA,VGA)
       = 07  80x25 Monochrome text (MDA,HERC,EGA,VGA)
       = 08  160x200 16 color graphics (PCjr)
       = 09  320x200 16 color graphics (PCjr)
       = 0A  640x200 4 color graphics (PCjr)
       = 0B  Reserved (EGA BIOS function 11)
       = 0C  Reserved (EGA BIOS function 11)
       = 0D  320x200 16 color graphics (EGA,VGA)
       = 0E  640x200 16 color graphics (EGA,VGA)
       = 0F  640x350 Monochrome graphics (EGA,VGA)
       = 10  640x350 16 color graphics (EGA or VGA with 128K)
         640x350 4 color graphics (64K EGA)
       = 11  640x480 B/W graphics (MCGA,VGA)
       = 12  640x480 16 color graphics (VGA)
       = 13  320x200 256 color graphics (MCGA,VGA)
       = 8x  EGA, MCGA or VGA ignore bit 7, see below
       = 9x  EGA, MCGA or VGA ignore bit 7, see below