setting graphics mode in ASM

Started by
9 comments, last by MattCarpenter 21 years, 9 months ago
I realized that you cant use VESA to set the graphics mode in bochs (which I use to test my kernel), so I was wondering how to set the video mode in ASM without interrupts (using the out function). I''m aiming to get 640x480 res. with 256 color if possible
//att
Advertisement
I don''t think that''s possible with a standard VGA display. The best you''ll get is 640x480 at 16 colors. Are you absolutely sure Bochs has no SVGA capability at all?



---
Bart
----Bart
Set AX to 13 and use int 10.
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---
quote:Original post by trzy
I don''t think that''s possible with a standard VGA display. The best you''ll get is 640x480 at 16 colors. Are you absolutely sure Bochs has no SVGA capability at all
---
Bart


Bochs has SVGA capability, I just cant use interrupts (VESA) to set the video mode. I''m tired of the low resolution mode 13h, So I want to know how to use the i/o ports to set a higher resolution
//att
quote:Original post by trzy
I don''t think that''s possible with a standard VGA display. The best you''ll get is 640x480 at 16 colors. Are you absolutely sure Bochs has no SVGA capability at all?


That would be correct, standard VGA only has 256KB of memory. The highest resolution you can get with VGA is 640x480x4 (16 colors) and the most colors you can get is 320x200x8 (256 colors). In order to use SVGA ''modes'' you need to either 1) Hard code your own drivers for every possible graphics card out there or 2) Have VESA drivers or VESA bios extensions installed.

quote:Original post by Andrew Nguyen
Set AX to 13 and use int 10.

You need to set AX to 19 (13h) and call interrupt 16 (10h). That will give you 320x200x8. To get 640x480x4 set AX to 18 (12h).
CLOSE ENOUGH!
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---
Once one has set the video mode, how does one get and modify the graphics? If I remember right, a char (byte) pointer to 1000h will do, but a protected-mode compiler won''t like that, will it?
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
You want higher-res?

*thinks*

Use DirectDraw, and lock the backbuffer to get a pointer to its image data. I''ve got code for that somewhere around here...

Oo! It''s also in the DirectX8.1 SDK... they included samples for DirectDraw, and one of them is called "direct surface write". Look at that.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
I don''t mean to flame here, but:

There''s more to writting an operating system than just knowing how to write in assembly language. So learn about the computer first, then write an OS. I suggest starting at

http://developer.intel.com

and downloading the old 386 doucmentation. It''s a great place to start.

--Andrew
If you want to set the video mode using i/o ports, good luck! The only standard relating to i/o ports on video cards is VGA, which you state you don''t want, so unless you only want your program to run on one type of video card only, i''d steer away from i/o ports. You could possibly hack up something to use windows drivers, supplying the driver with any emulated win32 API calls it might want, it would be a mission but could work, allowing your program to use any video card with win drivers (i am assuming ur program isn''t already running in windows).

This topic is closed to new replies.

Advertisement