0

How can I create my own video mode in assembly (x86, tasm, DOSbox)?

int 10h in assembly enables me to open the graphics mode and to create a screen, but the dimensions of the screen are very limited. For example, if I want to have an option for 256 colors on the screen, the only option for the screen size is 320 pixels X 200 pixels.

I have researched a ton about this subject and didn't get anywhere. I have heard about something called video mode X, but I didn't understand it, and I heard can also ruin the graphics of my actual screen. I lost hope, but today I saw a very old answer about video mode which stated the following:

"You can create your own modes by writing directly to the ports of the video card" https://stackoverflow.com/a/14419154/13397045

This statement relieved my dream of creating a custom-sized screen in assembly. Is it really possible to do so? If true, how can we use the ports (or any other way) in order to create our own video modes (setting the dimensions of the screen and the number of possible colors)?

Gilad Kustin
  • 73
  • 1
  • 6
  • There a limit to what video modes you can create in practice. Mode X actually is using the same video timings that 640x480 graphics modes uses, just with double width and height pixels to get 320x240 resolution. Arbitrary resolutions and timings may not work on real video cards and displays, and may not be supported by emulators. For an overview of what's possible on actual VGA hardware, if not necessarily all displays see: https://en.wikipedia.org/wiki/Video_Graphics_Array#Other_modes – Ross Ridge Oct 12 '20 at 19:59
  • Since you're using DOSBox you might want to look at what SuperVGA modes are available, since SuperVGA cards were able to support 256 colours at much higher resolution than 320x200. – Ross Ridge Oct 12 '20 at 20:04
  • see [Graphics mode in assembly 8086](https://stackoverflow.com/a/48664419/2521214) see the table of standard [videomodes](http://www.columbia.edu/~em36/wpdos/videomodes.txt) use [VBE/VESA](https://stackoverflow.com/a/21699076/2521214). Here simple asm example: [reading and rendering PCX](https://stackoverflow.com/a/45780565/2521214) as you can see you are not limited to 320x200x8bpp there are bigger resolutions and even color depth up to 24bpp. If your HW/SW do not support use UNIVBE 5.1 or newer. As mentioned before X-mode might not work reliably outside real genuine VGA cards – Spektre Oct 13 '20 at 10:44

0 Answers0