Page 1 of 1

change text mode VGA width/height?

Posted: Wed Sep 01, 2021 11:02 am
by YDeeps1
I keep searching for the answer but I cant find any so I'm curious if it is possible to change the VGA text mode width & height from 80x25 to something else (whether thats by resizing the text of whatever) without switching to pixel mode and drawing the characters myself.

Is this possible? Thanks.

Re: change text mode VGA width/height?

Posted: Wed Sep 01, 2021 2:40 pm
by nexos
There are some obscure higher resolution VGA text modes AFAIK, but I am not sure how widely implemented they are implemented.

Re: change text mode VGA width/height?

Posted: Wed Sep 01, 2021 2:46 pm
by kzinti
It is possible, here is some high-level info:

https://en.wikipedia.org/wiki/VGA_text_mode

Re: change text mode VGA width/height?

Posted: Wed Sep 01, 2021 3:03 pm
by Octocontrabass
Standard VGA doesn't have a whole lot of options for higher resolutions, but you can make the character cells smaller. Using the default 720x400 text mode resolution, the character cells are 9x16 which results in 80x25 cells. Using only standard BIOS calls, you can reduce the cell height - for example, use 9x8 characters for an 80x50 text mode. I'm not sure if it's possible with BIOS calls, but by poking the registers directly, you can change the cell width to 8 pixels. With 8x8 character cells, you can have a 90x50 text mode. (You might also be able to increase the vertical resolution to 480 lines, giving you 60 rows, but I haven't tried to work out the timings to see if displays would accept it.)

Re: change text mode VGA width/height?

Posted: Fri Sep 10, 2021 6:04 am
by eekee
Octocontrabass wrote:Standard VGA doesn't have a whole lot of options for higher resolutions, but you can make the character cells smaller. Using the default 720x400 text mode resolution, the character cells are 9x16 which results in 80x25 cells.
Note: There is an old alternative standard, "LCD", for 80s laptops. This has 640x400 (or 640x200) pixels and 8x16 (or 8x8) characters. I mention it because some much more recent laptops implement it, even when it's quite unnecessary to do so. I have a Thinkpad X61 which implements LCD text although its screen is greater than 720 pixels wide and the characters have to be stretched in software.

Some other VGA BIOSes implemented 132-column modes, presumably 1056 pixels wide, but I haven't seen one for many years. Lilo was good at probing for these things.

Re: change text mode VGA width/height?

Posted: Mon Sep 13, 2021 12:45 pm
by feryno
I used this code in my very old project to change from 80x25 to 80x50, I hope it will help you and is still present:

Code: Select all

; set 80x50 text mode
	mov	ax,1112h	; AH=11h TEXT-MODE CHARACTER GENERATOR FUNCTIONS
				; AL=12h load ROM 8x8 double-dot pattern (PS,EGA,VGA)
	xor	bl,bl		; block to load
	int	10h

Re: change text mode VGA width/height?

Posted: Thu Mar 28, 2024 4:55 am
by FrankRay78
feryno wrote:I used this code in my very old project to change from 80x25 to 80x50, I hope it will help you and is still present:

Code: Select all

; set 80x50 text mode
	mov	ax,1112h	; AH=11h TEXT-MODE CHARACTER GENERATOR FUNCTIONS
				; AL=12h load ROM 8x8 double-dot pattern (PS,EGA,VGA)
	xor	bl,bl		; block to load
	int	10h
Is the above code snippet actually correct? Wouldn't we expect to see AH=00h included somewhere, along with AL specifying which text mode to switch to?

Re: change text mode VGA width/height?

Posted: Thu Mar 28, 2024 12:46 pm
by Octocontrabass
It's not switching to a different mode, it's just changing the font. If you want to also set the mode, you'd write something like this:

Code: Select all

mov ax, 0x0003 ; VGA text mode, 720x400 pixels, 9x16 font, 80x25 characters
int 0x10
mov ax, 0x1112 ; replace 9x16 font with 9x8 font, so now it's 80x50 characters
mov bl, 0x00
int 0x10