MChess Pro 8.0: UCI Compatible

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
Steve Maughan
Posts: 1409
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: MChess Pro 8.0: UCI Compatible

Post by Steve Maughan »

That's amazing!
http://www.chessprogramming.net - Juggernaut & Maverick Chess Engine
Luigi335
Posts: 3
Joined: Sat Jun 03, 2023 5:35 pm
Full name: Luigi Del Giudice

Re: MChess Pro 8.0: UCI Compatible

Post by Luigi335 »

Thank you, Steve!

Would it be possible to do the same work for Richard Lang's Chess Genius program?
John_F
Posts: 45
Joined: Wed Jan 27, 2010 2:58 pm

Re: MChess Pro 8.0: UCI Compatible

Post by John_F »

Very interesting. But I bet it can't automatically build a killer book like Marty's DOS MChess Pros used to. :lol:
User avatar
mclane
Posts: 19025
Joined: Thu Mar 09, 2006 6:40 pm
Location: US of Europe, germany
Full name: Thorsten Czub

Re: MChess Pro 8.0: UCI Compatible

Post by mclane »

Sandro Necci Made the book.
What seems like a fairy tale today may be reality tomorrow.
Here we have a fairy tale of the day after tomorrow....
Damas Clásicas
Posts: 34
Joined: Thu Aug 22, 2019 6:11 am
Full name: Herson P. Guier

Re: MChess Pro 8.0: UCI Compatible

Post by Damas Clásicas »

Dear Steve,

I just wanted to say a big thank you for all the work you've put into bringing MChess Pro 8 back to life and, especially, for making it available to everyone. I find what you've done truly fascinating! You didn't simply create a new engine inspired by MChess; you actually brought the original program back, preserving its search and evaluation. That's quite an achievement!

The fact that you managed to reproduce all 700 recorded searches with exactly the same moves, node counts and move order is particularly impressive. I can only imagine how much time and effort went into achieving that level of accuracy.

I'm genuinely delighted that you've decided to share your work with the chess community. For those of us who appreciate classic chess programs, this is a real gift. It's wonderful to see an important piece of computer-chess history preserved and made available to run on modern computers. I really appreciate your generosity in doing this. Thank you, Steve!

I'd also like to ask you something from a technical perspective. I've already spent several months reverse-engineering and reconstructing several older Spanish Checkers programs, with some very successful results. So your project immediately caught my attention, especially the way you recovered the original search and evaluation routines.

Would you mind sharing which tools you used for the reverse-engineering work? I'd be particularly interested to know which disassembler, decompiler (if you used one), and debugger you worked with. I'd also love to know a little more about how you developed the purpose-built emulator you used to compare the original program with your reconstruction.

I'd find any details you're willing to share extremely interesting and useful.

Congratulations on this wonderful project, Steve, and once again, thank you for sharing it with all of us. I really appreciate it!

Best regards,
Herson



Steve Maughan wrote: ↑Mon Nov 23, 2026 4:00 am I'm delighted to announce that Marty Hirsch's MChess Pro 8.0 is back, this time as a native UCI engine you can drop into any modern chess GUI.

https://github.com/stevemaughan/MChess-Pro-8.0-UCI-Compatible

This is not a new engine "in the style of" MChess. It is MChess. I took the 1998 MS-DOS program apart and rebuilt it in Zig, translating the original search and evaluation from the machine code and checking the result against the original running in a purpose-built emulator. With the bug corrections switched off, it matches the original on all 700 recorded searches: same move, same node count, same move order.

The fun part is the speed. The original manages about 7,000 nodes per second on a fast 1998 PC, while the rewrite runs at 1.8 to 2.9 million on a single thread of a current laptop. A first test of 750 fast games puts it at roughly 2525 Elo on the CCRL Blitz scale.

It ships as a single executable with Sandro Necchi's opening book and the original three- and four-man tablebases built in, so there is nothing to install. UCI support is thorough, including pondering and Fischer increments. I also corrected 38 bugs in the original (one of which could make it play an illegal move), and each is documented and switchable in the source.

For the programmers here, the README describes what the disassembly revealed about MChess's famous tactical style: the plan built at the root, the layered selective search, and a remarkable threat detector.

The Windows x64 build is fully tested. The Windows ARM, macOS, Linux, and Android builds are compiled but not yet run, so reports are very welcome, as are test results at longer time controls. One request: this is a restoration, not an improvement. If the original would have played it, it's not a bug!

All of the chess is Marty Hirsch's. The rewrite is free for non-commercial use.

Enjoy!

Steve
Robert Flesher
Posts: 1293
Joined: Tue Aug 18, 2009 3:06 am

Re: MChess Pro 8.0: UCI Compatible

Post by Robert Flesher »

This is fantastic news! Several years ago I reached out to Marty to ask if he would perhaps want to release his fine engine to the fans. He told me that he actually did not have a copy anymore, or something similar. Years later to see this engine on modern hardware is a real treat. Thank-you!
User avatar
Steve Maughan
Posts: 1409
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: MChess Pro 8.0: UCI Compatible

Post by Steve Maughan »

Damas Clásicas wrote: ↑Wed Nov 25, 2026 9:40 am<SNIP>
Would you mind sharing which tools you used for the reverse-engineering work? I'd be particularly interested to know which disassembler, decompiler (if you used one), and debugger you worked with. I'd also love to know a little more about how you developed the purpose-built emulator you used to compare the original program with your reconstruction.

I'd find any details you're willing to share extremely interesting and useful.
</SNIP>
Hi Herson,

Thank you, that is very kind, and I'm glad the project is of interest. Happy to share.

The short answer is that almost nothing was off the shelf.

HOW IT WAS DONE
I did the project with Claude Code, Anthropic's AI coding agent, working under my direction. It read the machine code and wrote the tools below and the Zig engine; the decisions about what counts as faithful, and which bugs to fix, were mine.

EMULATOR
A small DOS machine written in Python on top of Unicorn (the CPU emulation library), about 1,400 lines. It implements only the DOS and BIOS calls MChess actually makes, plus a simple VGA model, an XMS driver for the hash tables, scripted keystrokes and a virtual clock. The virtual clock is the important part: every run is identical, so any result can be reproduced.
It also did the unpacking. MCP8.EXE is packed and then encrypted, so we ran the protector inside the emulator and dumped memory at the moment it hands over to the real program.

DISASSEMBLER
Our own, under 400 lines of Python on top of Capstone: recursive descent from the known entry points. One feature mattered more than anything else: the emulator records which instructions execute during a search, and the listing shows a run count on every line. You read the hot code first and ignore the user interface.

DECOMPILER
None. Ghidra and rizin were installed and hardly used.

DEBUGGER
None as such. The emulator has hooks instead: instruction traces, memory dumps, and stops at a routine's entry and return.

THE METHOD
For each routine: write a small Python model from the listing, then hook that routine in the running original and compare the model with it on every real call, down to every byte of memory it changes. Only when the model matches is the routine ported, and the port is tested against the same recorded calls. Whole searches are then compared by hashing every move the search makes, in order.

For the earlier Cyrus IS Chess project (Z80) I used SkoolKit for both disassembly and simulation.

If I had to pass on one idea, it is this: get the original running under script control in a deterministic emulator.

Best regards,
Steve
http://www.chessprogramming.net - Juggernaut & Maverick Chess Engine
Jjaw
Posts: 128
Joined: Thu Jul 29, 2021 4:48 pm
Full name: Joe Louvier

Re: MChess Pro 8.0: UCI Compatible

Post by Jjaw »

When attempting to open engine on windows , engine displays error that says " could not find entry point into dynamic link kernel " and window closes.
Dann Corbit
Posts: 12902
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: MChess Pro 8.0: UCI Compatible

Post by Dann Corbit »

Jjaw wrote: ↑Thu Nov 26, 2026 12:13 am When attempting to open engine on windows , engine displays error that says " could not find entry point into dynamic link kernel " and window closes.
Are you sure you downloaded the correct binary for your system?
It works fine for me.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
Steve Maughan
Posts: 1409
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: MChess Pro 8.0: UCI Compatible

Post by Steve Maughan »

Jjaw wrote: ↑Thu Nov 26, 2026 12:13 am When attempting to open engine on windows , engine displays error that says " could not find entry point into dynamic link kernel " and window closes.
Are you running Windows 7? I've just added Win7 executables (both 32 and 64 bits) to the Release. They should work if you're running Win7.

— Steve
http://www.chessprogramming.net - Juggernaut & Maverick Chess Engine