问题
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.
回答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.
回答2:
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
来源:https://stackoverflow.com/questions/21955406/enter-graphics-mode-without-interrupts-in-assembly