Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where In Space Is Carmen Sandiego black screen #212

Open
Die4Ever opened this issue Dec 4, 2022 · 21 comments
Open

Where In Space Is Carmen Sandiego black screen #212

Die4Ever opened this issue Dec 4, 2022 · 21 comments
Labels
bug Something isn't working compatibility Emulator compatibility with DOS apps memory Emulator memory access mode and layout

Comments

@Die4Ever
Copy link

Die4Ever commented Dec 4, 2022

Describe the bug
for Where In Space Is Carmen Sandiego, I only see a black screen, but it shows instructions are running

To Reproduce
You can easily reproduce this with the shareware demo

https://archive.org/details/msdos_WISPACE_shareware - direct download link: https://archive.org/download/msdos_WISPACE_shareware/WISPACE.zip

C:\Users\die4e\Downloads\Spice86 Release\Release\net7.0\win-x64>Spice86.exe -e "C:\Games\carmen sandiego\msdos_WISPACE_shareware\WISPACE\demo.exe"
[2022-12-03 23:10:58.285 -06:00 ERR {"SourceContext": "Spice86.Core.Emulator.InterruptHandlers.Dos.DosMemoryManager"}] Could not find any MCB to fit 65535.
[2022-12-03 23:10:58.314 -06:00 ERR {"SourceContext": "Spice86.Core.Emulator.InterruptHandlers.Dos.DosInt21Handler"}] DOS operation failed with an error. Int will return to 0x143B:0x2A76/0x16E26. . State is Cycles=2668 CS:IP=0xF000:0x20/0xF0020 EAX=0x48A4 EBX=0xFFFF ECX=0x200 EDX=0xFFFF ESI=0x32A8 EDI=0x32A8 EBP=0x81DC ESP=0x80CE SS=0x2972 DS=0x2972 ES=0xFFFF FS=0x0 GS=0x0 flags=0x7086 (    S  P )
[2022-12-03 23:10:58.327 -06:00 ERR {"SourceContext": "Spice86.Core.Emulator.InterruptHandlers.Dos.DosMemoryManager"}] MCB {"FileName": "", "PspSegment": 4080, "Size": 28266, "TypeField": 90, "UsableSpaceSegment": 12693, "IsFree": false, "IsLast": true, "IsNonLast": false, "IsValid": true, "BaseAddress": 203072, "Memory": {"CurrentlyWritingByte": 114, "Ram": "37013223000000000000000000000000... (1048576 bytes)", "Size": 1048576, "UInt8": {"$type": "UInt8Indexer"}, "UInt16": {"$type": "UInt16Indexer"}, "UInt32": {"$type": "UInt32Indexer"}, "$type": "Memory"}, "$type": "DosMemoryControlBlock"} is too small for requested size 65535.
[2022-12-03 23:10:58.353 -06:00 ERR {"SourceContext": "Spice86.Core.Emulator.InterruptHandlers.Dos.DosInt21Handler"}] DOS operation failed with an error. Int will return to 0x143B:0x298D/0x16D3D. . State is Cycles=2766 CS:IP=0xF000:0x20/0xF0020 EAX=0x4A50 EBX=0xFFFF ECX=0x4 EDX=0x9000 ESI=0x2B67 EDI=0x0 EBP=0x80CA ESP=0x80BA SS=0x2972 DS=0x3195 ES=0x3195 FS=0x0 GS=0x0 flags=0x7086 (    S  P )

image

I'm using Windows 10, I downloaded the latest release from commit 1a3cfc9

@maximilien-noal maximilien-noal added the bug Something isn't working label Dec 8, 2022
@maximilien-noal
Copy link
Member

Hi,

Can you run it again with the -f switch ?

I suspect a port might not answer correctly.
Also, that DOS Memory Manager error is a good lead...

At the moment, game compatibility needs a lot of work. This might be a simple fix. Or it very well may not be.

@Die4Ever
Copy link
Author

Die4Ever commented Dec 8, 2022

same issue

C:\Users\die4e\Downloads\Spice86 Release\Release\net7.0\win-x64>Spice86.exe -fe "C:\Games\carmen sandiego\msdos_WISPACE_shareware\WISPACE\demo.exe"
[2022-12-08 04:21:14.153 -06:00 ERR {"SourceContext": "Spice86.Core.Emulator.InterruptHandlers.Dos.DosMemoryManager"}] Could not find any MCB to fit 65535.
[2022-12-08 04:21:14.183 -06:00 ERR {"SourceContext": "Spice86.Core.Emulator.InterruptHandlers.Dos.DosInt21Handler"}] DOS operation failed with an error. Int will return to 0x143B:0x2A76/0x16E26. . State is Cycles=2668 CS:IP=0xF000:0x20/0xF0020 EAX=0x48A4 EBX=0xFFFF ECX=0x200 EDX=0xFFFF ESI=0x32A8 EDI=0x32A8 EBP=0x81DC ESP=0x80CE SS=0x2972 DS=0x2972 ES=0xFFFF FS=0x0 GS=0x0 flags=0x7086 (    S  P )
[2022-12-08 04:21:14.188 -06:00 ERR {"SourceContext": "Spice86.Core.Emulator.InterruptHandlers.Dos.DosMemoryManager"}] MCB {"FileName": "", "PspSegment": 4080, "Size": 28266, "TypeField": 90, "UsableSpaceSegment": 12693, "IsFree": false, "IsLast": true, "IsNonLast": false, "IsValid": true, "BaseAddress": 203072, "Memory": {"CurrentlyWritingByte": 114, "Ram": "37013223000000000000000000000000... (1048576 bytes)", "Size": 1048576, "UInt8": {"$type": "UInt8Indexer"}, "UInt16": {"$type": "UInt16Indexer"}, "UInt32": {"$type": "UInt32Indexer"}, "$type": "Memory"}, "$type": "DosMemoryControlBlock"} is too small for requested size 65535.
[2022-12-08 04:21:14.214 -06:00 ERR {"SourceContext": "Spice86.Core.Emulator.InterruptHandlers.Dos.DosInt21Handler"}] DOS operation failed with an error. Int will return to 0x143B:0x298D/0x16D3D. . State is Cycles=2766 CS:IP=0xF000:0x20/0xF0020 EAX=0x4A50 EBX=0xFFFF ECX=0x4 EDX=0x9000 ESI=0x2B67 EDI=0x0 EBP=0x80CA ESP=0x80BA SS=0x2972 DS=0x3195 ES=0x3195 FS=0x0 GS=0x0 flags=0x7086 (    S  P )

@maximilien-noal
Copy link
Member

maximilien-noal commented Dec 17, 2022

https://www.mobygames.com/game/dos/where-in-space-is-carmen-sandiego-deluxe-edition/techinfo

It requires a 286, but it don't think that it uses protected mode. The 286's "protected mode" is not what we refer to usually. According to VOGONS, the 286 protected mode was very rarely used by games.
Protected Mode usually refers to what the 386 or later offered.

1993 is where games start to use protected mode, but I doubt this is one of them.

Anyway, the error message suggests that the game tries to allocate 64 KB of RAM and fails at that.

Perhaps the DOS Memory Manager of Spice86 needs some fixing.

@maximilien-noal
Copy link
Member

@Die4Ever The amount of main memory is now configurable, does it work better with say -k 8192 ?

@Die4Ever
Copy link
Author

still not working, I tried a bunch of different numbers

the free shareware demo is available here if you wanna try it

https://archive.org/details/msdos_WISPACE_shareware

direct download link: https://archive.org/download/msdos_WISPACE_shareware/WISPACE.zip

@maximilien-noal
Copy link
Member

On another issue, we are looking into adding an XMS handler and EMS handler to Spice86. It's probably what this game is missing.

In fact it's already implemented, it just needs a separate branch and PR.

@maximilien-noal maximilien-noal added compatibility Emulator compatibility with DOS apps memory Emulator memory access mode and layout labels Jan 10, 2023
@maximilien-noal
Copy link
Member

@Die4Ever Tested with the latest changes on master, and with the latest EMS code, it still doesn't run.

It's asking for 0xFFFF in memory size, but that's a usual trick:
Trying to allocate -1 (all memory) in order to find out how many bytes are free.

@Die4Ever
Copy link
Author

@Die4Ever Tested with the latest changes on master, and with the latest EMS code, it still doesn't run.

It's asking for 0xFFFF in memory size, but that's a usual trick: Trying to allocate -1 (all memory) in order to find out how many bytes are free.

sounds like fixing this could help other games too? that's cool

@maximilien-noal
Copy link
Member

@Die4Ever Latest master implements an entirely new VGA Card, which fixes a lot of video modes.

Sadly, Carmen Sandiego still only shows a black screen.

I'm currently trying to fix some memory managers (EMS), and Alpha Waves next. I'll need help on this one, I think.

@Die4Ever
Copy link
Author

just downloaded the latest release based on beae11b

the debug build, still getting the black screen but here's the log output

log.txt

notably I saw this

[2023-06-12 17:45:58.987 -05:00] [EROR] [0x143B:0x2A76/0x16E26] Could not find any MCB to fit 65535
[2023-06-12 17:45:59.011 -05:00] [EROR] [0x143B:0x2A76/0x16E26] DOS operation failed with an error. Int will return to 0x143B:0x2A76/0x16E26. . State is Cycles=2670 CS:IP=0xF000:0x20/0xF0020 EAX=0x48A4 EBX=0xFFFF ECX=0x200 EDX=0xFFFF ESI=0x32A8 EDI=0x32A8 EBP=0x81DC ESP=0x80CE SS=0x2972 DS=0x2972 ES=0xFFFF FS=0x0 GS=0x0 flags=0x7086 (    S  P )
[2023-06-12 17:45:59.108 -05:00] [EROR] [0x143B:0x298D/0x16D3D] MCB {"FileName":"","PspSegment":4080,"Size":28266,"TypeField":90,"UsableSpaceSegment":12693,"IsFree":false,"IsLast":true,"IsNonLast":false,"IsValid":true,"BaseAddress":203072,"Memory":{"A20Gate":{"AddressMask":1048575,"IsEnabled":false},

and then a big RAM dump, and then

"CurrentlyWritingByte":114,"Size":1114095,"UInt8":{},"UInt16":{},"UInt32":{}}}typeField: 90pspSegment: 4080size: 28266fileName:  is too small for requested size 65535
[2023-06-12 17:45:59.147 -05:00] [EROR] [0x143B:0x298D/0x16D3D] DOS operation failed with an error. Int will return to 0x143B:0x298D/0x16D3D. . State is Cycles=2766 CS:IP=0xF000:0x20/0xF0020 EAX=0x4A50 EBX=0xFFFF ECX=0x4 EDX=0x9000 ESI=0x2B67 EDI=0x0 EBP=0x80CA ESP=0x80BA SS=0x2972 DS=0x3195 ES=0x3195 FS=0x0 GS=0x0 flags=0x7086 (    S  P )

@maximilien-noal
Copy link
Member

Thanks, I was thinking of testing this game with the latest VGA and EMS implementations that are now on master.

I also tried the full game with the same results.

Will have to compare it with DOSBox.

@Die4Ever
Copy link
Author

yea I was watching those PRs, I subscribed to them so I could see when they were merged to see if they would help lol

I hope I can use your project to port this game into ScummVM some day, and maybe other Carmen Sandiego games (I don't remember how many of them are DOS) if they use the same or similar engine

@Die4Ever
Copy link
Author

Die4Ever commented Jul 16, 2023

just grabbed the latest release, debug build, after that big pull request was merged, commit d7f86ff

image

   at SafeFileHandle Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at SafeFileHandle Microsoft.Win32.SafeHandles.SafeFileHandle.Open(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize, UnixFileMode? unixCreateMode)
   at byte[] System.IO.File.ReadAllBytes(string path)
   at byte[] Spice86.Core.Emulator.LoadableFile.ExecutableFileLoader.ReadFile(string file) in /_/src/Spice86.Core/Emulator/LoadableFile/ExecutableFileLoader.cs:line 62
   at byte[] Spice86.Core.Emulator.LoadableFile.Dos.Exe.ExeLoader.LoadFile(string file, string arguments) in /_/src/Spice86.Core/Emulator/LoadableFile/Dos/Exe/ExeLoader.cs:line 52
   at void Spice86.Core.Emulator.ProgramExecutor.LoadFileToRun(Configuration configuration, ExecutableFileLoader loader) in /_/src/Spice86.Core/Emulator/ProgramExecutor.cs:line 256

@maximilien-noal
Copy link
Member

Looks like my most recent PR about file handling should be rebased on master and merged in order to fix this. :)

Should be a few days away, depending on free time.

@Die4Ever
Copy link
Author

after that pull request got merged I just tried it, it just says "Emulator: not started. ASM Overrides: not used."

@maximilien-noal
Copy link
Member

I'll look into it.

@maximilien-noal
Copy link
Member

after that pull request got merged I just tried it, it just says "Emulator: not started. ASM Overrides: not used."

This is fixed. Along with an emulator problem.

Now the game tries to set the DOS default drive to an index that doesn't exist... Progress. :)

@Die4Ever
Copy link
Author

Die4Ever commented Sep 16, 2023

I did notice Where In Europe Is Carmen Sandiego doesn't work either, idk if that would be helpful in debugging since it's an older and simpler game but it's probably doing things very differently? Anyways here's a link to the shareware demo from archive.org

direct download: https://archive.org/download/WhereInEuropeIsCarmenSandiegoDemo/carmen.zip

https://archive.org/details/WhereInEuropeIsCarmenSandiegoDemo

using the latest release from cda9a75

[2023-09-16 02:37:12.261 -05:00] [EROR] [0x1B56:0x5120/0x20680] An error occurred during execution
Spice86.Core.Emulator.Errors.UnhandledOperationException: An error occurred while machine was in this state: Cycles=2522 CS:IP=0x1B56:0x5120/0x20680 EAX=0x0 EBX=0x0 ECX=0x0 EDX=0x0 ESI=0x0 EDI=0x0 EBP=0x512A ESP=0x5116 SS=0x1B56 DS=0x1B56 ES=0x1B56 FS=0x0 GS=0x0 flags=0x7293 (  I S A C).
Error is: Int was called but vector was not initialized for vectorNumber=0x12
   at void Spice86.Core.Emulator.CPU.Cpu.Interrupt(byte? vectorNumber, bool external) in /_/src/Spice86.Core/Emulator/CPU/CPU.cs:line 1218
   at void Spice86.Core.Emulator.CPU.Cpu.ExecOpcode(byte opcode) in /_/src/Spice86.Core/Emulator/CPU/CPU.cs:line 819
   at void Spice86.Core.Emulator.CPU.Cpu.ExecuteNextInstruction() in /_/src/Spice86.Core/Emulator/CPU/CPU.cs:line 108
   at void Spice86.Core.Emulator.VM.EmulationLoop.RunLoop() in /_/src/Spice86.Core/Emulator/VM/EmulationLoop.cs:line 102
   at void Spice86.Core.Emulator.VM.EmulationLoop.StartRunLoop(FunctionHandler functionHandler) in /_/src/Spice86.Core/Emulator/VM/EmulationLoop.cs:line 92
   at void Spice86.Core.Emulator.VM.EmulationLoop.Run() in /_/src/Spice86.Core/Emulator/VM/EmulationLoop.cs:line 68
   at void Spice86.Core.Emulator.ProgramExecutor.Run() in /_/src/Spice86.Core/Emulator/ProgramExecutor.cs:line 63
   at void Spice86.ViewModels.MainWindowViewModel.StartProgramExecutor() in /_/src/Spice86/ViewModels/MainWindowViewModel.cs:line 621
   at void Spice86.ViewModels.MainWindowViewModel.MachineThread() in /_/src/Spice86/ViewModels/MainWindowViewModel.cs:line 599

Where In Space Is Carmen Sandiego still doesn't give a stack trace, this is the current console output for that game

[2023-09-16 02:38:41.330 -05:00] [EROR] [0x143B:0x2A76/0x16E26] Could not find any MCB to fit 65535
[2023-09-16 02:38:41.354 -05:00] [EROR] [0x143B:0x2A76/0x16E26] DOS operation failed with an error. Int will return to 0x143B:0x2A76/0x16E26. . State is Cycles=2683 CS:IP=0xF000:0x20/0xF0020 EAX=0x48A4 EBX=0xFFFF ECX=0x200 EDX=0xFFFF ESI=0x32A8 EDI=0x32A8 EBP=0x81DC ESP=0x80CE SS=0x2972 DS=0x2972 ES=0xFFFF FS=0x0 GS=0x0 flags=0x7086 (    S  P )
[2023-09-16 02:38:41.407 -05:00] [EROR] [0x143B:0x298D/0x16D3D] MCB {"FileName":"","PspSegment":4080,"Size":28266,"TypeField":90,"UsableSpaceSegment":12693,"IsFree":false,"IsLast":true,"IsNonLast":false,"IsValid":true,"BaseAddress":203072,"UInt8":{},"UInt16":{},"UInt32":{},"Int8":{},"Int16":{},"Int32":{},"SegmentedAddressValue":{},"SegmentedAddress":{},"ByteReaderWriter":{"Length":1114095}}typeField: 90pspSegment: 4080size: 28266fileName:  is too small for requested size 65535
[2023-09-16 02:38:41.409 -05:00] [EROR] [0x143B:0x298D/0x16D3D] DOS operation failed with an error. Int will return to 0x143B:0x298D/0x16D3D. . State is Cycles=2781 CS:IP=0xF000:0x20/0xF0020 EAX=0x4A50 EBX=0xFFFF ECX=0x4 EDX=0x9000 ESI=0x2B67 EDI=0x0 EBP=0x80CA ESP=0x80BA SS=0x2972 DS=0x3195 ES=0x3195 FS=0x0 GS=0x0 flags=0x7086 (    S  P )
[2023-09-16 02:38:41.412 -05:00] [EROR] [0x2332:0x1D71/0x25091] DOS operation failed with an error. Int will return to 0x2332:0x1D71/0x25091. . State is Cycles=3091 CS:IP=0xF000:0x20/0xF0020 EAX=0x3BAC EBX=0x81AC ECX=0x0 EDX=0x81AC ESI=0x0 EDI=0x0 EBP=0x81A0 ESP=0x819A SS=0x2972 DS=0x2972 ES=0x2972 FS=0x0 GS=0x0 flags=0x7046 (     Z P )

@maximilien-noal
Copy link
Member

maximilien-noal commented Sep 16, 2023

Thanks for this suggestion, I'm glad that you are still very interested in using this, despite the very slow progress on supporting more games. This project is focused on a new CPU that will enable the creation of a new machine code overrides generator. Also, I've been working on a new internal debugger that will make working on the emulator and on game's machine code overrides easier. And overall, our focus is on Dune / OpenRakis at first.

That said, supporting earlier games is worth it. For example, support for Duke Nukem I and II has been added recently. But, while there is an argument to be made that working on simpler game first will enable more complex games to run, it's a gamble. Will the more complex game have the same needs ? It's doubtful. The evolution of DOS games is not linear. On top of that, limited free time doesn't allow working on more than a few features at a time.

That's why, the code has been simplified a lot And while there are still gaps, it's also heavily documented. That, and the debugger, should make contributions to the emulator easier. If you know a little bit of C# or C like languages, I'll be glad to assist you on PRs that will make Where in Space is Carmen Sandiego work. Also, I'm a fan of this series as well.

@Die4Ever
Copy link
Author

Thanks for this suggestion, I'm glad that you are still very interested in using this, despite the very slow progress on supporting more games. This project is focused on a new CPU that will enable the creation of a new machine code overrides generator. Also, I've been working on a new internal debugger that will make working on the emulator and on game's machine code overrides easier. And overall, our focus is on Dune / OpenRakis at first.

That said, supporting earlier games is worth it. For example, support for Duke Nukem I and II has been added recently. But, while there is an argument to be made that working on simpler game first will enable more complex games to run, it's a gamble. Will the more complex game have the same needs ? It's doubtful. The evolution of DOS games is not linear. On top of that, limited free times doesn't allow working on more than a few features at a time.

That's why, the code has been simplified a lot And while there are still gaps, it's also heavily documented. That, and the debugger, should make contributions to the emulator easier. If you know a little bit of C# or C like languages, I'll be glad to assist you on PRs that will make Where in Space is Carmen Sandiego work. Also, I'm a fan of this series as well.

Thanks! One day I should try digging into this code, but I honestly don't know anything about how DOS works or "real mode" or "extended memory" lol. I just noticed Where In Europe had a demo on archive.org and I saw it uses a maybe similar looking DAT file, and then noticed it was able to produce a stack trace, no idea if it's helpful or not lol.

Duke Nukem 1&2 is great! That's really cool. I hope this project leads to more open source ports of all these games.

@maximilien-noal
Copy link
Member

maximilien-noal commented Sep 16, 2023

OK ! So the debugger I'm working on will definitely help a ton towards discovering why Where in Space is Carmen Sandegio doesn't work. :)

I didn't know a thing at first either, but the Dosbox staging and Freedos source code helped a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility Emulator compatibility with DOS apps memory Emulator memory access mode and layout
Projects
None yet
Development

No branches or pull requests

2 participants