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.
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.
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.
This and all of the other Apple II Technical Notes have been converted to HTML by Aaron Heiss as a public service to the Apple II community, with permission by Apple Computer, Inc. Any and all trademarks, registered and otherwise, are properties of their owners.