This is the owner's manual supplied with the Tandy PC-2 pocket computer, converted to HTML format.
The Tandy PC-2 is essentially identical to the Sharp PC 1500, but with a slightly different front panel and key layout. This manual is therefore suitable for the Sharp version also.
The original page numbering has been retained. See the notes at the end for more information.



PC-2 manual cover

A Special Note to Our Customers...

To make the TRS-80 PC-2 available to you as quickly as possible, we're providing this Owner's Manual which will explain how to use the PC-2.

Throughout this manual, we've made reference to the book "TRS-80 PC-2 Programming Guide" (optional/extra). This manual, which should be available in the Summer of 1982, will be a comprehensive PC-2 BASIC Programming Manual.

In the meantime, many of your programming questions can be answered by referring to another Radio Shack book called "Problem Solving on the TRS-80 Pocket Computer" (Catalog number 62-2312).

Thank you,
Radio Shack


To Our Customers...

Besides being one of the smallest computers that Radio Shack provides, the TRS-80 PC-2 is one of the most powerful and versatile computers of its size anywhere.

Its powerful capabilities, as well as its "expandability", make it the ideal personal computer for business, scientific, engineering, or personal use.

In spite of its size and power, however, the Pocket Computer can be quite simple to use. In fact, you can determine just how technical a machine you want it to be.

At its simplest level of operation, you can use Radio Shack cassette programs, RAM Modules, or ROM Modules. All you need to know is how to load and run a cassette program or insert a program cartridge into the Computer.

At a slightly more involved level of operation, you may want to write your own programs. If you are a beginner, read this operation manual, then read a PC-2 programming guide.

If, however, you are already an experienced programmer and are familiar with BASIC, read this operation manual. For you convenience, we've included a Language Reference Summary in the appendix which lists PC-2 commands, their syntax, and examples of use.

1

About This Manual

This manual contains operating instructions for the PC-2. The Language Reference Summary includes only those commands which can be used by the Computer when it is not connected to an optional device (such as Printer/Cassette Interface).

For a description of the commands which can be used with an optional device, see that peripheral's operation manual.

For instructions on programming the Computer, see a PC-2 programming manual.

2

Contents

 
Customer Information3
Welcome to the World of Pocket Computing!4
1/Description of the Pocket Computer
   Keyboard   Display   Rear Panel
5
2/Setting Up the Pocket Computer
   Starting-Up   Battery Installation   External Power Supply
13
3/Using the Pocket Computer
   Using the Keyboard   The PC-2 As A Calculator   PC-2 BASIC
19
4/Care and Maintenance87
5/Specifications89
Appendix A/Language Reference Summary91
Appendix B/Error Codes103

Customer Information

 
3

Welcome to the World of Pocket Computing!

The TRS-80 PC-2 system consists of:

  • A 66-Key keyboard for inputting programs and data into the Computer.
  • A 26-character Display to exhibit data results and other information. The Display can also be used to exhibit graphics (7 X 156 dot pattern).
  • An expanded BASIC Language that includes graphics commands.
  • A CMOS microprocessor with more power than the mammoth computers of a few years ago.
  • Read Only Memory (ROM) which contains the BASIC language.
  • Random Access Memory (RAM) for storage of programs and data even when the Computer is turned off (amount is expandable up to 24K, optional/extra).
  • Expansion area for plug-in of optional RAM, ROM, or combination RAM/ROM Modules.
  • A Cassette/Printer Interface for long-term storage and hard-copy output of programs and data (optional/extra).
  • Battery powered for portable operation or DC power adaptor (optional/extra).

4

1/Description of the Pocket Computer

Before using the PC-2, it's important that you become familiar with it. Carefully read the following section.

Keyboard layout

Figure 1. PC-2 (Front View)

5

1 OFF keyWhen you're ready to turn the Computer OFF, press this key.
2 ON keyTurns the PC-2 ON. If pressed while you are running a program, execution will "break" (interrupt).
3 DEF keyAllows you to execute line numbers which have had certain keys assigned to them as the first character of the line. Other keys permanently act as command keys after  DEF key is pressed. For instance, if  DEF key  Q key is pressed, the command INPUT will be displayed.
4 F1 key ~  F6 keyFunction keys. These keys are reserved for your use. You can assign to them any values, commands, or statements you desire. When  SHIFT key is pressed before any of the Function Keys, the character above the key will be used.
5 SHIFT keyIn Lowercase Mode (SMALL), any alpha-key pressed after this key will be uppercase. In Normal (uppercase) Mode, any alpha-key pressed after this key will be lowercase. Press this key before pressing key which has a character above it and the character above it will be displayed.
6 A key ~  Z keyAlphabet keys.
7 Decimal point key 
 0 key ~  9 key
Number keys.
8?
 / key
Division Key. Allows you to divide numeric values. Pressing  SHIFT key before this key will display a question mark (?).
9:
 * key
Multiplication Key. Allows you to multiply numeric values. Pressing  SHIFT key before this key will produce a colon (:).
6

10,
 - key
Subtraction Key. Allows you to subtract numeric values. Pressing  SHIFT key before pressing this key will produce a comma (,).
11;
 + key
Addition Key. Allows you to add numeric values. Pressing  SHIFT key before this key produces a semicolon (;).
12CA
 CL key
Clear Key. Pressing this key will clear the Display and "release" errors. Pressing  SHIFT key before pressing  CL key will activate the CA (reset) function. This will clear the display and reset the computer.
13 MODE keyPressing this key will specify either the RUN or PROgram Operation mode. Pressing  SHIFT key  MODE key will specify RESERVE operation mode.
14<  >
 ( key ) key
Parentheses Keys. Pressing  SHIFT key before pressing these keys will produce the Greater Than/Less Than symbols.
15Ö
 Cursor up key
Display previous program line. Pressing  SHIFT key before pressing this key will produce a square root (Ö) sign and allow you to compute the square root of a numeric value.
16p
 Cursor down key
Display next program line. Pressing  SHIFT key before pressing this key will produce a PI (p) sign and allow you to use a stored value of PI in your computations.
17 SML keyLowercase Option Key. Press once and lowercase (small) letters will be used. Press again and normal (uppercase alpha-) character display will be used.
18 Reserve mode keyReserve Mode Change. Since each of the six Function Keys can be assigned values in each of three modes —I/II/III — pressing this key will move the Computer to the next Reserve mode.
7

19 RCL keyRecall Key. Pressing this key once will display the function key menu for the current reserve mode (I/II/III). Pressing this key again will recall the contents of the original display.
20^
 SPACE key
Spacebar Key. Pressing this key will advance the Cursor, leaving a blank space. Press  SHIFT key before pressing this key and the Exponential symbol will be produced and allow you to raise a numeric expression to a power.
21 ENTER keyWhen you press this key, whatever you previously typed will "enter" the Computer's memory. This key is similar to the Carriage Return key on a typewriter. You must press  ENTER key before the PC-2 will accept alphanumeric input from the keyboard.
22DEL
 Cursor left key
Backspace Key. This key allows you to move the Cursor to the left without erasing previously typed characters. Pressing  SHIFT key before pressing this key will DELete whatever character the Cursor is "on top of".
23INS
 Cursor right key
Forward Key. Pressing this key allows you to move the Cursor to the right without erasing previously typed characters. Pressing  SHIFT key before pressing this key will allow INSertion of characters directly before the character the Cursor is "on top of".
24 Printer/Cassette Interface Connector Cover. Remove the Cover to attach the PC-2 to the Printer/Cassette Interface. See Printer/Cassette Interface owner's manual for details. (And attach the Cover to the bottom of the Interface so you won't lose it!)
8

Display indicators

Figure 2. Sample PC-2 Display

1BUSYProgram Execution Indicator. This Indicator is on during program execution. When program execution is complete, the Indicator goes off. The PC-2 will not turn off (manually by pressing OFF or automatically after seven minutes) when the BUSY Indicator is on.
2SHIFTShift Key Indicator. This Indicator is on whenever  SHIFT key has been pressed. Press any key (except  SML key or  ON key) and the Indicator will go off.
3SMALLLowercase Option Indicator. This Indicator is on whenever the Computer is in Lowercase Option Mode (the Computer can display either upper- or lowercase letters). Press  SML key to turn the Indicator on; press again to turn off.
4 Angular Measurement Indicator. This Indicator will display the current unit of angle for the input of trigonometric functions: DEG for "degrees." (To compute in degrees, type DEGREE  ENTER key); RAD for "radians." (To compute in radians, type RADIAN  ENTER key); GRAD for "gradients." (To compute in gradients, type GRAD  ENTER key). The Computer will use a measurement mode until you tell it to do otherwise.
9

5 Operation Mode Indicator. This Indicator will display RUN when you are in the RUN Mode. You must be in RUN Mode to execute ("run") programs or perform manual calculations (use the Computer like a calculator). This Indicator will display PRO when you are in PROgram Mode. You must be in PRO Mode to enter programs into the Computer's memory. Press  MODE key to go from one mode to the other. Press  SHIFT key  MODE key and the Indicator will display RESERVE. In this mode, you may assign values, commands, or statements to the Function keys as well as set up Function Key menus.
6DEFDefinable Mode Indicator. This Indicator lights up when you press  DEF key. When the PC-2 is in the RUN mode, pressing  DEF key followed by a program label key (see Table 2) will allow you to run a labelled program. In any mode, pressing  DEF key followed by a command instruction key (see Table 1) allows easy use of keywords.
7I/II/IIIReserve Mode Indicator. This Indicator tells you which Reserve mode the PC-2 is in. To change modes, press  Reserve mode key. All six Function Keys ( F1 key ~  F6 key) can be defined in each of the three modes (I/II/III) for a total of 18 different values.
8·Battery Indicator. As long as this Indicator is ON, the Computer has sufficient power to operate. When this Indicator is OFF, the Computer's batteries are too "low" to insure correct operation. Replace them or connect the Computer to an external power supply.
10

Back of PC-2

Figure 3. PC-2 (Rear Panel)

1RAM/ROM Module Slot. Insert RAM or ROM Modules into this slot. See your RAM/ROM Module user's guide for specific details.
2ALL RESET Button. If the PC-2 ever "hangs up," use a ball-point pen to press this button while pressing  ON key. Hold the button and key down for about 15 seconds. Be aware, however, that memory will be erased (I.E. you'll lose any programs in memory).
11

3Identification Tag. Place the permanently adhesive Identification Tag here.
4Battery Cover. Remove this Cover to gain access to the batteries which supply power to the PC-2. Be careful not to lose the screw which secures the Cover; it is not attached to the Cover when removed.
5External Power Supply Jack. If you have an external power supply adaptor (optional/extra), plug it in here.
12

2/Setting Up the Pocket Computer

Start-Up

To turn the PC-2 on, simply press the  ON key key.

The computer should respond with the Ready prompt (>) and indicators that tell you:

  • If the Computer was last used to compute degrees, radians, or gradients.
  • Which Operation Mode the Computer is in (PROgram, RUN, or RESERVE Mode).
  • Which of the three Reserve Modes (I, II, or III) has been selected.
  • Whether or not there's enough battery power to use the Computer.

On start-up, the PC-2 uses all mode settings that were being used when the Computer was turned off.

For instance:

Start-up display

Figure 4. Sample display on Start-Up

13

When the Computer is turned on, there are four different power-up messages which can be displayed:

First power-up message

This message can appear on power-up after:

  • Turning the Computer on for the first time.
  • Battery replacement.
  • Pressing ALL RESET.

To clear the Display and begin computing:

  1.  Press  CL key.
  2.  Be sure you are in PROgram Mode. If not, press  MODE key until PRO is displayed.
  3.  Type: NEW0  ENTER key.
  4.  Press  SHIFT key  MODE key. The PC-2 will then be in RESERVE Mode.
  5.  Type: NEW  ENTER key.

This procedure will clear the PC-2's Main and Auxiliary memory areas.

14

Check 6 message

If this message appears, it means that one of the peripheral devices (such as a Printer/Cassette Interface) is not operating properly. Press  CL key to clear the display and continue computing.

Normal power-up message

The display will look like this on normal power-on and when optional devices or memory modules are connected.

Sample display

This is a sample display. Whenever the PC-2 turns itself off automatically (when the PC-2 has not been busy and a key has not been pressed for seven minutes), press  ON key to turn the Computer back on. When you do so, the previous display will appear.

Note: If the ARUN statement is used as the first command in a program, the PC-2 can start up with the BUSY Indicator ON.

If you press  ON key while a program is running, it serves as a BREAK key. The program will stop execution and display the line number at which the "break" took place.

Press  Cursor up key and the portion of the program line that had just executed will re-appear. Press  Cursor down key again, and the next program step will execute. Type CONT  ENTER key to continue program execution after a break.

15

Turning the Computer OFF

When you're ready to turn the PC-2 OFF, press the  OFF key key. The Display will then clear (be erased).

If the BUSY indicator is on, press BREAK before pressing  OFF key.

When it is turned off, the PC-2 remembers programs, mode settings, Definable Keys, etc. that were being used when the Computer was turned on. When you turn the Computer back ON, those settings will be displayed and the program will be in memory.

(The PC-2 forgets only when you remove the batteries without first connecting an external power-supply or when you clear memory!).

Note: You cannot turn the Computer off when the BUSY light is on.

Battery Installation

We suggest you use Radio Shack Type AA Alkaline batteries (Radio Shack Catalog Number 23-552).

To install the batteries:

  1.  If you wish to preserve the contents of memory, connect the PC-2 to an optional external power supply.
  2.  Place the PC-2 upside down on a soft, non-abrasive surface (such as a foam rubber pad).

16

  1.  Use a coin to carefully loosen the small screw which holds the Battery Cover in place. (Do not lose the screw!)
  2.  Slide the Cover sideways until it is free from the Computer.
  3.  Insert four Type AA alkaline batteries into place, matching the battery outline (in the battery slot of the Computer) with the actual shape of the battery. (Place the "spring" against the bottom ("–") end of the battery.)
  4.  Replace the Cover and tighten the screw.

If you used an external power supply, disconnect it from the PC-2 before turning the Computer ON. (If the Battery Indicator does not come on, check to make sure the batteries are installed properly.) Then press ALL RESET (on the back of the Computer). The message NEW0: CHECK will be displayed. Press  CL key and the Ready prompt (>) will appear.

External Power Supply


The PC-2 can be used with external power supply sources (optional/extra) such as the one provided with the PC-2 PRINTER/CASSETTE INTERFACE (26-3605).

The PC-2 will not "recognize" that an external power source is connected to it until the adaptor is plugged into the Computer (on the right side of the PC-2) and into a wall outlet.

The Battery Indicator light should be ON whenever an external power source is connected to the Computer. If it is not ON, the power supply could be defective. Disconnect the power supply and see if the Indicator comes ON when the PC-2 is powered by batteries.

17

If the Indicator does not come on, replace the batteries. If the Indicator still does not come on, check with your local Radio Shack store.

Note that an external power supply will not recharge the batteries. When the batteries are low, replace them.

18

3/Using the Pocket Computer

You can start using the PC-2 as soon as it's been turned on.

Since many symbols on the PC-2 keyboard are not common to other computers, this section will explain how to use the Computer keyboard.

The PC-2 can also be used as a powerful calculator when in "immediate" (RUN) Mode. When using it this way, the PC-2 has all the features of a memory calculator plus much more! This section will describe how to use the PC-2 as a calculator.

We'll also discuss features of PC-2 BASIC Language which are not common to other forms of BASIC. If you're an experienced programmer, you'll be writing your own programs (including graphics) on the Computer by the time you finish this section.

If this is your introduction to computers, you'll be familiar enough with the PC-2 after reading this section to go on to a PC-2 programming guide and write your own programs.

19

Using the keyboard

The PC-2 keyboard allows you to enter all standard text characters as well as many special key functions.

 SHIFT key and  SML key

Normal vs. Lowercase Option

The PC-2 keyboard is usually in Normal (uppercase only) Mode. In this mode, all characters typed on the keyboard will be in uppercase.

To enter the Lowercase Mode, press  SML key. At this time, the Lowercase Indicator (SMALL) will light up on the Display and all letters entered will be lowercase.

To display uppercase letters while in Lowercase Mode, press  SHIFT key before pressing a character key. The next (and only the next) character will be displayed as an uppercase letter. Unless you press  SHIFT key again, all following letters will continue to be lowercase.

To return to Normal Mode, press  SML key again. The SMALL light will disappear from the Display and all letters will be uppercase.

If you need to display a single lowercase letter while in Normal Mode, press  SHIFT key and then a letter key. The letter specified (and only that letter) will be displayed as a lowercase character.

Note: when using lowercase letters, it's important to note that program instructions (commands such as RUN, etc.) must be uppercase. The PC-2 does not recognize lowercase statements or commands.

20

 CL key

Clearing the Display and Resetting the Computer

The PC-2's Display may be cleared at any time (except during program execution when the BUSY Indicator is on) simply by pressing the  CL key clear key.

Pressing  SHIFT key  CL key (e.g., CA) will reset the Computer. Resetting the Computer by pressing  CL key, however, does not mean that the PC-2 will erase all programs and set all variables to zero as with most TRS-80's. All it means is that the Display and the memory "stack" will be cleared.

To clear all variables (set them equal to zero), type CLEAR  ENTER key. If you want to erase all programs in memory go to PROgram mode and type NEW  ENTER key.

Don't forget that you can also reset the PC-2 by pressing the ALL RESET Button on the rear panel of the Computer. You may need to do this if the PC-2 ever "hangs up" and doesn't recognize any keyboard input. Use a ball-point pen to press ALL RESET (and  ON key) for about 15 seconds. The message: NEW0?: CHECK will appear. Press  CL key or  ON key to return to the Ready prompt (>).

 MODE key

Operation Modes

The PC-2 uses three modes of operation.

  • PROgram Mode in which you write and edit BASIC programs.
  • RUN Mode in which you can run (execute) BASIC programs or use the PC-2 as a powerful calculator.
  • RESERVE Mode where you assign values to Function Keys and set up Function Key menus.

21

The Operation Mode Indicator (on the Display) will tell you which mode the Computer is in.

Press the  MODE key key to enter either PROgram or RUN Mode (the Indicator will change).

Press  SHIFT key  MODE key to enter RESERVE Mode.

PROgram Mode

Whenever the Operation Mode Indicator displays PRO, the PC-2 is in PROgrammable Mode and you can write BASIC programs.

The PROgram Mode is used only for writing programs. All program lines must begin with a number between 1 and 65279, followed by a program instruction. (If you're typing a long program, we suggest you type in the line 65279: END in advance.) You must always press  ENTER key to enter the program line into the Computer's memory. For instance, type 50 PRINT X  ENTER key. After you press  ENTER key, the Computer will display: 50: PRINT X

You cannot use the PC-2 as a calculator (sometimes referred to as "immediate mode calculations" while it is on PROgram mode. For example, you cannot instruct the Computer to compute the answer to 2+2 when it is in PRO Mode.It will interpret the first "2" as program line number 2 and create a program line consisting of "+2".

In the same sense, if you attempt to enter an alphabet character that has not been assigned a numeric value and that is not preceded by a number (e.g., a line number), the Computer will return a zero (0) on the right side of the Display when you press  ENTER key. This is just the PC-2's way of telling you that you entered an invalid entry into its memory.

22

RUN Mode

Once programs have been entered into the Computer's memory, you can run (execute) them in RUN Mode.

To enter the RUN Mode, press  MODE key until RUN appears on the Display. Then type: RUN  ENTER key. The Computer will go to the first program line number in memory and execute it.

There are, however, a few ways to begin a program without typing RUN.

For instance, you might want to assign the RUN command to a Function Key. Try  F1 key, Reserve Mode I as an example. (See  F1 key ~  F6 key Function Keys for details.)

When F1: is displayed, type RUN  ENTER key. Then go to RUN Mode and press  F1 key. The Computer will display RUN_. Press  ENTER key and program execution will begin with the first program line in memory.

Hint: Assign RUN @ to  F1 key. When you press  F1 key in RUN Mode the program will automatically run without your having to press  ENTER key. When it follows RUN or any other command, the @ sign serves the same purpose as pressing  ENTER key.

Another way to RUN a program is to assign Definable key labels to certain line numbers within a program. (See Definable Keys for more details.) Then, when you want to RUN a specific program, simply press  DEF key followed by the key label. You will not have to type RUN  ENTER key.

The PC-2 can also be used as a calculator (make that a super calculator! when it is in RUN Mode.
For details on using the PC-2 as a calculator, see Using the PC-2 As A Calculator later in this manual.

23

RESERVE Mode

To enter RESERVE Mode, press  SHIFT key  MODE key. RESERVE will appear on the Display

In this Operation Mode, you can assign commands, statements, or values to any of the Function Keys ( F1 key ~  F6 key) in any of the three Reserve Modes (I/II/III) for a total of 18 different Function Keys. To go from one Reserve Mode to another, press  Reserve mode key and the Display will change from I to II to III.

For instance,  F1 key can be assigned one value in Reserve Mode I, a different value in Mode II, and still another value in Mode III.

Any value, statement, or command which the PC-2 recognizes can be assigned to a Function Key. You'll find it most convenient to assign common command statements (such as RUN or TIME) which you might use very frequently. You might also assign long mathematical functions or command lines to a key. Then, instead of typing them over and over, just put the Computer in the appropriate Reserve Mode and press the proper Function Key.

The value assigned to a Function Key can be any number of characters in length up to a maximum of 77. However, the total number of characters for all 18 Function Keys cannot exceed 77. When the maximum number of characters is reached, Error 13 will result. Press  ENTER key. The value will be assigned and the PC-2 will return to the Ready prompt.

24

If a function key has not been assigned a value and you press it, the symbol above the key (!, #, $, etc.) will be displayed.

To make a Function Key assignment:

  1.  Be sure you're in the appropriate Function Key Mode (I/II/III) (press  Reserve mode key and the Indicator will go from I to II to III). Use I for this example.
  2.  Press a Function Key ( F1 key ~  F6 key). Use  F1 key for this example.
  3.  The display will show:
    Function key assignment display
  4.  Type the characters you want to assign to the key.
  5.  Press  ENTER key to enter the value.

25

For example, you might want to assign the TIME statement to  F1 key. Type TIME @ (Remember that @ will serve the same function as pressing  ENTER key) and the Computer will display:

Assigning TIME to F1

Press  ENTER key.

Whenever the Computer is in PROgram or RUN Mode (and Reserve Mode I), and you press  F1 key, the command line will be displayed or executed immediately.

In this instance, the PC-2 would display the current time and date as soon as you pressed  F1 key.

Since it's easy to forget what is stored in a Function Key, the Computer has a couple of ways of reminding you what values are currently assigned.

One way is to create a "menu" which displays — all at once — whatever has been assigned (or abbreviations of what's been assigned) to Function keys in a specific Reserve Mode.

A menu cannot be more than 25 characters or spaces in length. Consequently, you'll find it a good idea to use abbreviations of one sort or another when creating menus.
For instance, a typical menu might be:

26

Function key menu

In this instance, the menu lists the individual Function Keys (1 – 6) along with abbreviations that identify the complete value assigned to a particular key.

Once a menu has been entered into the Computer's memory, you can edit or change that menu. To change the menu (e.g., if you add more values to Function Keys), you will have to re-type the entire menu for that Reserve Mode.

To set up a menu:

  1.  Assign values to one or more of the Function Keys.
  2.  When the > prompt is displayed (and you're in the RESERVE Mode you want — I, II, or III), type a quotation mark (").
  3.  Type the value (or an abbreviation) assigned to the keys in the order which they were assigned.
  4.  When the list is complete, type another quotation mark (") and press  ENTER key.

Once a menu has been set up, you can access it from either RUN or PROgram Mode, even if you're in the middle of entering a program line. Just press  RCL key and the menu for the current RESERVE Mode will be displayed. If you want to check another RESERVE Mode, press  Reserve mode key. To get back to the original program line you were typing in, press  RCL key again. The Cursor will be positioned exactly where you left off, ready for you to continue inputting data.

27

When you exit the RESERVE Mode (for example, to go to RUN mode), simply press  Reserve mode key and the menus indicating the Function Key assignments you have made in each RESERVE Mode will be displayed.

Another method lets you check the contents stored in each key one-at-a-time. Just go into a Reserve Mode (I/II/III) and press a Function Key (such as  F1 key). The contents of that key's memory will be immediately displayed. However, you will lose whatever was previously on the Display.

 DEF key

Definable Keys

Definable Keys let you use the alpha-keys (and a couple of others) for purposes other than their obvious intent (e.g., to display letters).

There are two types of Definable Keys the PC-2 recognizes:

  • Keys which have permanently been assigned BASIC statements (such as PRINT, INPUT, etc.) See Table 1.
  • Keys which can be used to label program line numbers. See Table 2.
To use a definable key that has been assigned to a BASIC command line number, press  DEF key, then the key of the statement that you need to use.

28

Command Instruction Keys
KeyCommand
 Q keyINPUT
 W keyPRINT
 E keyUSING
 R keyGOTO
 T keyGOSUB
 Y keyRETURN
 U keyCSAVE*
 I keyCLOAD*
 O keyMERGE*
 P keyLIST
Table 1

* These commands will only be displayed if the PC-2 is connected to the optional/extra Printer/Cassette Interface.
If you use these keys when the Computer is not connected to the optional device, a "~" will appear.

29

Program Line Number Definable Keys
 A key Z key
 S key X key
 D key C key
 F key V key
 G key B key
 H key N key
 U key M key
 K key = key
 L key SPACE key
Table 2

Note that Definable Keys are divided according to rows. The top row of alpha-keys have permanently assigned program statements; the bottom two rows of alpha-keys (and the equals key and spacebar) are used for labelling program line numbers.

For instance, you'll probably use the PRINT statement several times in a single program. Instead of typing it over and over, just press  DEF key  W key when you're ready to use the statement in a program line (or in immediate mode). The statement PRINT will immediately be displayed. Then just type whatever you want the Computer to PRINT and press  ENTER key. You can do the same with any other of the statements listed in Table 1.

30

The Command Instruction Defined Keys may be specified in any of the Operation Modes (RUN, PRO, or RESERVE).

If you are using the Computer by itself (e.g., the Computer is not connected to the Printer/Cassette Interface) and you press  DEF key  U key (CSAVE),  DEF key  I key (CLOAD), or  DEF key  O key (MERGE), the computer will display "~". This simply tells you that the command you specified cannot be used because the Interface is not connected. Once the Interface and Computer are connected, however, you can specify these commands even if the Interface is not connected to a Cassette Recorder.

The second set of Definable Keys allows you to begin program execution at a maximum of 18 different program line numbers.

The first step is to "label" a program by specifying one of the allowable keys in the first line of the program.
To do this:

  1.  Type the program line number.
  2.  Type a quotation mark (").
  3.  Type an allowable key (see Table 2).
  4.  Type another quotation mark (").
  5.  Type a program instruction.
For instance:

31

100 "A" WAIT 5:REM  This Program counts to 10.
110 FOR X=1 TO 10
120 PRINT X
130 NEXT X
140 END

Hint: When you come to line 120 in this example, type: 120  DEF key  W key  X key and the Computer will display:

120 PRINT X_

When you're ready to run the program, set the Computer in RUN mode (press  MODE key until RUN appears on the Display); then press  DEF key  A key. The program will begin execution.

You might then want to begin another program at line 200 and label it as "B". When you want to run it, press  DEF key  B key.

 F1 key ~  F6 key

Function Keys

The keys  F1 key through  F6 key are reserved for your use. You can assign to them any values (program lines, BASIC commands, numeric values, etc.) you want.

32

Function Keys can be assigned when the PC-2 is in the RESERVE Operation Mode. For instructions on assigning values to keys  F1 key ~  F6 key, see RESERVE Mode earlier in this manual.

 Reserve mode key

Reserve Mode Change

An additional Function Key feature is that the PC-2 really has 18 Function keys, not just six.

Press the  Reserve mode key key a few times. Notice that Reserve Mode Indicator (in the upper right of the Display) changes from I to II to III and back to I.

For details on using  Reserve mode key, see RESERVE Mode earlier in this manual.

 RCL key

Recall Function Key Assignments

The Recall Key ( RCL key) acts as a "toggle" between whatever is on the Display at any particular time and the menu of Function key assignments for whichever Reserve Mode (I/II/III) is indicated.

For instance, lets say you are writing a program line (in PROgram Mode) and need to use a value assigned to a Function Key. The problem is you've forgotten what values were assigned to what key. You can press  Reserve mode key to recall the menus in the different Reserve Modes (see RESERVE Mode) and then, by pressing  RCL key, you can "toggle" the Display between the program line you are working on or viewing, and the menu line for the current RESERVE Mode.

33

To recall the menu you created for a specific Reserve Mode (see RESERVE Mode), press  RCL key. The menu for the current Reserve Mode will be displayed. Press  RCL key again and the program line you were currently typing in will be displayed and you can finish entering the line.

 Cursor down key

Display the First/Next Higher Program Line

Anytime the Computer is in the PROgram mode, you can press  Cursor down key and the first line of the program that's in memory will be displayed.

If you are writing or editing a program, pressing  Cursor down key will display the next program line.

Holding  Cursor down key down will activate a "repeat" function and the Computer will "scroll" (e.g., automatically go from one line to the next one) until the last line of the program is reached.

Hint: If you have a long program and want to look at a specific program line without scrolling through the entire program, type: LIST line number  ENTER key. For example: LIST 120   ENTER key.

When you press  SHIFT key  Cursor down key, the Computer will display p (the pi symbol). (Pi = 3.141592654).

For example, in the RUN Mode, press  SHIFT key  Cursor down key and  ENTER key. The value of PI will appear on the right side of the Display (3.141592654).

34

 SHIFT key  Cursor down key can be accessed from any of the Operation Modes.

 Cursor down key also has several other features.

For instance, if you stop program execution (in RUN Mode) by pressing BREAK, the Display will indicate the program line in which the "break" occurred. Press  MODE key to go to PROgram Mode, then press  Cursor down key (or  Cursor up key). The program line where the break occurred will be displayed and the Cursor will be positioned in the exact part of the line where execution stopped. Press  Cursor down key again and the next program line will be displayed. (Press  Cursor up key and the previous program line will be displayed.)

Whenever the PC-2 encounters an error in a program line, an error message (which indicates which error and which program line) will be displayed. Press  CL key (to clear the Display) and  MODE key (to enter PROgram Mode). Then press  Cursor down key (or  Cursor up key) and the program line which contains the error will be displayed. Furthermore, the Cursor will be on top of the part of the line which generated the error message. You can then correct the program line.

If you ever need to "single-step" through a program, press BREAK after the program has begun execution, then press  CL key to clear the Display. When the Ready prompt appears, press  Cursor down key and the next program step will be executed. Press it again and the next step will run. You'll find this technique especially helpful when "debugging" programs.

 Cursor up key

Display the Last/Next Lower Program Line

Whenever the PC-2 is in the PROgram Mode, you can press  Cursor up key to display the last line of the program. You can then press  Cursor up key to scroll "up" through the program.

35

If the current line is in the middle of a program, pressing  Cursor up key will display the next lower numbered program line.

Holding  Cursor up key down will activate a repeat function and the Computer will scroll "up" through the program until the first program line is reached.

When you press  SHIFT key  Cursor up key, the Computer will display "Ö"

 Cursor up key can be used much the same as  Cursor down key except that you cannot single-step through a program by pressing  Cursor up key. Pressing and holding down  Cursor up key in the RUN Mode after BREAK has been pressed will display the program line which was executed just before the "break" occurred.

Another difference is that (in the RUN Mode), pressing  Cursor up key after an error message has been displayed will display the program line with the Cursor positioned on the cause of the error. The offending line will be displayed only as long as you hold down  Cursor up key. Release  Cursor up key and the error message will disappear, press  Cursor up key and the line will appear. To correct the line, press  CL key, go to PROgram Mode, then press  Cursor up key or  Cursor down key and begin editing.

 Cursor left key

Backspace Cursor/Delete Character

Any time you are writing or editing a program line, you can move the Cursor to the left by pressing  Cursor left key. Doing so will not erase any existing character.

When the Cursor is in the "current" position while typing characters which appear on the Display, it appears as an underline (_). Pressing  Cursor left key will back the Cursor up one space and change it to a blinking block (n).

36

Holding down  Cursor left key will activate a repeat function and the Cursor will automatically move "backwards" until the first character in the line is reached.

The Cursor can be backspaced in any of the Operation Modes.

Pressing  SHIFT key before pressing  Cursor left key will activate the Delete function.

This function will erase whatever character (or space) the Cursor is "on top of" although the change will not be "saved" until you press  ENTER key.

A typical use of  Cursor left key might be to position the Cursor so it is on top of a character that doesn't need to be there. Then you could press  SHIFT key  Cursor left key and the character would be erased. For example, a program line might be:
100 FOR X==1 TO 100_
where the Cursor is at the end of the line.

  1.  Press  Cursor left key until the Cursor is on top of one of the equal signs.
  2.  Press  SHIFT key  Cursor left key and the Computer would display:
    100 FOR X=1 TO 100
  3.  Press  ENTER key to enter the "new" program line into memory.

37

If you press  Cursor down key or  Cursor up key to go on to another program line, the Computer will not realize that you have changed a line. Any time a program is edited (changed), you must press  ENTER key after the change!

Note that you can only delete one character at a time. If you want to erase two characters that are next to each other, you will have to position the Cursor and press  SHIFT key  Cursor left key twice.

When  SHIFT key  Cursor left key deletes a character, it also deletes the space the character filled and all characters to the right will move over one space to he left. (You can also delete a character by pressing  SHIFT key SPACE key but this puts a space where the character was.)

 Cursor right key

Forward Space/Insert Characters

When you need to move the Cursor "forward" (to the right) without erasing characters, press  Cursor right key.

If you hold  Cursor right key down, a repeat function will be activated and the Cursor will automatically move to the right until the end of the line is reached.

If you press  SHIFT key before pressing  Cursor right key, you will put the Computer in the Insert Mode and you can insert a new character between two existing ones. This will not replace any of the characters; it simply creates a blank space between them so you can put a new character there.

38

For instance:
100 FOR X=TO 100_
The underline is the "current" position of the Cursor and you need to insert the number 1 before TO.

  1.  Press  Cursor left key until the Cursor is on top of the T (in TO).
  2.  Press  SHIFT key  Cursor right key and the Computer will push all characters including the character under the Cursor one more space to the right. The Cursor, however, will remain in the same position and two square brackets on the top and bottom of the line will appear.
  3.  Press  1 key.
  4.  Press  ENTER key to enter the line into the Computer's memory.

You must press  ENTER key before going on to another line or your changes will not be in effect.

Using the PC-2's Calculator

Whenever it is in the RUN Mode, the PC-2 can also be used as a powerful scientific calculator with 10 digit precision and memory capabilities. Furthermore, you can combine calculator and programming instructions.

Note that no more than 80 characters (79 plus  ENTER key) may be entered into the Computer when it is being used as a calculator. Also note that any Function Key assignments can be used in the calculator mode as well as the PROgram Mode.

39

Table 3 describes the mathematical functions the PC-2 recognizes when you're using it as a calculator.

PC-2 Mathematical Functions
+ABS
-ACS
*ASN
/ATN
^COS
( )DEG
=DMS
<>EXP
EINT
ÖLN
pLOG
 SGN
 SIN
 SQR
 TAN
Table 3

40

For a complete description of these functions, see a PC-2 programming guide.

Table 4 lists the priority of operations the PC-2 uses.

PC-2 Order of Mathematical Operations
      1. ( ) Any values enclosed in parentheses will be evaluated first.
      2. Retrieval of values from variables (PI, MEM, TIME, etc.) are considered.
      3. Trigonometric functions (such as SIN, COS, TAN, etc.) will be evaluated next.
      4. Exponentiation (^) is evaluated next.
      5. Logical Arithmetic operations (+, -) are performed next.
      6. Multiplication (*) and Division (/) are next.
      7. Addition and subtraction is then performed.
      8. Comparison operations (<, >, =, =>, <=, <>) are evaluated.
      9. Logical operators (AND, OR, NOT) are the last to be evaluated.
  Operations of equal precedence are evaluated left to right.
Table 4

In the following example (assume you're in DEG mode):

7^2+3*SQR(144)/SQR(81)+SIN(120+150)*-3

41

  1.  First the expressions in parentheses are evaluated:
    7^2+3*SQR(144)/SQR(81)+SIN(270)*-3

  2.  Next the functions are evaluated:
    7^2+3*12/9+-1*-3

  3.  Then the exponentiation is performed:
    49+3*12/9+-1*-3

  4.  Multiplication and division are then completed:
    49+4+3

  5.  Finally, addition and subtraction are performed:
    56

Arithmetic Calculations.  You can perform all standard arithmetic functions (addition, subtraction, division, multiplication, and exponentiation) with the PC-2 while it is in the RUN Mode.

To perform arithmetic operations, simply enter the numbers and operators (+, -, *, etc.) and press  ENTER key. You do not need to press the  = key to generate the answer.

42

If you want to see the original expression after you've pressed  ENTER key, press  Cursor left key and the expression will appear on the left side of the Display and you can change (edit) or perform another calculation based on the expression.

For example, if you want to know what 10 multiplied by 10 is without having to write a program, press  MODE key to enter the RUN Mode. When the Ready prompt appears, type 10*10. The expression will be displayed on the left side of the Screen.

For example:

10*10 input display

As soon as you press  ENTER key, the answer will be displayed on the right:

100 answer display

The Computer will remember the result too. That is, if you want to multiply the result by p (or any other number), you don't have to clear the Display and type the result (100) in again. Just type the multiplication sign (*). The result and * will move to the left side of the Display. Then type  SHIFT key  Cursor down key and press  ENTER key. The new result will appear on the right side.

Raising to a Power  To raise a number to a power, type the number (or numeric expression) you wish to exponentiate, press  SHIFT key  SPACE key, the value of the power you wish to raise to, and press  ENTER key. For instance, type:
  (2*2)^3 ENTER key
and the PC-2 will display the answer (64 in this case).

43

Scientific Notation.  Scientific notation is available simply by using the  E key key. For example:
  9.25E7*2  ENTER key

Trigonometric Functions.   The PC-2 allows you to use the trigonometric functions listed in Table 3 whenever it is in RUN Mode.

Functions are entered in the same order as you would write them on paper. This is different from a calculator which requires the argument first, then the function. To find the arctangent of 7/3, type:
  ATN(7/3)

Press  ENTER key and the result (66.80140949 in DEG mode) will appear.

If you are in Degree Mode, the result will be displayed in degrees; if you are in Radian Mode, the result will be in radians.

44

To set the PC-2 to the appropriate Angle Calculation Mode:

  • To set the PC-2 to Degree Mode, type DEGREE  ENTER key and the Indicator will display DEG. In this mode, all angles are expressed in degrees.
  • To set the PC-2 to Radians Mode, type RADIAN  ENTER key and the Indicator will display RAD. In this mode, all angles are expressed in Radians.
  • To set the PC-2 to Gradient Mode, type GRAD  ENTER key and the Indicator will display GRAD. In this mode, all angles are expressed in Grads.
Note: Pressing ALL RESET will return the PC-2 to Degree Mode.

Calculator Memory.  Like a calculator, the PC-2 can store numbers in memory locations when it is being used as a calculator. Unlike a calculator, the PC-2 has 52 fixed memory variables (A–Z for numerics and A$–Z$ for characters). You can also assign many other variables such as A1 or NM$. However, these variables will be stored in the shared memory area normally used for programs.

There are two ways to assign values to a variable:

  • Use alphanumeric labels, such as A, A$, AVERAGE
  • Use an array in the format of @(n) where @ is required and n can be an integer between 1–26.

If you use the alphanumeric label, there are a few alpha-combinations that the PC-2 has reserved for its own use and you cannot use:

  IF, LF, LN, ON, OR, TO, PI

45

Each variable may be used in the calculator mode as well as in a program. For example:

  A=7  ENTER key

  B=13  ENTER key

This assigns the value of 7 to a variable named A and the value of 13 to a variable named B. You can then use these variables in an equation such as:

  A/B  ENTER key

and the PC-2 will display:

  5.384615385E-01

If you use the array format (@(n)) where n is a numeric expression between 1 and 26 which specifies a variable storage location. A is the first memory storage location (1) and Z is the last (26). For example, type:

  A=5  ENTER key

This stores the value 5 in memory storage location A which can also be identified as @(1). Then type:

  @(1)+10  ENTER key

This adds 10 to whatever value is stored in memory location #1 (5 in this case). The result — 15 — appears on the right as soon as you press  ENTER key.

46

The value you assign to variables will be retained until:

  • NEW or CLEAR is entered.
  • The values are changed by the execution of a program.
  • The variables are assigned new values.

Recalling Values.  Any time you need to recall a value assigned to a specific variable (A–Z), just type the variable (A, for instance) and press  ENTER key. The value currently assigned to A will be displayed on the right side of the Display.

Another way to recall a value is to specify the memory storage location, using the @ sign. For instance, type:

  @(2)  ENTER key

to recall the value assigned to the variable B.

Recalling Equations.  Once you've calculated the result, you may need to recall the original expression. To recall an expression (when the result is still displayed), press  Cursor left key or  Cursor right key. The expression will then appear, ready to be edited or changed.

  • If you pressed  Cursor left key, the Cursor will be positioned after the last character.
  • If you pressed  Cursor right key, the Cursor will be on top of the first character of the Display.

To re-display the result, press  ENTER key. Once you clear the Display, the original equation cannot be recalled.

If the Computer is turned off, it will remember the values assigned to the variables but you will not be able to recall the expression itself.

47

For example, type A=5  ENTER key, then turn the Computer off (or let it turn itself off). Next, turn the Computer back on and type A  ENTER key. The value you assigned to A (e.g., 5) will appear on the right side of the Display.

Successive (Chained) Calculations.  In some instances, you may want to perform several calculations — one after another — without having to press  ENTER key before moving on to the next calculation. To do this, simply type an equation, a comma (,), the next equation, another comma (,) and so on. When you've entered the final calculation, press  ENTER key and the last (current) result will be displayed. For instance:

  A=5/(12-4),B=87/24,C=12/(7+8),A*B/C

When you press  ENTER key, the result will be displayed.

2.83203125 display

Editing Equations.  When you're using the PC-2 as a calculator, you can change (edit) equations. This means you can insert new characters and delete or change existing ones.

For specific details on editing, see  Cursor left key and  Cursor right key earlier in this manual.

Hexadecimal-to-Decimal Conversions.  To find the decimal value of hexadecimal numbers, type the hex value (preceded by &) and press  ENTER key. The decimal equivalent will be displayed on the right. For example:

48

&2C0 input


Press  ENTER key and the PC-2 will display:

704 result

Combining Programming and Calculator Mode.  Any values assigned to variables in the RUN Mode can be used by the PC-2 when it is in the PROgramming Mode.

Press  MODE key to enter the PROgramming Mode and type in this one-line program which calculates the Average mileage of a car (A) when you assign values to the variables:

  10: A=M/G: END:REM A=Average M=Miles driven G=Gas used

Then return to RUN Mode and assign values to the variables:

  M = 360  ENTER key
  G = 10.5  ENTER key

49

Next type:

  RUN  ENTER key.

When the Ready prompt reappears, type:

  A  ENTER key

and the average mileage (34.28571429) will be displayed on the right.

Pocket Computer BASIC


The PC-2 recognizes almost all standard BASIC commands and statements as well as several non-standard BASIC keywords.

This section will describe those non-standard BASIC commands and statements (i.e., those commands recognized by the PC-2 but not by most other computers that use the BASIC Language). If you're familiar with standard BASIC, you should be able to begin programming after reading this section.

This section will not describe the BASIC commands used with the Printer/Cassette Interface or with any other PC-2 peripheral. For a discussion of those commands and statements, see your optional device's owner's manual and a PC-2 programming guide.

For a complete list (including syntax, example, and abbreviations) of the BASIC commands the PC-2 uses, see Appendix A.

50

Note that most commands and statements can be abbreviated. For example, instead of typing GOTO, simply type G. followed by a line number.

Keywords identified with an asterisk (*) will be described in this section. For details on all keywords listed, see Appendix A, a PC-2 programming guide or a BASIC language reference manual (such as 'Problem Solving on the PC-1', Catalog Number 62-2313).

Note that most PC-2 BASIC Keywords can be abbreviated. When abbreviating keywords, you must at least specify the part of the word which makes it unique from all other keywords — and then add a period. For instance, GCURSOR can be abbreviated to GC., GCU., GCURS., and GCURSO. You cannot use just G. since GPRINT also starts with this letter (abbreviate to GP.). The following Tables list a few of the abbreviations you may use with the PC-2.

PC-2 Commands
TextAbbreviationGraphicsAbbreviation
CONTC.GCURSOR*GC.
   GCURS.
LISTL.GPRINT*GP.
MEMM.POINT*POI.
RUNR.  

Table 5

51

PC-2 Statements
StatementAbbreviationStatementAbbreviation
AREAD*A.LETLE.
ARUN*ARU.LOCK*LO.
BEEP*B.NEXTN.
BEEP ON/OFF*--ONO.
CALL*CA.ON ERROR--
CLEARCL.PAUSE*PA.
CLS--PRINTP.
CURSOR*CU.RADIANRAD.
DATADA.RANDOMRA.
DEGREEDE.  
DIMD.READREA.
ENDE.REM--
ERRORER.RESTORERES.
FORF.RETURNRE.
GOSUBGOS.  
GOTOG.STEPSTE.
GRADGR.STOPS.
IF--THENT.
INPUTI.TROFFTROF.
TRONTRO.USINGU.
UNLOCK*UN.WAIT*W.

Table 6

52

PC-2 Functions
FunctionAbbreviationFunctionAbbreviation
ABSAB.DEG--
ACSAC.DMSDM.
ANDAN.EXPEX.
ASC--INKEY$INK.
ASNAS.INT--
ATNAT.LEFT$LEF.
CHR$CH.LEN--
COS--LN--
  LOGLO.
MID$M.RNDRN.
  SGNSG.
PEEK--SINSI.
PEEK#*PE.SQRSQ.
PI STATUS*STA.
POKE--STR$STR.
POKE#*PO.TANTA.
RIGHT$RI.TIME*TI.
  VALV.

Table 7

53

[This page now blank due to reorganising tables onto single pages.]

54

AREAD
Assign Display Contents to a Variable

  AREAD name
   name is numeric or character variable

  Abbreviations: A. AREA.

When a definable key (see  DEF key) is used to label and run a program, this statement will assign the Display contents to the variable name specified after AREAD.

This allows you to input (assign) values to variables without having to use the INPUT statement. The reading of the value is performed by AREAD.

The AREAD statement must directly follow (in the same line) the definable key label.

When you are ready to RUN a program that uses AREAD, simply enter the RUN Mode, type the information you wish to enter, and press the key combination of the definable key label.

Example

  10: "A" AREAD N$
20: WAIT 50
30: PRINT "YOUR NAME IS ";N$
40: END

55

To run this program, enter the RUN Mode and, when the Ready prompt appears, type:

  Jonathan  DEF key  A key

and the PC-2 will display:

  YOUR NAME IS Jonathan

  10: "Z" AREAD YEAR  :REM YEAR is the yearly total
20: AVERAGE = YEAR/12 :REM AVERAGE is monthly average
30: WAIT 100
40: PRINT "MONTHLY AVERAGE = ";AVERAGE
50: END

When you enter the RUN Mode and the Ready prompt is displayed, type a number which represents the total for the year. Then press  DEF key  Z key and the PC-2 will display:
  MONTHLY AVERAGE = 100

56

ARUN
Automatic Program Execution on Start-Up

  ARUN

  Abbreviations: ARU.

When ARUN is the first program statement in the first program line, the PC-2 will automatically execute (RUN) the program when you turn the Computer's power on. However, the following conditions must be met:

  • The PC-2 must be set to RUN Mode when you turn the power off.
  • You must turn the power off. If the PC-2 turns itself off, ARUN will not be recognized.
All variables and commands remain the same when ARUN is used.

57

Example

Set the PC-2 to PROgram Mode and enter the following program:

  10: ARUN
20: WAIT 15
30: FOR X = 1 TO 100
40: PRINT X
50: NEXT X
60: END

Press  MODE key to enter the RUN Mode. Press  OFF key to turn the Computer off. When you press  ON key, the program will automatically run.

58

BEEP
Turn Tone ON/OFF

  BEEP switch
    switch is ON or OFF.

This statement turns the BEEP tone ON or OFF.

BEEP ON is in effect after ALL RESET has been pressed or after the batteries have been removed from the Computer without first connecting an external power supply.

Example

To turn BEEP off, type:

  BEEP OFF

To turn BEEP back on, type:
  BEEP ON

59

BEEP
Sound Tone

  BEEP number, frequency, duration

  number is a numeric expression between 0-65535 and specifies the number of times the beep occurs.
  frequency is a numeric expression between 0-255 and specifies the frequency of the beep. frequency is optional; if omitted, 8 is used.
  duration is a numeric expression between 0-65279 and specifies the length of each beep. duration is optional; if omitted, 160 is used.

  Abbreviations: B.

The PC-2 can produce sounds with the BEEP statement. You must specify the number of beeps. You can also specify the frequency and duration (e.g., the length of each beep).

The frequency can range from 7kHz (0) to 230Hz (255). This means that each unit of measurement between 0-255 is equal to about 26.5Hz. When you do not specify frequency, the PC-2 uses 8 (approximately 4 kHz.)

60

Example

  10: WAIT 75
20: BEEP 150

  10: WAIT 50
20: BEEP 100,10

  10: WAIT 25
20: BEEP 75,10,75

CALL
Execute a Machine-Language Routine

  CALL address, variable

  address is a numeric expression between 0-65535 and specifies the entry address of a machine-language program.
  variable is a numeric variable which has previously been defined. variable is optional; if omitted, the machine-language subroutine located at address will be executed without regard to any variables.

This function will execute a machine-language routine which has been loaded into memory at a specified address.

61

After execution of the called program is complete, it can RETurn to the BASIC program.

If you include the optional variable, the X register will be pointing at the location where the variable is stored. If variable is undefined before you use CALL, an ERROR 7 will occur.

Note that machine-language programs can only be stored in the Primary memory buffer (see POKE# and PEEK# for more details on Primary and Alternate memory buffers).

Example

The following example will produce "reverse video" on the PC-2 Display. Note that the switch from normal video to reverse video (and back) is much faster than that of a comparable BASIC program.

  10: WAIT 0
20: CLS
30: GCURSOR 3
40: PRINT "TRS-80 PC-2"
50: POKE 18409,72,118,74,0,5,189,255,65,78,78,153,8
60: POKE 18421,76,119,139,6,72,119,74,0,158,18,154
70: FOR I = 1 TO 11: FOR J = 1 TO 50: NEXT J
80: CALL 18409
90: NEXT I
100: GOTO 100

62

CURSOR
Position Cursor

  CURSOR position
    position is a numeric expression between 0-25 and specifies one of the 26 character positions available on the Display. position is optional; if omitted, 0 is used.

  Abbreviations: CU. CUR. CURS.

The CURSOR statement positions the Cursor at one of the 26 character positions on the Display.

The normal use of CURSOR is to position the Cursor before printing some information on the Display. This allows you to specify where data will appear on the Display.

Using a position less than 0 or greater than 25 will result in ERROR 19.

63

Example

  10: WAIT 25
20: FOR X=0 TO 20
30: CURSOR X
40: PRINT X
50: NEXT X
60: END

When this program is executed, the numbers will move across the display from left to right.

GCURSOR
Selects Graphic Display Start Position

  GCURSOR position
    position is a numeric expression between 0-155 and specifies the dot column on the Display where printing will begin.

  Abbreviations: GC. GCU. GCUR. GCURS.

64

GCURSOR will allow you to specify the exact column on the PC-2 Display where printing will start. GCURSOR is like CURSOR but more precise. That is, CURSOR divides the Display into 26 columns; GCURSOR divides the Display into 156 columns.

GCURSOR is most often used with GPRINT. For details on using GCURSOR with GPRINT, see GPRINT later in this manual.

Example

  10: WAIT 25
20: GCURSOR 50
30: PRINT "A"
40: GCURSOR 80
50: PRINT 26/3
60: END

In this example, the letter A is printed at the 51st dot position on the Display. After a short "wait", the answer to the expression 26/3 (8.666666667) is printed, starting at the 81st dot position.

Change line 40 to:  40: GCURSOR 93 and run the program. The result to 26/3 will appear (starting at dot position 93) but it will be truncated (chopped off) because it ran off the end of the Display.

(Note: You could achieve much the same result if you changed line 40 to:  40: CURSOR 16.)

65

GPRINT
Set Graphic Dots

  GPRINT pattern delimiter pattern delimiter...
    pattern is either a numeric expression between 0-127 decimal or a hexadecimal string which specifies a combination of addressable dots on the Display.
    delimiter is either a comma or semi-colon. If a comma is used, a blank column will be left between patterns; if a semi-colon is used, columns will be printed next to each other.

  Abbreviations: GP. GPR. GPRI.

Note: the PC-2 will recognize pattern numbers up to 255. However, since the high bit isn't displayed, numbers greater than 127 will produce the same result as 0-127.

GPRINT provides direct, programmable control over all of the dots in the Display.

The PC-2 Display is made up of 156 dots across (columns on the X-axis) and 7 dots down (rows on the Y-axis) for a total of 1092 addressable dots.

66

GPRINT can set or reset any dot (or patten of dots) within the columns on the Display. For example, GPRINT 0 will turn all dots in a column off; GPRINT 127 (or GPRINT "7F") will turn all dots in a column on.

To specify which column, use GCURSOR. Then use GPRINT to turn any combination of dots in that column on or off.

For instance, (in the RUN Mode) type:

  GCURSOR 75  ENTER key

This will tell the PC-2 to use column 75. Then type:
  GPRINT 127  ENTER key

and a solid line will appear near the center of the Display.

Press  ENTER key and type:

  GCURSOR 155  ENTER key

and again type:
  GPRINT 127  ENTER key

This time the solid line will appear at the right side of the Display.

In both instances, the line pattern (all dots turned on) is the same but the lines are displayed in different positions.

67

If you use decimal numbers, you must specify the dots in terms of the rows they occupy as described in Table 8.

GPRINT Addressable Dot Numbering (Decimal)
Column
Row1----------*-----------------
 2----------*-----------------
 4----------*-----------------
 8----------*-----------------
 16----------*-----------------
 32----------*-----------------
 64----------*-----------------
Table 8

To turn on the Row 16 dot in a column (column 100, for instance), simply type (in RUN Mode):

  GCURSOR 100  ENTER key
  GPRINT 16  ENTER key

and the fifth dot from the top of the Display in column 100 will be turned on.

68

If you wish to turn on the dots in Rows 1 and 2, simply add the Row numbers together (1+2=3) and specify the sum. For example:

  GCURSOR 100  ENTER key
  GPRINT 3  ENTER key

and the first two dots in Column 100 will light up.

In the same sense, if you need to turn all dots in a single column on (to form a solid line), add the row numbers together (1+2+4+8+16+32+64=127) and specify the sum.

  GCURSOR 100  ENTER key
  GPRINT 127  ENTER key

and a solid vertical line will be displayed.

69

For example, to form a box with a line through it like the one in Figure 5:

   1  *******
   2  *     *
   4  *     *
   8  *******
  16  *     *
  32  *     *
  64  *******
     Figure 5

First (in the RUN Mode) specify the Column you want the first dot to be displayed in — Column 140 for instance.

Remember, the PC-2 will automatically turn on the dots in the next column (Column 141) if you separate Row numbers with semi-colons (;). If you separate Row numbers with commas (,), the PC-2 will leave a blank column.

Next enter the GPRINT statement and specify the sum of the Row numbers for the first Column numbers dot (127), the sum of the Row numbers for the next Column (73), the sum of the Row numbers for the next Column (73), etc. For instance:

  GCURSOR 140  ENTER key
  GPRINT 127;73;73;73;73;73;127  ENTER key

Any pattern can be generated by specifying a Column or the sum of several Rows.

70

If you use hexadecimal numbers to specify dots or combinations of dots, you must think of the Columns as being arranged as in Table 9:

GPRINT Addressable Dot Numbering (Hexadecimal)
Column
Row1----------*-----------------
 2----------*-----------------
 4----------*-----------------
 8----------*-----------------
 1----------*-----------------
 2----------*-----------------
 4----------*-----------------
Table 9

In this arrangement, the seven rows are divided into a lower group of three rows and an upper group of four rows. Each group is numbered, from top to bottom, by powers of two.

It is therefore possible to represent all the patterns of a group by a single hexadecimal number. Because the lower group has only three rows, the range of allowable digits for this group will be from 1–7.

71

Of the two hexadecimal digits required, the first digit will represent the lower group and the second digit will represent the upper group.

Note that the lower group (1–4) must be specified before the upper group (1–8).

To use hexadecimal numbers with GPRINT, you must enclose the numbers in quotes to create a string ("7F") or preface the numbers by the & sign (for instance, &7F).

Table 10 describes the different patterns that GPRINT can generate when hexadecimal numbers are used:

72

GPRINT Dot Patterns (Hexadecimal)
1-------*---------*--
2------------*----*--
4--------------------
8--------------------
 0123
1-------*---------*--
2------------*----*--
4--*----*----*----*--
8--------------------
 4567
1-------*---------*--
2------------*----*--
4--------------------
8--*----*----*----*--
 89AB
1-------*---------*--
2------------*----*--
4--*----*----*----*--
8--*----*----*----*--
 CDEF
Table 10

73

To create a box (like the one that was used in the previous example) but with hexadecimal numbers, type (in the RUN Mode):

  GCURSOR 140  ENTER key
  GPRINT "7F49494949497F"  ENTER key

and the box will be created.

If you specify a single-digit Hex number, it must be preceded by a zero (e.g., 0A is legal; A is illegal).

Another way to accomplish the same thing is to use the hexadecimal preface &. For instance:

  GCURSOR 140  ENTER key
  GPRINT &7F;&49;&49;&49;&49;&49;&7F  ENTER key

and the box will again be created.

Example

To create an up-arrow using GPRINT, type:

  10: WAIT 25
20: GCURSOR 100
30: GPRINT 4;2;127;2;4;

74

To generate the same symbol but with hex numbers, type:

  10: WAIT 25
20: GCURSOR 100
30: GPRINT "04027F0204"

LOCK/UNLOCK
Locks/Unlocks Current Operation Mode

  LOCK

  UNLOCK

This statement "locks" the PC-2 into the current Operation Mode (RUN, PROgram, or RESERVE). After LOCK  ENTER key is typed, you cannot change modes by pressing  MODE key.

On initial start-up, the PC-2 is not locked into any mode. If you lock the current mode and turn the Computer off, LOCK will still be in effect when you turn the PC-2 back on.

To unlock the Computer, allowing you to change modes, type: UNLOCK  ENTER key.

Whenever you type NEW0  ENTER key, the PC-2 is set to UNLOCK.

75

Example

To lock the PC-2 into the current Operation Mode, type:

  LOCK  ENTER key

To unlock the PC-2 so you can change modes, type:
  UNLOCK  ENTER key

PAUSE
Print Message and Continue Execution

  PAUSE

  Abbreviations: PA. PAU. PAUS.

PAUSE is a semi-automatic form of the PRINT statement. It holds whatever is on the Display for approximately one second and then goes on to the next program step.

PAUSE does not require a WAIT statement; PRINT does or you will have to press  ENTER key to continue.

76

PAUSE has a fixed delay value; PRINT has a variable delay (see WAIT).

Example

In the following example, each number will be held on the Display for approximately one second before the next number appears.

  10: FOR X=1 TO 10
20: PAUSE X
30: NEXT X
40: END

PEEK#
Returns Contents of address in Alternate Buffer

  PEEK# address
    address is a numeric expression between 0-65535 and specifies a location in memory.

  Abbreviations: PE. PEE.

PEEK# is the same as PEEK but returns the value of the specified address in the alternate memory buffer.

77

The PC-2 has two memory buffers — a Primary buffer for program and data storage and an Alternate buffer for data storage only.

PEEK# returns (in decimal form) the value stored at the specified byte address of the Alternate buffer. The values returned represent an ASCII code.

PEEK# may be used to retrieve information stored with a POKE# statement. PEEK# and POKE# allows you to set up very compact, byte oriented storage systems.

Example

  A=PEEK# 32034  ENTER key

PRINT A  ENTER key

POINT
Test Display

  POINT position
    position is a numeric expression between 0-155 and specifies one of the 156 columns on the Display.

  Abbreviations: POI.

78

POINT will return a number between 0-255. If 0 is returned, there are not any dots turned on in the specified column. If 255 (or 127) is returned, all of the dots in the specified column are turned on. 255 will be returned if you specified GPRINT 255 or FF and 127 will be returned if you specified GPRINT 127 or 7F.

The number the PC-2 returns will identify the dot pattern specified with GPRINT. For instance, if your program uses GCURSOR 100 and you specified GPRINT 8, the PC-2 will return the value of 8 when you enter POINT 100. For details on specifying dot patterns, see GPRINT.

Example

The following program randomly moves the GCURSOR position among the first 10 columns. It GPRINTs pattern 8 (a single dot). the program then tests whatever column you specify and tells you whether or not a dot is on in the column.

  10: WAIT 50
15: INPUT "WHAT COLUMN DO YOU WANT TO TEST (1-10)? ";C
20: GCURSOR RND(10)
25: GPRINT 8
30: A=POINT C
35: IF A>0 THEN GOSUB 100
40: IF A>10 THEN GOTO 15
45: GOTO 15
100: PRINT "A DOT PATTERN IS ON"
110: RETURN
[This program appears to be faulty. In particular, line 40 seems to be redundant. However it is as printed in the manual.]

79

POKE
Put Value Into Primary Buffer Location

  POKE address, value, value....
    address is a numeric expression between 0-65535 decimal and specifies a memory location in the Primary memory buffer.
    value is a numeric expression between 0-255 decimal and specifies the ASCII value you wish to put into address. value may be repeated.

POKE allows you to put values into specified memory locations. The PC-2 uses POKE just like other TRS-80's except you can use multiple values after a single address.

For details on using poke, see a BASIC Language Reference Manual.

For an example that uses POKE, see CALL earlier in this manual.

80

POKE#
Put Value Into Alternate Buffer Location

  POKE# address, value
    address is a numeric expression between 0-65535 decimal and specifies a memory location in the Alternate memory buffer.
    value is a numeric expression between 0-255 decimal and specifies the ASCII value you wish to put into address.

  Abbreviations: PO. POK.

POKE# is the same as POKE but POKE# puts a value into the Alternate memory buffer.

The PC-2 has two memory buffers — a Primary buffer for program and data storage and an Alternate buffer for data storage only.

POKE# requires a byte address (in decimal or hexadecimal form) and a value (also in decimal or hexadecimal form).

POKE# may be used in any of the Operation Modes.

81

Example

  POKE# &23FA,20  ENTER key

will store 20 in hexadecimal address 23FA.

For a more detailed example of POKE#, see CALL.

STATUS
Check Memory Status

  STATUS number
    number is a numeric expression between 0-255
      0 returns the number of free bytes.
      1 returns the number of bytes in use.
      2 returns the "address + 1" of the location where the current program ends.
      3 returns the "address" of the memory location where the current variables are stored.
      4–255 returns the line number which was executed immediately before the program was halted.

  Abbreviations: STA. STAT.

The STATUS statement lets you check the current status of the PC-2. STATUS can be executed from any Operation Mode (RUN, PROgram, RESERVE).

82

STATUS is useful when you need to know how much memory the PC-2 has left for programming or how much memory you are using at any time.

Example

  STATUS 0  ENTER key

will display the number of free bytes.

  STATUS 1  ENTER key

will display the number of bytes in use.

  STATUS 2  ENTER key

will display the memory address where the current program ends. Note that this address is actually one greater than the actual address where the program ends.

  STATUS 3  ENTER key

will display the memory address where variables are stored. Note that this address is actually one location less than the actual address where variables are stored.

  STATUS 4  ENTER key
STATUS 100  ENTER key

will display the program line number when program execution was halted.

83

TIME
Set/Display Current Time

  TIME = month day hour . minutes seconds
    month is a number between 1–12
      which specifies the month of the year.
    day is a two-digit number between 01–31
      which specifies the day of the month.
    hour is a two-digit number between 00–23
      which specifies the hour of the day.
    . is a decimal point.
    minutes is a two-digit number between 00–59
      and specifies the minutes of the hour.
    seconds is a two-digit number between 00–59
      and specifies the seconds of the minutes.

  Abbreviations: TI.

TIME lets you specify (set) the time or display the current time.

Note that the time is set according to the 24-hour clock. That is, 1:00 P.M. would be specified as 13:00 hours.

If you do not set the time the first time you turn the Computer on, the PC-2's internal clock uses TIME = 000000.00. Whenever you request the time after that, the Computer will display how many days, hours, minutes, and seconds it has been since you first turned the Computer on.

The PC-2's clock does not stop counting when the Computer is turned off.

84

Example

To set the time on July 28 as 11:30:01 A.M., type;

  TIME=072811.3001  ENTER key

To display the current time, type;

  TIME  ENTER key

and the PC-2 will display the time. For example:

91214.2424

for September 12, 2:24:21 P.M.

WAIT
Specify Duration of PRINT

  WAIT delay
    delay is a numeric expression between 0-65535 and specifies the length of time the PRINT statement will be displayed. delay is optional; if omitted, you must press  ENTER key to go to the next program step after a PRINT statement.

  Abbreviations: W. WA.

85

A WAIT statement should always precede a PRINT statement in your program.

The length of time WAIT holds whatever you told the PC-2 to print depends on the number you specify.

  • WAIT without a specified delay will wait for you to press  ENTER key.
  • WAIT 0 causes the information to be displayed faster than you can keep up with it.
  • WAIT 65535 holds whatever you want printed for approximately 17 minutes.
  • WAIT 64 holds the display for about one second.
  • WAIT 3840 holds the display for about a minute.

Example


  10: FOR X=1 TO 100
20: WAIT 50
30: PRINT X
40: NEXT X
50: END

86

4/Care and Maintenance

Your PC-2 should provide you with years of trouble-free service. However, if you ever have problems with the Computer, check the symptom/cure table below. After that, if you still can't remedy the problem, contact your nearest Radio Shack store or computer center.

SymptomCure
Can't change Operation ModesThe LOCK command may be in effect.
Type: UNLOCK  ENTER key.
Display Indicators don't come on when you press  ON key.Batteries may be worn out. Replace batteries or connect the PC-2 to an external power supply.
The PC-2 "hangs-up" during program execution.Press ALL RESET on the rear of the Computer.
A program line appears on Display that will not go away.Type: NEW0  ENTER key.
A "~" appears when you specify a Defined key such as LLIST or CSAVE.The correct optional device is not connected.
Display Indicators do not come on after installing batteries or connecting DC adaptor.Batteries may not be installed correctly or connections to DC adaptor may not be proper.

87

5/Specifications

CPU:CMOS 8-bit 
System ROM:16KB 
Memory Capacity:System Area:
Fixed Memory Area:


BASIC Program/Data Area:
Reserve Area:
Expandable User Area:
0.9KB
0.6KB
A–Z
A$–Z$
1.85KB
0.19KB
16KB
(RAM. 22KB)
Display:Dot LCD Display
   Display positions:
   Graphic display:

26 Columns
7 x 156 Dots
Keyboard:66 Keys
   Alphabet
   Numeric
   Function
   Reserved
 

89

Power:4 – Type AA Batteries (23–552)
9V DC Adaptor
Expansion Capabilities:Plug-in RAM (4KB RAM)
Plug-in ROM/RAM (16KB ROM/2KB RAM)
Dimensions:7-11/16"(W) x 3-3/8"(D) x 1"(H)
195(W) x 86(D) x 25.5(H) mm
Weight:Approx. 0.83 lbs. (375 g) (with batteries)
Operating Temperature:32°F ~ 104°F (0°C ~ 40°C)
Storage Temperature:5°F ~ 131°F (-15°C ~ 55°C)

90

Appendix A/PC-2 Language Reference Summary

Argument ranges are indicated by special letters:

n:  (-9.999999999 E-99, +9.999999999 E99)
c:  (0-–255)
str:  string argument
var:  variable name

 Page
ABS n      Computes absolute value. Abbreviations: AB.
    Y=ABS X
 
ACS n      Computes arccosine. Abbreviations: AC.
    Y=ACS .102
 
AREAD var      Assigns Display contents to variable. Must be used with a Definable Key label. Abbreviations: A. AREA.
    "A" AREAD X
55
ARUN      Automatic execution on power-up. Must be the first line in a program. Abbreviations: ARU.
    ARUN    ARU.
57
ASC str      Returns ASCII code of first character in string.
    A=ASC "ASHER"
 
91

 Page
ASN n      Computes arcsine. Abbreviations: AS.
    A=ASN X/3
 
ATN n      Computes arctangent. Abbreviations: AT.
    Y=ATN 45
 
BEEP switch      Turns tone feature on or off.
    BEEP ON    BEEP OFF
59
BEEP number, frequency, duration      Sounds tone for specified number of times, frequency, and duration of each tone. Abbreviations: B.
    BEEP 25,45,14    B. 150
59
CALL address, var      Calls the machine-language routine stored with specified entry address and will use specified variable values to execute. Abbreviations: CA.
    CALL &2C00    CALL 35423,A
61
CHR$ c      Converts ASCII code to character. Abbreviations: CH. CHR.
    P$=CHR$ T
 
CLEAR      Clears all data, resets variables to zero. Abbreviations: CL. CLE. CLEA.
    CLEAR    CL.
 
92

 Page
CLS      Erases Display.
    CLS
 
CONT      Continues execution after BREAK or STOP. Abbreviations: C. CO. CON.
    Y=ATN 45
 
COS n      Computes cosine.
    Y=COS X
 
CURSOR position      Display printing will start at one of the 26 Display positions specified by position. Abbreviations: CU. CUR. CURS.
    CURSOR 13    CUR. 20
63
DATA expression      Stores data to be accessed by a READ statement. Abbreviations: DA. DAT.
    DATA "LINCOLN, A.",1861,"ILLINOIS"
 
DEG      Converts degrees, minutes, and seconds into decimal degrees.
    DEG 32.2513
45
DEGREE      Sets Angle Calculation to degrees. Abbreviations: DE. DEG. DEGR. DEGRE.
    DEGREE    DEG.
 
DIM      Dimensions an array. Abbreviations: D. DI.
    DIM R(75)    DIM A(10,3)    DIM A$(5,3)*20
 
93

 Page
DMS      Converts decimal degrees into degrees, minutes, and seconds. Abbreviations: DM.
    DMS 16.1932
 
EXP n      Computes natural antilog. (en) Abbreviations: EX.
    Y=EXP X
 
END      Ends program execution. Abbreviations: E. EN.
    END
 
FOR..TO..STEP/NEXT      Opens program loop. Abbreviations: F. FO. STE. N. NE. NEX.
    FOR I=1 TO 100 STEP 10...NEXT I
 
GOSUB      Transfers program control to the specified line. Abbreviations: GOS. GOSU.
    GOSUB 750
 
GOTO      Transfers program control to the specified line. Abbreviations: G. GO. GOT.
    GOTO 180
 
GCURSOR position      Selects Display start position. Position is between 0-155. Abbreviations: GCU. GCUR. GCURS.
    GCURSOR 100    GCUR. 75
64
94

 Page
GRAD      Sets Angle Calculation to gradients.
    GRAD
45
GPRINT pattern delimiter pattern delimiter...      Sets graphic dots on the Display. Pattern is between 0-127; delimiter is a comma or semi-colon. Abbreviations: GP. GPR. GPRI.
    GPRINT 10,100    GPRI. &F;&2C    GP. "7F4949497F"
66
IF...THEN      Tests conditional expression. Abbreviations: T. TH. THE.
    IF P=Q THEN 200
 
INKEY$      Gets keyboard character if available. Abbreviations: INK. INKE. INKEY.
    A$=INKEY$
 
INPUT      Inputs data from keyboard. Abbreviations: I. IN. INP. INPU.
    INPUT "WHAT IS THE SCORE";S    IN. "NAME";N$
 
INT n      Returns largest whole number not greater than n.
    Y=INT X
 
LEFT$ (str,c)      Returns left portion of string. Abbreviations: LEF. LEFT.
    A$=LEFT$("BENJAMIN",3)
 
95

 Page
LEN (str)      Returns the number of characters in a string.
    X=LEN(SEN$)
 
LET      Assigns value to a variable (optional). Abbreviations: LE.
    LET X=10
 
LIST line      Lists first program line or specified line. Abbreviations: L. LI. LIS.
    LIST 100    L. 75    L.
 
LOCK      Locks in current Operation Mode. Abbreviations: LOC.
    LOCK    LOC.
75
LOG n      Computes logarithm to base 10. Abbreviations: LO.
    Y=LOG X
 
LN n      Computes natural logarithm to base e.
    Y=LN X
 
MEM      Finds amount of free memory. Abbreviations: M.
    MEM    M.
 
96

 Page
MID$ (str,position,length)      Takes a character(s) from the middle of the specified string. Abbreviations: MI. MID.
    PRINT MID$(A$,3,3)
 
NEW      Erases current program from memory.
    NEW
 
NEW0      Erases current program and resets the Computer.
    NEW0
14
ON ERROR GOTO      Sets up an error-handling routine. Abbreviations: O. ER. ERR. ERRO.
    ON ERROR GOTO 210
 
ON...GOSUB      Multi-way branch to specified subroutines. Abbreviations: O. GOS. GOSU.
    ON Y GOSUB 50,100,150,200
 
ON...GOTO      Multi-way branch to specified lines. Abbreviations: O. G. GO. GOT.
    ON X GOTO 190,200,210
 
PAUSE      Print message and continue execution. Abbreviations: PA. PAU. PAUS.
    PAUSE
76
97

 Page
PEEK address      Gets value in specified address from Primary memory buffer.
    PEEK 34223    PEEK &2C00
77
PEEK# address      Gets value in specified address from Alternate memory buffer. Abbreviations: PE. PEE.
    PEEK# 53990    PEEK# &A45
77
PI p      Returns value of PI (3.141592654).
    A=PI/3
 
POINT position      Test dot pattern of specified column (0–155) on Display. Abbreviations: POI. POIN.
    A=POINT 100
78
POKE address, value, value...      Puts value (0–255) into specified memory address (0–65535) of Primary memory buffer.
    POKE 3422,22
80
POKE# address, value      Puts value (0–255) into specified memory address (0–65535) of Alternate memory buffer. Abbreviations: PO. POK.
    POKE# 3422,22    PO. &5C,&1
81
PRINT      Prints an item or list of items on the Display at current cursor position. Abbreviations: P. PR. PRI. PRIN.
    PRINT a$    PR. 100    PRI. A
 
98

 Page
PRINT USING      Formats strings and numbers for printing.
The width of a numeric field must always be one more than the width of the data.
#Formats numbers.
PRINT USING "####";66.2
*Specifies Asterisk Fill of the specified positions of a Numbering field which do not contain data.
PRINT USING "***##";Y
.Decimal point.
PRINT USING "####.###";58.76
,Displays a comma to the left of every third digit left of the decimal point. An extra # is required for each comma.
PRINT USING "######,###";246813
^Exponential format. Display numbers in scientific notation.
PRINT USING "###.^";3.14
+Prints a + sign in the first position if the specified number is a positive number; a minus sign (-) if the specified number is negative. (0 is assumed to be positive.)
PRINT USING "+###";66.2    PRINT USING "+###";-74.1
&Specifies a character field.
PRINT USING "&&&&";"JACKSON"
 
RADIAN      Sets Angle Calculation to radians. Abbreviations: RAD. RADI. RADIA.
    RADIAN    RAD.
45
99

 Page
RANDOM      Reseeds the random number generator. Abbreviations: RA. RAN. RAND. RANDO.
    RANDOM
 
READ      Reads value(s) from a DATA statement. Abbreviations: REA.
    READ T    READ T$    REA. NM$,AGE
 
:REM      REMARK; instructs the PC-2 to ignore the rest of the line.
    :REM
 
RESTORE      Resets data pointer to the first item in the data line. Abbreviations: RES. REST. RESTO.
    RESTORE
 
RETURN      Returns from the subroutine to the next statement after GOSUB. Abbreviations: RE. RET. RETU. RETUR.
    RETURN
 
RIGHT$ (str,c)      Returns the right portion of string. Abbreviations: RI. RIG. RIGH. RIGHT.
    ZIP$=RIGHT$(AD$,5)
 
RND n      generates a pseudo-random number between1 and n if n>1, or between 0 and 1 if n=0. Abbreviations: RN.
    Y=RND(100)
 
100

 Page
RUN      Executes the current program or portion of it. Abbreviations: R. RU.
    RUN    R. 100
 
SGN n      Returns sign component: -1, 0, 1, if n is negative, zero, positive. Abbreviations: SG.
    X=SGN(A*B)
 
SIN n      Computes sine. Abbreviations: SI.
    Y=SIN X
 
SQR n      Computes square root. Abbreviations: SQ.
    Y=SQR(A+B)
 
STATUS number      Checks the current memory status. number returns
0 = program steps available; 1 = program steps used; 2 = address+1 of location of end of current program; 3 = address of location of variable storage; 4–255 = line number of program when execution was halted. Abbreviations: STA. STAT. STATU.
    STATUS 0    status 1
82
TAN n      Computes tangent. Abbreviations: TA.
    X=TAN Y
 
101

 Page
TIME month day hour. minutes seconds      Sets or returns the current time. Abbreviations:TI. TIM.
    TIME=123014.3030    TIME    TIM.
84
TROFF      Turn program trace off. Abbreviations: TROF.
    TROFF    TROF.
 
TRON      Turn program trace on. Abbreviations: TR. TRO.
    TRON    TRO.
 
UNLOCK      Unlocks Operation Mode after it has been locked. Abbreviations: UN. UNL. UNLO. UNLOC.
    UNLOCK    UN.
75
VAL (str)      Converts a string to a number. Abbreviations: V. VA.
    V=VAL("100 dollars")
 
WAIT delay      Specifies duration of PRINT. Delay can be between 0–65535. Abbreviations: W. WA. WAI.
    WAIT 100    W. 500    WA. 10    WAI.
85
102

Appendix B/PC-2 Error Codes

Error CodeExplanation
1Syntax Error. Incorrectly typed statement.
2NEXT statement without a FOR.
4READ statement without a DATA.
5Array variable already exists.
6Array specified without first DIMensioning it.
7Illegal variable name.
8DIMensioned array has more than two levels.
9Array subscript exceeds size of array specified in DIM statement.
10Out of memory.
11Program line does not exist.
12Incorrect format for PRINT USING statement.
13Program exceeds program memory capacity or Function Key specification exceeds Function Key memory capacity.
14Buffer space exceeded or FOR statement nested too deeply and stack capacity has been exceeded.
15GOSUB nested too deeply and stack area has been exceeded or the string buffer size has been exceeded by the character strings while parsing an expression.
16Specified value is greater than 10 E100 or less than -10 E-100 or the hexadecimal value is greater than 65535 decimal.
17Data type is inappropriate for calculation expression.

103

Error CodeExplanation
18Number of arguments is inappropriate for expression.
19Specified numeric value is outside permitted range.
20There is not a parenthesis following the @ when fixed memory array variables were specified.
21Required variable is not in the expression.
22There is not enough memory available to load the program that is loading.
23TIME is incorrectly typed in.
26Command cannot be executed in the current mode.
27There is not a program which corresponds to the specified label.
28INPUT or AREAD statements have been used as variables or a command has been inserted within quotation marks.
30Line number is greater than 65535.
32Graphic cursor is between Columns 152–153 during execution of input commands. The input code cannot be displayed.
34Specified optional device is not attached.
35The optional device specified in the PRINT# or INPUT# expression is not consistent or the specified optional device cannot handle input/output commands according to the given syntax.
36Inappropriate PRINT USING format.
37Calculation results are greater than 9.999999999 E99
38Division by zero.
39An illogical calculation has been attempted.
81–181Program has overwritten the data area.
224–241Incorrect input data during the execution of an INPUT or AREAD command.

104

RADIO SHACK, A DIVISION OF TANDY CORPORATION
U.S.A.: FORT WORTH, TEXAS 76102
CANADA: BARRIE, ONTARIO L4M 4W5


TANDY CORPORATION
AUSTRALIA
280-316 VICTORIA ROAD
RYDALMERE, N.S.W. 2116
BELGIUM
PARC INDUSTRIEL DE NANINNE
5140 NANINNE
U.K.
BILSTON ROAD WEDNESBURY
WEST MIDLANDS WS10 7JN

PRINTED IN JAPAN






Notes

The copyright of this manual obviously still belongs to Tandy Corporation, but I cannot imagine they would be interested in a product discontinued over twenty years ago.

This HTML version of the PC-2 manual was retyped from PDF'd scans of the original by Peter Ochocki in April 2009. It may be copied and distributed without restriction for non-commercial purposes.

The formatting and page layout of the printed manual has been adhered to as closely as possible within the limits of simple HTML, except that I have generally avoided splitting paragraphs across pages.
Each table 'block' corresponds to one page in the printed manual.
A few obvious typing errors in the original text have been corrected, and I hope I have not introduced any new ones.
The rather quaint use of capitals for words such as Computer and Display is as per the original manual.
All the figures and 'screenshots' were redrawn in vector-graphics format using the RISC OS !Draw application, then converted to GIF files by !Intergif. This produced clearer results and smaller file sizes than JPEGs of the originals would.

It is certainly refreshing to read a product manual written in fluent, grammatically correct English – though the section on programming commands seems less carefully composed.
Such a change from the usual badly translated and ill-thought-out efforts.


Hosted by www.Geocities.ws

1