Talk:Mode 13h

What the heck does "Yestation"? mean? Google tells me it's some kind of thin client? --Darkstar (talk) 19:56, 4 July 2015 (UTC)

Bleah. I'm a DOS Mode 13h programming veteran, and I found the page nearly incomprehensible. I envision many people are going to get here after a google search on mode 13h. We need external links to Mode13h C and X86 ASM pages, maybe some sample source code, and especially a couple of diagrams representing the VGA hardware plane layout. My drawing skills are limited to Microsoft Paintbrush, alas. --Ardonik 06:41, Jul 14, 2004 (UTC)


 * Ardonik - i'm not much of a wikipedia buff, so don't know the best way of contacting you. Would like to get in touch with you via email to discuss improving the Mode 13h page.  One of my big interests is the inner workings of the VGA (yes, I am sad).  Essentially i'd like to improve the page such that it provides a better insight to people who just want to understand how to program Mode 13, yet I dont want to lose the technical detail I have provided on the workings of Mode 13h.  It's my opinion that one of the great things about the Wikipedia is the ability (through the passion of individuals) to provide detail about subjects that may well otherwise be lost in the course of time.  The VGA is a rather complex beast (it's taken me a long time to get my head round its detailed workings and there is still stuff I dont completely understand), and so I admit my description may be poor.  If I can, I'll include diagrams from IBM's orginal technical documentation on the VGA, but i'm worried about copyright implications.  --User:funkymonkey

Can you put up some source code? I can't seem to get into mode 13h with a 32-bit compiler (I can only seem to do it with Turbo C++). Does 13h work on non-DOS machines (like Linux, Unix)? http://www.daniweb.com/techtalkforums/post98509.html <-- Nevermind. Apparently Mode 13h only works in DOS, and can only be compiled with 16-bit compilers.

You can use mode 13h in Windows, or other protected mode OSses. But in Windows you can't just write to any old bit of memory. It's protected by the OS, unlike in DOS. So you need to find out how to access "real mode" memory addresses in your compiler. Usually there's a function to copy an array of bytes, to a particular address. Use a 64K buffer of bytes, then copy it to the screen address using this function. In DJGPP, look at dosmemput

If you look up protected mode, and memory protection, you'll understand this a bit better. Basically modern OSses translate your prog's accessing of memory, into different addresses of actual physical memory. It's all handled by the OS.

--188.28.10.233 (talk) 03:57, 9 April 2011 (UTC) Sam

Instead of saying "Mode 13h is slang for ..." I would prefer something like "Mode 13h refers to the standard 256 colour mode on IBM's VGA graphics hardware. The 13h in the name refers to a hexadecimal notation popular in computer languages such as assembler." (that's not the best, but you get my drift?). Also, code to switch to mode 13h in assembler:

mov ax, 13h

int 10h

This is a BIOS call. Yes, it is 16bit, but I would have thought it would be available for all x86 computers? -talistreit


 * talistreit:, I did that for ya. I also removed the reference about mode 13h being so popular for scrolling.  This just isn't really true.  In mode13h nearly all of the 65535bytes of memory are used (64000 for 320x200) and so scrolling ability is margininal, although it is possible to scroll horizontally somewhat.  Furthermore, the scroll register mentioned (the start address register) is available in all modes and is not special to Mode 13h.  To make the most of hardware scrolling you need at least two pages  to do wraparound vertical scrolling, and add a little more for horizontal scroll.  If anyone wants any further evidence of VGA scrolling techniques, I can provide them.  I have not seen anyone do infinite vertical scrolling on a VGA in Mode13h.  It was Mode-X that was so popular for scrolling because of the extra pages available.

--funkymonkey. —Preceding unsigned comment added by Funkymonkey (talk • contribs) 17:18, 26 March 2008 (UTC)

"For example, on the first line of the screen pixels 0, 4, 8, 12 etc. are all contained in memory plane 0, while pixels 1, 5, 9, 13 etc. are contained in memory plane 1 and so on. A single byte written to the 64K window therefore can address up to 4 pixels at once." looks like a contradiction. —Preceding unsigned comment added by 91.121.143.81 (talk) 21:09, 1 July 2009 (UTC)

Sorry, I need to update this explanation slightly to make more sense. In planar mode (non chunky) then depending on which planes are enabled you can write to either no planes, or 1,2,3,or 4 planes with a single write. For example, if enabled all four planes, a single write with the value FFh would write that value to planes 0,1,2,3 - so covering four pixels, all of the same colour. This is how ModeX works.

In Mode 13, the programmer doesn't select the planes to write to (via the map mask register), instead the two least significant bits of the address are used to select one of the four planes to write to. Funkymonkey (talk) 17:39, 7 February 2011 (UTC)

Palette Info
I'd like to see this include a listing of the RBG values for the 256-color palette. Finding it seems to be a bitch. I see that there's an image of the palette, but I'd hate to have to write a program to extract the values from that. Thx Inhahe (talk) 12:45, 1 September 2014 (UTC)

It's been a long time since I've accessed VGA memory directly, but the description of planar mode seems off to me:

"For any given byte in the PC's 64 KiB video memory aperture, four pixels can be accessed on screen by selecting the required plane(s)."

As far as I remember it was *eight* pixels per byte: Each pixel occupied 1 bit in each plane for a total of 4 bits or 16 colors. 640x480 is 38400 pixels which wouldn't fit into a 64 k plane if each pixel occupied 2 bits. — Preceding unsigned comment added by Ligneus (talk • contribs) 18:27, 20 October 2017 (UTC)