901546C Basic Refere
Total Page:16
File Type:pdf, Size:1020Kb
XJDl5 SIGMA 5/7 BASIC Xerox Oata Systems Reference Manual - ~ , ~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ .• ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ . ~~§~~ ~~§~~ ~~§~~ .' ~~§~~ ~~§~~ ~~§~~ ~ -~ - ~~§~~ ~~§~~ ~~§~~ .• ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ ~~§~~ - - -----. '- .. -- - -----..._- - -- -' ~- --- - . -- --.--- __ .--i.....",. ~_ -~._._ _ _____.. _____ _ __ __. __ . ________._ -'-_ ......A- _______ . __ Price: $2.00 BASIC REFERENCE MANUAL for XDS SIGMA 5/7 COMPUTERS 90 15 46C July 1970 Xerox Data Systemsj701 South Aviation Boulevard/EI Segundo, California 90245 @1969. 1970. Xerox Data Systems. Inc. Printed in U.S.A. REVISION This publication is a minor revision to the BASIC Reference Manual for XDS Sigma 5/7 Computers, and incorporates new material for the Universal Time-Sharing Monitor version of BASIC. A change in text from that of the previous manual is indicated by a vertical bar in the margin of the page. RELATED PUBLICATIONS o Title Publication No. XDS Sigma 5 Computer Reference Manual 900959 XDS Sigma 7 Computer Reference Manual 900950 XDS Sigma 5/7 Batch Processing Monitor (BPM) Reference Manual 900954 XDS Sigma 5/7 Batch Processing Monitor (BPM) Operations Manual 90 11 98 XDS Sigma 5/7 Batch Time-Sharing Monitor (BTM) Reference Manual 90 1577 XDSSigma Multipurpose Keyboard/Display Reference Manual 900982 XDS Sigma 5/7 Mathematical Routines Technical Manual 900906 XDS Sigma Message-Oriented Communications Equipment Reference Manual 90 1568 XDS Sigma Character-Oriented Communications Equipment Reference Manual 900981 XDS Sigma 7 Universal Time-Sharing System (UTS) Reference Manual 900907 XDS Sigma 7 Universal Time-Sharing System (UTS) Operations Manual 90 1675 NOTICE The specifications of the software system described in this publicotion ore subject to change without notice. The availability or performance of some features may depend on a specific configuration of equipment such as additional tape units or larger memory. Customers should consult their XDS sales representative for details. ii CONTENTS ./--------.., l. AN INTRODUCTION TO BASIC User-Defined Functions 16 16 The Computer Dimensioning 16 Computer Programs DIM 16 The BASIC System Print Images 17 A Sample Program PRINTUSING 17 : (Image statement) 17 2. ELEMENTARY FEATURES OF BASIC 5 Matrix Operations 18 Print 18 0 Elements of a BASIC Program 5 Put 18 Step Numbers 5 Get 18 Simple 5 Size 19 Simple Variables 5 Read 19 (' Arithmetic Operators 5 Input 19 Intrinsic Functions 5 Zero 19 Expressions 6 Constant 19 Error Messages 6 Identity Matrix 19 Defining Arithmetic Operations 6 Copy 20 LET 6 Scalar Multiplication 20 6 Addition and Subtraction 20 6 Transposition 20 7 Multiplication 20 Data 7 Inversion 20 PRINT 7 Simultaneous Equation Solution 21 Data Input 8 DATA 8 4. BASIC OPERATING PROCEDURES READ 8 22 Miscellaneous 8 On-Line STOP and PAUSE 8 22 Calling BASIC END 8 22 REM 8 Editing Mode 22 Looping 8 Compi lation and Execution Mode 24 Escape Key Activation FOR 9 24 Parameter Setting NEXT 9 24 Direct Statements 25 3. ADVANCED FEATURES OF BASIC 10 File Operations 25 Precision of Output 25 Other Elements of a BASIC Program 10 Printer Width 25 Status Arphanumeric Constants 10 25 Sign-Off 26 Subscripted Variables_ 10 Batch Processing 26 Additional Intrinsic Functions 10 Print Formats II UTS BASIC ADDITIONS 30 Number Ranges 12 5. External Data Input 12 Summary of UTS Additions 30 INPUT 12 UTS BASIC Language Extensions 30 Rereading Data 13 Character String Manipulation 30 RESTORE 13 Intrinsic Functions Added to UTS BASIC 32 Branching to a 13 Chain Link Statement 33 GOSUB and RETURN 13 Additions to Edit Command List 33 Multiple Path Branching 14 CLEAR 33 ON 14 NULL 33 GOTO ••. ON 14 FILE PACK 34 File Manipulations 14 EXECUTE 34 OPEN 14 SET 34 CLOSE 15 DELETE 34 PUT 15 INPUT 34 15 Increased Interaction, Edit-Execute Activities_ 34 Running Consecutive Programs 15 Break-Proceed Logic Changes 35 CHAIN 15 Changes in Direct-Statement Capability ___ 35 iii Summary of UTS BASIC Operating Procedures __ 35 ILLUSTRATIONS Group 1 . 35 Group 2 35 Group 3 36 1. The Evolution of a Program 2 Group 4 36 2. Sample Program 2 Proceed 36 3. Modified Sample Program 3 Direct Statements 36 4. Nested Loops 9 Batch Processing 36 5. Coding Sheet with Modified Sample Program __ 26 I/O Control 36 6. Deck Setup for BASIC Batch Processing 27 7. Deck Setup for BASIC Batch Processing (UTSl-- 28 6. BASIC MESSAGES 37 INDEX 48 APPENDIXES TABLES A. SUMMARY OF BASIC STATEMENTS 41 1. Order of Arithmetic Operations 5 B. BASIC EDITING COMMANDS 44- 2. Partial list of BASIC Intrinsic Functions 5 C. BASIC INTRINSIC FUNCTIONS 45 3. Condition Operators 7 D. TECHNICAL ASPECTS OF MATHEMATICAL 4. Additional BASIC Intrinsic Functions 10 RUN-TIME FOR BASIC 47 5. Intrinsic Functions, UTS BASIC Only 33 iv 1. AN INTRODUCTION TO BASIC BASld is a programming system that enables a person with COMPUTER PROGRAMS little or no computer experience to write computer programs for solving a variety of numerical problems. The system is A computer program is analogous to the operations manually easy to learn and to use, but it also conlains a number of performed on a desk calculator in solving a problem. That advanced features that make it suitable for programming is, a program is a series of instructions (statements) that complex problems. prescribes a set of operations to be performed by the com puter to solve a particular problem. To make up the pro To augment the flexibility of the language, XDS BASIC gram, the programmer selects and orders the instructions he provides the user with two highly desirable capabilities for requires out of many the computer can perform. These in on-I ine operation: o structions are usually in a format referred to as "symbolic 1. Immediate, statement-by-statement syntax checking, language". That is, they are made up of ordinary numbers, which permits the programmer to correct syntax errors English words, and alphabetic symbols in a form that can be without the necessity of waiting compilation and re input to the computer. sulting error messages. As the program is read into the computer, it must be trans 2. Direct execution of statements, which allows the pro formed (compiled) from symbolic language into so-called grammer to debug a program and to continue execution "machine language", which is the only language the com without recompilation. Additionally, direct statements puter understands. After the machine-language program permit use of the computer in a desk calculator fashion. has been produced, the computer can be allowed to "exe cute" it; that is, to step through the instructions in the Alternatively, after on-,line development, programs may be program one at a time, performing the operations each submitted for compilation under the Batch Processing Moni calls for. When the program specifies, the results accumu tor System. BASIC is most effective in small to medium lated up to a certain point are recorded permanently by scale applications of a computational nature. being sent to some output device such as a line printer, typewriter, magnetic tape, or card punch. This output This chapter orients the reader to fundamental programming produced by the user's program is usually printed in concepts. The reader with some programming experience natural-language form as English words, abbreviations, and may skip to Chapter 2, where the elementary BASIC state decimal numbers. When the program has finished operating, ments are explained. As the skill of the BASIC programmer either it will be rerun using new data, or another program increases, he may progress to Chapter 3, where more ad wi II be read in and executed. vanced features of the system are presented. Chapter 4 describes procedures for operating the computer within the THE BASIC SYSTEM BASIC system. The appendixes contain reference material including a summary of the BASIC statements. BASIC is an operating system consisting of both the BASIC language and the BASIC processor for the language. The BASIC language is composed of English words, decimal THE COMPUTER numbers, special characters, and rules of usage with which the user writes a BASIC program. The BASIC processor is a The beginning programmer may think of a computer as an previousl y-stored program that compiles the user's BASIC elaborate desk calculator; that is, a device capable of language program and assists in execution of the resulting performing step-by-step calculations on data to praduce a machine-language program. The overall flow of information numerical result. That part of the computer most like a from programmer to computer and back is shown in Figure 1. calculator is the arithmetic unit, in which mathematical operations are performed. Other, no less important, ele ments of the computer that a calculator does not have are At this point, the user need not be concerned with opera a memory unit for storing program instructions and data, a tional details such as entering his symbolic program into control unit for stepping through the program and directing the computer, the compilation of the program into machine the execution of its instructions, and input/output devices language, the actual execution of the program, or the for accepting the program and data and for delivering the handling of output. Operating instructions and related results to various output media. matters are explained in Chapter 4. A SAMPLE PROGRAM Figure 2 shows a program written in the BASIC language. This program evaluates the quantities tBASIC stands for Beginner's All-Purpose Symbolic Instruc tion Code, which was originOlly developed at Dartmouth -B ±~B2 -4AC College. 2A An Introduction to BASIC Programmer Analyzes new prob lem or output of pre vious program ond designs method of solution 5 Output Programmer Transm i tted to output Selects required media in natural BASIC instructions language form for his program 4 3 Program Program Compiled and Input to computer executed Figure 1.