Skip to content

CP/M-86 support#139

Open
johnsonjh wants to merge 11 commits into
masterfrom
johnsonjh/20260523/new_cpm86
Open

CP/M-86 support#139
johnsonjh wants to merge 11 commits into
masterfrom
johnsonjh/20260523/new_cpm86

Conversation

@johnsonjh

@johnsonjh johnsonjh commented May 23, 2026

Copy link
Copy Markdown
Collaborator

CP/M-86 support!

The goal is to match DOS-PLUS / CP/M 4.1 eventually.

When complete this will close #52.

90% of the code is by me, 90% of the comments and the docs updates
are Claude and Gemini (because I hate writing docs and comments).

This isn't finished by a long shot but a lot works already.  Some
attention needs to be paid to ensure there are no regressions to
any of the DOS code, but I tried to be very careful about that.

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
@johnsonjh

johnsonjh commented May 23, 2026

Copy link
Copy Markdown
Collaborator Author

This isn't finished by a long shot but a lot works already. Some attention needs to be paid to ensure there are no regressions to any of the DOS code, but I tried to be very careful about that.

@tsupplis I see my base page init is all fubar - I will fix that and maybe more will work.

Edit - success! Confession - Claude helped me. I haaattte it.:)

… System Guide

... and also analysis of the layout / live base-page dump from cpm86.exe emu

ARC86 now both compresses and extracts successfully!

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
@johnsonjh

johnsonjh commented May 23, 2026

Copy link
Copy Markdown
Collaborator Author

FIXED ZORK!! It’s not accepting keyboard input yet that appears to be interrupt driven? I’m on it.

johnsonjh added 2 commits May 23, 2026 19:01
Claude AI wrote some tests... and the comments.

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
and AI clanker docs again, sorry.

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
@johnsonjh

Copy link
Copy Markdown
Collaborator Author
IMG_4693 IMG_4691

IBM PC CP/M-86 ZORK now plays!

@johnsonjh

Copy link
Copy Markdown
Collaborator Author

@tsupplis @dmsc I think I’ll call it a day for now. And play Zork.

@johnsonjh johnsonjh changed the title WIP CP/M-86 support; merge working subset from local dev branch WIP CP/M-86 support May 24, 2026
@johnsonjh

Copy link
Copy Markdown
Collaborator Author

More discussion at tsupplis/cpm86-crossdev#10

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
@johnsonjh

Copy link
Copy Markdown
Collaborator Author

Fixed Turbo Pascal IDE, STAT, LS, and more. Still fighting TED video.

…yte Count.

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
@johnsonjh

Copy link
Copy Markdown
Collaborator Author

Pushed the branch again, now we report our CP/M version as 3.1. Added support for setting the CP/M version via EMU2_CPMVER (just like EMU2_DOSVER). Fixes Last Record Byte Counts for most CP/M-Plus programs.

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
johnsonjh added a commit to johnsonjh/lzpack that referenced this pull request May 27, 2026
See tsupplis/cpm86-crossdev#10
and dmsc/emu2#139 for details.

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
@johnsonjh

Copy link
Copy Markdown
Collaborator Author

Pushed again, with support for ISX-style LRBC, add EMU2_CPM_ISXLRBC knob.

CP/M-86 programs in the 8080 memory model (and CP/M-80-heritage code generally)
commonly terminate with a near RET to the warm-boot vector at offset 0 of the
code segment, rather than a far RETF to the loader-supplied exit address.

emu2 pushes a far exit address (PSP:0000 -> INT 20h) on the program entry stack.
That satisfies a far RETF, but a near RET pops only the offset (0) and keeps CS,
landing at code:0000 -- the base page -- which emu2 then executes as code.  The
program runs off into the base page / arbitrary memory instead of terminating
(observed: dstat86.cmd spins printing its message / hangs).

In the 8080 model the code entry point is 0x100, so code:0000 is never reached by
normal execution; arm a warm-boot trap there that terminates the program.  The
trap segment is 0 (disabled) for the small/compact models, whose entry *is*
code:0000.

Verified: dstat86.cmd now terminates cleanly (prints its message once and exits),
matching real CP/M-86 behavior; other CP/M-86 programs are unaffected.

Shocking good analysis from Claude.  Patch by me with Clauded comments.

Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
@johnsonjh

Copy link
Copy Markdown
Collaborator Author

Pushed a small 8080 memory model fix

@johnsonjh

Copy link
Copy Markdown
Collaborator Author

I'm unmarking this as draft because it's probably good enough now for a huge number of CP/M-86 programs!

@johnsonjh johnsonjh marked this pull request as ready for review May 29, 2026 10:20
@johnsonjh johnsonjh requested a review from dmsc May 30, 2026 00:36
@johnsonjh johnsonjh changed the title WIP CP/M-86 support CP/M-86 support May 31, 2026
johnsonjh added 2 commits June 2, 2026 07:04
Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
Signed-off-by: Jeffrey H. Johnson <johnsonjh.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advice required: CP/M-86 Emulator

2 participants