Home > Casio > Personal Computer > Casio Z1 Gr User Manual

Casio Z1 Gr User Manual

    Download as PDF Print this page Share this page

    Have a look at the manual Casio Z1 Gr User Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 338 Casio manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.

    							  71  MID$   PURPOSE: Returns a substring of a specified length from a specified position within a string. FORMAT: MID$ ( string , position [ , number of characters ] )  String expression  Numeric expression  Numeric expression EXAMPLE: MID$ (A$, 5, 3) PARAMETERS: 1. String: string expression 2. Position: numeric expression truncated to an integer in the [0 , 256[ range. 3. Number of characters: numeric expression truncated to an integer in the [0 , 256[ range. The default option is from the specified position to the end of the string when this parameter is omitted. EXPLANATION: 1. Returns the substring of a specified length from a specified position within a string. A substring from the specified position to the end of the string when the length of the substring is not specified. 2. A substring of length 0 (null) is returned when the specified position exceeds the length of the string. 3. A substring from the specified position to the end of the string is returned when the specified number of characters is greater than the number of characters from the specified position to the end of the string. SEE: RIGHT$, LEFT$  RIGHT$   PURPOSE: Returns a substring of a specified length counting from the right of a string. FORMAT: RIGHT$ ( string , number of characters )  String expression  Numeric expression EXAMPLE: RIGHT$ (“ABCDEF”, 3) PARAMETERS: 1. String: string expression 2. Number of characters: numeric expression truncated to an integer in the [0 , 256[ range. EXPLANATION: 1. Returns the substring of a specified length from the right of a string. 2. The entire string is returned when the specified number of characters is greater than the number of characters of the string.  SEE: MID$, LEFT$  F0 F0  
    						
    							  72  STR$   PURPOSE: Converts the argument (numeric value or numeric expression value) to a string. FORMAT: STR$ (argument)  Numeric expression EXAMPLE: STR$ (123), STR$ (255+3) PARAMETERS: Argument: numeric expression EXPLANATION: 1. Converts decimal values specified in the argument to strings. 2. Converted positive values include a leading space and converted negative values are preceded by a minus sign SEE: VAL  VAL   PURPOSE: Converts a numeric character string to a numeric value. FORMAT: VAL (string)  String expression EXAMPLE: A=VAL (“345”) PARAMETERS: string : string expression EXPLANATION: 1. Converts a numeric character string to a numeric value. 2. Numeric characters are converted up to the point in the string that a non-numeric character is encountered. All subsequent characters are disregarded from the non-numeric character onwards. (i.e. VAL(“123A456”) = 123). 3. The value of this function becomes 0 when the length of the string is 0 or when the leading character is non-numeric. SEE: STR$, VALF  VALF   PURPOSE: Performs calculation of numeric expression expressed as string, and returns the result. FORMAT: VALF (string)  String expression EXAMPLE: VALF (X$) PARAMETERS: String : string expression EXPLANATION: 1. Performs calculation of numeric expressions, which are expressed as strings, and returns their results. 2. An error is generated when an intermediate of final result of calculation exceeds 10100. 3. VALF cannot be used within a VALF argument.  F0 F0 F0  
    						
    							  73  5.8.6 Graphical Functions  DRAW   PURPOSE: Draws a line segment between two graphic coordinates. FORMAT: DRAW [ ( x1 , y1 ) ] - ( x2 , y2 )   Numeric expression Numeric expression  Numeric expression Numeric expression EXAMPLE: DRAW (0,0)-(50,50) DRAW-(100,50) PARAMETERS: 1. (x1, y1) are the coordinates of the first graphic coordinate. When omitted, the computer will use the last graphic coordinate used in the program. 2. (x2, y2) are the coordinates of the second graphic coordinate. 3. x1 and x2 should be in the [0 , 191] range. 4. y1 and y2 should be in the [0 , 63] range, knowing [0 , 31] only is within the actual screen, [32 , 63] being in the virtual screen that can be made visible using the    .. cursor keys. SEE: DRAWC  DRAWC   PURPOSE: Erases a line segment between two graphic coordinates. FORMAT: DRAWC [ ( x1 , y1 ) ] - ( x2 , y2 )   Numeric expression Numeric expression  Numeric expression Numeric expression EXAMPLE: DRAWC (0,0)-(50,50) DRAWC-(100,50) PARAMETERS: 1. (x1, y1) are the coordinates of the first graphic coordinate. When omitted, the computer will use the last graphic coordinate used in the program. 2. (x2, y2) are the coordinates of the second graphic coordinate. 3. x1 and x2 should be in the [0 , 191] range. 4. y1 and y2 should be in the [0 , 63] range, knowing [0 , 31] only is within the actual screen, [32 , 63] being in the virtual screen that can be made visible using the    .. cursor keys. SEE: DRAWC  (0, 0) →x (191, 0)  Actual screen  (0, 31) (191,31)  ↓ y  Virtual screen    (0, 63) (191, 63) F0 F0  
    						
    							  74  POINT   PURPOSE: Returns the status of a pixel FORMAT: POINT ( x , y )  Numeric expression Numeric expression EXAMPLE: POINT(50,50) PARAMETERS: (x, y) is a graphic coordinate. 1. x should be in the [0 , 191] range. 2. y should be in the [0 , 63] range. EXPLANATION: Value returned is 1 if the pixel is active (black), 0 if the pixel is inactive.  F0  
    						
    							  75  5.1 BASIC Commands Index  &H 69 LOAD#  ABS 57 LOCATE  ANGLE 57 LOG, LN 63 ASC 68 LPRINT  ASN, ACS, ATN 58 MID$ 71 BEEP  NCR 63 CHR$  NEW [ALL] 42 CLEAR 43 NEW#  CLOSE  NPR 64 CLS  ON ERROR GOTO  CUR 59 ON GOSUB 52 DATA 56 ON GOTO 51 DEFSEG  OPEN  DEG 68 PASS 42 DIM  PAUSE  DMS$ 68 PEEK  EDIT 46 PI 64 END 48 POKE  EOF  POL 64 ERASE  PRINT  ERL  PRINT#  ERR  RAN# 65 EXP 59 READ  FACT 59 READ#  FIX 60 REC 65 FOR - NEXT 54 REM (‘) 55 FRAC 60 RESTORE  FRE 43 RESTORE#  GOSUB 50 RESUME  GOTO 49 RETURN 50 HEX$ 69 RIGHT$ 71 HYPACS, HYPASN, HYPATN 60 ROUND 66 HYPCOS, HYPSIN, HYPTAN 61 RUN 47 IF – THEN/GOTO – ELSE 53 SAVE, SAVE ALL  INKEY$  SAVE#  INPUT  SET  INPUT#  SIN, COS, TAN 66 INPUT$  SQR 67 INT 62 STOP 48 LEFT$ 70 STR$ 72 LEN 70 TAB  LET 55 TRON, TROFF 47 LIST [ALL] 45 VAL, VALF 72 LIST#  VARLIST 46 LLIST  VERTIFY  LLIST#  WAIT 48 LOAD, LOAD ALL  WRITE#   
    						
    							  76  6 C Programming 6.1 The Basics of C 6.1.1 C and the other programming languages Early history of C C is a programming language that incorporates such concepts as module programming and structural syntax along the lines of ALGOL. Another well-known offshoot of ALGOL is PASCAL, and forebears of C are the CPL and BCPL languages. Both CPL and ECPL were early innovations by Britains Cambridge University in an attempt to make ALGOL 60 easier to use. This concept crossed over to the United States, Resulting in such languages as B and Mesa. B language was developed as the notation of the UNIX operating system, and the development of an improved UNIX notation produced todays C language.  Why C? Until a number of years ago, the main programming languages for mainframe computing devices were COBOL FORTRAN and PL/1, while microcomputers were programmed using assembler or BASIC. Recently, however, there is a definite movement toward the use of C for programming a variety of computers. But what has made the C the language of choice for programming? One reason is that C was developed for thr UNIX operating system. UNIX on the other served as basis for the widely popular MS-DOS, which means that the UNIX notation system is applied in a wide variety of software in use today. Another reason is the wide appeal of C due to its distinctive features noted below.  Features of C 1. Wide applicability C can be used in a wide range of programming applications, from numeric calculations to machine control.  2. Simple program portability Since C is a high level programming language, programs can be used on a wide variety of computing devices.  3. Compact programs The abundant operators and control structures that are built into C greatly simplify complex processing. Compared with other languages, the rules that govern C are relatively simple making program creation quick and easy.  4. Control structures based on structured programming Structured programming allows easily mastered programs that are similar to human thought patterns. This means that conditional branching and repeat loop controls are all included.  5. A host of operators C includes arithmetic operators, logical operators, relational operators, incremental / decremental operators, bit logical operators, and bit shift operators.  
    						
    							  77 6. Pointer control Unlike the memory addresses used in FORTRAN, COBOL and BASIC, C employs a pointer to indicate memory locations.  7. Efficient use of memory Memory and data management functions, as well as programs are very compact, for more efficient memory utilization. Thanks to this, C gives you the high level programming capabilities of FORTRAN and Pascal, with all of the detailed processing of machine language. 6.1.2 Learning about C with your pocket computer There once was a time that C could be seen running on large computers. A time when it was only within the realm of programmers and system engineers. Since C notation resembles that of machine language, it often appeared too difficult or confusing for the casual user.  All of that changed with the introduction of the Casio PB-2000C pocket computer and its successors. It is now possible for everyone to enjoy the many benefits of programming in C. The full portability of the pocket computer format means that the computer can go with you everywhere, so you can program and compute whenever and wherever you want.  Since C interacts with many of the computer’s functions, it would be difficult to obtain a solid grasp of its workings by simply reading this manual. We highly recommend that you get as much hands on experience as possible with your pocket computer, creating and running your own programs. This is the best way to learn about the power and versatility of C.  The Casio pocket computer makes actually a very good teacher. Should you make a mistake when inputting a program, error messages will appear on the display to guide you back to the correct path. With each error you will be moving one more step closer to the mastery of C. A trace function is also provided to give you valuable insights of programs as they are executed. 6.1.3 Meet the Casio C interpreter With most computers, C acts as a compiler language. A compiler translates the program written in C into a machine language, which can directly be understood by the computer. The program that the computer actually executes in the machine language program.  Since the compiler must perform the three steps of compiling, linking and execution for each program, they cannot be executed immediately after you enter them. The two steps of compiling and linking require some time to perform.  The Casio pocket computers, on the other hand, feature a C interpreter. The interpreter translates programs as you enter them, making it much easier to operate than a compiler. Once you enter a program, all you have to do is enter the RUN command to execute the program. Everyone who has ever worked with the BASIC programming language will find this is a very familiar process.   
    						
    							  78 The few differences between the Casio interpreted C language and an ANSI standard compiled C will be highlighted in this manual 6.2 C Program Input 6.2.1 About the C Interpreter and Editor The unit provides you with both a C interpreter and editor. The interpreter is used to execute programs. The editor is used for program creation and editing. Before getting into the actual operations of the unit, perhaps it might be a good idea to first look at these two functions in a little more detail.  About the C interpreter There are two ways to process a C program: using a compiler or using an interpreter. With the compiler, the program is first translated into machine language before it is executed. This means that each time you write a program, all of the following processes must be performed: Program input → compiling → linking → execution. With an interpreter, the program is entered and executed in the same environment, for easier operation. The Casio unit features a C interpreter. After you enter the program, all you have to do is enter the RUN command to execute it. Throughout the rest of this manual, the C interpreter will be referred simply as an “interpreter”.  About the C editor An editor can be used to write everything from a few lines to an entire program. Unlike the interpreter in which simple writing cannot be performed easily, the editor lets you easily modify and correct programs. The C editor is for writing and modifying C programs. You should note, however, that you cannot execute programs while in the C editor. You can only execute from the interpreter. Throughout the rest of this manual, the C editor will be referred simply as an “editor”. 6.2.2 Activating the C mode Besides the C mode, the unit also features calculator, formula, BASIC, CASL and ASSEMBLER modes. Here, we will see how to select the C mode.  1. Switch the power of the unit ON. _   The display indicates that the computer is in the CAL mode. This is the initial mode when you switch the computer ON.  2. Press the MENU key. MENU             < MENU >  1:F.COM 2:BASIC 3:C     4:CASL 5:ASMBL 6:FX    7:MODE  
    						
    							  79 3. Pressing the key  3  will lead to the C sub-menu allowing writing, compiling, running and editing programs in C language. .3. < C >  F 0 1 2 3 4 5 6 7 8 9     51113B F1>Run/Load/Source You can use the       cursor keys to select the program area 0 - 9 The  S  key allows to start writing the source code with the editor. .S. .    Note that the C language is case sensitive. Key words have to be written in lower case characters only. Make sure the CAPS symbol is switched OFF before entering a keyword. .M   A   I   N   (   )  Shift  {  . . main(){↵ .                         <     2> SPC .P   R   I   N   T   F   (   “  CAPS  H   E   L   L   O  Shift  ¥  CAPS  N   ”  .). .;. . . main(){↵  printf(“HELLO¥n”);↵ .                        <     3> Shift  }  . .  printf(“HELLO¥n”);↵ }↵ .                        <     4> This gives the following C program: main(){  printf(“HELLO¥n”); } 6.2.3 Using the Editor The editor of the computer is used for creating and editing programs, as we saw with our HELLO program. This section takes you further along the path of using the editor effectively to create and edit useful C programs.  Entering the editor You can enter the editor either from the MENU mode (by pressing  3  for the C mode, and the  S  for the editor), or from the interpreter (by entering the EDIT command).   
    						
    							  80  To create a new program from the MENU mode 1. Press the MENU key to enter in the main menu. MENU             < MENU >  1:F.COM 2:BASIC 3:C     4:CASL 5:ASMBL 6:FX    7:MODE 2. Press the key 3 to enter in the C mode .3. < C >  F 0 1 2 3 4 5 6 7 8 9     51113B F1>Run/Load/Source Use the       cursor keys to select an empty program area among areas 0 - 9 Enter the editor typing the  S  key. .S. .    You can start writing the new program.  To enter an existing program from the interpreter After executing a program, you may want to edit it to make modifications. Just enter the EDIT command followed by . ..  Moving the cursor You can control cursor movement using the cursor keys in the editor as follows: .. Cursor moves up .. Cursor moves down    Cursor moves left    Cursor moves right  Moving the cursor to the beginning of a line Use the following operation to move the cursor to the beginning (left end) of the current line while in the editor: Shift L.TOP  Moving the cursor to the end of a line Use the following operation to move the cursor to the end (right end) of the current line while in the editor: Shift L.END  Scrolling the screen Press the .. cursor key while the cursor is at the top line of the display to scroll the display downward. Press the .. cursor key while the cursor is at the bottom line of the display to scroll the display upward.  
    						
    All Casio manuals Comments (0)