What is causing 'Illegal Read' problem?

Here you can post questions about GP2, your favourite GP2 things and errorreports/problems!
Post Reply
User avatar
Mad_Troyden
GP2 Starter
Posts: 67
Joined: 02.01.2011, 16:55

What is causing 'Illegal Read' problem?

Post by Mad_Troyden »

First of all cool shot:
That isn't this problem but looks like it
That isn't this problem but looks like it
In my problem is only 'Illegal read from: ******* CS:IP 180:*******'. But it isn't better because of this.
It usually has been seen at Stauber's Monaco, and now at Fernando Pedace's Interlagos. Please help me :(
User avatar
AD
GP2 Acc
Posts: 720
Joined: 12.09.2006, 15:02

Re: What is causing 'Illegal Read' problem?

Post by AD »

In the hope that I don't end up sounding as enigmatic as that wonderful screenshot:

"Illegal read" points to memory corruption. Usually, the reason for that is either that a program managed to write data into a memory address it wasn't supposed to use, and therefore can't read the data back from that address -- or a program managed to read an address it wasn't supposed to read, and ends up getting whatever data is stored there, which may not be relevant or interpretable for whatever function is trying to read the data. In either case, the program ends up with data it's unable to use as intended, hence the crash.

Now, there are different possible reasons why this could occur. Generally, such errors can happen with old applications these days, because we have amounts of memory developers and programmers might not have actually dreamt of fifteen, twenty years ago. So the software, i.e. GP2, might not have been proofed against these kinds of show-stopping access mix-ups.

Apparently, there are a number of other old games where similar-sounding issues have come up over the years. I've tried to find some reasons why these problems occur, and potential workarounds. It's not easy as long as it's not clear which program caused the crash where, but here's what I've come up with:

First of all, there's a console command in DosBox called "loadfix" that can be used to reduce the amount of conventional memory available for applications that run within the emulator. Normally, conventional memory should be somewhere below 640 KB (you can check the exact amount by typing mem at the prompt). If a game was getting screwed up somehow by that amount being too much, loadfix reduces this amount by 64 KB (or any amount, if you type loadfix and then the amount of memory you want to substract, for example: loadfix -128 would reduce by 128 KB).
The question mark with this workaround is that GP2 uses DOS4GW to expand beyond conventional memory. And I couldn't find a solution to limit the extended memory. So maybe this is something that works in general, but might not be effective here. Rather if you`re trying to revive an old Wing Commander part or something.

Second, I've seen threads for other old games where checking and/or adjusting the cpu core mode in DosBox's configuration file affects stability. If you want to look into that, you can access the file by running

Code: Select all

DOSBox.exe -editconf notepad.exe
There's a section within the file called [cpu], which defines the parameters for the CPU emulation. Usually, the CPU is set to auto and the section of the file looks like this:

Code: Select all

[cpu]
#      core: CPU Core used in emulation. auto will switch to dynamic if available and appropriate.
#            Possible values: auto, dynamic, normal, simple.
#   cputype: CPU Type used in emulation. auto is the fastest choice.
#            Possible values: auto, 386, 386_slow, 486_slow, pentium_slow, 386_prefetch.
#    cycles: Amount of instructions DOSBox tries to emulate each millisecond.
#            Setting this value too high results in sound dropouts and lags.
#            Cycles can be set in 3 ways:
#              'auto'          tries to guess what a game needs.
#                              It usually works, but can fail for certain games.
#              'fixed #number' will set a fixed amount of cycles. This is what you usually need if 'auto' fails.
#                              (Example: fixed 4000).
#              'max'           will allocate as much cycles as your computer is able to handle.
#            
#            Possible values: auto, fixed, max.
#   cycleup: Amount of cycles to decrease/increase with keycombo.(CTRL-F11/CTRL-F12)
# cycledown: Setting it lower than 100 will be a percentage.

core=auto
cputype=auto
cycles=auto
cycleup=10
cycledown=20
The parameter for "core" set to "auto" can, as the comments say, switch to dynamic mode -- which appears to produce some crashes. So you could try to make DosBox avoid dynamic mode by forcing "normal" or "simple" here.

Third, DOS4GW could somehow cause this memory shakeup, which we couldn't change, because we don't have access to that, anyway, and otherwise, it's not being developed / updated / bugfixed etc. anymore.

Fourth, I found this discussion on what dosbox.com links to as the official support forums, where a user got "illegal read" messages while getting a certain, aged archeologist to appear on his screen, and there's two responses from a developer saying it may or may not be DosBox itself causing such a kind of error through some potential bug in the emulated memory. It's, however, one of these cases where you stumble upon a discussion that's years old, from 2009, in this case, and it's hard to determine if this has been verified, let alone fixed at all.

tl;dr: Some kind of memory corruption going on there, apparently.
1996 .. 2017 .. 21 years and counting ..
racer63
GP2 Gamer
Posts: 239
Joined: 02.05.2009, 18:15

Re: What is causing 'Illegal Read' problem?

Post by racer63 »

AD, I really want to congratulate you. You know a lot about memory management and DosBox.

I think the only solution for this kind of problems is to not use DosBox or any emulation to run games like GP2. These games are from an era of different computers and other technology. The best solution I have found myself so far is use a proper or near period computer. I use a 256 MB RAM Pentium III just for GP2 and other ancient games. Old computers are very very cheap. Today there are many problems with Win 7 for example, and in Windows 8 not just GP2. Amost all the games with some years will be unplayable. I think it´s a good moment to find a good Win 98/XP PIII or PIV PC just for enjoy games like GP2 or others, for the years to come.
User avatar
RacerBG
GP2 Pro
Posts: 999
Joined: 09.08.2010, 17:57
Location: Bulgaria

Re: What is causing 'Illegal Read' problem?

Post by RacerBG »

Windows 8 will have support for older games isnt it :?:

I had readed that he will have. :roll:
racer63
GP2 Gamer
Posts: 239
Joined: 02.05.2009, 18:15

Re: What is causing 'Illegal Read' problem?

Post by racer63 »

RacerBG wrote:Windows 8 will have support for older games isnt it :?:

I had readed that he will have. :roll:
Hmm, i would not be so sure. Remember what they said about Win7.
Post Reply