DOSBox-X branch

Here you can discuss the development of patches.

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2019-3-30 @ 01:29

Morten79 wrote:Thanks alot Codeholio for making DOSBox-x. After using 0.82.4 for long time I decided too try the newest version. I then discovered that the Drive option was missing from the menu bar. Actually it's been missing since 0.82.7 2018-06-01 13:05.
Why did you removed that feature? I use it for one game that's on six CD images. I hope it's a minor bug that you're willing too fix soon. I've tested both the 32 and the 64-bit Windows versions. In the meantime I'll just use 0.82.6 :happy:
I'm using Windows 10 64-bit.


That happened when I replaced the Windows menu resource inherited from Daum's branch, with the menu framework. I didn't bother to recreate the drive list because I didn't see any demand for it.

I'll keep your request in mind. I think it would be helpful to be able to mount and change floppies and CDs at runtime too.

The biggest challenge obviously is to write common code that can show a "select file" interface across all platforms.

Windows obviously has the "GetOpenFileName" function, but I'm not yet familiar with Mac OS X for it's version of the same, and using one from a toolkit like GTK would require linking to a whole GUI toolkit in Linux, so it's probably going to have a custom drawn file select dialog for platforms other than Windows and Mac OS X.
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: 694
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby bfcastello » 2019-3-30 @ 12:25

TheGreatCodeholio wrote:
Morten79 wrote:Thanks alot Codeholio for making DOSBox-x. After using 0.82.4 for long time I decided too try the newest version. I then discovered that the Drive option was missing from the menu bar. Actually it's been missing since 0.82.7 2018-06-01 13:05.
Why did you removed that feature? I use it for one game that's on six CD images. I hope it's a minor bug that you're willing too fix soon. I've tested both the 32 and the 64-bit Windows versions. In the meantime I'll just use 0.82.6 :happy:
I'm using Windows 10 64-bit.


That happened when I replaced the Windows menu resource inherited from Daum's branch, with the menu framework. I didn't bother to recreate the drive list because I didn't see any demand for it.

I'll keep your request in mind. I think it would be helpful to be able to mount and change floppies and CDs at runtime too.

The biggest challenge obviously is to write common code that can show a "select file" interface across all platforms.

Windows obviously has the "GetOpenFileName" function, but I'm not yet familiar with Mac OS X for it's version of the same, and using one from a toolkit like GTK would require linking to a whole GUI toolkit in Linux, so it's probably going to have a custom drawn file select dialog for platforms other than Windows and Mac OS X.



Boxer (boxerapp.com) a GUI frontend for dosbox, has a way to use CDs/floppies the way he described. You might want to check it
"Design isn't just what it looks like and feels like. Design is how it works."
JOBS, Steve.
User avatar
bfcastello
Member
 
Posts: 271
Joined: 2017-9-07 @ 02:39
Location: Rio de Janeiro, Brazil and Catalonia, Spain

Re: DOSBox-X branch

Postby Morten79 » 2019-3-31 @ 08:22

bfcastello wrote:Boxer (boxerapp.com) a GUI frontend for dosbox, has a way to use CDs/floppies the way he described. You might want to check it

Boxer is only available for Mac OS X.
Morten79
Newbie
 
Posts: 4
Joined: 2017-8-12 @ 15:10

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2019-3-31 @ 14:55

If Boxer is open source it may serve as something to study on how to do the File Open/Save dialog boxes in Mac OS X.
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: 694
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby collector » 2019-4-01 @ 00:32

Wouldn't it have to be since it is based on DOSBox?
User avatar
collector
l33t
 
Posts: 4385
Joined: 2003-1-15 @ 10:39

Re: DOSBox-X branch

Postby bfcastello » 2019-4-03 @ 08:39

I think it is.

I was given a compiled 64bit version on their github page to test last year.

Boxer hasn’t been updated since then, I stopped using it when macOS Mojave came, and when I wanted to use NE2000 patch (boxer doesn’t have it).
"Design isn't just what it looks like and feels like. Design is how it works."
JOBS, Steve.
User avatar
bfcastello
Member
 
Posts: 271
Joined: 2017-9-07 @ 02:39
Location: Rio de Janeiro, Brazil and Catalonia, Spain

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2019-4-04 @ 00:56

It is possible to keep use of the normal core in resolving the page faults for the normal core while using the full core to resolve the dynarec core faults. This is sample code:
Code: Select all
diff -rupN dosbox-X/src/cpu/cpu.cpp dosbox-X-Orig/src/cpu/cpu.cpp
--- dosbox-X/src/cpu/cpu.cpp   2019-04-03 20:32:50 -0400
+++ dosbox-X-Orig/src/cpu/cpu.cpp   2019-01-25 20:25:38 -0500
@@ -1817,17 +1817,6 @@ void CPU_Snap_Back_Forget() {
    snap_cpu_snapped = false;
 }
 
-bool CPU_IsDynamicCore(void) {
-#if (C_DYNAMIC_X86)
-    if (cpudecoder == &CPU_Core_Dyn_X86_Run)
-        return true;
-#elif (C_DYNREC)
-    if (cpudecoder == &CPU_Core_Dynrec_Run)
-        return true;
-#endif
-    return false;
-}
-
 static bool printed_cycles_auto_info = false;
 void CPU_SET_CRX(Bitu cr,Bitu value) {
    switch (cr) {
@@ -2688,13 +2677,17 @@ public:
       cpudecoder=&CPU_Core_Normal_Run;
       if (core == "normal") {
          cpudecoder=&CPU_Core_Normal_Run;
+         use_dynamic_core_with_paging=false;
       } else if (core =="simple") {
          cpudecoder=&CPU_Core_Simple_Run;
+         use_dynamic_core_with_paging=false;
       } else if (core == "full") {
          cpudecoder=&CPU_Core_Full_Run;
+         use_dynamic_core_with_paging=false;
       } else if (core == "auto") {
          cpudecoder=&CPU_Core_Normal_Run;
          CPU_AutoDetermineMode|=CPU_AUTODETERMINE_CORE;
+         use_dynamic_core_with_paging=false;
 #if (C_DYNAMIC_X86)
       } else if (core == "dynamic") {
          cpudecoder=&CPU_Core_Dyn_X86_Run;
@@ -2711,6 +2704,7 @@ public:
           std::string core("normal");
          LOG_MSG("CPU:Unknown core type %s, switching to normal.",core.c_str());
          cpudecoder=&CPU_Core_Normal_Run;
+         use_dynamic_core_with_paging=false;
        }
 
 #if (C_DYNAMIC_X86)
diff -rupN dosbox-X/src/cpu/paging.cpp dosbox-X-Orig/src/cpu/paging.cpp
--- dosbox-X/src/cpu/paging.cpp   2019-04-03 20:22:10 -0400
+++ dosbox-X-Orig/src/cpu/paging.cpp   2018-11-12 03:19:06 -0500
@@ -112,7 +112,10 @@ static Bits PageFaultCore(void) {
    CPU_CycleLeft+=CPU_Cycles;
    CPU_Cycles=1;
 
-   ret=CPU_Core_Full_Run();
+   if (!use_dynamic_core_with_paging)
+      ret=CPU_Core_Normal_Run();
+   else
+      ret=CPU_Core_Full_Run();
 
    CPU_CycleLeft+=CPU_Cycles;
    if (ret<0) E_Exit("Got a dosbox close machine in pagefault core?");
@@ -268,8 +271,6 @@ void PrintPageInfo(const char* string, P
 
 bool dosbox_allow_nonrecursive_page_fault = false;
 
-bool CPU_IsDynamicCore(void);
-
 // PAGING_NewPageFault
 // lin_addr, page_addr: the linear and page address the fault happened at
 // prepare_only: true in case the calling core handles the fault, else the PageFaultCore does
@@ -282,7 +283,7 @@ static void PAGING_NewPageFault(PhysPt l
    if (prepare_only) {
       cpu.exception.which = EXCEPTION_PF;
       cpu.exception.error = faultcode;
-   } else if (dosbox_allow_nonrecursive_page_fault && !CPU_IsDynamicCore()) {
+   } else if (dosbox_allow_nonrecursive_page_fault && !use_dynamic_core_with_paging) {
       throw GuestPageFaultException(lin_addr,page_addr,faultcode);   
 
    } else {

hail-to-the-ryzen
Member
 
Posts: 332
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby Timbi » 2019-4-12 @ 12:37

Is possible to get rid of mouse lag in the Win95 protected mode MS-DOS? Basically when user runs the command line windowed, the mouse pointer lags and the refresh rate slightly changes to better while pressing or holding any key from keyboard input. Yet, the keyboard input works fine in both environments.
User avatar
Timbi
Newbie
 
Posts: 14
Joined: 2016-4-11 @ 09:07

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2019-4-20 @ 15:16

DOSBox-X has a modification to the dynamic core in decoder.h (as compared to vanilla dosbox):
Code: Select all
static bool MakeCodePage(Bitu lin_addr,CodePageHandler * &cph) {
   Bit8u rdval;
...
   if (handler->getFlags() & PFLAG_NOCODE) {
         LOG_MSG("DYNX86:Can't run code in this page!");
         cph=0;      return false;
   }


But the same code is unmodified except for the false condition in the dynrec core (decoder_basic.h):
Code: Select all
static bool MakeCodePage(Bitu lin_addr,CodePageHandlerDynRec * &cph) {
   Bit8u rdval;
...
   if (handler->flags & PFLAG_NOCODE) {
      if (false) { // PAGING_ForcePageInit(lin_addr)) {
         handler=get_tlb_readhandler(lin_addr);
         if (handler->flags & PFLAG_HASCODE) {
            cph=(CodePageHandlerDynRec *)handler;
            return false;
         }
      }
      if (handler->flags & PFLAG_NOCODE) {
         LOG_MSG("DYNREC:Can't run code in this page");
         cph=0;
         return false;
      }
   }

I think the modification to the dynamic core originated from Hal's modified dosbox build (megabuild) which was enhanced for paging operations. Since one of those code blocks in the dynrec is not active, it could be removed along with a redundant check on (handler->flags & PFLAG_NOCODE).
hail-to-the-ryzen
Member
 
Posts: 332
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2019-4-28 @ 02:31

The recent compiler warning fix casts written only (/cpu/core_dynrec/cache.h):
Code: Select all
+         if (written>block->cache.size+CACHE_MAXSIZE) E_Exit("CacheBlock overrun 1 %lu",(unsigned long)written-block->cache.size);
but this could be written so both variables are cast like in a related line that is not shown here:
Code: Select all
+         if (written>block->cache.size+CACHE_MAXSIZE) E_Exit("CacheBlock overrun 1 %lu",(unsigned long)written-(unsigned long)block->cache.size);
hail-to-the-ryzen
Member
 
Posts: 332
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby bfcastello » 2019-4-28 @ 14:00

hail-to-the-ryzen wrote:The recent compiler warning fix casts written only (/cpu/core_dynrec/cache.h):
Code: Select all
+         if (written>block->cache.size+CACHE_MAXSIZE) E_Exit("CacheBlock overrun 1 %lu",(unsigned long)written-block->cache.size);
but this could be written so both variables are cast like in a related line that is not shown here:
Code: Select all
+         if (written>block->cache.size+CACHE_MAXSIZE) E_Exit("CacheBlock overrun 1 %lu",(unsigned long)written-(unsigned long)block->cache.size);


Hmmmm.... why not post this on his github project page? Not a complaint, just a honest question
"Design isn't just what it looks like and feels like. Design is how it works."
JOBS, Steve.
User avatar
bfcastello
Member
 
Posts: 271
Joined: 2017-9-07 @ 02:39
Location: Rio de Janeiro, Brazil and Catalonia, Spain

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2019-4-28 @ 20:32

So others may easily search and archive information.
hail-to-the-ryzen
Member
 
Posts: 332
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2019-5-12 @ 21:57

Remapping video memory according to r3974 may restrict access to the mmio region by the s3 trio Windows driver. Testing in the dos box may verify.
hail-to-the-ryzen
Member
 
Posts: 332
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2019-5-25 @ 20:41

A 16-bit wave out sound device fails to close after exiting a dos box in Windows 95. Tested by running DOS Quake, closing the dos box, and then running a 32-bit application dependent on the sound device. However, it works as expected in PCem.
hail-to-the-ryzen
Member
 
Posts: 332
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby hail-to-the-ryzen » 2019-5-26 @ 23:36

On further testing of 16-bit wave out, I now see that the device has the same behavior in pcem. As expected, other DOS games in the dos box also do not open the sound device in the emulators.

I believe the r4039 commit is not incorporated fully into dosbox-x. The code block is different between it and SVN. I can paste a suggestion, if needed.
hail-to-the-ryzen
Member
 
Posts: 332
Joined: 2017-3-09 @ 01:34

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2019-8-01 @ 14:25

Here's a DOSBox-X fix to consider for DOSBox SVN:

On Intel processors, if STI is immediately followed by CLI, then no interrupts are serviced even if some are pending.

I wrote a program in DOSLIB to test this on an actual Intel i486 and I can confirm this is the case even if STI+CLI is executed rapidly in a loop for one second: No interrupts processed.

The reason this came up is that someone mentioned a PC-98 game (made by a game maker program, apparently) that appeared to crash at specific intervals if FM music was enabled.
Upon closer examination the crash happened when the vertical retrace interrupt happened during the FM interrupt, and THAT happened because the FM interrupt has STI+CLI sequences at various places for some reason despite the fact that the FM driver code is non-reentrant. The stack switching at entry and exit will corrupt the stack pointer if entered again while in the middle of processing.

The reason it never crashed on real hardware is that on real Intel CPUs, STI+CLI is too quick to process any interrupts.

The reason it crashed in DOSBox-X is because DOSBox-X inherited the normal core from DOSBox SVN which upon processing STI, immediately breaks to process interrupts.

It might be worth it to see if some games on your compatibility list crashed because of similar sequences in the code.
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: 694
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2019-8-01 @ 14:29

This fix is implemented in DOSBox-X by adding to the normal core a "peek" function. The STI handler is coded to "peek" at the next opcode, and ignore the STI if the next opcode is CLI.

I do not recommend simply clamping CPU_Cycles to a low value on STI. You will eventually hit a corner case with a game that causes the CPU core to get stuck in an infinite loop.
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: 694
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby bfcastello » 2019-8-03 @ 19:38

I have a small issue, not DOSBox-X related, but I believe someone here can help.

When I try to run SimCity 2000 from DOS, "C:\Games\SC2000\SC2000.exe" I get this message:

"Critical Error, Microsoft compatable mouse not found. Please load mouse driver"

Any ideas, please? Tks in advance.
"Design isn't just what it looks like and feels like. Design is how it works."
JOBS, Steve.
User avatar
bfcastello
Member
 
Posts: 271
Joined: 2017-9-07 @ 02:39
Location: Rio de Janeiro, Brazil and Catalonia, Spain

Re: DOSBox-X branch

Postby TheGreatCodeholio » 2019-8-03 @ 19:49

bfcastello wrote:I have a small issue, not DOSBox-X related, but I believe someone here can help.

When I try to run SimCity 2000 from DOS, "C:\Games\SC2000\SC2000.exe" I get this message:

"Critical Error, Microsoft compatable mouse not found. Please load mouse driver"

Any ideas, please? Tks in advance.


Should not happen unless int33=false is in your dosbox.conf or you are booting a bootdisk to run the game without a mouse driver in the guest OS.

I know that Sim City 2000 is also one of those games that may get unstable or crashy if loaded too low in memory, try LOADFIX first.
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: 694
Joined: 2011-8-18 @ 20:15
Location: Seattle, WA

Re: DOSBox-X branch

Postby bfcastello » 2019-8-03 @ 21:17

TheGreatCodeholio wrote:
bfcastello wrote:I have a small issue, not DOSBox-X related, but I believe someone here can help.

When I try to run SimCity 2000 from DOS, "C:\Games\SC2000\SC2000.exe" I get this message:

"Critical Error, Microsoft compatable mouse not found. Please load mouse driver"

Any ideas, please? Tks in advance.


Should not happen unless int33=false is in your dosbox.conf or you are booting a bootdisk to run the game without a mouse driver in the guest OS.

I know that Sim City 2000 is also one of those games that may get unstable or crashy if loaded too low in memory, try LOADFIX first.


I'm actually booting from a boot disk. I guess that I need a mouse driver...

Edit: Fixed with the installation of a mouse driver for DOS (MOUSE.COM). Never thought I would forget simple things I knew 25 years ago.
"Design isn't just what it looks like and feels like. Design is how it works."
JOBS, Steve.
User avatar
bfcastello
Member
 
Posts: 271
Joined: 2017-9-07 @ 02:39
Location: Rio de Janeiro, Brazil and Catalonia, Spain

PreviousNext

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 1 guest