Displaying custom designed characters from BASIC on the IBM PC

Oct 1, 1986 - Bits and pieces, 31. A technique for displaying subscripts and superscripts when working on a computer word processor. Keywords (Domain)...
0 downloads 9 Views 850KB Size
Displaying Custom Designed Characters from BASIC on the IBM PC

which the graphics information is to be stored. The syntax for the PUT statement is PUT(X,Y), array

T. Caasen

University of North Carolina at Charlone Charlotte, NC 28223 The internal character set typically available on most microcomnuters does not nrovide the suhscrint and suoerscrint capahi6ty that is necessary t o display lhemical formuias properly. A technique originally developed to solve this problem has proven to be useful not only for displaying custom designed characters, hut for animating them as well. Techniques are, of course, available for displaying special characters. An obvious anproach is t o use ordinary graphics statements to draw the characterson the display screen. The advantage in this is that statements from a high-level programming language are used, but this approach may be somewhat cumbersome. At the other extreme, assembly lanmaee nrovides soeed and flexibilitv. hut this annroach is rikeiy appeal o h y to those who a r e s u f f i c i e n t l ~ o t i v a t e d to become adent in its use. Recoenizine the advantaaes and disadvantagesbf these two technyrpes,; method for displaying special characters and symbols was sought that was rapid, highly flexible, and capable of being implemented in a high-level programming language (BASIC) with a maximum degree of transportability from one applications program to another. The technique centers on the use of the graphics P U T statement that is supported by most modern versions of (Microsoft) BASIC. This statement is often used for animation, in conjunction with the graphics GET statement. Execution of the eraohics . GET statement in a BASIC program . causes information within a specified rectangular area of the display screen t o he stored in an array that appears in the argument of the GET statement. This information can be rapidly retrieved from the array and placed on the screen a t some other specified location by executing the PUT statement. For the IBM PC the syntax for the GET statement is

tb

GET(X1,YI) - (X2,Y2), array

where (X1,Yl) and (X2,Y2) are coordinates specifyingopposite corners of the rectangular area containing the graphics information, and array is the name of a numeric array in

842

Journal of Chemical Education

where (X.Y) are the screen coordinates a t which the too left of the graphics rectangle is to be placed when the graphics information within i t is to be displayed. I t is possihleto place graphics information directly into the array used by the PUT statement without executing the GET statement. Information thus stored may be displayed as though the GET statement had been executed. The author has written a character editor for creating disk files of up to 99 graphics symbols each. The graphics information contained in such files may he employed in a BASIC application program through the use of the P U T statement. A single, relatively simple algorithm can he used to display a wide variety of characters, thus eliminating the need to write tedious graphics code a t each point in the program where special characters are to be displayed, and the necessity of having to proaram lenbhy DATA statements containing the character LnformatLn is avoided. Furthermore, special characters are not limited to thoseassociated with text, forn wide varietyof graphics information can be handled in this manner. The character editor is designed t o be used on an IBM PC, XT, AT, and AT&T 6300. Application programs employing the files created by the character editor should also be designed to run on these microcomputers. Copies of the character editor are available from Project SERAPHIM on a 5%in. disk.

( 5 ) Evjen, H. M. Physical Re". 1932.39.675. (6) Frank,F.C.Phil. Mag. 1950,11,1267. 171 Butler. J. N. "ionic Eouilibrium: A Mathematical Aooroseh". Addiaon-Wcalev: .. ~ e a d i n g 1964. ~ ~ , ' (8) Butler, J. N. "Solubilih. and pH Calculations": Addiwn-Wealey: Reading MA, 1964. (91 Fceiser. H.: Fernando, Q. "ionic Equilibria in A d y t i d Chemistry": Wiley: New v--,.

.*"".

.*C"

(10) Bard, A. J. "ChemicalEquilibrium"; Harper & Rov:New York, 1966. (11) Fernando,Q.: Ryan, M. D."Cslcuiations in Analytical Chemistry"; Hareowt, Brace & Jovanwich: NeruYork. 1982.