2

How can I enter graphics mode (mode 13h) without using BIOS interrupts? I'm targeting 32-bit protected mode where BIOS interrupts aren't available. I found a tutorial on web, but it only gives me hints such as VGA registers.

I want to know how VGA registers are accessed? I'm using x86 assembly in NASM. I know how to enter graphics mode using INT 13h/INT 10h BIOS interrupts.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • It is quite simple, get the documents for your pcie controller and your video card and program them accordingly. – old_timer Feb 22 '14 at 14:10
  • I fail to see the benefit of not using `int 10h`. – Michael Feb 22 '14 at 17:38
  • int 13h is a VBE interrupt and VBE interrupts are disabled in protected mode. maybe windows replaces that BIOS interrupt with a system interrupt which does what you want - but the method it is not portable and it defenitely doesn't work when you are writing an operating system – Algoman Jun 06 '16 at 09:33

2 Answers2

1

This would be very hardware dependent. Realistic if you limit yourself to VGA-compatible adapters, but not if you want to support the whole gamut of video hardware out there. But then again, if you were, you probably won't be writing for DOS in the first place.

For VGA, read up here. The registers are accessed via assembler's IN/OUT commands, read up on them.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
  • I want only enter to 13h graphics mode without bios interrupts – Syed Mukarram Ali Kazmi Feb 22 '14 at 16:01
  • 1
    Without the interrupt, it's not "only". It's quite complicated. The interrupt abstracts away a lot. – Seva Alekseyev Feb 22 '14 at 16:11
  • Very old example from Anthony Williams (author of Alink) here: http://ftp.lanet.lv/ftp/mirror/x2ftp/msdos/programming/hardware/modes.asm - Tasm syntax, sorry... – Frank Kotler Feb 22 '14 at 17:59
  • 1
    yeah it is too complicated without BIOS interrupts. but, problem is this we can't use BIOS interrupts in protected mode. – Syed Mukarram Ali Kazmi Feb 23 '14 at 04:14
  • In protected mode, you can't use direct hardware access, either (unless it's a DOS extender). You have to use the operating system's services - Windows API, Linux syscalls or whatever. If under Windows, read up on DirectX. – Seva Alekseyev Feb 23 '14 at 05:08
  • @SevaAlekseyev I'm not sure but the "normal" use case for changing the screen mode is people who write their own operating system. In this case they can use `out` and `in` but they cannot use BIOS interrupts. – Martin Rosenau Jun 02 '19 at 19:05
  • Point taken. That said, "I found a tutorial on web" in the question is a dead giveaway - the OP is utterly confused. – Seva Alekseyev Jun 02 '19 at 22:51
1

here's a link with example code: http://files.osdev.org/mirrors/geezer/osd/graphics/modes.c this code wouldn't work inside an operating system like windows or linux though, because it uses the commands inportb and outportb which issue the assembler commands inb and outb, which are disabled in user space.

by the way - user3340787 didn't ask for how to go to a graphics mode in DOS, he asked how to do it without BIOS, which he might want to do when he writes an operating system

Algoman
  • 1,905
  • 16
  • 16