VOGONS


First post, by Shane32

User metadata
Rank Newbie
Rank
Newbie

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:

[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

Reply 1 of 4, by Zup

User metadata
Rank Oldbie
Rank
Oldbie

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!

Reply 2 of 4, by collector

User metadata
Rank l33t
Rank
l33t

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

DOSBox-X branch

The Sierra Help Pages -- New Sierra Game Installers -- Sierra Game Patches -- New Non-Sierra Game Installers

Reply 3 of 4, by Shane32

User metadata
Rank Newbie
Rank
Newbie

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/help/6933 … arison-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.

Reply 4 of 4, by BlackJack

User metadata
Rank Newbie
Rank
Newbie
Shane32 wrote:

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

Dosbox 0.74 seems to always have an FPU. I wasn't able to configure it so that this simple test program doesn't detect an FPU:

; nasm fpu_test.asm -o fpu_test.com

cpu 8086
org 100h

start:
mov dx, no_fpu_txt

fninit
fnstsw [fpu_status]
cmp word [fpu_status], 0
jne .nope
fnstcw [fpu_control]
cmp word [fpu_control], 037fh
jne .nope

mov dx, fpu_txt
.nope:
mov ah, 09h
int 21h

mov ax, 4c00h
int 21h

no_fpu_txt:
db "No "
fpu_txt:
db "FPU found", 13, 10, '$'

fpu_status:
dw 0ffffh
fpu_control:
dw 0ffffh

The setting `fpu=false` is neither documented in the config file or man page, nor does it have any effect on my 0.74 installation.

Attachments

  • Filename
    fpu_test.zip
    File size
    614 Bytes
    Downloads
    57 downloads
    File comment
    Source & COM
    File license
    Fair use/fair dealing exception

“The city's central computer told you? R2D2, you know better than to trust a strange computer!” — C3PO