Out of curiosity: I tried to increase the size of the video memory available by changing these lines in vga_s3.cpp from
1 if (vga.vmemsize == 0) 2 vga.vmemsize = 2*1024*1024; // the most common S3 configuration
to
1 if (vga.vmemsize == 0) 2 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.
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:
1 // Set CRTC 36 to specify amount of VRAM and PCI 2 if (vga.vmemsize < 1024*1024) { 3 vga.vmemsize = 512*1024; 4 vga.s3.reg_36 = 0xfa; // less than 1mb fast page mode 5 } else if (vga.vmemsize < 2048*1024) { 6 vga.vmemsize = 1024*1024; 7 vga.s3.reg_36 = 0xda; // 1mb fast page mode 8 } else if (vga.vmemsize < 3072*1024) { 9 vga.vmemsize = 2048*1024; 10 vga.s3.reg_36 = 0x9a; // 2mb fast page mode 11 } else if (vga.vmemsize < 4096*1024) { 12 vga.vmemsize = 3072*1024; 13 vga.s3.reg_36 = 0x5a; // 3mb fast page mode 14 } else if (vga.vmemsize < 8192*1024) { // Trio64 supported only up to 4M 15 vga.vmemsize = 4096*1024; 16 vga.s3.reg_36 = 0x1a; // 4mb fast page mode 17 } else { // 8M 18 vga.vmemsize = 8192*1024; 19 vga.s3.reg_36 = 0x7a; // 8mb fast page mode 20 }
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:
1 if (vga.vmemsize == 0) 2 vga.vmemsize = 16384*1024; // hopefully fixes Build engine games 3 4 // Set CRTC 36 to specify amount of VRAM and PCI 5 if (vga.vmemsize < 1024*1024) { 6 vga.vmemsize = 512*1024; 7 vga.s3.reg_36 = 0xfa; // less than 1mb fast page mode 8 } else if (vga.vmemsize < 2048*1024) { 9 vga.vmemsize = 1024*1024; 10 vga.s3.reg_36 = 0xda; // 1mb fast page mode 11 } else if (vga.vmemsize < 3072*1024) { 12 vga.vmemsize = 2048*1024; 13 vga.s3.reg_36 = 0x9a; // 2mb fast page mode 14 } else if (vga.vmemsize < 4096*1024) { 15 vga.vmemsize = 4096*1024; 16 vga.s3.reg_36 = 0x5a; // 4mb fast page mode 17 } else if (vga.vmemsize < 8192*1024) { // Trio64 supported only up to 4M 18 vga.vmemsize = 8192*1024; 19 vga.s3.reg_36 = 0x1a; // 8mb fast page mode 20 } else if (vga.vmemsize < 16384*1024) { 21 vga.vmemsize = 16384*1024; 22 vga.s3.reg_36 = 0x7a; // 16mb fast page mode 23 }
But UVCONFIG.EXE (from UNIVBE) still shows only 4MB?
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.
UniVBE 5.3a says 3MB, and it does the same for MB6 and Daum with a vmemsize=8 setting, so perhaps unreliable detection (or an unrealistic amount of memory 😉)
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.
The attachment s3_trio32_64.pdf is no longer available
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:
1diff -ruN dosbox/src/dosbox.cpp dosbox_vmem/src/dosbox.cpp 2--- dosbox/src/dosbox.cpp 2018-11-30 10:03:33 +0000 3+++ dosbox_vmem/src/dosbox.cpp 2018-11-30 10:06:45 +0000 4@@ -438,6 +438,11 @@ 5 "This value is best left at its default to avoid problems with some games,\n" 6 "though few games might require a higher value.\n" 7 "There is generally no speed advantage when raising this value."); 8+ Pint = secprop->Add_int("vmemsize", Property::Changeable::WhenIdle, 2); 9+ Pint->SetMinMax(1,8); 10+ Pint->Set_help("Amount of video memory for the emulated S3 video card. The default \n" 11+ "value is 2 MB, officially a maximum of 4MB is supported. Can be set \n" 12+ "up to 8MB, e.g. to reduce flickering in Build engine games."); 13 secprop->AddInitFunction(&CALLBACK_Init); 14 secprop->AddInitFunction(&PIC_Init);//done 15 secprop->AddInitFunction(&PROGRAMS_Init); 16diff -ruN dosbox/src/hardware/vga_s3.cpp dosbox_vmem/src/hardware/vga_s3.cpp 17--- dosbox/src/hardware/vga_s3.cpp 2018-11-30 10:03:02 +0000 18+++ dosbox_vmem/src/hardware/vga_s3.cpp 2018-11-30 10:09:32 +0000 19@@ -532,7 +532,7 @@ 20 svga.accepts_mode = &SVGA_S3_AcceptsMode; 21 22 if (vga.vmemsize == 0) 23- vga.vmemsize = 2*1024*1024; // the most common S3 configuration 24+ vga.vmemsize = vmemsize*1024*1024; // variable S3 configuration 25 26 // Set CRTC 36 to specify amount of VRAM and PCI 27 if (vga.vmemsize < 1024*1024) { 28@@ -547,9 +547,12 @@ 29 } else if (vga.vmemsize < 4096*1024) { 30 vga.vmemsize = 3072*1024; 31 vga.s3.reg_36 = 0x5a; // 3mb fast page mode 32- } else { // Trio64 supported only up to 4M 33+ } else if (vga.vmemsize < 8192*1024) { // Trio64 supported only up to 4M 34 vga.vmemsize = 4096*1024; 35 vga.s3.reg_36 = 0x1a; // 4mb fast page mode 36+ } else { 37+ vga.vmemsize = vmemsize*1024; 38+ vga.s3.reg_36 = 0x7a; // amount in MB set in conf file 39 } 40 41 // 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?
The attachment vmem_error.jpg is no longer available
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:
1// Set CRTC 36 to specify amount of VRAM and PCI 2 if (vga.vmemsize < 1024*1024) { 3 vga.vmemsize = 512*1024; 4 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.
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.
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.
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.
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.
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.
[..] 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