DOSBox-X branch

Here you can discuss the development of patches.

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 16:23

Scali wrote:It would be nice if MDA mode also emulates that MDA only has 4k of video memory (as opposed to the 32k/64k of Hercules).
MDA memory wraps that 4k around in the range of B0000-B7FFF, where Hercules has a full 32k there without wraparound, and another optional 32k from B8000-BFFFF when no CGA card is installed.


It already does. According to the current implementation, machine=hercules already limits memory to 4KB unless a bit is flipped to enable the rest of the memory. machine=mda prevents setting that bit, therefore 4KB limit.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby Scali » 2018-12-30 @ 18:24

TheGreatCodeholio wrote:It already does. According to the current implementation, machine=hercules already limits memory to 4KB unless a bit is flipped to enable the rest of the memory. machine=mda prevents setting that bit, therefore 4KB limit.


Hm, I'd have to check that (I have an original Hercules GB102 card), but I don't think Hercules has that behaviour.
Afaik the first 32k is always enabled, and there is no wraparound, even in textmode (you just get 8 pages of text instead of just 1). The second 64k is enabled by setting a bit.
Scali
l33t
 
Posts: 3849
Joined: 2014-12-13 @ 14:24

Re: DOSBox-X branch

Postby Spikey » 2018-12-30 @ 18:58

Thanks for all the work, Codeholio! This is my new version of DOSBox to use. Loving that xbrz scaler :)

I have a feature request, if you'll allow it- (optional) faux stereo sound for Adlib mono soundtracks. See my older post for details (viewtopic.php?f=7&t=49831), but basically the DOSBox for DS utility from a while back, DSx86, was able to implement stereo Adlib sound by modifying DOSBox's code. I'm sure Patrick would be happy to provide it if asked for, otherwise I'm sure knowledgeable minds can recreate it.

Much in the same way a scaler can provide output more to one's taste in 2018/9, stereo sound in the Adlib games can sound really, really good. I would much rather play Duke Nukem II on my HD laptop than my tiny DS, though! ;)

Once again, thanks for your hard work and the great results. Fast and beautiful, and just seamless.
User avatar
Spikey
Member
 
Posts: 239
Joined: 2003-2-04 @ 10:36
Location: South Australia

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 19:22

Scali wrote:
TheGreatCodeholio wrote:It already does. According to the current implementation, machine=hercules already limits memory to 4KB unless a bit is flipped to enable the rest of the memory. machine=mda prevents setting that bit, therefore 4KB limit.


Hm, I'd have to check that (I have an original Hercules GB102 card), but I don't think Hercules has that behaviour.
Afaik the first 32k is always enabled, and there is no wraparound, even in textmode (you just get 8 pages of text instead of just 1). The second 64k is enabled by setting a bit.


So then the emulation is wrong in src/hardware/vga_draw.cpp and src/hardware/vga_other.cpp concerning Hercules graphics emulation?
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 19:55

Patch to incorporate (minimally) the DOSBox-X mixer code into DOSBox SVN (attached).[OLDER PATCH, scroll down for newer patch]

EDIT: This is against SVN revision r4180 "qbix79 | 2018-12-28 04:19:13 -0800 (Fri, 28 Dec 2018)"

EDIT: This will temporarily break Sound Blaster direct DAC output until the Sound Blaster code incorporates the DOSBox-X method. The new mixer lacks the "stretched" audio output function.

EDIT: This is from the dosbox-svn repository on github: git diff -r master..feature-20181230-0016-dosbox-x-mixer
You do not have the required permissions to view the files attached to this post.
Last edited by TheGreatCodeholio on 2018-12-31 @ 00:45, edited 2 times in total.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby Qbix » 2018-12-30 @ 20:12

so the interpolation is always done ? How are equal sample rates treated now ?
(The last set of commits of harekiet to the mixer file)
As that part i saw being removed from my quick overview.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10762
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 20:16

Qbix wrote:so the interpolation is always done ? How are equal sample rates treated now ?
(The last set of commits of harekiet to the mixer file)
As that part i saw being removed from my quick overview.


If the sample rates match, then the fractional part should always be zero and interpolation will result in the same sample going in. Otherwise, the fractional part will count as needed to interpolate between sample rates.

The lowpass filter should not filter unless the mixer channel has called on the mixer to apply a lowpass filter.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 20:17

The mixer is written so that, if no calls are made to the mixer channel to change lowpass filtering or slew rate, interpolation will happen in the same way it does now in DOSBox SVN: Linear interpolation.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby Qbix » 2018-12-30 @ 20:20

but what if the input rate is equal to the output rate ? (as those commits improved the behaviour of that)
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10762
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 20:29

Qbix wrote:but what if the input rate is equal to the output rate ? (as those commits improved the behaviour of that)


Looking over the code, freq_f == 0 when the channel is first made. If a call is made to SetFreq that matches the mixer's output rate, then it will have freq_f == 0 at every sample, freq_f += freq_n will set it to freq_d, and roll over so that on the next sample freq_f == 0 again. Without any special calls, the "slew rate" equals the sample rate (becomes linear interpolation just like SVN does now) so freq_fslew == freq_f. The interpolated sample is result = last + ((delta * freq_fslew) / freq_d). If freq_fslew == 0 at every call, then no interpolation is done.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 20:30

However if the sample rate does not match at first, then changed to match later, the SetFreq code updates freq_f to preserve whatever interpolation state was there across the sample rate change, so at that point, interpolation will always happen.

If you're concerned about that, you could modify SetFreq after the patch to set freq_f = freq_fslew = 0 instead of recomputing it from the change in sample rate.

EDIT: See DOSBox-X src/hardware/mixer.cpp line 264, MixerChannel::SetFreq
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2018-12-30 @ 21:11

I think these lines could be removed from SVN code in the mixer-X patch:
Code: Select all
#define FREQ_SHIFT 14
#define FREQ_NEXT ( 1 << FREQ_SHIFT)
#define FREQ_MASK ( FREQ_NEXT -1 )

#define TICK_SHIFT 14
#define TICK_NEXT ( 1 << TICK_SHIFT)
#define TICK_MASK (TICK_NEXT -1)
hail-to-the-ryzen
Member
 
Posts: 305
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 21:13

hail-to-the-ryzen wrote:I think these lines could be removed from SVN code in the mixer-X patch:
Code: Select all
#define FREQ_SHIFT 14
#define FREQ_NEXT ( 1 << FREQ_SHIFT)
#define FREQ_MASK ( FREQ_NEXT -1 )

#define TICK_SHIFT 14
#define TICK_NEXT ( 1 << TICK_SHIFT)
#define TICK_MASK (TICK_NEXT -1)


I think it's better if the patch modifies as little as possible.

If DOSBox SVN approves of this patch, then they can remove the unused functions, variables, defines, etc.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2018-12-30 @ 21:15

I agree entirely but it may make it easier for their team to see the modifications.
hail-to-the-ryzen
Member
 
Posts: 305
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 21:15

hail-to-the-ryzen wrote:I agree entirely but it may make it easier for their team to see the modifications.


It's easier to see modifications if the patch changes less of the code. More modifications like that will only add to the noise.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2018-12-30 @ 21:42

I agree. The mute function code added with the patch is also unused.
hail-to-the-ryzen
Member
 
Posts: 305
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 22:01

hail-to-the-ryzen wrote:I agree. The mute function code added with the patch is also unused.


In DOSBox SVN, yes. In DOSBox-X it's tied to a menu command.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 23:09

Patch to incorporate (minimally) the DOSBox-X mixer code into DOSBox SVN (attached) revised to remove "mute" function. [OLDER PATCH, scroll down for newer patch]

EDIT: This is against SVN revision r4180 "qbix79 | 2018-12-28 04:19:13 -0800 (Fri, 28 Dec 2018)"

EDIT: This will temporarily break Sound Blaster direct DAC output until the Sound Blaster code incorporates the DOSBox-X method. The new mixer lacks the "stretched" audio output function.

EDIT: This is from the dosbox-svn repository on github: git diff -r master..feature-20181230-0016-dosbox-x-mixer
You do not have the required permissions to view the files attached to this post.
Last edited by TheGreatCodeholio on 2018-12-31 @ 00:45, edited 1 time in total.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2018-12-30 @ 23:26

Patch to incorporate (minimally) the DOSBox-X mixer code into DOSBox SVN (attached) revised to remove "mute" function, and working Direct DAC Sound Blaster output taken from DOSBox-X and adapted to SVN.

EDIT: This is against SVN revision r4180 "qbix79 | 2018-12-28 04:19:13 -0800 (Fri, 28 Dec 2018)"

EDIT: This is from the dosbox-svn repository on github: git diff -r master..feature-20181230-0016-dosbox-x-mixer
You do not have the required permissions to view the files attached to this post.
DOSBox-X project: more emulation better accuracy.
DOSLIB and DOSLIB2: Learn how to tinker and hack hardware and software from DOS.
User avatar
TheGreatCodeholio
Oldbie
 
Posts: 672
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2018-12-31 @ 04:10

Some ideas for SVN patches from -X (history of commits per file):
Code: Select all
CGA bug fixes in vga_draw.cpp and vga_dac.cpp
signed integer overflow in dbopl.cc
ems/xms fixes to vanilla memory arrangement (ems.cpp, xms.cpp, dos_memory.cpp)
INT 10h AH=1Ch save and restore code
mpu401.cpp fixes
SSE renderer fix in RENDER_StartLineHandler
hail-to-the-ryzen
Member
 
Posts: 305
Joined: 2017-3-09 @ 01:34

PreviousNext

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 1 guest