Computer Hope

Microsoft => Microsoft DOS => Topic started by: maferv on December 02, 2016, 06:39:03 PM

Title: Problem loading EMS memory and USBMASS.EXE
Post by: maferv on December 02, 2016, 06:39:03 PM
I need to load EMS (EMM386.exe) and USBMASS (proprietary usb 2.0 driver) on this harddrive-less Pentium 1 computer.

With ems, while usbmass.exe loads, when I check my usb stick dir, instead of the list of files, all I see is "IO.SYS" and nothing else.

So I guess this has to do with emm386 and how it is using some part of the memory that usbmass.exe needs, because without ems, usbmass.exe works fine.
I was trying many configurations but although I read a lot and tried a lot, I'm a complete ignorant of how to fine-tune emm386 and assign "parts" of the memory.

The usbmass.exe allows one to define the start address of i/o pool and the start address of memory pool, the help page says:

/io:n start address of I/O pool (default 0x00002000)
/M:n start address of memory pool (default 0x000D0000)

So what parameters should I pass to either emm386.exe or usbmass.exe to get them both working at the same time?

Thank you in advance.
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: DaveLembke on December 02, 2016, 07:12:06 PM
Quote
So what parameters should I pass to either emm386.exe or usbmass.exe to get them both working at the same time?

One will be before the other. DOS is single threaded and so its one thing at a time. However the order of what is first, second, third is how its done.

What is your base memory with USBMASS working compared to what it is with emm386 active and USBMASS broken? Sometimes you need to tweak it to increase your base memory. However if you can get emm386 loaded and then LoadHigh the USBMASS to get it away from consuming base memory that might be the trick to fixing this. More here: https://en.wikipedia.org/wiki/LOADHIGH

Back in the day, fine tuning for maximum base memory available was best. TSR's and other stuff loaded down the base (conventional) memory and so some programs failed to run at less than say 592k available of the 640k base memory. Best i ever got was like 608k available but usually it was closer to 600k available.

More here: https://en.wikipedia.org/wiki/DOS_memory_management
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: patio on December 02, 2016, 09:22:15 PM
More info...Post your autoexec and config files.
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: maferv on December 02, 2016, 10:02:41 PM
Hey thanks for the help and the info. I tried before with DEVICEHIGH...

I liked to read the Wikipedia article but I don't understand the hex numbers and how to identify the different ranges. I think I need to specify something in emm386 with the x or i parameters. I guess I need somebody to tell me which values should I set for x and i based on the info of usbmass.exe I posted before:

Quote
/io:n start address of I/O pool (default 0x00002000)
/M:n start address of memory pool (default 0x000D0000)

This is the info of mem:

Without EMS:
~~~~~~~~~~~~

Code: [Select]
Normal boot:

Conventional     used  55K free    585K
Upper used   0K free      0K
Reserved used 384K free      0K
Extended used  64K free 64,448K
-----------------------------------
Total used 503K free 65,033K


USBMASS.EXE loaded and working

Code: [Select]
Conventional     used 148K free    492K
Upper used   0K free      0K
Reserved used 384K free      0K
Extended used  72K free 64,440K
-----------------------------------
Total used 604K free 64,932K


USBMASS.EXE /nu loaded and working

Code: [Select]
Conventional     used 148K free    492K
Upper used   0K free      0K
Reserved used 384K free      0K
Extended used  64K free 64,448K
-----------------------------------
Total used 596K free 64,940K



With EMS (emm386.exe noems):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Normal boot:

Code: [Select]
Conventional     used  15K free    625K
Upper used  45K free    110K
Reserved used 384K free      0K
Extended used 305K free 64,052K
-----------------------------------
Total used 749K free 64,787K


USBMASS.EXE loaded and broken

Code: [Select]
Conventional     used    59K free    581K
Upper used    94K free     61K
Reserved used   384K free      0K
Extended used   565K free 63,792K
-----------------------------------
Total used 1,102K free 64,434K


USBMASS.EXE /nu loaded and broken

Code: [Select]
Conventional     used   108K free    532K
Upper used    45K free    110K
Reserved used   384K free      0K
Extended used   565K free 63,792K
-----------------------------------
Total used 1,102K free 64,434K


The /nu switch of usbmass.exe according to the help:
/NU Do not move part of resident code to upper memory   


Tried to no avail:
LH usbmass.exe in autoexec.bat and
DEVICEHIGH usbmass.exe in config.sys


Full CONFIG.SYS:

DEVICE=HIMEM.SYS
DOS=HIGH,UMB
*DEVICE=EMM386.EXE noems
COUNTRY=001,437,COUNTRY.SYS
SHELL=COMMAND.COM /P /E:640
FILES=30
FCBSHIGH=4,0
LASTDRIVEHIGH=26
STACKSHIGH=9,256
SET TEMP=.
SET TMP=.


Full AUTOEXEC.BAT:

@ECHO OFF
PROMPT $P$G
PATH=A:\;..
LFNFOR ON
SET DIRCMD=/4
MODE CON RATE=32 DELAY=1
LH KILLER
LH DOSKEY
LH DOSLFN
set blaster=a220 i5 d1 h5 p330
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: BC_Programmer on December 02, 2016, 10:26:25 PM
Tne EMM386 X= option lets you specify a range of segments to exclude from EMM386 using for paging to and from emulated EMS. unfortunately USBMASS only gives you the starting address. There is no documentation about how large the data it places there is. The documentation setup instructions for USBMASS appear to specifically mention that it isn't compatible with EMM386 configured to emulate expanded memory.


For what purpose do you want Expanded Memory? Expanded Memory was used by even older programs and the purpose of EMM386 was to effectively allow software designed for EMS memory to use XMS memory instead.
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: maferv on December 03, 2016, 01:04:59 AM
I need EMS to have music in Dune, otherwise the highest amount of memory I could get with without EMS was 500 kb, and that is with the USBMASS driver included and the iso mounted with shscdsuhd. That is enough for sounds, but not for music (requires 535K of low memory).

Maybe you could tell me how to put that starting address (btw, which one matters here, the I/O pool address or the memory pool address?) in ems, and then I could try different end values until I get it working... what do you think?

I'm pretty lame when it comes to DOS.
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: BC_Programmer on December 03, 2016, 04:21:48 AM
Looking into it further, the issue is not a simple memory conflict; USBMASS.EXE doesn't support operating in protected mode, and get's screwed up. As it happens, EMM386 uses protected mode if it is providing Expanded Memory Services.

So what this means is that the operating mode where EMM386 offers Expanded memory simply cannot work with USBMASS.EXE.

Note that Expanded Memory(EMS) is not Extended memory(XMS); and Dune itself confuses things further because while the game only supports XMS, the setup program called it "Expanded Memory".

As you've noted your issue is a lack of conventional memory. Neither EMS nor XMS really save conventional memory- you can only really load  drivers either into conventional memory or in the 384K HMA, so the MS-DOS memory limitations effectively mean there simply isn't a good solution. The best you might be able to do is using something like memmaker or sizer tools, which might b e able to more efficiently pack software into the HMA, but it looks like you are using FreeDOS so I don't know if those tools are available.



Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: maferv on December 03, 2016, 05:04:00 AM
VICTORY!  (|

It took me a lot of hours and pain but I finally got it working. Thanks for your help.

config.sys

dos=high,umb
device=himem.sys
device=emm386.exe ram i=eeee-efff

Actually I don't know WHY this works, but it does. I think I guessed the appropriate portion of memory out of sheer luck, right?

Now I can play it directly from the thumbstick, with soundblaster/adlib music and voices. No hard disk. No CD drive. Magic.

Can anybody please explain why I got it working this way? I can do more tests if you tell me, so we can figure out exactly why this works and learn how emms and usbmass coexist.

By the way, I'm using a MS-DOS 7.1 boot disk.

In case anybody cares, my autoexec.bat looks like this:

Code: [Select]
@echo off
::loads a script that loads usbmass.exe automatically
call usbmass.bat
:: loads the sound driver
c:\drivers\alsound\alsinit
::loads the mouse driver
c:\drivers\ctmouse
::mounts the iso
shsucdhd /f:c:\isos\dune.iso
shsucdx /d:shsu-cdh
::play dune
d:\dune c:\games\dunecd
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: DaveLembke on December 03, 2016, 05:54:35 AM
Quote
Can anybody please explain why I got it working this way? I can do more tests if you tell me, so we can figure out exactly why this works and learn how emms and usbmass coexist.

The ram i=eeee-efff is using tail end of addresses, and my guess is that USBMASS is operating in an area that doesnt overlap this memory address range. Kind of surprised you found a sweet spot to have it working after reading that BC Programmer found documentation stating: The documentation setup instructions for USBMASS appear to specifically mention that it isn't compatible with EMM386 configured to emulate expanded memory.

Congrats in getting it to work.  :)
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: maferv on December 03, 2016, 11:47:31 AM
Thank you!

So I'm kind of narrowing down EMS to the bottom of the UMB?

It sounds reasonable, doesn't it? Like telling it: "Don't bother, do your stuff only over there and let the grownups use all the rest of the UMB", right?

As you can see, I still don't understand much =(

And remember the start address of memory pool of usbmass (default 0x000D0000)?
How does this translate to the four character format EMS handles?


Maybe this helps too:

Without EMS:

Code: [Select]
A:\>mem /m usbmass

Segment: 00ECD

Region:

Total: 95,472 (93K)
Type: Program


with emm386.exe ram i=eeff-efff it works too, am I narrowing down EMM386.exe even more with this??

This is the mem /m usbmass then:

Code: [Select]
Segment: 004C8
Region:
Total:45,312(44K)
Type: Program

Segment: 0CE83
Region: 1
Total:10,752(11K)
Type: Data

Segment: 0D123
Region: 1
Total:28,320(28K)
Type: Data

Segment: 0D80D
Region: 1
Total:11,120(11K)
Type: Data

Total Size 95,504 (93K)

Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: Geek-9pm on December 03, 2016, 03:00:47 PM
Reference:
http://www.computerhope.com/jargon/e/ems.htm
The article has relevant links to related items.
Like:
http://www.computerhope.com/emm386hl.htm
Title: Re: Problem loading EMS memory and USBMASS.EXE
Post by: BC_Programmer on December 03, 2016, 03:21:02 PM
Code: [Select]
[quote]
I=mmmm-nnnn

Specifies a range of segment addresses to be used (included) for an EMS page or for UMBs. Valid values for mmmm and nnnn are in the range A0000h through FFFFh and are rounded down to the nearest 4-kilobyte boundary. The X switch takes precedence over the I switch if the two ranges overlap.

RAM=mmmm-nnnn

Specifies a range of segment address to be used for UMBs and also enables EMS support. If you do not specify a range, EMM386 uses all available adapter space to create UMBs and a page frame for EMS.



Quote
How does this translate to the four character format EMS handles?
The Segment format is not EMS specific. In this case it's specified for EMM386 to exclude a range of segments, and doesn't include the specific location within that segment.

EEEE would be the segment starting at absolute byte position 978,656 in memory (basically get the decimal from the hex and multiply by 16 to get the actual position). The nearest 4K boundary rounding down is 974,848.

EFFF is absolute position 983,024. Rounded down to the nearest 4K is 983,040. You've specified a range of exactly 8 Kilobytes at the very top of the HMA for EMM386 to use....

But RAM may be overriding the I= part anyway. According to the MS-DOS Help passage I quoted, if no range is specified it will use  all available adapter space as a page frame. EMM386 also refers to 16K EMS Pages which suggests it needs at least 16K to use as a page frame to allow EMS, so I think the RAM argument could be overriding the I= argument entirely.