Intel 9800758-02 manual BASIC-80 Functions Contd

Page 14

Language Elements

BASIC-80

Table 2-3. BASIC-80 Functions (Cont'd.)

Functions

Returns

Example

 

 

 

DSKF

Number of 128-byte sectors free on disk or

DSKF(X)

 

drive (X)

 

EOF

-1 if end-of-file; 0 if not (for file X).

A = EOF(X)

ERL

Line number of last error.

ERL

ERR

Error code of last error.

ERR

EXP

e to the (X)th power.

EXP (X)

FIX

Integer value of (X).

FIX (X)

FRE

Number of bytes in memory (X) or number of

FRE (X)

 

bytes in string space (X$)

 

HEX$

String equal to hex value of (X%)

HEX$(X%)

INP

Reads a byte from port (X)

INP(X)

INPUT$

Inputs (X) characters from file (Y)

INPUT$ (X, Y)

INSTR$

Position of (X$) within (Y$)

INSTR$ (X$, Y$)

INT

Integer value of (X)

INT(X)

LEFT$

Leftmost (X) characters of (A$)

LEFT$ (A$, X)

LEN

Character length of (X$)

LEN (X$)

LOC

Current record number in random file X.

LOC (X)

 

Sectors read or written since last OPEN in se-

 

 

quential file X.

 

LOF

Number of records in random file X. Number of

LOF (X)

 

data sectors in sequential file X.

 

LOG

Natural log of (X)

LOG (X)

MID$

J characters, starting at I, of string A$

MID$ (A$, I, J)

MKD$

B-byte string equal to double-precision

MKD$ (A$)

 

floating-point variable (X!)

 

MKI$

2-byte string equal to integer variable (X%)

MKI$ (A$)

MKS$

4-byte string equal to single-precision

MKS$(A$)

 

floating-point variable (X!)

 

OCT$

Octal equivalent of decimal argument

OCT$(X)

PEEK

Single byte from memory location (X)

PEEK (X)

POS

Position of cursor after last PRINT.

POS (dummy argument)

RIGHT$

Rightmost (1%) characters of X$

RIGHT$ (X$, 1%)

RND

Single-precision random number between 0

RND

 

and 1.

 

SGN

Sign of (X)

SGN (X)

SIN

Sine of (X)

SIN (X)

SPACES

String of (1%) spaces

SPACE$(I%)

SPC

String of (X%) spaces

SPC(X%)

SQR

Square root of (X)

SQR (X)

STR$

String equal to (X)

STR$ (X)

STRING$

Character X, Y% times-or the first character

STRING$ (Y%, X)

 

of A$, Y% times.

STRING$ (Y%, A$)

TAB

Spaces to (X) position on terminal

TAB (X)

TAN

Tangent value of (X)

TAN (X)

USR

References user subroutine 0 to 24

AX = USR 12 (A1, A2)

VAL

Numerical value of (X$)

VAL (X$)

VARPTR

Memory address of (X)

VARPTR(X)

 

 

 

2-4

Image 14
Contents BASIC-SO Reference Manual A108/0979/7500 FL Preface Page Contents Illustrations Chapter Introduction to BASIC-80 Invoking BASIC-80Basic filename MEMTOPaddress ExamplesIntroduction to BASIC-80 FilenameChanging File Attributes Listing the Directory of a DiskRenaming a File Deleting a FileYou can now run, list, or edit the program Save LP ,ACommands StatementsBASIC-80 Commands Contd BASIC-80 StatementsBASIC-80 Statements Contd BASIC-80 FunctionsBASIC-80 Functions Contd Representing Data FunctionsDecimal Integer Constants ConstantsInteger Constants Hexadecimal Integer ConstantsDouble-Precision Floating-Point Constants Octal Integer ConstantsSingle-Precision Floating-Point Constants This is a string constant String ConstantsString Variables $ = Enter next data stringL4! = Csng l4 YI,1String Arrays Arithmetic Operators BASIC-SO Operators in Order of Precedence ContdNumeric Expressions Logical OperatorsString Operator String ExpressionsEntering and Editing Programs 30 A=8*52 30 A=8*37 30 A=8*5230 A=8 30 A--=8xx*522537 Control-R a = 8*37Integer D SubcommandCommand 3D press 3, then D results If AB thenIf AB then 120 Else Null SET Syntax of the X subcommand is At this point, the other editing subcommands may be usedMove the cursor to PRINT. Enter 2C RE L Print Undefined SET The E subcommand is enteredInteger C character character Print Undefined SET. Enter a LOverflow, Underflow, and Divide-by-Zero BASIC-80 Error MessagesSyntax Error Messages Error Trapping Trace Facility Restarting Program Execution Error SimulationError Handling If line 40 is replaced withOpening a Sequential File Open 1,#1,F1DATESReading from a Sequential File Refer to for further details of Print UsingWriting to a Sequential File If executed four times, it would read all eight valuesClosing a Sequential File Value of R$ would beField #3, 20 AS N$ BuffersDefining a Random 1/0 Field-FIELD Disk File Input/Output Field #3, 20 AS N$, 9 AS SS$Any of the parameters can be variables Opening and Closing a Random Disk FileReading from a Random 1/0 File To read the next recordSingle-precision value Writing to a Random 1/0 FileInteger Double-precision valueMKI$ Auto first lineJ, increment Attrib Fdrive numberfilename, W1Attrib Fdrive numberfilename, WO Clear expression,addressCommands and Statements CloseDEF FNX Rules for function name are the same as for variable nameDefsng Defdbl Defstr Defint DIM DeleteEdit ErrorDIR ENDField Error expressionExit FOR-NEXT-STEPFor variable=expression to expression Step expression GETGosub GET I file number ,record numberGoto IF-THEN-ELSEInput Line Input KillLET ListLSET, Rset LoadMerge NEWNext 9 16Open On ... GosubOn ... Goto Poke Option BaseOUT String Fields Print UsingPrint Numeric fields If X$=SEVEN and Y$=EIGHT, the results of line 40 would bePrun PUTRandomize ReadREM Resume ReturnLine number RUN filename SaveRUN line numberlstring expression ,F 60 ENDTRON, Troff ? 5,8,2Wait WidthABS ATNFunctions CHR$Cint 10 A# = 1.00/3.00 CsngCVI CVS AO/o =Dskf EOFFIX Ok·Inputs HexsINP LEFT$ INTInstr LOF LENLOC LOGOCT$ MID$MKI$ MKS$ MKD$ POS integer RightsPeek expression RIGHT$ string,integerSpaces SGNSIN 10 a =1If A$ = 2 then Print Correct Else Goto SPCSPC integer SQRexpressionTAN expression STR$ expressionTAB expression Here is an example of how the USRn statement is used 60 AO/o =Appendix a BASIC-SO Error Codes Table A-I. BASIC-80 Error CodesTable A-I. BASIC-SO Error Codes Contd Appendix B BASIC-SO Reserved Words Page To tab across the line To halt program execution and return to commandLevel To resume program execution after it is stopped byPage Table D-l. Ascii Code List Appendix D Ascii CodesTable D-2. Ascii Code Definition BELAppendixe Calling Subroutines Figure B-1. Internal Representation of Numbers and Strings Some Real Examples RESULT=USR%1VARPTRA, VARPTRB, VARPTRC» PRINTA+B+C= ResultFigure E-2 /8085 Assembly Language Program Figure E-3. PL/M-80 Program Appendix F RMX/SO BASIC-SO Initializing the Predefined RMX/SO BASIC-SO Configuration ISIS-II BASIC-SOTable F-l. Sample Configuration Jumper Wiring OOOOH-OFFFHBASIC-80 Object Files Generating Boot-Loaded and PROM-Based VersionsBASIC-80 Source Files BASIC-80 Executable FilesGenerating a Boot-Loaded RMX/80 BASIC-80 Setting baud rates, refer to the RMX/SO Users Guide That are not boot loadedThis option is used to allocate memory. It is 1 if the boot This option enables your user-written I/O drivers if youISBC 80/20-4 Generating a PROM-Based RMX/80 BASIC-80 Prom F1 RMX820.L1BSTART, & FOBASCM.OBJ,& FORMXBAS.LlB F1 DFSDIR. L1BDIRECTORY ,RENAM E,& F1 MTI810.L1B Configuration Requirements Configuring DFS on an iSBC 80/10Adding BASIC-SO to an Existing RMX/SO Configuration ISBC SO/10 System ClockPublic Variables Adding User-Written I/O Drivers to RMX/SO BASIC-SO Open 0,#1, L1LlSTFigure F-S. Sample User-Written 1/0 Driver Routine Altering BASIC-80 Workspace Burning a BASIC-80 Program Into PromBaprom F1HEATER.BAS Page Index Ase BASIC-80 RIGHT$,7-1O Request for Readerscomments 111111