VOGONS


SBEMU: Sound Blaster emulation on AC97

Topic actions

Reply 2080 of 2093, by Angel Of Nemesis

User metadata
Rank Newbie
Rank
Newbie
crazii wrote on 2026-12-02, 04:56:

Thank you for the test!
well in that case I think I will check if it is the problem of SBEMU and I think it's probably not. and I recommend to use the vdpmi build. after all it's one of the reason I started vdpmi, because I'm unable to fix problems in HDPMI.

Thanks! I can confirm that the VDPMI build works with the Boom port on the ASUS P5KPL-SE with Sound Blaster Live 5.1.

Reply 2081 of 2093, by Angel Of Nemesis

User metadata
Rank Newbie
Rank
Newbie

During the tests, I noticed that no matter which sf2 I connect, it still plays the same way. I tried the ones that came by default with the sound card driver, and I tried the one I liked — masterpiece.sf2. Of course, I renamed them to sbemusf.sf2 and specified the file path: c:\sbemusf.sf2. When loading sbemu, it didn’t complain about the missing file and loaded it. The ones that came with the driver were of different sizes: 2, 4, 8 mb; the masterpiece was 28 mb. I’m using in the Windows 98 WDDM driver with the ability to connect sf2 banks within the operating system itself. I have this bank (masterpiece) connected, and the difference between the playback is very noticeable, but with SBEMU I don’t hear any difference.

Reply 2082 of 2093, by crazii

User metadata
Rank Oldbie
Rank
Oldbie
Angel Of Nemesis wrote on Yesterday, 08:01:

During the tests, I noticed that no matter which sf2 I connect, it still plays the same way. I tried the ones that came by default with the sound card driver, and I tried the one I liked — masterpiece.sf2. Of course, I renamed them to sbemusf.sf2 and specified the file path: c:\sbemusf.sf2. When loading sbemu, it didn’t complain about the missing file and loaded it. The ones that came with the driver were of different sizes: 2, 4, 8 mb; the masterpiece was 28 mb. I’m using in the Windows 98 WDDM driver with the ability to connect sf2 banks within the operating system itself. I have this bank (masterpiece) connected, and the difference between the playback is very noticeable, but with SBEMU I don’t hear any difference.

if you have multiple SF2 files, it's not recommend to change file names but just place where SBEMU is, or in a sub folder. and use /VMSF="relative path of sf2 file" (without quotes) to switch between different SFs. I think the README.txt has that.
I may have test a 28MB file but sbemu preserve only 8M for sf2 so if you switch sf2 file dynamically via running SBEMU /vmsf=xxx again, its memory is limited and may fail.
you also probably need to change the "ClientDriverMem" to 32 or more in VDPMI.CFG to make it work. the default setting 11 only supports ~8M SF.
I will test more and try to check bugs this weekend.

Last edited by crazii on 2026-12-03, 10:15. Edited 1 time in total.

Toshiba Satellite Pro 4300 - YMF744, Savage IX
Toshiba Satellite 2805-S501 - YMF754, GeForce 2Go
IBM Thinkpad A21p - CS4624, Mobility Radeon 128
main: Intel NUC11PHKi7C Phantom Canyon: i7-1165G7 RTX2060 64G 2T760PSDD

Reply 2083 of 2093, by Angel Of Nemesis

User metadata
Rank Newbie
Rank
Newbie
crazii wrote on Yesterday, 08:14:
if you have multiple SF2 files, it's no recommend to change file names but just place where SBEMU is, or in a sub folder. and us […]
Show full quote

if you have multiple SF2 files, it's no recommend to change file names but just place where SBEMU is, or in a sub folder. and use /VMSF="relative path of sf2 file. " I think the README.txt has that.
I may have test a 28MB file but sbemu preserve only 8M for sf2 so if you switch sf2 file dynamically via running SBEMU /vmsf=xxx again, its memory is limited and may fail.
you also probably need to change the "ClientDriverMem" to 32 in VDPMI.CFG to make it work. the default setting 11 only supports ~8M SF.
I will test more and try to check bugs this weekend.

Thanks, friend. I installed the updated VDPMI along with the configuration over the old working version and ended up with this error:

The attachment IMG.png is no longer available

At the same time, the Yamaha works without any problems.
DOS=UMB is present.

Reply 2084 of 2093, by crazii

User metadata
Rank Oldbie
Rank
Oldbie

Thanks for the feedback, what's the exact parameters you used? for both vdpmi and sbemu?
It seems a very stupid bug caused by null pointers 🤣.

Toshiba Satellite Pro 4300 - YMF744, Savage IX
Toshiba Satellite 2805-S501 - YMF754, GeForce 2Go
IBM Thinkpad A21p - CS4624, Mobility Radeon 128
main: Intel NUC11PHKi7C Phantom Canyon: i7-1165G7 RTX2060 64G 2T760PSDD

Reply 2085 of 2093, by Angel Of Nemesis

User metadata
Rank Newbie
Rank
Newbie
crazii wrote on Yesterday, 09:41:

Thanks for the feedback, what's the exact parameters you used? for both vdpmi and sbemu?
It seems a very stupid bug caused by null pointers 🤣.

in FAUTO.BAT:
LH sbemu /SC2 /VMPU /VMSF=C:\sbemusf.sf2
Is the “load high” option correct?
in FDCONGIG.SYS:
DEVICE=VDPMI /DPMIMEM=256
Is himemx needed before him?

Reply 2086 of 2093, by crazii

User metadata
Rank Oldbie
Rank
Oldbie

the latest vdpmi uses /DPMI=256 instead of /DPMIMEM.
LH does no matter for the latest release because there's no DOS memory usage at all. so have you change "ClientDriverMem" in VDPMI.CFG?

Toshiba Satellite Pro 4300 - YMF744, Savage IX
Toshiba Satellite 2805-S501 - YMF754, GeForce 2Go
IBM Thinkpad A21p - CS4624, Mobility Radeon 128
main: Intel NUC11PHKi7C Phantom Canyon: i7-1165G7 RTX2060 64G 2T760PSDD

Reply 2087 of 2093, by Angel Of Nemesis

User metadata
Rank Newbie
Rank
Newbie
crazii wrote on Yesterday, 10:09:

the latest vdpmi uses /DPMI=256 instead of /DPMIMEM.
LH does no matter for the latest release because there's no DOS memory usage at all. so have you change "ClientDriverMem" in VDPMI.CFG?

Yes, changed to 32 Mb

Reply 2088 of 2093, by crazii

User metadata
Rank Oldbie
Rank
Oldbie
Angel Of Nemesis wrote on Yesterday, 10:12:
crazii wrote on Yesterday, 10:09:

the latest vdpmi uses /DPMI=256 instead of /DPMIMEM.
LH does no matter for the latest release because there's no DOS memory usage at all. so have you change "ClientDriverMem" in VDPMI.CFG?

Yes, changed to 32 Mb

Thank you.
I will fix it this weekend.

EDIT: I think the crash is on NULL pointer from memory allocation (malloc) because 32M might not be enough. I checked the source, the ClientDriverMem is clamped to 32M so currently there's no way to set it larger than 32M.
I've fixed it and tested it with a 46MB SC-55.sf2 with ClientDriverMem=64 and it works. I think it's OK now.
Will be released on this weekend with other changes.

Toshiba Satellite Pro 4300 - YMF744, Savage IX
Toshiba Satellite 2805-S501 - YMF754, GeForce 2Go
IBM Thinkpad A21p - CS4624, Mobility Radeon 128
main: Intel NUC11PHKi7C Phantom Canyon: i7-1165G7 RTX2060 64G 2T760PSDD

Reply 2089 of 2093, by Plombo

User metadata
Rank Newbie
Rank
Newbie
crazii wrote on 2026-12-01, 06:03:

Ha, you cannot say that I "don't want to implement it", because you yourself "still more focused on whether it's possible". how can one want to implement if it is not possible?
I suggest you do some basic code experiments.

Well, yeah. I don't want to try implementing things that aren't possible, either. That's precisely why I try to figure out whether a problem can be solved before I spend any serious time trying to solve it.

crazii wrote on 2026-12-01, 06:03:

I need to clarify that it is not worth the effort within the scope of VDPMI or at the current stage of vdpmi. but it can be tried, with a new experimental project.
vdpmi is definitely not for that because this idea should be considered/designed in the beginning - even that is true, it is not even totally possible in my point of view. it might not be possible in "thought experiments", and in real engineering there will be much more unexpected challenges.
I can imagine it may take more time than starting a new "unreal monitor" project from scratch. its like you want NT features based on win3.x, technically & theoretically yes it could be done but it is really full of hacks, because of totally different design. sometimes start anew is more faster because it's without any limitations/technical debts from existing code.

I was actually about to start a standalone project of this nature before making my first post about it. But then I realized two things:

  • I didn't have any real confidence in my design at the time, and didn't want to put a ton of work into something that wasn't possible.
  • The whole thing would make more sense as an extension to an existing V86 monitor because the whole concept is an extension of a V86 monitor. Doing it as a fully separate thing would require either 1) making my own V86 monitor from scratch (not interested), or 2) trying to get two V86 monitors to somehow work together (sounds far less possible than anything about the actual "unreal monitor" design, and guaranteed to be hacky and not work very well).

Frankly, if VDPMI's source code were available, I would have just started implementing my idea instead of posting in this thread at all. I enjoy making things, and I don't especially enjoy posting. But afaik VDPMI is still closed-source, at least for now, so talking about it is all I can do.

Reply 2090 of 2093, by Plombo

User metadata
Rank Newbie
Rank
Newbie
RayeR wrote on 2026-11-30, 23:13:

AFAIK as I it understood (maybe wrong), apps that use unreal mode do the RM-PM-RM switch only once at startup and rely on CPU descriptor cache will holds the right values set in PM for the rest of running. If V86 mon activates it reloads GDT with it's own setup then it would need to set it back for the app.

That's the theory of how unreal mode is supposed to work, but I've confirmed through DOSbox that at least one game (Ultima VII) does the RM-PM-RM switch multiple times after startup, for some reason.

I don't think it changes that much about the design, though. Doing multiple RM-PM-RM switches involves the same considerations as just doing one.

One question I still have about unreal mode is exactly how much of the GDT still applies to it. From what I've read, it sounds like it discards everything except the cached segment lengths, and the addressing scheme is identical to real mode otherwise. If that's the case, I can be reasonably confident in my proposed design (extended memory accesses done through a GPF handler, conventional/high memory accesses need no special handling in V86 mode). If it's some other mix of real-mode and protected-mode, that design probably won't work.

Reply 2091 of 2093, by RayeR

User metadata
Rank Oldbie
Rank
Oldbie

I guess reload of new GDT or first real use of some new PM segment will discard previous settings valid in UM but I never experiment this. And remember that various real CPU families may behave slightly different and maybe different than in DOSBOX/QEMU/other VM, so I would do such exomoeriments on real HW and don't rely on how author of VM implemented it...

Gigabyte GA-P67-DS3-B3, Core i7-2600K @4,5GHz, 8GB DDR3, 128GB SSD, GTX970(GF7900GT), SB Audigy + YMF724F + DreamBlaster combo + LPC2ISA

Reply 2092 of 2093, by Plombo

User metadata
Rank Newbie
Rank
Newbie
crazii wrote on 2026-12-01, 07:18:
RayeR wrote on 2026-11-30, 23:13:

AFAIK as I it understood (maybe wrong), apps that use unreal mode do the RM-PM-RM switch only once at startup and rely on CPU descriptor cache will holds the right values set in PM for the rest of running. If V86 mon activates it reloads GDT with it's own setup then it would need to set it back for the app.

Theoretically yes, provided that any BIOS/DOS ints will not reset the segment registers to real mode ones. otherwise it needs more. so the best might be use FS/GS which is not frequently used.

Sorry, I hadn't noticed this post before making my earlier replies.

The idea, which I probably didn't explain very well, is to record the protected mode GDT and reference it when handling GPFs in extended memory. I don't know anything about trying to mess with the program's GDT once it's back in V86 mode, but I would be surprised if it works. I haven't seen much documentation of how V86 mode's real-mode addressing emulation interacts with the segment descriptor table, but the answer probably isn't anything convenient enough to be useful.

crazii wrote on 2026-12-01, 07:18:

And because on switching from pm to v86, the CPU will RELOAD ALL segment registers (either via TSS call gate or IRETD) so those cache are gone for good. recording app's previously unreal pm selector (base and size) and emulate the access may work; but that's way too slow, there might be thousands of fault per one game loop, e.g. think about a game write VBE LFB at high address using unreal mode, there might be 800x600 writes, let alone other game data.

I did say something similar to this in one of my posts. The performance hit from this approach will definitely be enormous, precluding it from being practical on 90s CPUs. The old Ultima VII in Windows project was my initial inspiration for this idea, and it notably makes the game run much slower because it's handling thousands of interrupts and context switches on every frame to deal with the extended memory accesses, just like this would.

The silver lining, though, is that processors have become so much faster since the mid-90s that they can handle all of this. The aforementioned "Ultima VII in Windows" runs at a more than playable speed (actually even a bit too fast) on my Athlon 64. And actual modern processors are dozens of times faster than that Athlon 64. So the performance cost doesn't make the idea untenable; it just raises the minimum system requirements.

crazii wrote on 2026-12-01, 07:18:

the very first thing to think about, is how to emulate "lgdt", we can assume an unreal program do not use page tables, but to load the pm selector cache, you still need to emulate it.
obviously the monitor cannot switch gdt directly to the program's because every code&data the monitor uses rely on its own gdt.
the proper way I can think about it to (1) move the monitor's gdt descriptors down (or preserve) and copy programs' gdt to monitor's, or (2) leave the first descriptors empty to trigger exceptions and set a working one for it. or (3) you can just do nothing and let it load monitor's ring0 descriptor which will trigger a fault in ring3 and set a working one for it, not the exactly value it expects but it probably will work.

On this topic, the Pentium Pro manual and the modern Intel documentation say very different things about what happens when "lgdt" is run in V86 mode. I'm inclined to believe the newer version, especially since the PPro manual's implications here don't make any sense. The modern reference says that "lgdt" always causes a GPF in V86 mode unless the CPL is 0. (CPL=3 for any V86 task under a normal V86 monitor).

Since it causes a GPF, the monitor can handle it by simply recording what is written to the GDT, and using that information when emulating extended memory accesses.

crazii wrote on 2026-12-01, 07:18:

to preserve some empty descriptors breaks the compatible EMM386 GDT layout for your HIMEMEX.SYS/RAMDSK64.COM already.
to dynamically move monitor's own descriptors, that is not possible for vdpmi for now without architectural changes. the GDT descriptors are all hard coded and selectors are used as an literal value (I believe all existing v86/dpmi code uses static layout).
so the third option could be the easiest solution, for now - but I don't know if there are more problems being overlooked. at least it needs state management, a flag should be set when "lgdt" is triggered and emulate the descriptor loads later. and the flag should be cleared after the app exits - which require another app state management. you cannot just blindly emulate every privilege instructions, because there are some real faults.

This is why I think the best solution is to not mess with the CPU's actual GDT at all. If you're thinking in terms of messing with the real GDT, I can see why you'd think this approach would break a lot of things.

crazii wrote on 2026-12-01, 07:18:
because the unreal mode may also have real mode segments, so about the rm segment & pm selector collisions, I ain't think of any […]
Show full quote

because the unreal mode may also have real mode segments, so about the rm segment & pm selector collisions, I ain't think of any solutions yet. and also, if in pm, how to bridge BIOS/DOS int calls is another problem; in DPMI there is clearly defined API, an DPMI program does that explicitly - it's total aware of that. but in a pm mode emulating unreal, the program does not know at all it's being "emulated", how to automatically translate the pm data buffers is another problem.
or maybe using v86 mode is much more easy on this problem, maybe trap every unreal access in v86 mode is not that slow; but that all needs real code to test out. in v86 mode, loading a segment is valid so an "virtual pm" flag is need to record whether it's loading a pm selector now or a rm segment, and record the assignment from its gdt previous via "lgdt" in a table for later trap access emulations.

another problem in v86 mode: accessing an emulated unreal selector does not always triggers faults, e.g.
08h:20000h accessing memory above 64K offset and will trigger a fault. but since the offset could be legal: 08h:1000h won't trigger a fault, instead, CPU will auto perform real mode addressing in v86 mode, which will read the wrong data, at linear address 1080h. not 1000h.

So I think my understanding of unreal mode and yours are different. I don't know who's right.

From what I understand, unreal mode is not a mix of real and protected mode segments. Instead, all addressing works like real mode, except that the larger cached segment length prevents a GPF from happening when accessing beyond 1 MB. This means that there's no issue with RM and PM sector collisions, since there are only RM sectors. It also means that, in your example, 1080h is the correct address, so there's not a problem with accessing it.

If I'm wrong, and you're right, and unreal mode is some weird mix of real/protected addressing, then indeed, none of this "unreal monitor" business is very feasible.

crazii wrote on 2026-12-01, 07:18:

and things will go much more compilated if a program do extra unexpected things in protected mode during the "unreal mode switch process".

This is definitely a real problem. My best idea at present is to give the program more or less what it wants. When it tries to switch to protected mode, actually switch the program into non-V86 protected mode. When it tries to switch back, switch it back into V86 mode. This might be a pain, but we can at least count on protected mode to behave like itself. Not much else needed there, unless the program tries to do something very strange. Hopefully, for its brief time in protected mode, the program can be set up with an LDT equivalent to its requested GDT. I haven't done much reading on LDTs, though.

Also, thanks for writing such a detailed reply 😀

Last edited by Plombo on 2026-12-04, 00:50. Edited 1 time in total.

Reply 2093 of 2093, by Plombo

User metadata
Rank Newbie
Rank
Newbie
RayeR wrote on 44 minutes ago:

I guess reload of new GDT or first real use of some new PM segment will discard previous settings valid in UM but I never experiment this. And remember that various real CPU families may behave slightly different and maybe different than in DOSBOX/QEMU/other VM, so I would do such exomoeriments on real HW and don't rely on how author of VM implemented it...

The reason I used DOSbox is that it was easy to set up logging for when the program does a switch to real mode or protected mode. I wouldn't expect it to depend on details of CPU behavior - the actual code of the game is the same either way, so the real/protected switching behavior should be the same unless something very strange is going on.