C.Basic - Extended Commands

  Enterance > English Top > C.Basic > Reference > Extended Commands

Eng, Norm, Fix, Sci

Eng, Norm, Fix, Sci return current state (On or Off).

  • Eng returns current state;
    - return value 0: state of EngOff
    - return value 1: state of EngOn
  • Norm, Fix, Sci
    To return current status, set negative value as parameter*;
     Note*) To add the parameter, ( ) is not necessarily required.

If current state is Norm1, return values are;
- Norm (-1) gives 1
- Fix (-1) gives -1
- Sci (-1) gives -1

If current state is Fix 8, return values are;
- Norm (-1) gives -1
- Fix (-1) gives 8
- Sci (-1) gives -1

(Top)

EngOn

3-digit separator can be displayed.

(example) EngOn 3
 After this commend, number is displayed with 3-digit separator ",".
 EngOff to cancel 3-digit operator.

(Top)

StoPict / RclPict

These comamnds can be used in 2 diferent modes, a mode storing in storage memory and a mode storing in heap memory secured in main memory.

To set the mode, open "Setup" page by [SHIFT][MENU](Setup), select to item "Pict", then set [F1](MEM) or [F2](Heap).

When "Heap" is set, we lose compatibility of Pict file with genuine Casio Basic, but access speed to Pict file will be faster.

The program source itself keep compatibility, so source in genuine Casio Basic can run in C.Basic.

(Top)

ElseIf

  • Format: If ~ Then ~ ElseIf ~ IfEnd

(example)
 If A:Then
 Locate 1,1,"A"
 ElseIf B:Then
 Locate 1,2,"B"
 EndIf

  • The number of IfEnd corresponding to If is not strictly checked in genuine Casio Basic. But in C.Basic you can set if you want the strict check or not at item "IfEnd Check" in "Setup" page.

Set "On" at "IfEnd Check", an error message may pop up in run time, and cursor locates at If command which does not have any corresponding IfEnd.

(Top)

Locate

  • Locate command can Reverse display string or value.

Add [,R] at the end of parameters, the display is reversed.
 (example) Locate 1,2,"Test",R
  Reversed "Test" is displayed at location (1,2).

  • With prefix # to expression (parameter) in Locate as well as Sprintf, Text and Disp commands makes evalution of the expression in real number.
     In "Integer Mode", the expression with prefix # allows displaying string of "real number" which reflects the evaluation in real number. Prefix # helps display in "Integer Mode" to handle "real number" by Locate, Sprintf, Text and Disp commands. 

(example)
 '#CBINT
 10→A
 Locate 1, 2, log 123+A
  In Integer Mode, "log 123+A" is rounded to 12, but
(example)
 '#CBINT
 10→A
 Locate 1, 2, #log 123+A
  with the prefix #, it is not rounded and display 12.089905111.
An expresison after prefix # is handled as real number, but variable (for example A above) is still used as integer variable, so prefix % should not be added.

(Top)

Switch~Case~Default~SwitchEnd

C.Basic supports Switch statement. Fall through is available like C Language (without "Break" program control goes through to the next "Case").

Note, "Default" should be placed in the last, otherwise unexpected result may occur.

New commands added here are "Switch", "Case", "Defualt" and "SwitchEnd". "Break" is an existing command.

(example)
Switch A:
Case 1:Locate 1,1,"A"
Break
Case 2:Locate 1,2,"B"
Case 3:Locate 1,3,"C"
Break
Default
Break
SwitchEnd

ACBreak

"ACBreak" command gives exactly the same result as to press [AC] key during program runs.

Availability of "ACBreak", enable or disable can be set at item "ACBreak" in "Setup" page. When "ACBreak" is Off (disable), the command "ACBreak" is ignored and is not breaking the program.

(example) ACBreak

Input command "ACBreak" and "Stop" right after ACBreak, then "ACBreakStop" command cancel all the ACBreak after this command. This gives exacltly the same result as to set "Off" for ACBreak in "Setup" page.

(example) ACBreakStop

Prog

Use with "Local" command, "Prog" can handle arguments and returns with sub program.

(example)
 "MAIN" Program
 10→X
 20→Y
 X+1→a
 Y×2→b
 Prog "SUB",X,Y
 Disp Ans
 Disp a
 Disp b

 "SUB" Program
 local a,b
 Dips a
 Disp b
 Return a+b

Reult Output
10
20
30
11
40

"MAIN" program calls "SUB" program calculating sum of 2 numbers and display the result.
 In the sub program, variables a and b is secured as local variables, so cannot access to global variables a and b.
 In the main program, a and b are global variables, so the variables are free of the influence of global variables a and b in the sub program.

(Top)

Local

In C.Basic all the variables including small letter variables are "global variable" as default. But some small leter variables can be used as "local variable" with "Local" command.

Set small letter variables to "Loca" command in a program, then those variales can be local, the scope is only within the single program.

(example) Local x,y,x
 - parametters x, y and z are now local variables.
 - Maximum 10 small letters can be set as local variable.
 - In the same order of the parametters can be passed to sub-routine with Prog command.

(example)
In sub-routine "TEST"、use Local with 3 small letters for local variables;

 Local x,y,x
 (describe this in the sub-routine, the position can be where ever you like...)

then in main routine discribe use Prog command with 3 extra parameters;

 Prog "TEST",123,456,N
 (at calling sub-routine "TEST", pass 123, 456 and N to "TEST" in the same order,
 that means 123→x、456→y、N→z in the sub-routine, ohter variables are still global.)

Uing local variables,  a recurrence algorithm is available in C.Basic, but at this moment maximum nesting is about 30 levels.

Return

"Return" command returns from sub-routine, in C.Basic a return value can be sent back to main routine.

(example) Return
 The return value, a value of is substituted in "Ans".

Gosub

"Gosub" comamnd allows to use sub-routine within single program.

(example) Gosub A
 Jump to "Lbl A", proceed codes until "Return", then resume back.

(example) Gosub A,123,456
 With Local command, arguments can be used as similar to Prog command, but all the codes are in single program, so the variables are global.

(example)
 10→X
 20→Y
 X+1→a
 Y×2→b
 Gosub A,X,Y
 Disp Ans
 Disp a
 Disp b
 Stop

 Lbl A
 local a,b
 Dips a
 Disp b
 Return a+b

Reult Output
10
20
30
10
20

This sample program is similar to (example) program of Prog command. Variables a and b are secured as local variable, so canot access to global variables a and b in this program.

(Top)

ElmSize( / ColSize( / RowSize(

Functions to obtain size of matrix.

  • ElemSize(
     Return size (in bit) of element.
     (example) ElemSize(Mat A)
  • ColSize(
     Return m of {m,n}, row size of matrix.
  • RawSize(
     Return m of {m,n}, のn,column size of matrix.

(Top)

Getkey

There are following features for Getkey in addition to genuine Casio Basic;
 - Getkey: compatible with genuine Casio Basic.
 - Getkey1: pause until any key is pressed (same as SDK's Getkey).
 - Getkey2: clear key buffer then accept input.
 - Getkey3: pause for a certain period before accept input.
* The number right after Getkey should be input by ten key.

Keycode is fully compatible with genuine Casio Basic, but not compatible with SDK.

In fx-9860GII (SH4A version), back light control by [SHIFT]+[OPTN] is available.

Power Off by [SHIFT]+[AC] as weel as [AC] is not supported yet to obtain keycode.

(example) Getkey3(128)
 Set 128 Ticks count (1 sec) for pause. This does not return keycode during the pause, but returns keycode of last key press after the key wait period.

(example) Getkey3(128,A)
 Pause until 128 Ticks count of current timer with initial timer as set by A (in Ticks count).

* In case Getkey1 does not properly work in SH3 version, use Getkey2 instrad of Getkey1.

(Top)

inserted by FC2 system