Home Gadgetman Forum Book Reviews Links Contact me X-UFO
Gadgets Processors Programming School Old news

Casio PB-100

OverviewUsageCassette InterfaceBasicPrinter
There are no pictures available for this page. Maybe later?

Overview:
The PB-100's is a 'classic' Basic variant. It uses Linenumbers, Goto and gosub for subroutine handling.
Valid line numbers are from 1 to 9999. The programs are stored as P0 to P9, and seleted on the numeric keypad.

The classic test program would therefore look like this:

10 PRINT "Hello World"
This line takes 17Bytes.
If the linenumber takes 2Bytes, the PRINT command takes 1Byte, and the text takes 13Bytes, that leaves 1Byte as a hidden 'EOL' marker.

In the following examples I will be using multiples of 10 as linenumbers. This is common in older Basic programs. (Leaves a lot of linenumbers free so that the program can more easily be changed later) It was also common to let 'subroutines' begin on lines that were multiples of 100... (Makes a easier reading :-) Commands:
(Commands that can be used directly in RUN mode is marked)
CommandModeDescription
PRINTThis should be self explanatory...
Use like:
10 PRINT N        REM to display a variable
20 PRINT "String" REM prints the string...
30 PRINT N*12     REM Prints out the result.
Also note that it seems to pause execution after a PRINT command, and won't continue until you press [Exe]
INPUTAsks the user to input a value...
10 INPUT N       REM asks for a value
20 PRINT N*1.23  REM 23% VAT in Norway
GOTOThis jumps to the specified line number and continues execution there.
10 PRINT "Here"
20 GOTO 100

100 PRINT "There"
I don't like GOTO! It allows sloppy and unstructured programming! Don't use if you don't have to.
GOSUB
RETURN
These are used for 'subroutines'. The difference between GOTO and GOSUB is that GOSUB stores information of where it jumped FROM, and returns to the next command after GOSUB when it encounters RETURN.
10 PRINT "Here"
20 GOSUB 100
30 PRINT "Back again"
----
----
100 PRINT "There"
110 RETURN
ENDSome might have spotted a problem with the code in the GOSUB example... After finishing line 30, it'll go on executing and might get to 100 and the 110, resulting in an Error situation...
Since the program isn't supposed to keep on running after 30, we just add this:
40 END
IF
THEN
To do or not to do, that's the problem.
A simple use might be:
10 IF N=5 THEN 40
20 GOSUB 2000
30 N=5
40 PRINT "All is well"
50 END
----
----
2000 ?????
As we see here, it is used to jump to another part of the program if the condition is fulfilled.
FOR
TO
STEP
NEXT
The FOR loop is an essential command in many languages...
This is a simple way to use it:
10 FOR N=1 TO 100
20 PRINT N
30 NEXT N
That example prints all numbers between 1 and 100... Replacing a single line:
10 FOR N=1 TO 100 STEP 5
This will result in the program counting only every fifth number.
Also, take note that even if 'STEP 1' is implied if nothing else is specified, that IS NOT the case when counting backwards. Then you MUST use 'STEP -1'
FOR-NEXT loops can be nested. But there is a maximum of 4 levels. Other constructs might limit it even more.
STOPThis command seems to pause execution of the program. You can then read out variables and do simple maths. Pressing [EXE] without any query will make the program continue. Running BASIC Commands like LIST will make the PB-100 cancel the continue option. And no, there don't seem to bee a CONT command.
DEFMSeems to have something to do with variables, but what?
RUNRSee using...
LISTRSee using...
Special commands (Not found on keyboard. There might be more of them)
CLEARUsed in Write mode. Clears the selected program. (Use with caution)
LOADRLoads a program from tape and into current position. See the FP-12 page for usage.
LOAD ARLoads ALL programs from tape. See the FP-12 page for usage.
SAVERStores Current program on tape. See the FP-12 page for usage.
SAVE ARStores ALL programs on tape. See the FP-12 page for usage.
PUTRStores variables on tape. See the FP-12 page for usage.
GETRRetrieves variables stored on a tape. See the FP-12 page for usage.
Other operators. Also not found on keyboard
ABS(X)Rthe ABSolute value of the input parameter.
ACS(X)RArc Cosine
ASN(X)RArc Sine
ATN(X)RArc Tangens
COS(X)RCosine
INT(X)RReturns the INTEGER part of a floating point variable. (Rounds down)
LN(X)RThe Natural Logaritm of the supplied variable.
LOG(X)RBase 10 Logaritm (1->0, 10->1, 100->2...)
SGNR
SIN(X)RSine
SQR(X)RThe SQuare Root of the variable. (And don't try working with Imaginary numbers like the Square of -1)
TAN(X)Tangens
Please note that I don't have a manual, and therefore must base this page on experimentation.

Valid variable names are supposedly A-Z, A$-Z$.
A and A$ cannot be used at the same time, and Strings($) can only be a maximum of 7 Characters.
Strings must be enclosed in "".
It also supports ARRAYS, but I don't know all about them yet. What I can say work is A(0)-A(20) and A$(0) to A$(20) and that A$ and A$(0) is functionally equivalent. A(1) is equivalent to B$...
Numbers are represented by Floating point variables internally. Since it's a 8Byte variable, I assume something like 8 or 10 digit accuracy.

Please note that ALL programs share the same variables.

You can have more than one command on a line by separating them with a ':'. (It's a good idea too, for every time you do it, you save two Bytes. Not much, but then you don't have much memory to start with :-)

This version of Basic does not have a REM (REMark) statement. Quite understandably, given the small RAM size.

You can call one program from within another by using the # sign. Either use GOTO #x or GOSUB #x where the x is the program that you want to call up. I recommend that you use the GOSUB command since that one allows you to use the RETURN command to return to the calling program.

Error codes. You know, even with such small programs, you will occasionally get it wrong. These codes should help you out...
CodeMeaning
ERR1And idea?
ERR2General 'Syntax error'. Misspelled command or wrong number of parameters.
ERR3Out of Range? One or more parameters is out of the allowed range. (Like SQR(-1) ) Also 'divide by ZERO'.
ERR4Any idea?
ERR5Any idea?
ERR6'String too long' Possibly a general string error. Goes off if you try to assign a value to a string variable and then try to print out the Floating point value.
ERR7'Stack overflow or underflow'. Caused by'NEXT without FOR' and 'FOR without NEXT'. The PB-100 ran into a NEXT command without first executing a FOR, or it didn't find the matching next after a FOR. It can also indicate too many levels of FOR-NEXT loops.
Feel free to mail me about anything that I've missed...


Got any comments? Write them here:

Name:
Email address:
Display email address?
Website:
Comment:
Note:
  • Comments will not be visible until I manually OK them.
  • You don't need to give an email address if you don't want to. But if you do, you decide whether or not it is visible. (No addresses will be given to third-parties, it's only there to make it easier for me to get back to you)
  • This script WILL log your IP adress.
  • Profanities, 'L337' speak, links to unrelated stuff like Pr0n and online gambling will result in your IP being banned, a message being sent to your ISP and anything else nasty I can think of...
  • Suspicious HTML in the comments field will also cause me to give you hell.
  • While I don't have any user registration here, that's no reason to use a 'nick' belonging to someone else.