Page 1 of 1

CP/M 86

Posted: Tue Sep 14, 2010 8:08 pm
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 :)

Re: CP/M 86

Posted: Wed Sep 15, 2010 8:46 am
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

Re: CP/M 86

Posted: Wed Sep 15, 2010 6:17 pm
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

Re: CP/M 86

Posted: Wed Sep 15, 2010 7:49 pm
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.

Re: CP/M 86

Posted: Wed Sep 15, 2010 8:39 pm
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.

Re: CP/M 86

Posted: Sat Jan 17, 2015 8:44 am
by Corey986
Reviving this thread...

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

Thanks,
Corey

Re: CP/M 86

Posted: Wed Dec 29, 2021 1:13 pm
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.