Apple II Miscellaneous #15: Compatibility Across Apple II Models

Apple II Technical Notes Developer Technical Support Revised by: Dave Lyons May 1992
Written by: Dave Lyons January 1990

This Technical Note explains how you can get in big trouble with soft switches.

CHANGES SINCE JANUARY 1990: Added caution against calling the 80-column firmware with RAMRD or RAMWRT enabled.


CALL FIRMWARE WITH NORMAL MEMORY MAPPING

Firmware behaves unpredictably if you call it with nonstandard memory mapping in effect.

For example, do not call the 80-column firmware with RAMRD (RDCARDRAM) or RAMWRT (WRCARDRAM) turned on. If you do, the firmware accidentally accesses auxiliary-memory screen holes instead of main-memory screen holes, including MSLOT ($07F8 in main memory). This can cause the system to crash.

READ DEFINED SOFT SWITCHES ONLY

When a soft switch location is defined on one Apple II model but not others, it is not safe to read the soft switch and later decide whether to use the value that was read. The following two examples demonstrate the hazards of this method.

An application must read KEYMODREG ($C025) only after determining that it is running on an Apple IIgs (using IDROUTINE at $FE1F). Reading KEYMODREG and later ignoring the result if not on an Apple IIgs does not work.

NEWVIDEO ($C029) is also defined only on the Apple IIgs. Again, an application must know that it is running on an Apple IIgs before reading or writing this location. (If your application uses double-high resolution, check for an Apple IIgs before attempting to set the monochrome-double-hires bit in NEWVIDEO.)

Both of these locations are reserved on the Apple IIc Plus, and reading from or writing to them currently causes the Apple IIc Plus ROM to be swapped out and replaced by additional ROM, instantly killing your application.

Further Reference