TRS80 Color Basic Quickref

Post on 10-Apr-2018

229 views 0 download

Transcript of TRS80 Color Basic Quickref

8/8/2019 TRS80 Color Basic Quickref

http://slidepdf.com/reader/full/trs80-color-basic-quickref 1/2

5-Buff6-Cyan7-Magenta8-0range

Statements

AUDIO ConnectsordisconnectscassetteoutputtoTVspeaker.AUDIDDN

AUDIO OFF

CIRCLE ( J r , Y } ~ ~ , h " " . ' ' ' ' ' , e a d Drawsacirclewithcenteratpoint (x,y) radlu ,speci f iedcolorc, height/widthratio (hw) of0-4.Circlecanstartand endatspecifiedpoint(0-1).CIRCLE(128 ,8S) ,50 ,4 t1 , .5 , . 75 JJ

CLEAR a,h Reserves n bytesofstringstoragespace.Erasesvariables. h specifieshighestBASICaddress.CLEAR

CLEAR 500

CLEAR 101' , 111000

CLOAD Loadsspecifiedprogramf efromcassette. I f e nameisnotspecified,firstfileencountered is loaded.F enamemustbeeightcharacter/spacesorfewer.CLOAD

CLOAD"PROGRAM"

CLOADM Loadsmachine-languageprogramfromcassette.MD offsetaddresstoadd the loadingaddressmay bespecified.CLOADM"PROG"

CLOADMCLOADM" PROG" , 1000 -

CLOSE d Cl os esopen f i le s.CLOSE

CLOSE-2

CLS c Clearsdisplaytospec i fiedcolorc . I fcolor is notspecified,green is used.O-Backl-Green

2-Yellow3-Blue4-RedCLS

CLS3

COLOR (lore _d , "adtgroaad) Set foregroundand backgroun color.COLOR,1,3

CONT Continuesprogramexecutionafterpressing (BREAK)orusingS TOPscatement.CONT

CSAVE Savesprogramoncassette(programnamemustbeeightcharacter/spacesorless).IfA is specified,programsavedisASCIIformat.CSAI.IE "PROGRAM"

CSAIJE "PROGRAM" ,A

CSAVEMaaDle, . ' ' ' ' ' ,ead,traasfer Writesoutamachine-langua gefile.CSAVEM"X",4E,SF,5F

DATA Storesdatainyourprogram.Use READtoassignthisdatatovariables.DATAS ,3 ,PEARS

DATA PAPER, PEN

DEF FN DefinesnumericfunctionDEFFN (X) = X * 3

DEFUSR a De fi ne s ent r y po i nt f o rUSA function n.n = 0-9.

DEFUSR5=45S43

DEL Deletesprogramlines.DEL

DEL25

DEL 25

DEL -25

DEL 10 -25

DIM Dimensionsoneor morearrays.OIMR(6S) ,W(1l0)

DIMAR$(8,2S)

DLOAD Loads BASIC program at specified baud.baud.0= 300 baud 1 = 1200baudDLOAD "X " , 1

DRAW Drawsalinebeginning at specifiedstartingpointofspecifiedlengthof specifiedcolor.Willalsodrawto scale,drawblanklines,drawnon-updatedlines,andexecutesubstrings.Ifstartingpointis notspecified,last DRAW position or (128,96)isused.DRAW"BM100,100IS10IU25IBR25IND25IXA$I"

EDIT Allowseditingof programline.nC Changesn numberof characters.nO Deletes n numberof characters.I A l lows in se r ti on of new characters.H Del et es r es tof lineandallowsinsert.L Listscurrent l ineandcontinuesedi t.nSc Searchesfornth occurrence of characterc.X E xt en ds l in e.tIBIEIl(j) Escapefromsubcommand.n (SPACEBAR) Movescursornspacestoright.nS Movescursorn spacestoleft.ED IT 25lEBIE1ll

END Endsprogram.END

EXEC (address) Transferscontrolto machine-languageprogramsatspecifiedaddress.If address isomitted,control istransferredtoaddressset inlastCLOADM.E ~ < E CE){EC3211S3

FOR .•TO Createsaloop in programwhichtheComputermustSTEP/ repeatfromthefirstnumbertothe lastnumberyouspecify.NEXT UseSTEPto specifyhowmuchtoincrementthenumber

eachtimethroughtheloop. I youomitSTEP,one is used.FOR }(=2 TO 5 : NE><T ~ <FDRA=1 TO 10STEP5 :NE)<TA

FOR M=30 TO 10 STEP -5 : NU n M

GET (start)-(ead),d_tlaa t loa ,G Readsthegraphiccontents of arectangleintoanarrayfor futureusebyPUT.GET (5,20) - (3,8) ,V ,G

GOSUB Callsasubroutinebeginningat specifiedlinenumber.GOSUB 500

GOTO Jumpstospecifiedlinenumber.GOTO 300

IF TESTTHEN .. • ELSE action 1, action 2 P er fo rm s a te st .IFitistrue,the Computerexecutesaction 1. I false,action2 isexecuted.IFA=5THEN30

INPUT CausestheComputertostop andawaitinputfromthekeyboard.

INPUT)<$INPUT"NAME"; N$

INPUT#-l Inputsdatafromcassette.INPUT#-1,A

INSTR (posltloa,search,target) Searchesforthefirstoccurrence of targetstringinsearch stringbeginningatposition.Returnsthepositionatwhichthematchis found.?INSTR(5,X$,Y$)

LET Assignsvaluetovariable(optional).LET A$ = "JOBA"

LIST Listsspecifiedline(s)orentireprogramonscreen.LISTLIST50-85

LI ST 30

L IST-30

LIST30-

LUST Listspecifiedprogramline(s)orentireprogramtoprinter.LLIST

LL IST50 -85LLI ST 30

LLIST-30

LLIST30-

LINE (Jrl,yl)-(d,v2), PSET or PRESET, SF Drawalinefrom (x1.y1) to (x2,y2). If (x1,y1) isomitted,thelastendpoint or(128,96) is used.PSETselectsforegroundcolorandPRESETselectsbackgroundcolor.,Bdraws aboxwith (x 1,yt)and(x2,y2) as theoppos ingcorners . ,SFwi ll f in theboxwithforegroundcolor.LINE(5,3) - (S,S) ,PSET

L INL

MIDsM

MO

M

NEW

ON

ON.O

OPECO

PAIw

c

PCL

p

PCLocP

PC

PLAve

PMm

POm

PRE

PR

8/8/2019 TRS80 Color Basic Quickref

http://slidepdf.com/reader/full/trs80-color-basic-quickref 2/2

Graphic Character Codes

Each operator orgroupof operators is

precedentover thegroupbelow it.

Operators

i»OSprinPR

i»POIanPP

\lEMPR

\lID$staposF$

? M

EEK

locA=

JOYS

theo123M=

H=

lEFT

striP $

lEN (){=

l.OGY=

POIN(hotheit isI F

RIGHZI

SGN- 1o

+ 1)(=

SIN (Y=

CHR$ (code) ReturnscharacterforASCII,control,orgraphicscode.?C H R $(191)

P$=CHR$(T)

ASC (str) ReturnsASCIIcodeof firstcharacterof specifiedstring.A=ASC (1$)

ATN (. . . . . .erie) Returnsarctangentinradians.y= ( 3

Argumentrangesare indicatedbyspecialsymbols:

numeric: (_10 38, + 1038

) .

x: (0-255)y: (0-191)location: (0-65535)

code: (0-255)

str: stringargumentvar: variablename

ABS (numeric) Computesabsolutevalue.Y=ABS(S)

EXP (a . . . .erie) Returnsnaturalexponentialofnumber(e"umlJe').

Y= EXP( 7 )

EOF (f) ReturnsFALSE(0)if there is moredata:TRUE(-1)ifendoffilehas beenread.Forcassette,(= - 1;forkeyboard,(=0.

EOF=(-1)EOF(0)

cos (......eriel Returnscosineof ananglegiveninradians.Y= ()

FIX (a ....erie) Returnstruncated(wholenumber)value.Y=FIX<7 .6 )

HEX$ (aamerie) Computeshexadecimalvalue.PRINTHEX$ (30)

v=HEX$ (XL161

INKEY$ Checksthekeyboardandreturnsthekeybe ngpressed( fany).A$=INKEY$

INT (numeric) Convertsanumberto an integer.) ( =IN T( S.2 )

Functions

5

Exponentiation

Unarynegative,positive

Multiplication, division

Addition and concatenation,subtraction

Relationaltests

PRINTCHR$ (code)

Backspacesand erasescurrent character.Line feed wth carriage return.Space

Hex

080020

Video Contro l Codes

Dec

8

1332

Forexample, to print pattern 9 in blue (code 3),type:C=128+16*(3-1)+9

' CHR$ (C)

Given the color (1-8) andthe pattern (0-15), this formulawgeneratethe correctcode:

code = 128 + 16 · (color-1) +pattern

01 21 31 461 71 81 91 10

121 131 141 151

+-, +

*,1

+,

<,>,=,<=,>=,<>

1. Turn thetelevision setON.

2. Selectchannel3 or 4.

3. Setthe AntennaSwitchto "COMPUTER."

4. Turn onany accessoryequipment(e.g., aprinter).

5. Ifyou'reusinga ProgramPak'" ,insertitnow, beforeturning onthe Computer.

6. Turn theComputerON.

7. I f you 're not usi ng a P rogram Pak'·, t he Color BAS IC orExtendedColorBASICstart-upmessagewillappearon theTV,followed by: OK

TheComputeris nowreadyto use.

Start-Up

TRS· BO ®

Co lo r Compu t e r 2

M I C R O ·

C O M P U T E R

S Y S T E M

Note: Information pertaining to Extended Color BASIC only isshaded I <e this paragraph. Non-shaded informationpertains tobothExtended and non-ExtendedColor BASIC.