CP/M 86

Software related questions
Post Reply
Vorticon
Posts: 278
Joined: Fri Nov 27, 2009 6:25 am

CP/M 86

Post by Vorticon »

Hi. Has anyone here successfully run CP/M 86 on the PCjr? I downloaded a disk image of version 1.1 for the IBM PC, and it booted fine (albeit in 40 col mode), but then an "unexpected interrupt #48" error pops up the minute I press a key on the keyboard... It would really be nice to be able to run some CP/M software like WordStar on Jr :)
Brutman
Site Admin
Posts: 1331
Joined: Sat Jun 21, 2008 5:03 pm
Contact:

Re: CP/M 86

Post by Brutman »

I have not tried CPM/86. But the Int 48 problem is interesting. Check this out:

http://www.brutman.com/PCjr/pcjr_keyboard_handling.html

So on a PCjr Int 48 is the second level interrupt handler that converts a PCjr scan code received from the hardware interrupt handler to a PC compatible scan code. Under normal circumstances the BIOS should be setting the interrupt vectors. It looks like CPM/86 is expecting to use INT48, and probably redefined it, and then gets confused with INT 9 calls it.

It has to be patched ... or you have to modify INT9 to generate PC compatible scan codes up front without using INT48.


Mike
CommodoreJohn
Posts: 28
Joined: Thu Apr 29, 2010 4:13 pm
Location: Minnesota, USA
Contact:

Re: CP/M 86

Post by CommodoreJohn »

Hmm. CP/M fortunately keeps all the hardware-specific stuff in its BIOS section (not to be confused with the PC BIOS,) so that should be the only part that needs alteration. Luckily, the source has been public for a while; you can get the CP/M-86 source, plus the source for the PC/XT BIOS, here, implement a workaround, and re-build it for PCjr.

As for the workaround itself, I'm not sure what INT 48h is used for in CP/M-86, but it might be used by applications (and therefore impossible/impractical to patch,) so if there's a way you can patch the PCjr keyboard handler to use a different interrupt, that would probably be the better solution
Packard-Bell 286 (DOS 3.3, 32MB HD, 2.6MB RAM, HGC/EGA)
Tandy 1000TX (DOS 3.2, 640KB RAM, TGA)
Brutman
Site Admin
Posts: 1331
Joined: Sat Jun 21, 2008 5:03 pm
Contact:

Re: CP/M 86

Post by Brutman »

This is fun! Here is your bogus piece of code in PCBIOS.A86

Code: Select all

;
;----------------------------------------
;
;    Setup Interrupt Service Routine vectors
;
SETISR:    SUB    AX,AX
    MOV    ES,AX
    MOV    DS,AX
    MOV    DI,0080h
    MOV    AX,Offset UNEXPINT    ; Unexpected interrupt routine
    MOV    BX,CS            ; and segment
    CLD
    MOV    CX,0040h
SETISR1:
    INC    DI        ; AT PATCH - Originally STOSW instruction
    XCHG    AX,BX
    LOOP    SETISR1
;
    ADD    DI,0008h
    MOV    CX,017Ch
SETISR2:
    INC    DI        ; AT PATCH - Originally STOSW instruction
    XCHG    AX,BX
    LOOP    SETISR2
Basically, it looks like it is running through the interrupt table setting everything to 'Unexpected' started at the interrupt vector at 0x80. That corresponds to INT 32 on up, which leaves the low numbered interrupts for timer, disk, keyboard unchanged.

At a minimum that code has to be patched to not touch INT 48, or to put it back to what BIOS starts with.
CommodoreJohn
Posts: 28
Joined: Thu Apr 29, 2010 4:13 pm
Location: Minnesota, USA
Contact:

Re: CP/M 86

Post by CommodoreJohn »

Ah. Well, if it's just setting the vectors to serve as invalid-interrupt traps, it should work to just change the code to skip INT 48h.
Packard-Bell 286 (DOS 3.3, 32MB HD, 2.6MB RAM, HGC/EGA)
Tandy 1000TX (DOS 3.2, 640KB RAM, TGA)
Corey986
Posts: 35
Joined: Tue Jun 03, 2014 6:03 pm

Re: CP/M 86

Post by Corey986 »

Reviving this thread...

Has anyone done the patch to get CP/M running on the JR?

Thanks,
Corey
Junkman
Posts: 9
Joined: Sat Dec 18, 2021 6:36 pm
Contact:

Re: CP/M 86

Post by Junkman »

Sorry for the necropost but has anyone ever bothered to try and do the patch?

Most CPM systems only had 128k of ram so this OS would be usable even on a stock Jr.
Post Reply