[DISCUSSION] MS-DOS memory optimisation tricks

Support and general discussion.
User avatar
ppgrainbow
Posts: 479
Joined: Thu 04 Sep, 2014 7:03 am
Contact:

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by ppgrainbow »

I finally managed to get the MS-DOS 5.0 prompt working under Windows 3.0 using Norton Desktop 2.2 instead of Program Manger.

This is not without having to do a lot of tweaking as well as trial and error of getting the MS-DOS prompt working correctly using the PIF Editor. Using the PIF Editor, I had to click on the Advanced button. In the Advanced Options window, there's a section called Other Options, I had to uncheck Allow Fast Paste and click OK to save. When I was finished, I saved the file as DOSPRPMT.PIF.

I also had to modify the CONFIG.SYS and AUTOEXEC.BAT files as follows:

Here's what the contents of the CONFIG.SYS file looks like so far:
FILES=50
BUFFERS=10
FCBS=1,0
STACKS=9,256
DOS=HIGH,UMB

DEVICE=C:\QEMM\DOSDATA.SYS
DEVICE=C:\QEMM\QEMM386.SYS RAM BE:N X=B800-DFFF R:1
DEVICE=C:\QEMM\DOS-UP.SYS @C:\QEMM\DOS-UP.DAT
DEVICE=C:\QEMM\LOADHI.SYS /R:1 /SIZE=11248 C:\QEMM\QDPMI.SYS SWAPFILE=DPMI.SWP SWAPSIZE=4096

DEVICE=C:\SB16\DRV\CTSB16.SYS /UNIT=0 /BLASTER=A:220 I:5 D:1 H:5
DEVICE=C:\SB16\DRV\CTMMSYS.SYS
And here's what the AUTOEXEC.BAT contents look like so far as well:
@ECHO OFF
PROMPT [$p$g]
PATH C:\DOS;C:\WINDOWS

SET PATH=%PATH%;C:\CWSDPMI
SET PATH=%PATH%;C:\ET4000
SET PATH=%PATH%;C:\MOUSE
SET PATH=%PATH%;C:\NDW
SET PATH=%PATH%;C:\PKZIP
SET PATH=%PATH%;C:\POPDOS
SET PATH=%PATH%;C:\QEMM
SET PATH=%PATH%;C:\RIXAI
SET PATH=%PATH%;C:\SB16

SET TEMP=C:\TEMP
SET WATTCP.CFG=C:\WATTCP
SET LMOUSE=C:\MOUSE
SET SOUND=C:\SB16
SET TZ=PST08PDT

SET BLASTER=A220 I5 D1 H5 P330 T6
SET MIDI=SYNTH:1 MAP:E

TLIVESA

MOUSE MEMA MEMSA

NE2000 0x60 10 0x300

HIDE87
Here's what I did. I had to remo the CTSB16.SYS Sound Blaster 16 driver from high memory and put it below the 640 KB barrier. That is obviously what prevented MS-D0S 5.0 from working properly while running in Windows 3.0 and has eventually resulted in Unrecoverable Application Errors (UAE) when running the Norton Desktop 2.2 as the shell.

I also removed the RIXAI8 8514/A emulation driver from the AUTOEXEC.BAT file so that it will free up 43.6 KB of base memory. I only put RIXAI8 in PC Paintbrush IV and unloaded it when exiting. The end result is this:

Available to programmes (base + upper): 609.6 KB
Largest executable programme size: 583 BK
Largest available upper memory block: 26.3 KB

A lot of progress has been made to improve Windows 3.0/MS-DOS 5 stability! :)

Here's a screenie of what I have accomplished so far:
AMI 486 clone screenshot.png
AMI 486 clone screenshot.png (201.49 KiB) Viewed 11162 times
Due to the AMI 486 BIOS supporting only one IDE controller, the CD-ROM drivers are not necessary in this emulated machine. I will update again if I even run into problems with my current CONFIG.SYS and AUTOEXEC.BAT configurations.
Last edited by ppgrainbow on Sun 06 Sep, 2015 4:31 am, edited 1 time in total.
User avatar
ppgrainbow
Posts: 479
Joined: Thu 04 Sep, 2014 7:03 am
Contact:

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by ppgrainbow »

Battler wrote:- neozeed: As I said, I just repeated in the latest revision the actions that some time ago made everything behave erratically, and everything behaves fine now. I even mentioned which revision I think fixed the problem. :p

Edit: Just noticed this happening:
1. Start LBA 1.
2. Get to the main menu.
3. Quit LBA 1.
4. Start LBA 1 again. It will freeze after it's done playing the MIDI and the only thing that will remove the freeze is quitting the emulator and relaunching it.

Edit: It happens regardless of where the CD-ROM driver is loaded. And yes, the CD-ROM driver has to do with it because at that point the game checks if the CD is present.

Edit #2: This might be the CD Audio thread bug striking. Because at the main menu, the game starts playing audio from the CD (the background music), and most probably the thread gets stuck, causing any further CD reads to get stuck, hence the game freezing when it's restarted and does the CD check again.

Edit #3: For some reason, it only happens when I boot DOS from a floppy, but not when I boot it from hard disk.

Edit #4: Found why. The DOS on hard disk used OAKCDROM.SYS. The DOS on the floppy used VIDE-CDD.SYS version 2.15. So it seems there's a bug in PCem that causes VIDE-CDD.SYS to misbehave (regardless of where in the memory it's loaded).

Edit #5: Did some tests. Only OAKCDROM.SYS works (and it's ironically the one that consumes the most memory). VIDE-CDD.SYS has the above-mentioned problem. GSCDROM.SYS makes LBA 1 freeze when transferring speech files. MTMCDAI.SYS makes LBA 1 freeze at CD check on the first run. I would try XCDROM.SYS but I remember it not supporting mixed mode CD's.

This IMHO clearly points me at there being a severe bug in the CD emulation.
That doesn't sound good to see that PCem has a severe CD emulation and audio thread bugs. :( Let's hope that Tom tries to investigate the issue and what could be causing it soon.
neozeed
Posts: 176
Joined: Tue 08 Jul, 2014 4:41 am
Location: Hong Kong SAR
Contact:

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by neozeed »

what is LBA?? Is it a mixmode CD?

Im pretty sure there is CD issues as we saw with the stock warp 3.0 install.
User avatar
te_lanus
Posts: 135
Joined: Tue 28 Jul, 2015 4:47 am

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by te_lanus »

neozeed wrote:what is LBA?? Is it a mixmode CD?

Im pretty sure there is CD issues as we saw with the stock warp 3.0 install.
LBA = Little Big Adventure
neozeed
Posts: 176
Joined: Tue 08 Jul, 2014 4:41 am
Location: Hong Kong SAR
Contact:

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by neozeed »

te_lanus wrote:
neozeed wrote:what is LBA?? Is it a mixmode CD?

Im pretty sure there is CD issues as we saw with the stock warp 3.0 install.
LBA = Little Big Adventure
Safe to say I've never heard of it. So is it mixed mode? Straight data? What makes it so special?
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by Battler »

- neozeed: Little Big Adventure is a game. And yes, its CD is mixed mode, as in it has the one data track followed by I think 9 audio tracks with music from the game. XCDROM.SYS causes a DIR on the CD to return garbage if it's a mixed mode CD (and yes, also in, say, Virtual PC 2007, so this is not a PCem bug, but an XCDROM.SYS bug).
neozeed
Posts: 176
Joined: Tue 08 Jul, 2014 4:41 am
Location: Hong Kong SAR
Contact:

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by neozeed »

Battler wrote:- neozeed: Little Big Adventure is a game. And yes, its CD is mixed mode, as in it has the one data track followed by I think 9 audio tracks with music from the game. XCDROM.SYS causes a DIR on the CD to return garbage if it's a mixed mode CD (and yes, also in, say, Virtual PC 2007, so this is not a PCem bug, but an XCDROM.SYS bug).
Are you using a physical disk, or CD emulation?
neozeed
Posts: 176
Joined: Tue 08 Jul, 2014 4:41 am
Location: Hong Kong SAR
Contact:

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by neozeed »

Configuring EMM386.EXE with EMS...

config.sys

Code: Select all

DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE 4096 frame=d000 x=a000-afff i=b000-b7ff x=b800-bbff x=c000-c7ff i=c800-cfff i=e000-efff ram
DEVICEHIGH=C:\DOS\CD1.SYS /D:CDROM01
DEVICEHIGH=C:\DOS\SETVER.EXE
DEVICEHIGH=C:\DOS\ANSI.SYS
DOS=HIGH,UMB
FILES=40
autoexec.bat

Code: Select all

@ECHO OFF
PROMPT $p$g
PATH C:\DOS;c:\windows
SET TEMP=C:\TEMP
LH MSCDEX /D:CDROM01
LH SMARTDRV
LH IDLE
LH DOSKEY
LH SHARE
mem output

Code: Select all


    655360 bytes total conventional memory
    655360 bytes available to MS-DOS
    619328 largest executable program size

   4587520 bytes total EMS memory
   4194304 bytes free EMS memory

  15728640 bytes total contiguous extended memory
         0 bytes available contiguous extended memory
  13008896 bytes available XMS memory
           MS-DOS resident in High Memory Area

  Address     Name          Size       Type 
  -------     --------     ------     ------
  000000                   000400     Interrupt Vector
  000400                   000100     ROM Communication Area
  000500                   000200     DOS Communication Area

  000700      IO           000A60     System Data

  001160      MSDOS        0013D0     System Data

  002530      IO           002550     System Data
                HIMEM      0004A0      DEVICE=    
                EMM386     000C20      DEVICE=    
                           000820      FILES=     
                           000100      FCBS=      
                           000200      BUFFERS=   
                           0001C0      LASTDRIVE= 
                           000740      STACKS=    
  004A90      MSDOS        000040     System Program

  004AE0      COMMAND      000940     Program   
  005430      MSDOS        000040     -- Free --
  005480      COMMAND      000100     Environment
  005590      SMARTDRV     003690     Program   
  008C30      MEM          000060     Environment
  008CA0      MEM          0176F0     Program   
  0203A0      MSDOS        07FC40     -- Free --
  09FFF0      SYSTEM       0114A0     System Program

  0B14A0      IDLE         000060     Environment
  0B1510      SMARTDRV     004000     Data      
  0B5520      MSDOS        000060     -- Free --
  0B5590      MSDOS        002A40     -- Free --
  0B7FE0      SYSTEM       010020     System Program

  0C8010      MSCDEX       006D20     Program   
  0CED40      MSDOS        001290     -- Free --
  0CFFE0      SYSTEM       010020     System Program

  0E0010      IO           0082E0     System Data
                CD1        0070C0      DEVICE=    
                SETVER     000190      DEVICE=    
                ANSI       001060      DEVICE=    
  0E8300      IDLE         000180     Program   
  0E8490      DOSKEY       001020     Program   
  0E94C0      SHARE        001830     Program   
  0EAD00      MSDOS        0052F0     -- Free --


    655360 bytes total conventional memory
    655360 bytes available to MS-DOS
    619328 largest executable program size

   4587520 bytes total EMS memory
   4194304 bytes free EMS memory

  15728640 bytes total contiguous extended memory
         0 bytes available contiguous extended memory
  13008896 bytes available XMS memory
           MS-DOS resident in High Memory Area

  Address     Name          Size       Type 
  -------     --------     ------     ------
  000000                   000400     Interrupt Vector
  000400                   000100     ROM Communication Area
  000500                   000200     DOS Communication Area

  000700      IO           000A60     System Data
                  CON                   System Device Driver 
                  AUX                   System Device Driver 
                  PRN                   System Device Driver 
                  CLOCK$                System Device Driver 
                  A: - C:               System Device Driver 
                  COM1                  System Device Driver 
                  LPT1                  System Device Driver 
                  LPT2                  System Device Driver 
                  LPT3                  System Device Driver 
                  COM2                  System Device Driver 
                  COM3                  System Device Driver 
                  COM4                  System Device Driver 

  001160      MSDOS        0013D0     System Data

  002530      IO           002550     System Data
                HIMEM      0004A0      DEVICE=    
                  XMSXXXX0              Installed Device Driver 
                EMM386     000C20      DEVICE=    
                  EMMXXXX0              Installed Device Driver 
                           000820      FILES=     
                           000100      FCBS=      
                           000200      BUFFERS=   
                           0001C0      LASTDRIVE= 
                           000740      STACKS=    
  004A90      MSDOS        000040     System Program

  004AE0      COMMAND      000940     Program   
  005430      MSDOS        000040     -- Free --
  005480      COMMAND      000100     Environment
  005590      SMARTDRV     003690     Program   
  008C30      MEM          000060     Environment
  008CA0      MEM          0176F0     Program   
  0203A0      MSDOS        07FC40     -- Free --
  09FFF0      SYSTEM       0114A0     System Program

  0B14A0      IDLE         000060     Environment
  0B1510      SMARTDRV     004000     Data      
  0B5520      MSDOS        000060     -- Free --
  0B5590      MSDOS        002A40     -- Free --
  0B7FE0      SYSTEM       010020     System Program

  0C8010      MSCDEX       006D20     Program   
  0CED40      MSDOS        001290     -- Free --
  0CFFE0      SYSTEM       010020     System Program

  0E0010      IO           0082E0     System Data
                CD1        0070C0      DEVICE=    
                  CDROM01               Installed Device Driver 
                SETVER     000190      DEVICE=    
                  SETVERXX              Installed Device Driver 
                ANSI       001060      DEVICE=    
                  CON                   Installed Device Driver 
  0E8300      IDLE         000180     Program   
  0E8490      DOSKEY       001020     Program   
  0E94C0      SHARE        001830     Program   
  0EAD00      MSDOS        0052F0     -- Free --


    655360 bytes total conventional memory
    655360 bytes available to MS-DOS
    619328 largest executable program size

  Handle      EMS Name      Size   
  -------     --------     ------  
       0                   060000

   4587520 bytes total EMS memory
   4194304 bytes free EMS memory

  15728640 bytes total contiguous extended memory
         0 bytes available contiguous extended memory
  13008896 bytes available XMS memory
           MS-DOS resident in High Memory Area

Conventional Memory :

  Name                Size in Decimal       Size in Hex
-------------      ---------------------   -------------
  MSDOS              14752      ( 14.4K)       39A0
  HIMEM               1184      (  1.2K)        4A0
  EMM386              3104      (  3.0K)        C20
  COMMAND             2624      (  2.6K)        A40
  SMARTDRV           13968      ( 13.6K)       3690
  FREE                  64      (  0.1K)         40
  FREE              619440      (604.9K)      973B0

Total  FREE :       619504      (605.0K) 

Upper Memory :

  Name                Size in Decimal       Size in Hex
-------------      ---------------------   -------------
  SYSTEM            201936      (197.2K)      314D0
  SMARTDRV           16384      ( 16.0K)       4000
  IDLE                 480      (  0.5K)        1E0
  MSCDEX             27936      ( 27.3K)       6D20
  CD1                28864      ( 28.2K)       70C0
  SETVER               400      (  0.4K)        190
  ANSI                4192      (  4.1K)       1060
  DOSKEY              4128      (  4.0K)       1020
  SHARE               6192      (  6.0K)       1830
  FREE                  96      (  0.1K)         60
  FREE               10816      ( 10.6K)       2A40
  FREE                4752      (  4.6K)       1290
  FREE               21232      ( 20.7K)       52F0

Total  FREE :        36896      ( 36.0K) 

Total bytes available to programs (Conventional+Upper) :      656400   (641.0K)
Largest executable program size :                             619328   (604.8K)
Largest available upper memory block :                         21232   ( 20.7K)

   4587520 bytes total EMS memory
   4194304 bytes free EMS memory

  15728640 bytes total contiguous extended memory
         0 bytes available contiguous extended memory
  13008896 bytes available XMS memory
           MS-DOS resident in High Memory Area
I can run windows 3.0 fine in enhanced mode, with 256 colours, and all that jazz. This gives me 619,328 largest executable program size in conventional RAM.
User avatar
ppgrainbow
Posts: 479
Joined: Thu 04 Sep, 2014 7:03 am
Contact:

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by ppgrainbow »

That's a pretty nifty configuration so far, Neozeed! :)

I'm trying to do some memory optimisation under VMware Player and for some reason, the VMware BIOS has a bug that causes QEMM Optimize feature to bomb out completely!

The good news is that VMware does have ISO CD-ROM support, however, using the OAKCDROM.SYS and MSCDEX.EXE drivers can consume a lot of memory (up to 62 KB to be exact). Talk about poor memory management here. :(

Here's my CONFIG.SYS from VMware Player:
FILES=50
BUFFERS=50
FCBS=1,0
STACKS=9,256
DOS=HIGH,UMB

DEVICE=C:\QEMM\QEMM386.SYS RAM XBDA:L BE:N P:VME:N X=E000-EFFF I=DC00-DFFF
DEVICE=C:\QEMM\QDPMI.SYS SWAPFILE\DPMI.SWP SWAPSIZE=16384
DEVICE=C:\QEMM\DOS-UP.SYS @C:\QEMM\DOS-UP.DAT

DEVICE=C:\DOS\OAKCDROM.SYS /DLVMW_IDE /V
DEVICE=C:\WINDOWS\IFSHLP.SYS

LASTDRIVE=Z
Now, here's my AUTOEXEC.BAT file:
@ECHO OFF
PATH C:\DOS;C:\WINDOWS

PROMPT [$p$g]

SET PATH=%PATH%;C:\IEXPLORE
SET PATH=%PATH%;C:\NDW
SET PATH=%PATH%;C:\QEMM
SET PATH=%PATH%;C:\SB16

SET TEMP=C:\TEMP
SET SOUND=C:\SB16
SET BLASTER=A200 I5 D1 H5 P330 T6
SET MIDI=SYNTH:1 MAP:E

DIAGNOSE /S
MIXERSET /P /Q

LH MSCDEX /E /D:VMW_IDE /L:X

LH NET START

HIDE87

CTMOUSE

DOSIDLE
The end result is that I have the following:

Total under 1 MB (free): 581 KB
Largest executable program size: 549 KB
Largest free upper memory block: 24 KB

The current configuration is 64 MB memory (63 MB RAM usable) and a SanDIsk SDCFH-2048 compact flash drive that is used as a physical drive.

Somehow, there needs to be a way to put the OAKCDROM and PCNTND drivers in upper memory. How can it be done though?
Last edited by ppgrainbow on Fri 11 Sep, 2015 2:05 am, edited 1 time in total.
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by Battler »

- ppgrainbow: You do that by replacing DEVICE= with DEVICEHIGH= . :p
User avatar
ppgrainbow
Posts: 479
Joined: Thu 04 Sep, 2014 7:03 am
Contact:

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by ppgrainbow »

Battler wrote:- ppgrainbow: You do that by replacing DEVICE= with DEVICEHIGH= . :p
That's what I'm going to do right now. However, with only 24 KB of upper memory left, I'm gonna have to find ways to manually optimize the CONFIG.SYS and AUTOEXEC.BAT files, because the QEMM Optimize feature doesn't work properly in VMware.
Dw213
Posts: 1
Joined: Fri 08 Jul, 2022 9:39 pm

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by Dw213 »

How can I set a USB compact flash card as a physical drive in PCEM? I'm trying to link it to my IBM PC dos 7 emulation.
User avatar
Arjen42
Posts: 131
Joined: Fri 11 Jun, 2021 3:15 pm

Re: [DISCUSSION] MS-DOS memory optimisation tricks

Post by Arjen42 »

Hi Dw,

You asked an off topic question that you really should have opened a separate thread for.
  • If you run Linux, you have to identify the /dev/sd? device node, and assign read/write permissions on it to your user account. Then select /dev/sd? as your hard drive image file.
  • If you run Windows, it might not be so easy. In theory you could directly access a storage device using the \\.\Device\Harddisk? name, but I'm not sure Windows would let you that as easily as Linux.
In practice the only reason to this is to copy files between PCem virtual machines and a physical DOS machine using a compact flash card instead of a hard disk. In that case you would probably better of mounting the PCem vm harddrive image file on the host computer and copy the to or from the compact flash card.

If you need to partition and/or make the compact flash card bootable you should do that on the physical DOS machine, booting from a floppy drive or a floppy drive emulator.
Post Reply