Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"SYS2090: Unable to load User Program" #4

Closed
mike632t opened this issue Oct 1, 2023 · 13 comments
Closed

"SYS2090: Unable to load User Program" #4

mike632t opened this issue Oct 1, 2023 · 13 comments

Comments

@mike632t
Copy link
Contributor

mike632t commented Oct 1, 2023

Quick BASIC is one of the compiler you managed to test, but when running on Linux what is the incantation needed to avoid the 'SYS2090: Unable to load User Program' error.

This copy of an old Microsoft KB article Q42591 seems to describe the same problem.

You have already far exceeded my expectations!

@davidly
Copy link
Owner

davidly commented Oct 2, 2023

Which .exe are you running when you see this error? Also, which version of Quick Basic are you using? Thanks.

@mike632t
Copy link
Contributor Author

mike632t commented Oct 2, 2023

What I assumed was the command line BASIC compiler in the 'qbx' folder.

$ ls
djl8086d.hxx   djl_durat.hxx  djl_perf.hxx  gwbasic    LICENSE  mgr.bat  msc_v1  m.sh       qbx         tasm       wordstar
djl_con.hxx    djl_kslog.hxx  djl_thrd.hxx  i8086.cxx  m.bat    mr.bat   msc_v2  ntvdm      QCL250.DOS  turbo3dos
djl_cycle.hxx  djl_os.hxx     djltrace.hxx  i8086.hxx  mg.bat   mr.sh    msc_v3  ntvdm.cxx  README.md   turbodos
$ cd qbx
$ ls
BC.EXE        BCL71ANR.LIB  BCL71ENR.LIB  BRT71ANR.EXE  BRT71ENR.EXE  LIB.EXE   QBX.EXE       TP.BAS
BCL71AFR.LIB  BCL71EFR.LIB  BRT71AFR.EXE  BRT71EFR.EXE  comptp.bat    LINK.EXE  STARTREK.BAS  TREKINST.BAS
$ ../ntvdm BC.EXE 
SYS2090: The system is unable to load the program.
$ 

@mike632t
Copy link
Contributor Author

mike632t commented Oct 2, 2023

With regards to path names it might be more logical if (on Linux) you assumed that current working folder was actually 'C:' when launching 'ntvdm' as Linux has no concept of drive letters?

@davidly
Copy link
Owner

davidly commented Oct 2, 2023

When BC.EXE starts, it opens BC.EXE, allocates some RAM, and reads parts of BC.EXE into various locations. I suspect that the file open fails due to case differences in the path.

NTVDM makes the DOS current directory the Linux current directory, but in the form C:\CURRENT\LINUX\FOLDER. I tried making C:\ be the current folder, but that makes apps that look for paths like "..\INCLUDE" fail. The best workaround I've found
is to make a new root folder (I called my /DOSLAND) and make everything below that be uppercase. Copy the qbx folder contents to /DOSLAND/QBX and use the -u switch with NTVDM, and it'll work.

Different apps attempt to open files with all permutations of case in path and filenames. Some apps uppercase parts of paths
and other apps lowercase parts of paths seemingly at random. It's all very painful without just forcing everything to be
uppercase on the filesystem and with -u.

Build an app like TP.BAS like this:

../ntvdm -u BC.EXE tp.bas tp.obj tp.lst /O
../ntvdm -u LINK.EXE tp,,tp,,nul.def

@mike632t
Copy link
Contributor Author

mike632t commented Oct 2, 2023

You are right the current working folder wouldn't work but using the folder containing 'ntvdm' might. (Or just specify the root folder as a parameter).

So (on Linux) if you had

<some path>\ntvdm 
<some path>\lib\ EM.LIB
<some path>\bin\BC.EXE
<some path>\usr\TP.BAS

This would appear to the DOS programs be

C:/ntvdm 
C:/LIB/EM.LIB
C:/BIN/BC.EXE
C:/USR/TP.BAS

@davidly
Copy link
Owner

davidly commented Oct 2, 2023

Ooh -- a command line argument makes sense!

Also, I discovered when building ntvdm on RISC-V that I have to force g++ to use signed char via -fsigned-char -- without this there were failures executing some instructions. I'm not sure on Debian if the default is signed, but that may explain some odd behavior of NTVDM.

@mike632t
Copy link
Contributor Author

mike632t commented Oct 2, 2023

I give that a try.

In the mean time I thought I'd try just tidying up the help text and README to make them a bit more Linux like, and I've added a couple of options to display the version/build and to display the usage information using -v and -? (I know the latter is not very Linux like but I wasn't going to rewrite the whole command line parser!).

I've left the usage details (almost) unchanged on Windows

C:> ntvdm -?
NT Virtual DOS Machine: emulates an 8086 MS-DOS 3.00 runtime environment enough to run COM/EXE apps
usage: ntvdm [arguments] <DOS executable> [arg1] [arg2]
  notes:
            -c     don't auto-detect apps that want 80x25 then set window to that size;
                   stay in teletype/console mode.
            -C     always set window to 80x25; don't use teletype mode.
            -d     don't clear the display on app exit when in 80x25 mode
            -e     comma-separated list of environment variables. e.g. -e:include=..\include,lib=..\lib
            -h     workaround for Packed File Corrupt error: load apps High, above 64k
            -i     trace instructions as they are executed to ntvdm.log (this is verbose!)
            -p     show performance information
            -s:X   speed in Hz. Default is to run as fast as possible.
                   for 4.77Mhz, use -s:4770000
                   to roughly match a 4.77Mhz 8088, use -s:4500000
            -t     enable debug tracing to ntvdm.log
            -z:X   applies X as a hex mask to SetProcessAffinityMask, e.g.:
                     /z:11    2 performance cores on an i7-1280P
                     /z:3000  2 efficiency cores on an i7-1280P
                     /z:11    2 random good cores on a 5950x
            -v     output version information and exit.
            -?     output this help and exit.
 [arg1] [arg2]     arguments after the .COM/.EXE file are passed to that command
  examples:
      ntvdm -c -t app.com foo bar
      ntvdm -s:4770000 turbo.com
      ntvdm s:\github\MS-DOS\v2.0\bin\masm small,,,small
      ntvdm s:\github\MS-DOS\v2.0\bin\link small,,,small
      ntvdm -t b -k myfile.asm
C:>

However, on Linux it looks a bit more Linux like (and perhaps a bit too terse) with the example commands modified to show how to use the escape characters to allow the use of the MSDOS backslash and a semi-colon.

Windows specific option are omitted.

$ ./ntvdm -?
Usage: ntvdm [OPTION]... PROGRAM [ARGUMENT]...
Emulates an 8086 and MS-DOS 3.00 runtime environment.

  -c               don't automatically change window size.
  -C               change text area to 80x25 (don't use tty mode).
  -d               don't clear the display on exit
  -u               force DOS paths to be uppercase
  -l               force DOS paths to be lowercase
  -e:env,...       define environment variables.
  -h               load high above 64k.
  -i               trace instructions to ntvdm.log.
  -t               enable debug tracing to ntvdm.log
  -p               show performance stats on exit.
  -s:X             set processor speed in Hz.
                     for 4.77 MHz 8086 use -s:4770000.
                     for 4.77 MHz 8088 use -s:4500000.
  -v               output version information and exit.
  -?               output this help and exit.

Examples:
  ntvdm -u -e:include=.\\inc msc.exe demo.c,,\;
  ntvdm -u -e:lib=.\\lib link.exe demo,,\;
  ntvdm -u -e:include=.\\inc,lib=.\\lib demo.exe one two three
  ntvdm -s:4770000 turbo.com
$

On both operating systems the version is shown along with a copyright and licence (I manged to get rid of the extra spaces in the date but it is very 'English' - you may which to change that! :-) )

$ ./ntvdm -v
Copyright(C) DJL 2023
License CC0 1.0 Universal <https://creativecommons.org/publicdomain/zero/1.0/>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Built for amd64 release on 2 Oct 23 23:16:32 by g++ on linux

$ 

If that looks OK to you I'll submit a pull request (if I can figure out how) when I've updated the README with a separate section for Linux users including how to get the META (Alt) key to work and some Linux specific examples...

@davidly
Copy link
Owner

davidly commented Oct 2, 2023

Very cool -- yes, please submit a PR as this looks great!

@davidly
Copy link
Owner

davidly commented Oct 4, 2023

Sorry @mike632t I was busy with my day job. Please resubmit the PR and I'll approve it tonight.

@mike632t
Copy link
Contributor Author

mike632t commented Oct 4, 2023

No worries - I think I messed up any way! New PR submitted (which should include your latest changes) which should make merging (a bit) easier...

@davidly
Copy link
Owner

davidly commented Oct 8, 2023

Is the original issue now resolved? I'm guessing it is. If not, please reactivate this item. Thanks!

@davidly davidly closed this as completed Oct 8, 2023
@davidly
Copy link
Owner

davidly commented Oct 18, 2023

With regards to path names it might be more logical if (on Linux) you assumed that current working folder was actually 'C:' when launching 'ntvdm' as Linux has no concept of drive letters?

@mike632t I've added a /r argument that takes a folder that gets mapped to C:\ That should make it easier to run apps on Linux without creating a new top-level folder that's all uppercase.

@mike632t
Copy link
Contributor Author

That's awesome.

I can't wait to try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants