Sharp OZ-707 Operation Manual - Page 29
Programming
UPC - 074000012141
View all Sharp OZ-707 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 29 highlights
Example: 41 AND 27 ~ equals 9 41 OR 27 ~ equals 59 41 = 101001 AND 27 = 011011 ~ 001001 41 = 101001 OR 27 = 011011 ~ 111011 41 XOR 27 ~ equals 50 41 = 101001 XOR 27 = 011011 ~ 110010 NOT3~ equals -4 (two's complement form) 3= 0000000000000011 NOT ~ 1111111111111100 NOT X can generally be calculated by the equation NOT X = -(X+1). Parentheses and Operator Precedence When evaluating complex expressions, the C.ard f~1I0WS a predefined set of priorities that deter~ine .th~ ~equence In which operators are evaluated. This can be qUite significant: * 5 + 2 3 could be * 5 + 2 = 7 or 2 3 = 6 *7 3 = 21 6 + 5 = 11 The exact rules of "operator precedence" are given on page 28. To avoid having to remember all these rules and to make your program more precise, always use parentheses to determ.i~e the sequence of evaluation. The above example is clarified by wntlng: 46 3. PROGRAMMING In the previous chapter, we examined some of the concepts and terms of the BASIC programming language. In this chapter, you will use these elements to create programs. Let us remind you, however, that this is not a manual on how to program in BASIC. What this chapter will do is familiarize you with the use of BASIC on your Card. Programs A program consists of a set of instructions to the Card. It will perform the exact operations that you specify. You, the programmer, are responsible for issuing the correct instructions. BASIC Statements The Card interprets instructions according to a predetermined format. This format is called a statement. You must always enter BASIC statements in the same pattern. Statements must start with a line number: 10: INPUT A 20: PRINT A*A 30: END Line Numbers Each line of a program must have a unique line number - any integer between 1 and 65279. Line numbers are the reference for the Card. They tell the Card the order in which to run the program, and can be used to tell the Card at which line to start. You need not enter lines in sequential order (although if you are a beginning programmer, it is probably less confusing for you to do so). The computer always begins execution with the lowest line number and moves sequentially through the lines of program in ascending order. 47