VOGONS


First post, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

Out of curiosity: I tried to increase the size of the video memory available by changing these lines in vga_s3.cpp from

	if (vga.vmemsize == 0)
vga.vmemsize = 2*1024*1024; // the most common S3 configuration

to

	if (vga.vmemsize == 0)
vga.vmemsize = 2*2048*1024; // the most common S3 configuration

and came up with a DOSBox executable with 4MB video memory (according to the UniVBE utility). But I couldn't get out more than 4 MB, no matter which values I tried for vga.vmemsize. So there must be a limiter somewhere else in the code. Could someone please show me, how to increase the video memory capacity? I know it isn't an official configuration of the emulated video card and might lead to some kind of trouble, I just want to play around a bit.

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 1 of 15, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

There is code immediately following the line you refer to that sets the S3 CRTC register 36 for the VRAM size, and you need to change that to support more than 4MB. This is the code from MB6 that goes as high as 8MB:

	// Set CRTC 36 to specify amount of VRAM and PCI
if (vga.vmemsize < 1024*1024) {
vga.vmemsize = 512*1024;
vga.s3.reg_36 = 0xfa; // less than 1mb fast page mode
} else if (vga.vmemsize < 2048*1024) {
vga.vmemsize = 1024*1024;
vga.s3.reg_36 = 0xda; // 1mb fast page mode
} else if (vga.vmemsize < 3072*1024) {
vga.vmemsize = 2048*1024;
vga.s3.reg_36 = 0x9a; // 2mb fast page mode
} else if (vga.vmemsize < 4096*1024) {
vga.vmemsize = 3072*1024;
vga.s3.reg_36 = 0x5a; // 3mb fast page mode
} else if (vga.vmemsize < 8192*1024) { // Trio64 supported only up to 4M
vga.vmemsize = 4096*1024;
vga.s3.reg_36 = 0x1a; // 4mb fast page mode
} else { // 8M
vga.vmemsize = 8192*1024;
vga.s3.reg_36 = 0x7a; // 8mb fast page mode
}

Reply 2 of 15, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

If I set this, should i comment out the two lines from my first post? And how do those hex values correspond to the amount of video memory? Are more than 8M possible? Is there some sort of table I could look that up? Sorry about all those questions!

UPDATE: I just tried this, dumping the 3MB definition to allow for a 16 MB one:

	if (vga.vmemsize == 0)
vga.vmemsize = 16384*1024; // hopefully fixes Build engine games

// Set CRTC 36 to specify amount of VRAM and PCI
if (vga.vmemsize < 1024*1024) {
vga.vmemsize = 512*1024;
vga.s3.reg_36 = 0xfa; // less than 1mb fast page mode
} else if (vga.vmemsize < 2048*1024) {
vga.vmemsize = 1024*1024;
vga.s3.reg_36 = 0xda; // 1mb fast page mode
} else if (vga.vmemsize < 3072*1024) {
vga.vmemsize = 2048*1024;
vga.s3.reg_36 = 0x9a; // 2mb fast page mode
} else if (vga.vmemsize < 4096*1024) {
vga.vmemsize = 4096*1024;
vga.s3.reg_36 = 0x5a; // 4mb fast page mode
} else if (vga.vmemsize < 8192*1024) { // Trio64 supported only up to 4M
vga.vmemsize = 8192*1024;
vga.s3.reg_36 = 0x1a; // 8mb fast page mode
} else if (vga.vmemsize < 16384*1024) {
vga.vmemsize = 16384*1024;
vga.s3.reg_36 = 0x7a; // 16mb fast page mode
}

But UVCONFIG.EXE (from UNIVBE) still shows only 4MB?

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 3 of 15, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Change the condition block to what I posted, then change the line above to: vga.vmemsize = 8*1024*1024;

The register values (in hex) correspond to the amount of memory. In your reworking of the conditions you've mismatched the register and vmemsize values. Also, the last of the conditions should be an "else", not an "else if", in order to catch any value above.

I don't know if more than 8MB is possible, or what the register values would be. I guess search for S3 specs if you really want to know.

Reply 4 of 15, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

Strangely, this is detected as only 2 MB:

	if (vga.vmemsize == 0)
vga.vmemsize = 8*1024*1024; // hopefully fixes Build engine games

// Set CRTC 36 to specify amount of VRAM and PCI
if (vga.vmemsize < 1024*1024) {
vga.vmemsize = 512*1024;
vga.s3.reg_36 = 0xfa; // less than 1mb fast page mode
} else if (vga.vmemsize < 2048*1024) {
vga.vmemsize = 1024*1024;
vga.s3.reg_36 = 0xda; // 1mb fast page mode
} else if (vga.vmemsize < 3072*1024) {
vga.vmemsize = 2048*1024;
vga.s3.reg_36 = 0x9a; // 2mb fast page mode
} else if (vga.vmemsize < 4096*1024) {
vga.vmemsize = 3072*1024;
vga.s3.reg_36 = 0x5a; // 3mb fast page mode
} else if (vga.vmemsize < 8192*1024) { // Trio64 supported only up to 4M
vga.vmemsize = 4096*1024;
vga.s3.reg_36 = 0x1a; // 4mb fast page mode
} else {
vga.vmemsize = 8192*1024;
vga.s3.reg_36 = 0x7a; // 8mb fast page mode
}

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 6 of 15, by gandhig

User metadata
Rank Member
Rank
Member

VBETEST does show it as having 16384 Kb memory in the Version output, when you set vga.vmemsize to 16384*1024 (initially as well as after the last 'else'). However, not sure whether it effects the desired change actually.

As per S3Trio64 datasheet, max display memory size is 4 MB which corresponds to reg_36's value of 1a(EDO) or 1e(fast page). That aside, comments in the vga_s3 source file mention 'EDO' mode as 'fast page' mode for all the vram combinations.

Filename
s3_trio32_64.pdf
File size
53.96 KiB
Downloads
100 downloads
File license
Fair use/fair dealing exception

Dosbox SVN r4019 + savestates Build (Alpha)
1st thread & the only one related to the forum(?)...warning about modern-retro combo
Dead, but, Personal Favourite
Replacement for Candy Crush...Train the Brain

Reply 7 of 15, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

I'm currently trying to get the video memory configurable via the conf file, but lacking C++ skills, this is all I could come up with until now:

diff -ruN dosbox/src/dosbox.cpp dosbox_vmem/src/dosbox.cpp
--- dosbox/src/dosbox.cpp 2018-11-30 10:03:33 +0000
+++ dosbox_vmem/src/dosbox.cpp 2018-11-30 10:06:45 +0000
@@ -438,6 +438,11 @@
"This value is best left at its default to avoid problems with some games,\n"
"though few games might require a higher value.\n"
"There is generally no speed advantage when raising this value.");
+ Pint = secprop->Add_int("vmemsize", Property::Changeable::WhenIdle, 2);
+ Pint->SetMinMax(1,8);
+ Pint->Set_help("Amount of video memory for the emulated S3 video card. The default \n"
+ "value is 2 MB, officially a maximum of 4MB is supported. Can be set \n"
+ "up to 8MB, e.g. to reduce flickering in Build engine games.");
secprop->AddInitFunction(&CALLBACK_Init);
secprop->AddInitFunction(&PIC_Init);//done
secprop->AddInitFunction(&PROGRAMS_Init);
diff -ruN dosbox/src/hardware/vga_s3.cpp dosbox_vmem/src/hardware/vga_s3.cpp
--- dosbox/src/hardware/vga_s3.cpp 2018-11-30 10:03:02 +0000
+++ dosbox_vmem/src/hardware/vga_s3.cpp 2018-11-30 10:09:32 +0000
@@ -532,7 +532,7 @@
svga.accepts_mode = &SVGA_S3_AcceptsMode;

if (vga.vmemsize == 0)
- vga.vmemsize = 2*1024*1024; // the most common S3 configuration
+ vga.vmemsize = vmemsize*1024*1024; // variable S3 configuration

// Set CRTC 36 to specify amount of VRAM and PCI
if (vga.vmemsize < 1024*1024) {
@@ -547,9 +547,12 @@
} else if (vga.vmemsize < 4096*1024) {
vga.vmemsize = 3072*1024;
vga.s3.reg_36 = 0x5a; // 3mb fast page mode
- } else { // Trio64 supported only up to 4M
+ } else if (vga.vmemsize < 8192*1024) { // Trio64 supported only up to 4M
vga.vmemsize = 4096*1024;
vga.s3.reg_36 = 0x1a; // 4mb fast page mode
+ } else {
+ vga.vmemsize = vmemsize*1024;
+ vga.s3.reg_36 = 0x7a; // amount in MB set in conf file
}

// S3 ROM signature

Of course, this doesn't compile. Can anyone help me out here? How can I "connect" the value in the cpp files to the variable used in the conf file of the compiled binary?

vmem_error.jpg
Filename
vmem_error.jpg
File size
104.92 KiB
Views
2784 views
File license
Fair use/fair dealing exception

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 9 of 15, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

Thanks, it compiles now, but no matter what I set for vmemsize in the conf file, VBETEST always reports back only 512kbyte of video memory, which seems to be a fallback minimum defined in vga_s3.cpp:

// Set CRTC 36 to specify amount of VRAM and PCI
if (vga.vmemsize < 1024*1024) {
vga.vmemsize = 512*1024;
vga.s3.reg_36 = 0xfa; // less than 1mb fast page mode

With all other DOSBox binaries I tried the memory is reported correctly. Something is missing obviously.

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 10 of 15, by spiroyster

User metadata
Rank Oldbie
Rank
Oldbie

Actually scratch that change to get it to compile. The line doesn't make sense.. since the previous condition checks if vga.vmemsize is 0, the expression is always going to evaluate to 0.

Need to see the rest of the source to see where the vmemsize (not vga.vmemsize) value is defined. Is that code you posted just the diff from sourceforge?

[EDIT:] I don't think having a variable vmemsize for S3 hardware is going to work. Like ripsaw said, you need to set the registry value that corresponds to the size of the buffer, unless you know that you will be out of luck.

Reply 11 of 15, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Well, you could simply borrow the relevant code from the Daum build, as it has a conf-configurable vmemsize. Still, I don't know what the fuss is for if it's all about the Build Engine; just use machine=vesa_nolfb to be rid of flicker.

Reply 12 of 15, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie
ripsaw8080 wrote:

Well, you could simply borrow the relevant code from the Daum build, as it has a conf-configurable vmemsize.

DOSBox-X has it, too. But I can't figure out what I'm missing, due to a lack of knowledge.

ripsaw8080 wrote:

Still, I don't know what the fuss is for if it's all about the Build Engine; just use machine=vesa_nolfb to be rid of flicker.

I personally am fine with just 800x600, but obviously many like the possibility to use much higher resolution, which, afair, were not even available with the standard 2 MB. That's why I raised the memory to 8MB in ECE.

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 13 of 15, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The Build Engine only uses 8-bits per color modes, and 2 MB is enough of a frame buffer for even 1600x1200, although the highest resolution built into vanilla DOSBox is 1280x1024. If you want higher resolution AND higher color depth for some reason then more video memory becomes necessary, but again, Build ignores any mode that isn't 8-bit color.

Reply 14 of 15, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

I just played a bit of Blood and Redneck Rampage with vesa_nolfb and indeed, it ran just fine and I didn't encounter any flickering. So if more memory actually serves no other purpose, I think I'll stick with a maximum of 4 MB as a compromise, which also prevents the graphics error with the mouse pointer in Windows 3.1.

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 15 of 15, by Jo22

User metadata
Rank l33t++
Rank
l33t++
Yesterplay80 wrote:

[..] which also prevents the graphics error with the mouse pointer in Windows 3.1.

Now that's interesting. I had no clue this was related to video memory size. I also encountered in VPC2007 (16MiB S3).
Back in tme I solved this glitchy pointer issue issue by switching between S3 Trio and S3 864 1.41B5 drivers..

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//