flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Question about INT 0x10 |
Author |
|
Fulgurance 27 Nov 2018, 23:27
Hello, i have question about INT 0x10, about VBE.
It's about 4F 02 function to set super VGA mode. On this VBE doc: https://pdos.csail.mit.edu/6.828/2011/readings/hardware/vbe3.pdf it's specified to set D0-D8 on BX register to set desired mode, but what value can i put ? And what is the result of this value ? |
|||
27 Nov 2018, 23:27 |
|
Fulgurance 27 Nov 2018, 23:53
I don't understand... 18 mode is VBE ? (i would like to use custom resolution)
|
|||
27 Nov 2018, 23:53 |
|
edfed 27 Nov 2018, 23:58
page 18 modes,
page 40 function 02 |
|||
27 Nov 2018, 23:58 |
|
Fulgurance 28 Nov 2018, 00:09
Oh okay, i have don't seen that. Thanks
|
|||
28 Nov 2018, 00:09 |
|
bzt 28 Nov 2018, 13:45
Not sure why is this question in "OS Construction", but anyway, here's my answer:
Use INT 10/4F00 to query available modes (since VBE2.0 there are no more fixed resolution codes, the returned structure has a 32 bit pointer at 0Eh to the list, the list is terminated by 0FFFFh) http://www.ctyme.com/intr/rb-0273.htm And INT 10/4F01 to query information on a mode (like screen resolution, pitch and pixel format). This is important, because pitch may be different than width*bpp, and it's essential to know to calculate position on the screen. http://www.ctyme.com/intr/rb-0274.htm The structure returned by that function (table 79) has the BX value for the mode at offset 0 (which may or may not be different to the one in the 4F00 list. A few bits could be different). You may need to alter that a little too (bits 11-15, see table 78 ) before you pass it to INT 10/4F02. Here's a working, well tested example (tested on qemu, bochs, VirtualBox, many different versions; on real machines: an Acer laptop, and two noname machines with 5 different video cards): https://gitlab.com/bztsrc/bootboot/blob/master/x86_64-bios/bootboot.asm#L1715 lines 1720-1731: check if VBE2.0 is supported, and query available modes lines 1732-1773: iterate on each mode, call 4F01 in a loop lines 1774-1800: check wether the returned structure has the W x H x 32bpp resolution we're looking for lines 1819-1825: set that resolution with the returned mode code with bits 13,14 set (LFB and HW acceleration) Cheers, bzt |
|||
28 Nov 2018, 13:45 |
|
Fulgurance 29 Nov 2018, 12:05
Thanks for your help
I have just questions about CRTC Info Block arguments. Example: I would like to set the resolution with size 1920x1080 I think Horizontal total it's just the horizontal size of my resolution = 1920 Horizontal Sync Start: what is this ? Horizontal Sync End: ? Vertical Total: 1080 ? Flags: ? What is this ? Pixel clock ??? Refresh rate ? How i found this information ? |
|||
29 Nov 2018, 12:05 |
|
bzt 29 Nov 2018, 17:18
Are you using a CRT monitor?
If not, then simply "don't care". Non-electron-cannon monitors (TFT, Plasma, OLED, etc. anything manufactured in the last twenty years or so) don't have a CRTC anyway, so it doesn't matter what's in that block. If the answer is yes, then you should buy a new monitor ASAP (not kidding). Quote: Example: I would like to set the resolution with size 1920x1080 1. get the mode list with 4F00. 2. iterate on every mode, using 4F01 to get the VBE info (output) for mode (input). 3. check if the returned word es:[di+12h]==1920 and word es:[di+14h]==1080 and byte es:[di+19h]==32 if so, you got your mode code that you can use with 4F02 to set up 1920x1080x32 resolution (pitch at word es:[di+10h], frame buffer pointer at dword es:[di+28h]). 4. if you reach the mode 0FFFFh (or 0000h on some video cards), then 1920x1080x32 resolution is not supported. BIOS should not list a mode which is not displayable. (Unless your BIOS is seriously broken, or your monitor is so ancient that it does not provide EDID information, see INT 10/4F15/01). In that case (INT 10/4F15/01 returned AH=1) you can always do what WinXP did: display a message "Press OK if you can read this" with 10 secs timeout, and revert to the next (or previous) mode on timeout. Cheers, bzt |
|||
29 Nov 2018, 17:18 |
|
Fulgurance 29 Nov 2018, 18:04
In fact, without video card specification, is it not possible to set custom resolution ?
I suppose all BIOS support current screen resolution with int 10 VESA ? Or it's possible BIOS don't support screen resolution ? |
|||
29 Nov 2018, 18:04 |
|
bzt 30 Nov 2018, 13:39
Fulgurance wrote: In fact, without video card specification, is it not possible to set custom resolution ? Quote: I suppose all BIOS support current screen resolution with int 10 VESA ? Or it's possible BIOS don't support screen resolution ? Now with UEFI, you have the same scheme. The only difference is that the video card ROM provides the GOP interface. You can use that to query the available video modes and to set one just like with BIOS VBE. Btw, UEFI mandates that 1024x768 must be supported by both the card and the monitor. As a last note, if you know how to low level program the video card directly (with IO ports, memory regions etc.), then you are not restricted to the VBE/GOP. Then you can write a driver that does the same, or maybe even more. With that custom driver it is possible to set up resolutions not listed by the standard interfaces (but that's not recommended, not guaranteed to work, and if you are uncareful, you can blow up your monitor). There are some manufacturers that publicate such low level specifications for their cards (typically Intel), but big players usually don't (Nvidia for example). The only option you have is to disassembly their ROM, and see what the code actually does when you call a BIOS VBE interrupt. But to do so may be illegal in some countries, be warned. Cheers, bzt |
|||
30 Nov 2018, 13:39 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.