FPU math errors

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

FPU math errors

Postby Shane32 » 2018-1-01 @ 15:45

I'm having problems with the fpu enabled on DosBox-X 12-31-2017. To illustrate, this one-line BASIC program returns 0 (false) instead of -1 (true):

PRINT VAL("1") = 1

With the FPU turned off it works fine. I've tried all the core and cpu settings, but no matter what, the example above fails whenever the fpu is enabled. This can be seen in the BASIC game NIBBLES (included with MS-DOS 5) where the game will not accept a response to "number of players?", or the game Operation Neptune, in which the built-in calculator always responds with "answer too large" and will not accept a correct answer.

Is this a bug in the fpu emulation? Or is there another setting I'm missing to properly emulate a 80486DX2 (which should include a fpu)? It would seem that when core=simple, the fpu should simulate a fpu from that era, even if the answers are a bit different from when core=dynamic.

Note that the problem does not occur with Dosbox 0.74. I'm guessing it does not emulate the fpu at all.

My setup is:
Doxbox-X 12-31-2017 build
Windows 10 64 bit
Intel Core i7-7567U 3.5GHz / 16GB RAM / integrated graphics

My config is:
Code: Select all
[sdl]
output=direct3d
fullscreen=true
[dosbox]
a20=mask
[render]
aspect=true
scaler=normal3x
[cpu]
core=auto
cputype=auto
fpu=true
cycles=25000
[midi]
mpu401=uart

I'm using MS PDS 7.1 BASIC within DosBox.

Thanks!
Shane
User avatar
Shane32
Newbie
 
Posts: 5
Joined: 2018-1-01 @ 15:28

Re: FPU math errors

Postby Zup » 2018-1-01 @ 16:18

You should check it on a real DOS machine, because this may be a BASIC issue.

I mean... what kind of data is 1 and what kind of data returns VAL()? Maybe you are comparing a integer number with a float, and in some languages this can lead to unexpected results.
I have traveled across the universe and through the years to find Her.
Sometimes going all the way is just a start...

I'm selling some stuff!
User avatar
Zup
Oldbie
 
Posts: 1026
Joined: 2003-10-04 @ 12:16

Re: FPU math errors

Postby collector » 2018-1-01 @ 16:19

You might want to post this in the DOSBox-X thread to be sure that TheGreatCodeholio sees it.

viewtopic.php?f=41&t=31881
User avatar
collector
l33t
 
Posts: 4037
Joined: 2003-1-15 @ 10:39

Re: FPU math errors

Postby Shane32 » 2018-1-01 @ 17:54

You're correct - VAL returns a double, and then it's compared to an integer. With single-precision variables, there isn't a problem.

I don't know about the rest, but I never remember a problem with NIBBLES or Operation Neptune on my old 486DX2-66 machine that I grew up on.

There is a MS KB article about comparisons in BASIC, but ... it did work ...
https://support.microsoft.com/en-us/hel ... n-problems

I have not found any FPU-testing programs online. So for now I'll just leave the fpu disabled. None of the software I'm emulating requires a fpu anyway.
User avatar
Shane32
Newbie
 
Posts: 5
Joined: 2018-1-01 @ 15:28


Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 1 guest