IBM PC/PCjr BASIC Compatibility
I would like to know if a program written for the PCjr in Cartridge BASIC would work on the PC with a color/graphics adapter and BASIC?
The PC and PCjr are quite compatible, considering the differences in the hardware. Since Cartridge BASIC contains all the commands of BASICA (plus a few PCjr-specific commands), most programs written in BASIC or BASICA on the PC will work on the PCjr. To go the other way, the PC must have BASICA and the color/graphics adapter, and it helps to have the game controller adapter (and joystick), since many PCjr programs take advantage of the built-in joystick interface.
One problem when running a PCjr program on the PC is that the PCjr has several graphics modes not found on the PC. The PC with the color graphics adapter supports SCREEN 1, the 320 × 200 four-color mode; and SCREEN 2, the 640 × 200 two-color mode. The PCjr, of course, supports quite a few more modes, including a 160 × 200 and 320 × 200 16-color mode. It's possible (though by no means easy) to rewrite such a PCjr program to run on the PC. Remember that some of the commands in Cartridge BASIC are not found in PC BASICA. These include PCOPY, PALETTE, and PALETTE USING.
Additionally, the PCjr boasts a 3-voice, 10-bit sound chip with white noise capability. The PC has only a programmable beeper, but since the PCjr also has this capability, you can use the beeper instead if you're interested in compatibility.
As long as you avoid these enhanced PCjr features, you can write programs on the PCjr that will run as is on the PC. Since both machines use the same microprocessor, machine language programs will also transfer, as long as you avoid direct calls into the ROMs. Instead, make use of the BIOS routines, documented in the PC or PCjr Technical Reference Manual. Also, do not use software timing loops, since the PC generally runs faster than a PCjr. You can instead use the programmable timer that behaves the same on both machines. IBM programmers have been eagerly awaiting a new color/graphics card for the PC that will emulate some of the features of the PCjr, but to date no such card exists.