VOGONS


First post, by StinkyFox

User metadata
Rank Newbie
Rank
Newbie

Two bugs. Bug #1 present in both 0.74 and 0.74-2. Bug #2 only present in 0.74-2.

Host platform:
MacOS 10.13.6
Macbook Pro Retina i7 with discrete AMD graphics (with GFX switching to Intel Iris Pro)
16GB RAM
Built-in soundcard

Bug #1 :
Affected versions: At least 0.74 and 0.74-2
Problem: Fasttracker II runs too slowly and breaks up, depending on what page is being displayed in Fasttracker II.
Solution: Change output=surface to output=opengl
Other DOS programs affected?: Untested.

Bug #2 :
Affected versions: 0.74-2 only. 0.74 is not affected.
Problem: Fasttracker II is missing channels and plays back corrupted noises on some channels when in GUS mode. Soundblaster mode is not affected.
Solution: No solution found. Swapping IRQ lines 5/7 between GUS and Soundblaster does not help.
Other DOS programs affected?: Untested.

Fasttracker II configuration:
MOD file for testing: ambpower.mod (Ambient Power by Vogue of Triton, 8 channels Protracker)
Output device: GUS or SB
Sampler: GUS
Mixing frequency in FTII: 44100, interpolation off, 8 bit mixing, Amiga frequency table
GUS addresses: $240, DMA 3, IRQ 7 (also tested with 5), RecDMA 3
SB addresses: $220, DMA 1, HDMA 5, IRQ 5 (also tested with 7), MIDI port $330
GUS DOS driver disk is installed.

DOSBox configuration:
Audio mixing rate for all sound devices: 49716
Other rates untested. To confirm: is this where the regression is?

DOSBox config file:
# This is the configuration file for DOSBox 0.74-2. (Please use the latest version of DOSBox)
# Lines starting with a # are comment lines and are ignored by DOSBox.
# They are used to (briefly) document the effect of each option.

[sdl]
# fullscreen: Start dosbox directly in fullscreen. (Press ALT-Enter to go back)
# fulldouble: Use double buffering in fullscreen. It can reduce screen flickering, but it can also result in a slow DOSBox.
# fullresolution: What resolution to use for fullscreen: original, desktop or fixed size (e.g. 1024x768).
# Using your monitor's native resolution (desktop) with aspect=true might give the best results.
# If you end up with small window on a large screen, try an output different from surface.
# On Windows 10 with display scaling (Scale and layout) set to a value above 100%, it is recommended
# to use a lower full/windowresolution, in order to avoid window size problems.
# windowresolution: Scale the window to this size IF the output device supports hardware scaling.
# (output=surface does not!)
# output: What video system to use for output.
# Possible values: surface, overlay, opengl, openglnb.
# autolock: Mouse will automatically lock, if you click on the screen. (Press CTRL-F10 to unlock)
# sensitivity: Mouse sensitivity.
# waitonerror: Wait before closing the console if dosbox has an error.
# priority: Priority levels for dosbox. Second entry behind the comma is for when dosbox is not focused/minimized.
# pause is only valid for the second entry.
# Possible values: lowest, lower, normal, higher, highest, pause.
# mapperfile: File used to load/save the key/event mappings from. Resetmapper only works with the defaul value.
# usescancodes: Avoid usage of symkeys, might not work on all operating systems.

fullscreen=false
fulldouble=false
fullresolution=original
windowresolution=original
output=opengl
autolock=false
sensitivity=300
waitonerror=true
priority=higher,normal
mapperfile=mapper-0.74-2.map
usescancodes=true

[dosbox]
# language: Select another language file.
# machine: The type of machine DOSBox tries to emulate.
# Possible values: hercules, cga, tandy, pcjr, ega, vgaonly, svga_s3, svga_et3000, svga_et4000, svga_paradise, vesa_nolfb, vesa_oldvbe.
# captures: Directory where things like wave, midi, screenshot get captured.
# memsize: Amount of memory DOSBox has in megabytes.
# This value is best left at its default to avoid problems with some games,
# though few games might require a higher value.
# There is generally no speed advantage when raising this value.

language=
machine=svga_s3
captures=~/
memsize=32

[render]
# frameskip: How many frames DOSBox skips before drawing one.
# aspect: Do aspect correction, if your output method doesn't support scaling this can slow things down!
# scaler: Scaler used to enlarge/enhance low resolution modes. If 'forced' is appended,
# then the scaler will be used even if the result might not be desired.
# To fit a scaler in the resolution used at full screen may require a border or side bars,
# to fill the screen entirely, depending on your hardware, a different scaler/fullresolution might work.
# Possible values: none, normal2x, normal3x, advmame2x, advmame3x, advinterp2x, advinterp3x, hq2x, hq3x, 2xsai, super2xsai, supereagle, tv2x, tv3x, rgb2x, rgb3x, scan2x, scan3x.

frameskip=0
aspect=false
scaler=normal2x

[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 keycombos.(CTRL-F11/CTRL-F12)
# cycledown: Setting it lower than 100 will be a percentage.

core=auto
cputype=auto
cycles=auto
cycleup=10
cycledown=20

[mixer]
# nosound: Enable silent mode, sound is still emulated though.
# rate: Mixer sample rate, setting any device's rate higher than this will probably lower their sound quality.
# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
# blocksize: Mixer block size, larger blocks might help sound stuttering but sound will also be more lagged.
# Possible values: 1024, 2048, 4096, 8192, 512, 256.
# prebuffer: How many milliseconds of data to keep on top of the blocksize.

nosound=false
rate=49716
blocksize=1024
prebuffer=25

[midi]
# mpu401: Type of MPU-401 to emulate.
# Possible values: intelligent, uart, none.
# mididevice: Device that will receive the MIDI data from MPU-401.
# Possible values: default, win32, alsa, oss, coreaudio, coremidi, none.
# midiconfig: Special configuration options for the device driver. This is usually the id of the device you want to use
# (find the id with mixer/listmidi).
# Or in the case of coreaudio, you can specify a soundfont here.
# See the README/Manual for more details.

mpu401=intelligent
mididevice=default
midiconfig=

[sblaster]
# sbtype: Type of Soundblaster to emulate. gb is Gameblaster.
# Possible values: sb1, sb2, sbpro1, sbpro2, sb16, gb, none.
# sbbase: The IO address of the soundblaster.
# Possible values: 220, 240, 260, 280, 2a0, 2c0, 2e0, 300.
# irq: The IRQ number of the soundblaster.
# Possible values: 7, 5, 3, 9, 10, 11, 12.
# dma: The DMA number of the soundblaster.
# Possible values: 1, 5, 0, 3, 6, 7.
# hdma: The High DMA number of the soundblaster.
# Possible values: 1, 5, 0, 3, 6, 7.
# sbmixer: Allow the soundblaster mixer to modify the DOSBox mixer.
# oplmode: Type of OPL emulation. On 'auto' the mode is determined by sblaster type. All OPL modes are Adlib-compatible, except for 'cms'.
# Possible values: auto, cms, opl2, dualopl2, opl3, none.
# oplemu: Provider for the OPL emulation. compat might provide better quality (see oplrate as well).
# Possible values: default, compat, fast.
# oplrate: Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly).
# Possible values: 44100, 49716, 48000, 32000, 22050, 16000, 11025, 8000.

sbtype=sb16
sbbase=220
irq=5
dma=1
hdma=5
sbmixer=true
oplmode=auto
oplemu=default
oplrate=49716

[gus]
# gus: Enable the Gravis Ultrasound emulation.
# gusrate: Sample rate of Ultrasound emulation.
# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
# gusbase: The IO base address of the Gravis Ultrasound.
# Possible values: 240, 220, 260, 280, 2a0, 2c0, 2e0, 300.
# gusirq: The IRQ number of the Gravis Ultrasound.
# Possible values: 5, 3, 7, 9, 10, 11, 12.
# gusdma: The DMA channel of the Gravis Ultrasound.
# Possible values: 3, 0, 1, 5, 6, 7.
# ultradir: Path to Ultrasound directory. In this directory
# there should be a MIDI directory that contains
# the patch files for GUS playback. Patch sets used
# with Timidity should work fine.

gus=true
gusrate=49716
gusbase=240
gusirq=7
gusdma=3
ultradir=C:\ULTRASND

[speaker]
# pcspeaker: Enable PC-Speaker emulation.
# pcrate: Sample rate of the PC-Speaker sound generation.
# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
# tandy: Enable Tandy Sound System emulation. For 'auto', emulation is present only if machine is set to 'tandy'.
# Possible values: auto, on, off.
# tandyrate: Sample rate of the Tandy 3-Voice generation.
# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
# disney: Enable Disney Sound Source emulation. (Covox Voice Master and Speech Thing compatible).

pcspeaker=true
pcrate=49716
tandy=off
tandyrate=49716
disney=true

[joystick]
# joysticktype: Type of joystick to emulate: auto (default), none,
# 2axis (supports two joysticks),
# 4axis (supports one joystick, first joystick used),
# 4axis_2 (supports one joystick, second joystick used),
# fcs (Thrustmaster), ch (CH Flightstick).
# none disables joystick emulation.
# auto chooses emulation depending on real joystick(s).
# (Remember to reset dosbox's mapperfile if you saved it earlier)
# Possible values: auto, 2axis, 4axis, 4axis_2, fcs, ch, none.
# timed: enable timed intervals for axis. Experiment with this option, if your joystick drifts (away).
# autofire: continuously fires as long as you keep the button pressed.
# swap34: swap the 3rd and the 4th axis. Can be useful for certain joysticks.
# buttonwrap: enable button wrapping at the number of emulated buttons.

joysticktype=2axis
timed=true
autofire=false
swap34=false
buttonwrap=false

[serial]
# serial1: set type of device connected to com port.
# Can be disabled, dummy, modem, nullmodem, directserial.
# Additional parameters must be in the same line in the form of
# parameter:value. Parameter for all types is irq (optional).
# for directserial: realport (required), rxdelay (optional).
# (realport:COM1 realport:ttyS0).
# for modem: listenport (optional).
# for nullmodem: server, rxdelay, txdelay, telnet, usedtr,
# transparent, port, inhsocket (all optional).
# Example: serial1=modem listenport:5000
# Possible values: dummy, disabled, modem, nullmodem, directserial.
# serial2: see serial1
# Possible values: dummy, disabled, modem, nullmodem, directserial.
# serial3: see serial1
# Possible values: dummy, disabled, modem, nullmodem, directserial.
# serial4: see serial1
# Possible values: dummy, disabled, modem, nullmodem, directserial.

serial1=dummy
serial2=dummy
serial3=disabled
serial4=disabled

[dos]
# xms: Enable XMS support.
# ems: Enable EMS support.
# umb: Enable UMB support.
# keyboardlayout: Language code of the keyboard layout (or none).

xms=true
ems=true
umb=true
keyboardlayout=uk166

[ipx]
# ipx: Enable ipx over UDP/IP emulation.

ipx=false

[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.
mount c "/Users/user/DOS"
c:

Reply 1 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

if you look at
https://sourceforge.net/p/dosbox/code-0/4176/ … ardware/gus.cpp

the input file for 0.74-2 for the gus emulation is identical to 0.74.

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 19, by digistorm

User metadata
Rank Member
Rank
Member

What version of FastTracker are you using? I am running version 2.09 just fine in the latest DOSBox version (SVN). I use the GUS as a sound card, just as you described. And I tested the same module as you revered to (but I am running dozens of tracker software at the moment, and they all behave well).
I did notice that sound will stutter (in multiple applications) when the render mode is set to surface, but opengl just works fine.

Reply 3 of 19, by StinkyFox

User metadata
Rank Newbie
Rank
Newbie
digistorm wrote:

What version of FastTracker are you using?

2.09.

Qbix wrote:

if you look at
the input file for 0.74-2 for the gus emulation is identical to 0.74.

Well, there's something different for certain between 0.74 and 0.74-2 for GUS behaviour. If you're certain no bug could have been introduced in gus.cpp then it must be a bug elsewhere impacting upon that. Buffer overflow overwriting GUS variables?

Here is a video documenting the behaviour. Note the following points:
* Video frame rate is low to save bandwidth, this is not the fault of DOSBox.
* Config files are identical on both versions.
* Emulated hard drive is identical on both versions (points to the same folder).
* 0.74 was downloaded years ago, 0.74-2 was downloaded recently.
* DOSBox still behaves the same way (broken GUS) when installed in /Applications too.
* In neither version is Soundblaster emulation affected.
* Both Soundblaster and GUS are active in DOSBox config file simultaneously, mixing rate is 49kHz (important to note).

https://www.youtube.com/watch?v=xpc9RHi9pYY&feature=youtu.be

digistorm wrote:

I am running version 2.09 just fine in the latest DOSBox version (SVN).

Is this also with MacOS 10.13.x? With a 49kHz GUS mixing rate?

digistorm wrote:

I did notice that sound will stutter (in multiple applications) when the render mode is set to surface, but opengl just works fine.

Might I suggest that DOSBox be shipped with opengl as the default? Most users may never think to try changing that setting to fix sound stuttering.

Reply 4 of 19, by StinkyFox

User metadata
Rank Newbie
Rank
Newbie
StinkyFox wrote:

Well, there's something different for certain between 0.74 and 0.74-2 for GUS behaviour.

UPDATE:

My wonderful furry lover has tested this exact configuration on Windows 64 bit for me (with a 32 bit 0.74-2 DOSBox and a copy of my configuration file + FT2 install). And - to my surprise! - it works without glitches.

Therefore, it seems likely that the code is not 64-bit safe, and thus the bug was introduced when compiling for 64 bit MacOS. Of course, you can't really ship 32 bit stuff on MacOS these days.

UPDATE:

When I mute the bell/pad channels I hear this noise. Instead of the drum channels being missing, they appear to be playing back weirdly and quietly. Too slowly?
See attached mp3.

Filename
weirdnoise.mp3
File size
186.12 KiB
Downloads
61 downloads
File comment
Weird noise
File license
Fair use/fair dealing exception

UPDATE:

Selecting this in "Get Info" fixes the problem - confirming the issue is definitely due to faulty 64 bit compatibility:

Screen Shot 2018-12-12 at 1.38.18 am.png
Filename
Screen Shot 2018-12-12 at 1.38.18 am.png
File size
50.9 KiB
Views
1957 views
File comment
Screenshot
File license
Fair use/fair dealing exception

But this is surely going away soon, so at best a temporary fix.

Reply 5 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Mac OS X is not the only 64 bit that we support. I haven't had reports from linux user. Do you have any clear instructions on how easily reproduce the bug ?
(for somebody like who has never FT II before) ? Maybe a file needs to be loaded ?

(maybe to only get that drum part of which you made the mp3 ?)

Water flows down the stream
How to ask questions the smart way!

Reply 6 of 19, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

as OS X 10.14 did away with the "Open in 32-bit mode" it definitely is something that needs fixing.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 8 of 19, by Ringding

User metadata
Rank Member
Rank
Member

macOS is very troublesome regarding frame updates. The problem is that DOSBox wants to update its screen 70 times per second, but macOS doesn't like this, because it considers it wasteful, and throttles DOSBox, which leads to the sound stuttering problem. Unfortunately, the exact behavior varies from one version of macOS to the next. See also this thread: DOSBox OS X 64bit

I had the same experience that I could make the problem go away with opengl (after a small patch to DOSBox's code, which has gone in meanwhile: https://sourceforge.net/p/dosbox/code-0/4132/), but never with surface. I'm on macOS 10.11.

Reply 9 of 19, by StinkyFox

User metadata
Rank Newbie
Rank
Newbie
Qbix wrote:

Do you have any clear instructions on how easily reproduce the bug ?
(for somebody like who has never FT II before) ? Maybe a file needs to be loaded ?

Download FT2.zip (attached), then run ft2.exe. Click disk op, single click ambpower.mod to load it. Then just click disk op again to dismiss that panel, and click play sng.

Individual channels can be muted by clicking one of the eight oscilloscope views on the left of the screen.

If needed, load the DOSBox config file I pasted at the start of this thread (not sure if any changes there can fix the bug).

Qbix wrote:

could you try the build in the signature of Dominus as well ?

Tested, still the same problem.

Ringding wrote:

macOS is very troublesome regarding frame updates. The problem is that DOSBox wants to update its screen 70 times per second,

Why is it updating the screen at 70fps in FT2? I think FT2 just uses mode $12, so it will be a 60Hz scan rate.

Attachments

  • Filename
    FT2.zip
    File size
    476.26 KiB
    Downloads
    78 downloads
    File license
    Fair use/fair dealing exception

Reply 10 of 19, by digistorm

User metadata
Rank Member
Rank
Member

Just a quick reply. I am running DOSBox in the latest version of macOS, but I am running it in the 32 bit mode. I checked that box in an earlier version of macOS because it is not possible anymore in the latest version. That also means that I can't upgrade to the latest SVN version, because I will lose a lot of performance. And also, 32 bit mode uses less real cpu cycles so the fans of my MacBook Pro will not spin up.

StinkyFox wrote:

Why is it updating the screen at 70fps in FT2? I think FT2 just uses mode $12, so it will be a 60Hz scan rate.

FastTracker seems to run at a 640x400 resolution (for whatever reason), judging from the aspect ratio. 400 scanlines seems to correspond with a 70 Hz refresh rate in almost all typical VGA modes.

Reply 11 of 19, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Ping me next week and I can tell you a little trickery with the plist of the app to make it run in 32bit mode again.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 12 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I managed to reproduce under linux 64 bit.
A thing I noticed is that the gus memory after loading the song (just above the channels) is different between 32 and 64 bit

Water flows down the stream
How to ask questions the smart way!

Reply 13 of 19, by StinkyFox

User metadata
Rank Newbie
Rank
Newbie
Qbix wrote:

I managed to reproduce under linux 64 bit.
A thing I noticed is that the gus memory after loading the song (just above the channels) is different between 32 and 64 bit

I have some further information.

1: Scream Tracker 3 and the GUS MIDI player utility are not affected by this issue. Both of these run in real mode, where as Fasttracker II runs in protected mode.

2: Running Scream Tracker 3, playing the song, quitting and running Fasttracker II results in a different sound when it fails. Most likely because the contents of GUS memory have already been loaded with data by Scream Tracker 3, and FT2 is now playing back this data because it's hitting the wrong addresses?

The sound it makes is attached.

Is this a bug to do with accessing GUS registers while in 32 bit mode, on a 64 bit host? Is it possible to tell whether Fasttracker II is using 32-bit-wide accesses to the GUS to hit two 16-bit registers in one instruction?

Attachments

  • Filename
    weirdmess.mp3
    File size
    408.37 KiB
    Downloads
    76 downloads
    File license
    Fair use/fair dealing exception

Reply 14 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

It's related to the cpu emulation and not the the gus itself.
The dynamic 32 bit core handles a very specific case differently from 64 bit dynrec core and normal core in 32/64 bit.
We are trying to determine which one is (more) correct, as it is undefined behavior (I think). It might be that a cpu detection is failing, as FT2 has multiple code paths depending on which kind of cpu it detects.

Water flows down the stream
How to ask questions the smart way!

Reply 15 of 19, by 8bitbubsy

User metadata
Rank Member
Rank
Member

Just a note: FT2.09 has completely broken GUS routines (because of an attempt at rewriting them to support InterWave/PnP, which broke because of SHL/SHR Pascal runtime bugs).
Even though you "fixed it", I high recommend that you stay away from FT2.09 when using GUS. It will give you weird symptoms at some point.

Try FT2.08 and see if it has the same problem there.

386:
- CPU: 386DX-40 (128kB external L1 cache)
- RAM: 8MB (0 waitstates at 40MHz)
- VGA: Diamond SpeedSTAR VGA (ET4000AX 1MB ISA)
- Audio: SB Pro 2.0 + GUS 1MB
- ISA PS/2 mouse card + ISA USB card
- MS-DOS 6.22 + Win 3.1
- MR BIOS

Reply 16 of 19, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

So I forgot to write, thanks @digistorm for reminding me.
I thought I could circumvent this with info.plist magic, but there is no way you can do this 🙁
There are two other ways:
- Right click the app, hold down the control key and click on open -> starts in 32bit mode 😀
- use lipo in terminal to delete the 64bit arch from the dosbox binary permanently. http://osxdaily.com/2006/11/22/ten-os-x-comma … not-know-about/

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 17 of 19, by TheGreatCodeholio

User metadata
Rank Oldbie
Rank
Oldbie

I can definitely confirm here as well that on Mac OS X the SDL1 surface output is slower (and incurs more CPU load) than OpenGL.
Note that the problem doesn't exist on SDL2 because SDL2 will use OpenGL or Metal on the backend for you automatically.
Furthermore, OS X Mojave appears to prevent NSWindow objects (any window on the screen) from redrawing themselves except in response to a call to redraw the client area, which causes anything based on SDL1 to show a blank screen.

DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.

Reply 18 of 19, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Yes, hopefully the SDL devs take time to fix SDL1.2x, but it's definitely not a priority for them

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 19 of 19, by TheGreatCodeholio

User metadata
Rank Oldbie
Rank
Oldbie

I don't expect the SDL devs to spend any time on SDL1, they need to focus on SDL2. 😀

That's why DOSBox-X uses it's own heavily modified in-tree SDL1 library, it's easier to fix things that way.

For Mojave the fix is to make OpenGL output the default, but if surface is needed, the blank window problem can be resolved by modifying SDL1 to mark the NSView and NSWindow as "needs redraw", then drawing the CGBitmap when the framework comes around and calls your "draw the client area" callback function. Mojave will not allow the CGBitmap to draw on the window outside of that callback, apparently.

EDIT: DOSBox-X uses it's own heavily modified SDL1 library, but is written to use SDL2 as-is because SDL2 is in active development/

DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.