Sharp OZ-707 Operation Manual - Page 22
Hexadecimal, Numbers, Variables - area code
UPC - 074000012141
View all Sharp OZ-707 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 22 highlights
Hexadecimal Numbers The decimal system is only one of many different ~ystems to rep~esent numbers. Another that is quite important when uSing computer.s IS the hexadecimal system. The hexadecimal system is base~ on 16 Instead of 10. To write hexadecimal numbers you use the familiar 0 to 9 and six more "digits": A, B, C, 0, E, and F. These correspond to 10, 11, 12 13 14 and 15. When you want the Card to treat a number as he~ad~ci~al, put an ampersand (&) character and "H" in front of the numeral: &HA =10 &H10 = 16 &H100 = 256 &HFFFF = 65535 Variables Computers are made up of many tiny memory are.as called bytes. Each byte can be thought of as a single character. For Instance, the word "card" requires four bytes of memory because there are four characters in it. To see how many bytes are available for use, simply enter FREO and press IENTER I . The number displayed is the number of bytes available for writing programs. This technique works well for words, but is very ineffici~nt when you try to store numbers. For this reason, numbers are stored In a coded fashion. Thanks to this coding technique, the Card can store large numbers in only 8 bytes (or 13 bytes in double-precision mode). The largest number that can be stored is +9.999999999E + 99 (or 9.99999999999999999990 + 99 in double-precision). The smallest number is 1.E-99. This gives you quite a range to choose from. However, if the result of a calculation exceeds this range, the computer will let you know by displaying an error message on the screen (see Appendix A). To see it right now, enter: 911 EXP ~ 9 9 00 9 IENTER I 9E99*9 Overflow 32 To get the Card working properly again, just press the ICeCE 1key. But how do you go about storing all these numbers and strings? It's really very easy. The Card uses names for different pieces of data. Let's store the number 556 in the Card. You may call this number by any name you wish, but for this exercise, let's use the letter R. The statement LET can be used to instruct the Card to assign a value to a variable name, but only in a program statement. However, the LET command is not necessary, so we will not use it often. Now, enter: R = 556 and press 1ENTER I. The Card now has the value 556 associated with the letter R. These letters that are used to store information are called variables. To see the content of the variable R, press the ICeCE I o=J key, the key and the 1ENTER 1key. The Card responds by showing you the value 556 on the right of your display. This is useful when writing programs and formulas. Next, let's use the R variable in a simple formula. In this formula, the variable R stands for the radius of a circle whose area we want to find. The formula for the area of a circle is: A = 1tR2. Type in the following: R yz 2 CKJ I It III ENTER I RA 2*PI 9711 79. 3866 The result is 971179.3866. This technique of using variables in equations will become more understandable as we get into writing programs. So far, we've only discussed numeric variables. What about storing alphabetic characters? Well, the idea is the same, but, so that the Card will know the difference between the two kinds of variables, add a $ to the variable name. For instance, let's store the word BYTE in the variable B$. Notice the $ after the B. This tells the Card that the contents of variable B$ are alphabetic, or I I I.-- string data. To illustrate this, enter the following: B$ = "B Y T E" ENTER -~-$-=-"B-Y-r-E-"- - -..... The string BYTE is now stored in the variable B$. To make sure of this, press the I CeCE 1 key and enter the following: 33