FORTRAN: Using WCHAR from FORTRAN

This applies to the Apple II, Apple II+, Apple IIe, and Apple IIc.
The Turtlegraphics WCHAR procedure, which writes a single character on the
high-res screen, will often give a "Value Range Error" (S#20, P#17, I#11) when
called from FORTRAN. WCHAR does not check the high byte of the character word
passed before calling the DRAWHBLOCK routine, so if the high byte contains a
value, WCHAR will choke by trying to access an index beyond the end of
SYSTEM.CHARSET.

This error will occur when passing a single character from a character array,
but not from a single character "string". For example,

CHARACTER CH(10)
READ (*,100) CH(1)
CALL WCHAR (CH(1))

will result in a "Value Range Error". However,

CHARACTER*1 CH
READ (*,100) CH
CALL WCHAR (CH)

will work correctly. To prevent the error in the first example, replace the
call statement with

CALL WCHAR (CHAR (ICHAR ( CH(1))))

which will convert the character to a integer, and then back to a character
before calling WCHAR.
Published Date: Feb 18, 2012