background image

p.  11

Add  another  line  to  your program:

15  PRINT

What  is  that  going  to  add?  Just  an  empty  line.  RUN  it  and you'll 

see  that  the  lines  are  separated;  looks  better now.

Let's  add  a  REMark  statement  at  the  beginning.  A  REMark  statement 

is  not  part  of  the  program,  it  is  just  like  a note  or  reminder 

to  you.

5  REM  **  THIS  IS  MY  FIRST  COMPUTER PROGRAM  **

RUN  the  program and you'll  see  that  line  5  had no  effect.  Now 

pull  a  list  (type  LIST)  and  sure  enough,  line  5  is  there.

Big-  &  Little  Numbers

The  TRS-80  uses  scientific  notation  to  handle  very  large  and 

very  small  numbers.  For example,  the  number  5,000,000  becomes 

5E+06;  this  means  the  number  5  followed by  6  zeros.  The 

number  .000,005  becomes  5E-06;  this  means  6  decimal  places 

to  the  left  of  5.  Scientific notation  is  a  very  common  method 

for  listing  very  large  and  very  small  numbers  (they  are  much 

easier  to work with  this  w a y ) .

Sequence  of  Math  Operators

Your TRS-80  uses  the  4  fundamental  math  functions.  You  also  can 

use  parentheses  in  your math  formulas.  The  following  rules  apply 

for  (  )

  and  sequence  of  Math  Operators:

1.  All  operations  inside  parentheses  are  performed  first.

2.  All  operations  buried  deepest within  (  )  are  performed  first. 

IE.  If you have  operations  nested  inside  (  ),  which  are  nested

Summary of Contents for TRS-80

Page 1: ...PRELIMINARY USER S MANUAL MICRO COMPUTER Catalog Numbers 26 1001 26 1201 14 841 Copyright 1977 by Radio Shack A Division of Tandy Corporation Fort Worth Texas 76107 U S A...

Page 2: ...ers tapes etc Save the packing material in case you need to transport the system Connecting the Video Monitor and Keyboard 1 Connect the power cord from the Video Monitor to a source of 120 volts 60 H...

Page 3: ...for 120 volt AC power 2 Connect the short cable DIN plug on one end and 3 plugs on the other to the TAPE jack on the back of the Keyboard Assembly Be sure you get the plug to mate correctly 3 The 3 pl...

Page 4: ...cond will blink indicating the program is loading When loading is done the TRS 80 will automatically t u n the CTR 41 off and flash READY on the screen You are then ready to RUN the program type in RU...

Page 5: ...m 5 When you are not going to use a CTR 41 for loading or recording programs do not leave RECORD or PLAY keys down press STOP 6 To REWIND or FAST Forward a cassette you must disconnect the plug from t...

Page 6: ...n it on again Pressing the power switch slowly can cause the machine to get confused Turn it on with a quick push Now type in P m and hit ENTER This is a test to see that the Computer powered up prope...

Page 7: ...press the backspace key repeat as necessary to erase the error If you have already ENTERed a line and notice an error type the same line over again the Computer always takes the last line typed in Let...

Page 8: ...ER The screen will display 17 5 1 9 318182 16 8 Press CLEAR and the screen will be blank except for the little cursor _ at the upper left hand comer If you want to recall the program that is in the Co...

Page 9: ...RINTinq Often you will want to put some wording in with your program to explain the meaning of calculations Try this PRINT THE APPROXIMATE VALUE OF PI IS 22 7 Hit ENTER The screen displays THE APPROXI...

Page 10: ...ore loading new programs from cassettes or typing in new programs Type 10 PRINT HELLO THERE I AM YOUR NEW TRS 80 MICROCOMPUTER RUN this one line program HELLO THERE I AM YOUR NEW TRS 80 MICROCOMPUTER...

Page 11: ...o handle very large and very small numbers For example the number 5 000 000 becomes 5E 06 this means the number 5 followed by 6 zeros The number 000 005 becomes 5E 06 this means 6 decimal places to th...

Page 12: ...to multiply X Y is for multiplication If you want to be sure your problems are calculated correctly use around operations which you want performed first NOTE INT RND and ABS functions are performed be...

Page 13: ...happens now Try other numbers Now change line 5 as follows 5 INPUT THE VALUE I WISH TO GIVE A IS A Delete line 10 type a line 10 and ENTER it with nothing else Run the program now and see what happen...

Page 14: ...ery powerful tool in the hands of an experienced programmer hang in there you ll become one Counting and Looping Try this 10 A 0 20 A A 1 30 PRINT A 40 GOTO 20 RUN it and see what happens To stop the...

Page 15: ...ly increases the number by 1 unless you tell it differently Change 10 to 10 FOR N 1 TO 10 STEP 2 RUN it Loops can be combined as long as the loops nest within each other ie finish one loop before goin...

Page 16: ...can have values assigned with commas separating them same with READ statements DATA lines are always read from left to right by READ statements It does not matter where DATA statements come in the seq...

Page 17: ...statements for almost any part of the screen Graphics Functions There are three Graphics statements SET RESET and POINT SET turns on a square on the screen RESET turns a square off POINT checks for t...

Page 18: ...0 TO 30 for Y Lines 70 and 90 set up 80 RESET X Y a loop for X Line 80 turns off 90 NEXT X 100 NEXT y the graphic display RUN the program The READY goofs of it up the display How to get rid How about...

Page 19: ...XT N RUN it Then add a comma at the end of line 20 and change the number for N so you can fill up the screen Then use a semi colon and change N again to fill up the screen before the program ends Abbr...

Page 20: ...ables for later READ statements READ X Y Z instructs Computer to READ values assigned by DATA statements RESTORE instructs Computer to start reading from first DATA statement PRINT X Computer will pri...

Page 21: ...t specified 1 is assumed NEXT N NEXT X used with FOR to complete a loop defining series for X STOP no abbr STOP used to stop a program END no abbr END optional to end a program GOTO G GOTO 1000 instru...

Page 22: ...le is evaluated and if X l Computer goes to 1000 if X 2 goes to 2000 etc ON X GOSUB 1000 2000 3000 multiple way branch to subroutine programs If X 4 Computer has no where to go and stops CLS clears th...

Page 23: ...at number END 100 returns or generates a random number between 1 and 100 END O returns or generates a random number between 0 and 1 END X returns or generates a random number with an upper limit equal...

Page 24: ...ust begin with a line number Information on a line may be up to 72 characters long In this case the screen display will overflow onto the next line but the Computer will interpret it as one line of in...

Page 25: ...Filing always INPUT the same number of variables as you PRINT If you print 3 input 3 otherwise errors may occur or data may be lost MISCELLANEOUS Remarks and documentation can be included in a program...

Page 26: ...es it is ready for entries it s your turn The prompt indicates the Computer is ready for a line number or other command If the Computer fails to turn the Cassette off at the end of a CLOAD or CSAVE yo...

Page 27: ...stir your imagination and creativity so you go on from here to make up your own Graphics and RND function 10 FOR X 0 TO 127 STEP N 20 N RND 5 30 FOR Y 0 TO 47 STEP 5 40 SET X Y 50 NEXT Y 60 FOR A 0 TO...

Page 28: ...HE OBJECT OF THE GAME IS FOR YOU TO GUESS 80 P THE NUMBER I AM THINKING OF IT IS FROM 0 90 P TO 100 ENTER 0 WHEN READY 105 IN P GOTO 110 110 LET X RND 100 115 CLS P P sP 117 LET F 0 LET Y 0 120 LET F...

Page 29: ...TO PLAY AGAIN 1 YES 0 NO IN G 380 IF G 1 THEN 110 390 CLS P P P P P RATS END Printing a Large X with TAB Function 5 CLS 10 X 0 20 Y 60 30 Y Y 4 40 X X 4 50 IF Y 0 THEN 140 60 IF X 28 THEN 100 70 IF X...

Page 30: ...RND 12 30 B RND 12 40 PRINT 50 PRINT A B WHAT 60 INPUT C 70 IF C A B GOTO 120 80 CLS 90 PRINT TRY AGAIN 100 PRINT 110 GOTO 40 120 CLS 130 p r i n t c o r r e c t 140 GOTO 10 To Use RUN and then enter...

Reviews: