[go: up one dir, main page]

0% found this document useful (0 votes)
882 views114 pages

Simons BASIC Extensions

c64 simons basic extensions

Uploaded by

vaskoa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
882 views114 pages

Simons BASIC Extensions

c64 simons basic extensions

Uploaded by

vaskoa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 114
SIMONS BASIC EXTENSION 91 ADDITIONAL PROGRAMING COMMANDS « COMPUTER SIMONS’ BASIC EXTENSION USER GUIDE SBX 6440/20 COMMODORE BUSINESS MACHINES (UK) LTD 675 Ajax Avenue Trading Estate Slough, Berkshire SL1 4BG ENGLAND SIMONS' BASIC EXTENSION USER GUIDE This manual was prepared on a COMMODORE 8000 series computer system using a word processor. The files were then electronically transmitted into a phototypesetter and typeset by KENTCHASE LTD., SLOUGH without compositor intervention. The manual was printed and bound by CARTER LITHO, Slough Special thanks to Gail Wellington and Marilyn Rutley who helped with the preparation of this manual and Mark Palmer for his help with the example programs. SIMONS' BASIC EXTENSION USER GUIDE COMMENTS AND ERRATA REQUEST TO THE READER To the best of our knowledge, this manual is technically and typographically correct at the time of going to print However, no matter how fine we make the sieve for catching errors, sometimes a few slip through. If you notice any mistakes, we would be grateful if you would notify us of them. Comments, criticisms and suggestions are also earnestly solicited. Yours sincerely, Chis Moaijensde Chris Maciejewski. Technical Author COMMODORE BUSINESS MACHINES (UK), LTD. 675 Ajax Avenue Trading Estate Slough, Berkshire SL1 4BG ENGLAND SIMONS' BASIC EXTENSION USER GUIDE COPYRIGHT — SOFTWARE PRODUCT This software product is copyrighted and all rights are reserved by: D. S. Software 19 Reddings Welwyn Garden City Hertfordshire ALB 7LA The distribution and sale of this product are intended for the original purchaser only. Lawful users of these programs are hereby licensed only to read these programs from the medium into the memory of a computer solely for the purpose of executing the programs. Security copies of the programs may be made only for their own use Duplicating for any other purpose, copying, selling or otherwise distributing this Product is a violation of the law. COPYRIGHT — MANUAL This manual is copyrighted and all rights are reserved. This document may not, in whole or in part be copied, photocopied, reprinted, translated, reduced to any electronic medium or machine readable form or reproduced in any manner without prior consent in writing from COMMODORE BUSINESS MACHINES, LTD., Technical Publications Manager. DISCLAIMER Although programs are tested by COMMODORE before release, no claim is made regarding the accuracy of this software. COMMODORE and its distributors cannot assume liability or responsibility for any loss or damage arising from the use of these Programs. Programs are sold only on the basis of this understanding. Individual applications should be thoroughly tested before implementation. Should you require installation, maintenance or training, please consult your COMMODORE dealer. ‘TABLE OF CONTENTS TABLE OF CONTENTS SECTION ONE - INTRODUCTION TO SIMONS' BASIC EXTENSION INTRODUCTION ... THE SIMONS’ BASIC EX LOADING SIMONS' BASIC EXTENSION FROM DISKETTE... FROM CASSETTE...... SIMONS' BASIC EXTENSION COMMANDS. ENTERING COMMANDS CONVENTIONS UAL SECTION TWO - PROGRAMMING AIDS SB VOOR oN& INTRODUCTION RENUMBER DELETE. . ALTER... HELP CHAIN... PROTECT FORCE Dss SECTION THREE - ARRAY MANIPULATION 2EeVwvee RRNosoo INTRODUCTION WHAT IS AN ARRAY? MULTI-DIMENSION ARRAYS . MANIPULATING ARRAYS ARRAY COMMANDS . CONVENTIONS «2.2.2... SET ARR PRINT ARR ZER ARR. ADD ARR SUB ARR MUL ARR DIV ARR... ADD ALL SUB ALL MUL ALL... DIV ALL COPY ARR INPUT ARR. READ ARR...... SCRATCH bbbbbb ooo powoe RBRIISSOOCHUSHHEOGOSIAA eeeeeg SIMONS’ BASIC EXTENSION BPR SUI occen 3218 ELEMENTS 3.2.19 MIN.. 3220 MAX... 3.3 STRING ARRAY MANIPULATION 3.3.1 SORT SECTION FOUR - NUMERIC AIDS 44 INTRODUCTION . 42 ADDITIONAL TRIGONOMETRICAL FUNCTIONS 424 GRAD 422 BEGET 43 NUMERIC CONVERSION 43.4 BINS - DECIMAL TO BINARY CONVERSION 43.2 HEXS - DECIMAL TO HEXADECIMAL CONVERSION . 44 SPECIAL CALCULATIONS. 444 CALCX... 442 CALCY a 45 EVALUATING A STRING AS A BASIC EXPRESSION... 451 EVAL cee 45.2 BACK SECTION FIVE - MEMORY MANIPULATION COMMANDS 51 INTRODUCTION 5.2 DOKE 5.3 DEEK..... 5.4 HIMEM.. 55 LOMEM 5.6 SCREEN SECTION SIX - HIGH-RESOLUTION AND MULTI-COLOUR GRAPHICS 61 INTRODUCTION .... bidet 62 HIGH-RESOLUTION AND MU UR GRAPHICS COMMANDS . : 6.2.1 GRID . 622 TICK 623 HSAVE 6.2.4 HLOAD. 625 LABEL . 626 DRAW TO 627 VLIN .. 628 HLIN 63 SCALING FUNCTIONS 63.1 SCALE...... 63.2 SCX 63.3 scY ° pibiia Der 0000000 Soeesuechonit TABLE OF CONTENTS SECTION SEVEN - LOW-RESOLUTION GRAPHICS COMMANDS Al INTRODUCTION .... F 7.2 LOW-RESOLUTION GRAPHICS COMMANDS . 7.24 LOW RES ; 722 PREPARE 723 PUSH 72.4 PULL . 73 SCREEN FUNCTIONS «1.0... 7.34 FONT we a8 7.3.2 UPPER... 7.3.3 ECOL . 7.3.4 CCOL.. 73.5 SCOL 7.3.6 SCHR 737 MCOL . 73.8 DESIGN. 739 ROTATE 5 7.310 BCKFLASH . 73.11 * 81 INTRODUCTION 84 8.2 SPRITES... 81 824 INTRODUCTION . 84 822 WHAT IS A VECTOR DRIVEN SPRITE?. 8-1 8.23 WHAT IS A FRAME? 8-2 83 SPRITE MANIPULATION COMMANDS 8-2 83.1 SPRITE 5 8-2 83.2 XVEC 8-5 833 YVEC 8-6 83.4 BARRIER 8-6 83.5 CHANGE. 8-7 83.6 START. 8-7 837 CLEAR... 8-8 83.8 INIT -8-9 83.9 NORMAL... 8-9 83.10 INFO -10 8.3.11 SPRX 11 8312 SPRY.. 12, 8313 SPRLOC 12, 83.14 INVERT 13, 83.15 REVERSE 83.16 SHOW. 83.17 ON DETECT . 83.18 © CONTINUE 83.19 TRANSFER 8312 CREATE. ceceeeeeee 5 84 NOTES ON VECTOR DRIVEN SPRITES... 8-20 SIMONS' BASIC EXTENSION SECTION NINE - MUSIC COMMANDS 94 INTRODUCTION 94 9.2 WHAT IS A FILTER? 9-1 93 MUSIC COMMANDS, 9-2 93.1 FILTER 9-2 9.3.2 MODE . 9-2 93.3 PULSE . 9-3 9.3.4 BEEBE 29-4 SECTION TEN - EXAMPLE PROGRAMS 10.4 INTRODUCTION .... 10.2 PROGRAM 1 - GRAPH PLOTTER . 10.3 PROGRAM 2 - DOGGY ....... 10.4 PROGRAM 3 - ROAD RACER APPENDIX A - ERROR MESSAGES GLOSSARY INDEX INTRODUCTION SECTION ONE INTRODUCTION TO SIMONS'’ BASIC EXTENSION 1.1. INTRODUCTION SIMONS’ BASIC EXTENSION contains an additional 91 commands to supplement those supplied by the SIMONS' BASIC cartridge. These additional commands fall into seven categories as detailed below: PROGRAMMING AIDS, such as CHAIN and ALTER, to assist in the entry and de- bugging of your BASIC programs ARRAY MANIPULATION commands, such as SET ARR, ADD ARR and SCRATCH to enable you to perform calculations on or between the information held in numeric arrays. Extra NUMERIC AIDS, like DEG, to provide more flexibility in mathematical calculations. MEMORY MANIPULATION commands, like HIMEM and LOMEM to allow you to set memory limits quickly and easily GRAPHICS commands, such as LABEL and ROTATE, to facilitate the design and presentation of graphics displays. Extra SPRITE MANIPULATION commands, like INVERSE and CREATE, to provide you with even greater control over sprite creation and animation Additional MUSIC commands, such as FILTER and PULSE, to provide a simple way of utilising the extensive sound and music capabilities of the COMMODORE 64. The commands provided by SIMONS' BASIC EXTENSION, used in conjunction with those supplied by the SIMONS' BASIC cartridge, allow even the inexperienced BASIC. programmer to utilise fully the power of the COMMODORE 64. 1.2. THE SIMONS’ BASIC EXTENSION MANUAL This manual is divided into ten sections as outlined below: SECTION ONE - INTRODUCTION TO SIMONS’ BASIC EXTENSION This section discusses the commands provided by SIMONS' BASIC EXTENSION (SBX) in broad terms. It explains how to load SBX either from diskette or cassette and how to enter a SIMONS' BASIC EXTENSION command. Also included are the conventions used in this manual to describe each command. SIMONS' BASIC EXTENSION SECTION TWO - PROGRAMMING AIDS Section Two contains commands, such as CHAIN and DELETE to speed up theentry and de-bugging of your BASIC programs. SECTION THREE - ARRAY MANIPULATION Here commands such as SET ARR and ADD ARR are explained. These enable you to carry out arithmetic operations on or between single or multi-dimensional numeric arrays SECTION FOUR - NUMERIC AIDS Section Four contains commands like BINS and HEX$ which are used respectively to convert a decimal number into its binary or hexadecimal equivalent. Also included are the DEG and GRAD functions. The first converts degrees into rads while the second converts degrees into rads. SECTION FIVE - MEMORY MANIPULATION COMMANDS This section includes the commands DEEK and DOKE, which allow you to respectively read or assign a 16 bit number in memory, and the commands HIMEM and LOMEM which enable BASIC memory parameters to be read and/or altered SECTION SIX - HIGH-RESOLUTION AND MULTI-COLOUR GRAPHICS Section Six contains commands, such as GRID, VLIN and MCOL, to enable you to draw shapes on a graphics screen SECTION SEVEN - LOW-RESOLUTION COMMANDS This section contains commands for use when drawing on anormal, low-resolution, screen, SECTION EIGHT - SPRITE MANIPULATION COMMANDS. Section Eight is concerned with the creation and movement of Sprite graphics. SECTION NINE - MUSIC COMMANDS Here, four additional music commands, FILTER, MODE, PULSE, and BEEP are discussed. SECTION TEN - EXAMPLE PROGRAMS Section Ten contains three example programs to demonstrate some of what may be achieved when using both SIMONS' BASIC and SIMONS’ BASIC EXTENSION commands, APPENDIX A - ERROR MESSAGES A list of the SIMONS' BASIC EXTENSION error messages that you may encounter and their probable causes are given in this Appendix. GLOSSARY A list of terms that are used in this manual and their definitions are given in this section. 12 INTRODUCTION 1.3. LOADING SIMONS’ BASIC EXTENSION WARNING SIMONS' BASIC EXTENSION CAN ONLY BE. LOADED WITH THE SIMONS’ BASIC. CARTRIDGE IN PLACE. 1.31 FROM DISKETTE Make sure that your computer is switched off. Insert the SIMONS’ BASIC cartridge, label uppermost, into the cartridge slot at the rear of your computer (for more information on starting the SIMONS' BASIC cartridge see Section 1.3 of your SIMONS' BASIC MANUAL). Switch on the computer, disk drive, and TV or monitor. Insert the SIMONS' BASIC EXTENSION disk into the disk drive with the label uppermost, and towards you. Type: LOAD ":"",8, and press RETURN. After a short while the SIMONS' BASIC I title page appears. Once the program is loaded, the following message is displayed: ++ SIMONS BASIC 2 44% (C)1984. ALL RIGHTS RESERVED 28287 BASIC BYTES FREE 1.3.2 FROM CASSETTE Make sure that your computer is switched off. Insert the SIMONS’ BASIC cartridge, label uppermost, into the cartridge slot at the rear of your computer (for more information on starting the SIMONS' BASIC cartridge see Section 1.3 of your SIMONS’ BASIC MANUAL). Insert the SIMONS’ BASIC EXTENSION cassette into the cassette unit. Switch on the computer, and TV or monitor. Type: LOAD and press RETURN. After a short while the SIMONS’ BASIC II title page appears. Once the program is loaded, the following message is displayed: +*% SIMONS BASIC 2 +4% 192% (C)1984. ALL RIGHTS RESERVED 285%! 28287 BASIC BYTES FREE All the SIMONS' BASIC EXTENSION commands are now included in the operating system of your COMMODORE 64, together with those supplied by the SIMONS” BASIC cartridge and may be used like any other BASIC command. Note that the combination of SIMONS' BASIC with SIMONS' BASIC EXTENSION uses. approximately 10K of the COMMODORE 64’s memory, so you are left with 28K free for your programs. 13 SIMONS’ BASIC EXTENSION 1.4 SIMONS'’ BASIC EXTENSION COMMANDS The following is a list of those commands supplied by SIMONS' BASIC EXTENSION: Commands for entering and debugging programs: RENUMBER, DELETE, ALTER, HELP, CHAIN, PROTECT, FORCE, DSS Commands for manipulation of numeric arrays: SET ARR, ZER ARR, PRINT ARR. ADD ARR, SUB ARR, MUL ARR, DIV ARR, ADD ALL, SUB ALL, MUL ALL, DIV ALL, COPY ARR, INPUT ARR, READ ARR. ELEMENTS, MIN, MAX, SCRATCH, SUM, SORT. Commands for numeric conversion and bit manipulation: GRAD, DEG, BINS, HEX$, CALCX, CALCY, EVAL, BACK Commands for memory manipulation and configuration: DEEK, DOKE, HIMEM, LOMEM, SCREEN. Commands for graphics plotting and screen handling GRID, TICK, LABEL, DRAW TO, VLIN, HLIN, SCALE, SCX, SCY, LOW RES, DESIGN, MCOL, ROTATE, FONT, UPPER, ECOL, BCKFLASH, CCOL, SCOL, SCHR, *. Commands for storing screen data in memory or on an external storage device: PREPARE, PUSH, PULL, HSAVE, HLOAD. Commands for generating/animating Sprites: INIT, SPRITE, CREATE, TRANSFER, INVERT, REVERSE, CHANGE, BARRIER, INFO, START, CLEAR, SPRX, SPRY, SPR LOC. XVEC, YVEC, ON DETECT, CONTINUE, SHOW, NORMAL. Commands for music synthesis FILTER, MODE, PULSE, BEEP. INTRODUCTION 1.5 ENTERING COMMANDS. All SIMONS’ BASIC commands are entered in the same way as those in standard Commodore BASIC. Most SIMONS’ BASIC commands can be used in direct mode or as part of a program. Any exceptions to this rule are indicated in the introduction to each section of the manual, or in the section in which the command appears. 1.6 CONVENTIONS The format of each SIMONS' BASIC command in this manual is presented using the following method of notation: 1. Brackets and items written in capital letters must be typed exactly as shown. 2. Items printed in lower case indicate a user-supplied or variable entry, e.g. coordinates or, a plotting colour. 3. Other symbols, such as quotation marks and commas, must be typed exactly as shown 4. Pressing the RETURN key is indicated by . 5. Keys other than alphabetic and numeric characters are indicated in the listing by the name on the key surface enclosed in <>, e.g. . These appear on the screen as reversed characters. If two keys are enclosed, e.g. , you must hold down the first key before pressing the second key. 6. With the exception of the FIND command (see Section 2.10 of your SIMONS' BASIC MANUAL), all SIMONS’ BASIC keywords must be separated from the first parameter of the command with a space. COMMANOS ; cold Sem PROGRAMMING AIDS. SECTION TWO PROGRAMMING AIDS 2.1 INTRODUCTION SIMONS' BASIC EXTENSION contains additional commands to assist you when entering and debugging BASIC programs. The RENUMBER command renumbers a program listing including all GOTOs and GOSUBs. DELETE allows you to erase a specified section of a BASIC program. The ALTER command permits you to replace one character string or command with another. The HELP command displays the program line where an error occurred and highlights the position of the error within the line. CHAIN permits you to load one program from within another without having to concern yourself with resetting memory pointers NOTE With the exception of the CHAIN command, all the commands in this section can ONLY be used in direct mode, NOT as part of a program 2.2 RENUMBER FORMAT: RENUMBER start line,increment PURPOSE: To renumber a BASIC program The RENUMBER command allows you to renumber a BASIC program including all GOTOs and. GOSUBs. The first parameter in the command is the start line number of the renumbered program. The second parameter is the interval between line numbers. Using RENUMBER with no parameters renumbers the program starting at line 1000 in increments of 19. EXAMPLE: To renumber the following program starting at line 100in increments of 25: ENTER: 10 GET AS: IF AS =” THEN 10 20 IF A$ = CHRS(13) THEN GOSUB 40 30 GOTO 10 40 PRINT "YOU PRESSED RETURN” 50 FOR X = 1 TO 2000: NEXT 60 RETURN SIMONS' BASIC EXTENSION COMMAND: RENUMBER 100,25 TYPE: LIST DISPLAY: 100 GET AS: IF A$ = "" THEN 100 125 IF AS = CHRS(13) THEN GOSUB 175 150 GOTO 100 175 PRINT "YOU PRESSED RETURN" 200 FOR X = 1 TO 2000: NEXT 225 RETURN 2.3 DELETE FORMAT: DELETE start line number - end line number PURPOSE: To delete program lines from the memory of the COMMODORE 64 The DELETE command operates on a specified line range, in the same way as the BASIC command LIST. The various formats of the DELETE command are listed below DELETE In Deletes line In only DELETE sin - fin Deletes all lines between sin and fin inclusive DELETE -fin Deletes all lines from the start of the program to fin inclusive DELETE sin- _Deletes all lines from line sin to the end of the program inclusive. NOTE The parameter In represents a single line number, sin is the start line number, and fin is the finish line number. EXAMPLE To delete the first two lines from the following program: ENTER: 10 REM DELETE COMMAND. 20 REM ONE OF THE MANY 30 REM USEFUL SIMONS’ BASIC 40 REM AND SIMONS' BASIC 50 REM EXTENSION COMMANDS COMMAND: DELETE-20 TYPE: LIST 22 PROGRAMMING AIDS DISPLAY, 30 REM USEFUL SIMONS’ BASIC 40 REM AND SIMONS’ BASIC 50 REM EXTENSION COMMANDS RESULT: Lines 10 and 20 have been removed from the program. EXAMPLE: To delete lines 30 and 49 of the remaining program: COMMAND: DELETE 30-40 TYPE: LIST DISPLAY: 50 REM EXTENSION COMMANDS RESULT: Lines 30 and 40 have been removed from the program 2.4 ALTER FORMAT: ALTER old code&new code or: ALTER’ old string&new string PURPOSE: To search foran existing code or character string and replace it witha new code or character string. If the character string to be ALTERed is enclosed in quotation marks, ALTER only replaces the matching character strings which themselves are bounded by quotation marks in the program. Note that in REM statements, BASIC, or SIMONS’ BASIC key words which are not enclosed in quotation marks, for example 10 REM PRINT, will not be changed by the command ALTER PRINT&PRINTS. EXAMPLE: To change the character string "JOHN" into MIKE” in the following program ENTER 10 INPUT "IS YOUR NAME JOHN" ;A$ 20 IF LEFTS(AS,1)<>"Y" THEN 40 30 PRINT “HI JOHN";:PRINT "GREAT TO SEE YOU” 40 END COMMAND: ALTER “JOHN"&"MIKE” DISPLAY: READY TYPE: LIST 23 SIMONS' BASIC EXTENSION DISPLAY: RESULT: 2.5 HELP FORMAT: PURPOSE: EXAMPLE ENTER TYPE: DISPLAY: (COMMAND: DISPLAY: 10 INPUT "IS YOUR NAME MIKE”,AS. 20 IF LEFTS(AS,1)<>"Y" THEN 40 30 PRINT “HI MIKE";:PRINT "GREAT TO SEE YOU" 40 END All occurrences of the character strings "JOHN" have been changed to "MIKE" HELP To display the line in which an error occurred during program execution and highlight the position of the error in reverse field characters. The HELP command only worksif the command is given immediately after an error has been detected by the BASIC interpreter and whilst the error message is displayed. NOTE Because of the way the BASIC interpreter works, the exact error may not always be displayed. It will, however, be very close to the reverse field area, To find the error in the following program: 10 FOR CO=1 TO 10 20 PRINT CO+243.142 30 NEXT C RUN 7.284 2. NEXT WITHOUT FOR ERROR IN 30 HELP NEXT G (the letter "C" appears in reverse field display.) 24 2.6 CHAIN FORMAT: PURPOSE: EXAMPLE: ENTER: TYPE ENTER: TYPE: DISPLAY: COMMAND: DISPLAY: DISPLAY: PROGRAMMING AIDS. CHAIN “program name" device number To load and run one program from within another. The CHAIN command allows you to load one program from another program and automatically RUN the second program after it has been loaded. This means that longer programs can be loaded from smaller programs without the necessity of changing BASIC memory pointers. The parameter within quotation marks is the name of the Program you wish to load. Device number refers to the storage medium on which the program to be loaded is stored. Thisis "8" fora disk unit and "1” for a cassette unit. If not specified, the device number defaults to "1”, ie. cassette. To load and run the program named "PROG2" from within another program: 10 PRINT”” 20 PRINT "THIS PROGRAM” 30 PRINT" DEMONSTRATES THE EFFECTIVENESS" 40 PRINT"OF THE CHAIN COMMAND” Save this program on cassette using the name "PROG2" to identify it. NEW Rewind the cassette tape to the beginning of the program. 1 PRINT "PRESS RETURN TO LOAD” 20 PRINT "THE NEXT PROGRAM” 30 GET AS: IF AS <> CHRS(13) THEN 30 40 CHAIN "PROG2” RUN PRESS RETURN TO LOAD THE NEXT PROGRAM Press the RETURN key. PRESS PLAY ON TAPE Press the PLAY key on the cassette unit. (The screen goes blank.) THIS PROGRAM DEMONSTRATES THE EFFECTIVENESS, OF THE CHAIN COMMAND 25 SIMONS' BASIC EXTENSION TYPE: DISPLAY: RESULT: LIST 10 PRINT”” 20 PRINT "THIS PROGRAM” 30 PRINT" DEMONSTRATES THE EFFECTIVENESS” 40 PRINT"OF THE CHAIN COMMAND" The first program has been erased from memory and "PROG2” has been loaded and executed automatically. NOTE The above example may also be effected with a disk unit. Line 40 of the second program must be changed to: 40 CHAIN "PROG2",8 2.7. PROTECT FORMAT: or: PURPOSE: PROTECT "PROGRAM NAME”,8 (for disk) PROTECT "PROGRAM NAME”,1 (for cassette) To protect a program from being listed The PROTECT command has exactly the same syntax as SAVE, and may be used to stop your programs from being studied, or saved. Should RUN/STOP, with or without RESTORE, be pressed at any time during the execution of the program, the program is re-run from the beginning. This also applies if an error should occur. When a program is being protected, the screen clears, and SAVING PROGRAM NAME appears. When finished, the 64 returns to direct mode. Once a program has been protected, it is loaded with LOAD “PROGRAM NAME".8,1 if on disk, and LOAD “PROGRAM NAME",1,1 if on tape. When the program is loaded, it runs automatically. WARNING ALWAYS ENSURE THAT YOU HAVE A NON- PROTECTED COPY OF THE PROGRAM, AS, ONCE IT HAS BEEN PROTECTED, YOU ARE, UNABLE TO LIST IT, AND THUS CHANGE IT. 26 EXAMPLE: ENTER TYPE: or: TYPE or: RESULT: PROGRAMMING AIDS. To protect a program from being listed: 10 HIRES 15,0 20 COLOUR 5,0 30 MULTI 3,5,7 40 TEXT 10,20,"THIS PROGRAM", 1,2,12 50 TEXT 70,60,"1S",2,2,12 60 TEXT 24,100,"PROTECTED! 70 PAUSE 4 80 STOP 2,12, LIST Protect the program using PROTECT "PROG".8 (for disk) PROTECT "PROG",1 (for cassette) NEW Load the program using LOAD "PROG".8,1 (for disk) LOAD "PROG",1,1 (for cassette) The program runs automatically, and you are unable to stop execution 2.8 FORCE FORMAT: PURPOSE FORCE err To force an error. This command forces an error that would otherwise not have occurred. The parameter errn is equal to the error you wish to force. For a list of the error numbers see section 10.2 of your SIMONS' BASIC manual a7 SIMONS’ BASIC EXTENSION 2.9 DSS FORMAT: PRINT DS$ or: AS=DS$ PURPOSE: To read the disk error channel. For more information on the disk error channel, see page 18 of your 1841 manual. DS$ reads the disk error channel. Four variables that describe the error condition are read. The first variable is the error number, where 0 denotes no error (for more information on the error numbers, and messages, see page 43 of your 1541 manual). The second variable is the error description. The third variable is the track number on which the error occurred, and the fourth variable is the block (also known as a sector) number inside that track. EXAMPLE To read the disk error channel: TYPE: PRINT DS$ DISPLAY: 00, OK,00,00 RESULT: This message denotes that no error has occurred. NOTE The length of DSS is always 30, e.g. PRINT LEN(DSS) gives 30. 28 ARRAY MANIPULATION SECTION THREE ARRAY MANIPULATION 3.1. INTRODUCTION 3.1.1 WHAT IS AN ARRAY? You were introduced to the concept of arrays in the User's Guide supplied with your COMMODORE 64 computer. (See pages 95 thru 103.) To refresh your memory, an array is a group of subscripted variables. For example, A(15) isan array containing 15 individual items, or elements, of information. If you ran the program below: 10 A(1) = 21.56: A(3) = 13.78: A(4) = 13.89 then the memory would look like this: A(0) A(t) 21.56 A(2) A(3) 13.78 Ala) 13.89 This is called a one-dimensional array. Arrays that contain more than 10 elements must first be DIMensioned like this: 10 DIM A(25) This tells the computer that you want to set up a one-dimensional array with a maximum of 25 elements. 3.1.2. MULTI-DIMENSION ARRAYS Arrays may be single or multi-dimensional. For example, a two-dimensional array would be written like this: A(4.8) and would be represented as a two-dimensional grid in memory. 1. (4,6) 34 SIMONS' BASIC EXTENSION Each subscript in the array represents the row and column number in the grid where the particular element of the array is stored. If you assigned the value 16 to A(3,4), then 16 could be thought of as having been placed in the 4th column of the 3rd row of the grid as shown below: 2.A(3,4) = 16 ‘iz As with one-dimensional arrays, multi-dimensional arrays must first be DIMensioned, For example 10 DIM A(12,7) would create a two-dimensional array in memory labelled A having 12 rows and 7 elements in each row. 3.1.3 MANIPULATING ARRAYS In standard BASIC, manipulation of arrays involves multiple operations requiring a great many instructions and, consequently, a great deal of memory space. The array commands provided by SIMONS’ BASIC allow you to perform these operations using simple statements ‘The ZER ARR command allows you to set each element in an array to zero, while the SET ARR command enables all the elements in an array to be set to a specified number or value. PRINT ARR allows you to display the contents of an array. ADD ARR enables the elements of two arrays to be added, while the SUB ARR command allows you to subtract the contents of one array from another. MUL ARR permits the contents of two arrays to be multiplied together; the DIV ARR command allows you to divide the contents of one array by another. The ADD ALL command permits you to add a particular value to each element in the array while the SUB ALL command allows you to subtract a specific number from each element inan array. The MUL ALL command multiples all the elements in an array by a specified number and DIV ALL will divide all the elements by a selected value. The INPUT ARR command allows an array to be filled directly from the keyboard while READ ARR reads data into an array from a block of data statements. The COPY ARR command copies the contents of one array into a second, empty array. The SCRATCH command clears an array from memory. 32 ARRAY MANIPULATION SIMONS' BASIC EXTENSION also supplies a number of array functions. The ELEMENTS function returns the number of elements in an array while the SUM function adds all the elements of an array together. The MIN function returns the lowest value in an array while the MAX function returns the largest value. NOTE The array commands provided by SIMONS’ BASIC are designed to be used on real number or integer arrays Arrays containing strings CANNOT be used 3.2 ARRAY COMMANDS 3.2.1 CONVENTIONS When using SIMONS' BASIC array manipulation commands, the following conventions must be observed: 1. Each array must contain no more than 8 dimensions, i.e.: DIM A(1,1,1,1,1,1,1.1). 2. The zero (0) position in an array must NOT be used. 3. The arrays in the calculation and the array into which the result of the calculation is placed must be of the same size, i.e. the same dimensions and number of elements. 4, All the arrays must be correctly DIMensioned. 5. The array into which the result of a calculation is placed must be empty. Failure to conform to any of the conventions above will result in the message: 2 SYNTAX ERROR 3.2.2 SET ARR FORMAT! SET ARR array name, value PURPOSE: To assign a value to each element in an array. The SET ARR command allows you to set every elementin an array to a specified number. This number can be a pre-determined value or the result of a computation EXAMPLE To place the number 6 in each location of a 4 row by 3 column two- dimensional array SIMONS' BASIC EXTENSION ENTER TYPE. DISPLAY: 10 DIM AA(4,3) 20 SET ARR AA6 30 FOR X=1T04 40 FOR Y= 1TO3 50 PRINT AA(X,Y),: NEXT Y,X RUN 6 6 6 6 6 6 6 6 6 6 6 6 3.2.3 PRINT ARR FORMAT: PURPOSE: EXAMPLE: ENTER TYPE: DISPLAY: PRINT ARR array name, print format To display the contents of an array. The PRINT ARR command allows you to display the contents of an array. The first parameter of the command is the name of the array you wish to display. The second parameter in the command indicates the format in which the array is shown. The commands are as follows: 0- displays each element of the array on a new line 1- causes each element to be separated by a space 2- separates each element of the array by ten spaces (like using a comma in a PRINT statement). To print the contents of a one-dimensional array, each element being separated by a space 10 DIM BB(20) 20 X=1 30 REPEAT 40 BB(X) = X * 2 50X=X+14 60 UNTIL X >20 70 PRINT ARR BB,1 RUN 246 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 a4 ARRAY MANIPULATION 3.2.4 ZER ARR FORMAT: PURPOSE: EXAMPLE: ENTER: TYPE: DISPLAY: ZER ARR array name To set an array to 0 ZER ARR allows you to place a value of zero (0) in every element in an array. Using the program in the previous section, to set each element in the array BB to zero: 10 DIM BB(20) 20X=4 30 REPEAT 40 BB(X) = X * 2 SOX =X +1 60 UNTIL X >20 70 PRINT ARR BB,1 80 ZER ARR BB 90 PRINT: PRINT ARR BB,1 RUN 2466 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 00000000000000000000 3.2.5 ADD ARR FORMAT: PURPOSE: EXAMPLE: ADD ARR result array, array1, array2 To add together two arrays. The ADD ARR command adds together the contents of two arrays and places the result in a third, empty, array. The first parameter in the command is the variable name of the array INTO which the result Of the addition is placed. The second and third parameters are the variable names of the two arrays which are added, Arrays are added, and stored element to element, e.g. the first element in array1 is added to the first element in array2, and stored in the first element of array3, the sixth element in array is added to the sixth element in array2, and stored in the sixth element of array3 etc. The arrays in the addition must have the same dimensions, and number of elements. To add the contents of arrays AA and BB, and place the result in array ce SIMONS' BASIC EXTENSION ENTER: 10 DIM AA(20),8B(20),CC(20) 20 ZER ARR CC 30 SET ARR AA,10 40 REPEAT 50 BB(X)=X * 2 60 X=X+1 70 UNTIL X>20 80 ADD ARR CC,AA.BB 90 PRINT “AA="::PRINT ARR AA,1:PRINT 100 PRINT "BB="::PRINT ARR BB,1:PRINT 110 PRINT "CC="::PRINT ARR CC,1:PRINT TYPE: RUN DISPLAY: AA= 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 BB= 0 2 468 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 CC= 10 12 14 16 18 20 22 24 26 28 30 32.34 36 38 40 42 44 46 48 50 3.2.6 SUB ARR FORMAT: SUB ARR result array, array, array2 PURPOSE: To subtract one array from another. SUB ARR subtracts the contents of one array from another and places the result in a third, empty, array. The first parameter in the ‘command is the variable name of the array INTO which the result of the subtraction is placed. The second parameter is the variable name of the array SUBTRACTED, while the third parameter in the command is the variable name of the array FROM WHICH the first array is subtracted. Arrays are subtracted, and stored element from element, e.g. the first, element in array1 is subtracted from the first element in array2, and stored in the first element of array3, the fourth element in array1 is subtracted from the fourth element in array2, and stored in the fourth element of array3 etc. The arrays in the subtraction must have the same dimensions, and number of elements EXAMPLE: To subtract the contents of arrays AA and BB, and place the resultin array CC 36 ENTER: TYPE: DISPLAY: ARRAY MANIPULATION 10 DIM AA(20),88(20),CC(20) 20 ZER ARR CC 30 SET ARR AA,60 40 REPEAT 50 BB(X)=X * 2 60 X=X+1 70 UNTIL X>20 80 SUB ARR CC,AA,BB 90 PRINT "AA="::PRINT ARR AA, 1:PRINT. 100 PRINT "BB=";;PRINT ARR 8B,1:PRINT 110 PRINT "CC=";:PRINT ARR CC,1:PRINT RUN AA= 60 60 60 6D 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 BB= 02 468 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 CC= 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 3.2.7 MUL ARR FORMAT: PURPOSE! EXAMPLE ENTER, MUL ARR result array, array, array2 To multiply two arrays together. The MUL ARR command multiplies the contents of one array by another and places the result in a third, empty, array. The first parameter in the command is the variable name of the array INTO which the result of the multiplication is placed. The second and third Parameters are the variable names of the arrays that are multiplied. Arrays are multiplied, and stored element by element, e.g. the first element in array1 is multiplied by the first element in array2, and stored in the first element of array3, the third element in array1 is multiplied by the third element in array2, and stored in the third element of array3 etc. The arrays in the multiplication must have the same dimensions, and number of elements To multiply the contents of arrays AA and BB, and place the result in array CC: 10 DIM AA(20),8B(20),CC(20) 20 ZER ARR CC 30 SET ARR AA,10 40 REPEAT 50 BB(X)=X+1 60 X=X+1 70 UNTIL X>20 80 MUL ARR CC,AA,BB 90 PRINT “AA=";PRINT ARR AA,1:PRINT. 100 PRINT "BB="::PRINT ARR BB,1:PRINT. 110 PRINT "CC=";;PRINT ARR CC,1:PRINT. 37 SIMONS’ BASIC EXTENSION TYPE: RUN DISPLAY: AA= 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 BB- 123456789 10 11 1213 14 15 16 17 18 19 20 21 CC= 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 3.28 DIVARR FORMAT: DIV ARR result array, array1, array2 PURPOSE: To divide one array by another. The DIV ARR command divides the contents of one array by another and places the result in a third, empty, array. The first parameter in the command is the variable name of the array INTO which the result of the division is placed. The second parameter is the variable name. of the array DIVIDED, and the third parameter in the command is the variable name of the array BY WHICH the division is made. Arrays are divided, and stored element by element, e.g. the first element in array1 is divided by the first element in array2, and stored in the first element of array3, the third element in array 1 is divided by the third element in array2, and stored in the third element of array3 etc. The arrays in the division must have the same dimensions, and number of elements. EXAMPLE: To divide the contents of array AA by the contents of array BB, and place the result in array CC: ENTER 10 DIM AA(6),BB(6),CC(6) 20 ZER ARR CC. 30 SET ARR AA,720 40 FOR I-0TO6 50 READ B 60 BB(|)=B 70 NEXT | 80 DIV ARR CC,AA,BB 90 PRINT "AA="::PRINT ARR AA,1:PRINT 100 PRINT "BB=";;PRINT ARR BB,1:PRINT 410 PRINT "CC=";;PRINT ARR CC,1:PRINT 1000 DATA 1,2,4,6.8,10,12 TYPE: RUN DISPLAY: AA= 720 720 720 720 720 720 720 BB= 12468 1012 CC= 720 360 180 120 90 72 60 38 ARRAY MANIPULATION 3.2.9 ADD ALL FORMAT: ADD ALL array name, value PURPOSE: To add a value to every element in an array The ADD ALL command adds a specified number to every element in a defined array. The first parameter in the command is the array to which the value is added. The second parameters the value you wish to add. This may be an actual number or the result of a computation. EXAMPLE: To add the value 20 to every element of the array AA: ENTER: 10 DIM AA(20) 20 FOR I-0T020 30 AA(|)=I 40 NEXT | 50 PRINT "AA=";;PRINT ARR AA,1:PRINT. 60 ADD ALL AA,20 7 PRINT "AA=":;PRINT ARR AA,1:PRINT. TYPE: RUN DISPLAY: AA=01 23456789 1011 12 13 14 15 16 17 18 19 20 AA= 20 21 22 23 24 25 26 27 28 29 30 31 32 33.34 35 36 37 38 39 40 3.2.10 SUB ALL FORMAT: PURPOSE: EXAMPLE ENTER: TYPE DISPLAY SUB ALL array name, value To subtract a number from every element in an array SUB ALL subtracts a specified value from every element in a defined array. The first parameter in the command is the array which is subtracted from. The second command parameter is the value subtracted, To subtract 20 from every element of array AA: 10 DIM ARR AA(20) 20 FOR I-0TO20 30 AA(I)=1+20 40 NEXT | 50 PRINT "AA="::PRINT ARR AA,1:PRINT 60 SUB ALL AA,20 70 PRINT “AA=":;PRINT ARR AA,1:PRINT RUN AA= 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 0123456789 1011 12 13 14 15 16 17 18 19 20 39 SIMONS' BASIC EXTENSION 3.2.11 MUL ALL FORMAT: PURPOSE EXAMPLE: ENTER: TYPE: DISPLAY: MUL ALL array name, value To multiply every element in an array by a number. The MUL ALL command multiplies every element in a defined array by a specified number. The first parameter in the command is the array which is multiplied. The second parameter is the multiplication factor. To multiply every element in array AA by 10: 10 DIM AA(20) 20 FOR I-0TO20 30 AA(I)=1 40 NEXT | 50 PRINT "AA=";:PRINT ARR AA,1:PRINT. 60 MUL ALL AA, 10 70 PRINT "AA=";:PRINT ARR AA,1:PRINT. RUN AA= 0123456789 1011 12 13 1415 16 17 18 19 20 AA= 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 3.2.12 DIV ALL FORMAT: PURPOSE: EXAMPLE ENTER: TYPE: DISPLAY: DIV ALL array name, value To divide every element in an array by a number DIV ALL divides every element in a defined array by a specified number. The first parameter in the command is the array that is divided, while the second command parameter is the division factor. To divide every element in array AA by 10: 10 DIM AA(20) 20 FOR I-0T020 30 AA(I)=1410 40 NEXT | 50 PRINT "AA=":;PRINT ARR AA,1:PRINT. 60 DIV ALL AA, 70 PRINT "AA PRINT ARR AA,1:PRINT RUN AA= 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180, 190 200 AA= 0123456789 1011 1213 14 15 16 17 18 19 20 ARRAY MANIPULATION 3.2.13 COPY ARR FORMAT: PURPOSE: EXAMPLE! ENTER: TYPE: DISPLAY: COPY ARR array1, array2 To copy one array to another. The COPY ARR command duplicates the contents of one array into another, empty array. The first parameter in the command is the variable name of the array into which the information is copied. The second command parameter is the variable name of the array whose contents are copied To copy the contents of array AA into array BB: 10 DIM ARR AA(20),BB(20) 20 ZER ARR BB 30 FOR | 40 AA(| 50 NEXT | 60 PRINT “AA="":PRINT ARR AA,1:PRINT 70 PRINT "BB=";:PRINT ARR BB,1:PRINT 80 COPY ARR AA,BB 90 PRINT “AA=";:PRINT ARR AA,1:PRINT 100 PRINT "BB=";:PRINT ARR BB,1:PRINT. RUN AA= 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180, 190 200 BB-000000000000000000000 AA= 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 BB= 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180, 190 200 3.2.14 INPUT ARR FORMAT: PURPOSE: EXAMPLE: INPUT ARR array name To fill an array from the keyboard. INPUT ARR allows an array to be filled directly from the keyboard. The parameter ‘array name’ is the variable name of the array to be filled. Once the array has been filled, program execution continues. To fill the array AA from the keyboard, and then display it 34t SIMONS' BASIC EXTENSION ENTER: TYPE: RESULT: 10 DIM AA(20) 20 PRINT "ENTER 21 NUMBERS” 30 INPUT ARR AA 40 PRINT "AA=";;PRINT ARR AA,1:PRINT RUN The numbers that you typed on the keyboard, are now elements of the array AA 3.2.15 READ ARR FORMAT: PURPOSE: EXAMPLE: ENTER: TYPE: DISPLAY READ ARR array name To read data into an array. The READ ARR command reads data from DATA statements into an array until the array is filled. The command parameter is the variable name of the array into which the data is stored. To set all the elements in array AA to 720, read the content of array BB from a DATA statement, and divide array AA by array BB 49 DIM AA(6),BB(6),CC(6) 20 ZER ARR CC 30 SET ARR AA,720 40 READ ARR BB 50 DIV ARR CC,AA,BB. 60 PRINT "AA=";:PRINT ARR AA,1:PRINT 70 PRINT "BB=";:PRINT ARR BB,1:PRINT. 80 PRINT "CC=";;PRINT ARR CC,1:PRINT 1000 DATA 1,2,4,6,8,10,12 RUN AA= 720 720 720 720 720 720 720 BB- 12468 10 12 CC= 720 360 180 120 90 72 60 3.2.16 SCRATCH FORMAT: PURPOSE: SCRATCH array name To delete an array from memory. The SCRATCH command removes an array from memory. It differs from the ZER ARR command in that the scratched array name can no longer be used as a parameter in an array manipulation command. The parameter ‘array name’ is the variable name of the array to be SCRATCHed. EXAMPLE: ENTER: TYPE, DISPLAY: 3.2.17 SUM FORMAT: or PURPOSE: EXAMPLE: ENTER TYPE: DISPLAY: ARRAY MANIPULATION NOTE If you wish to use a variable name of an array that has been SCRATCHed, always remember to re-DiMension the array. To DiMension arrays AA and BB, and SCRATCH array AA: 10 DIM AA(20,20) 20 PRINT "AA DIMENSIONED”;FRE(0) 30 DIM BB(20,20) 40 PRINT "BB DIMENSIONED”;FRE(0) 50 SCRATCH AA 60 PRINT "AA SCRATCHED ",FRE(0) RUN ‘AA DIMENSIONED 25948 BB DIMENSIONED 23734 AA SCRATCHED 25948 A-SUM(array name) PRINT SUM(array name) To add the contents of an array. The SUM function gives the result of adding together all the elements in an array. The parameter enclosed in brackets is the variable name of the array whose elements you wish to add. To set all the elements of array AA to 10, and add them together: 10 DIM AA(20) 20 SET ARR AA,10 30 A=SUM(AA) 40 PRINT "THE TOTAL SUM OF AA=",A RUN THE TOTAL SUM OF AA= 210 213 SIMONS’ BASIC EXTENSION 3.2.18 ELEMENTS FORMAT: or: PURPOSE EXAMPLE: ENTER: TYPE DISPLAY: 3.2.19 MIN FORMAT: or: PURPOSE EXAMPLE: ENTER: variabl LEMENTS(array name) PRINT ELEMENTS(array name) To determine the number of elements in an array. The ELEMENTS function returns the number of elements in a specified array. The parameter inside brackets is the variable name of the array whose contents you wish to examine. To determine the number of elements in array AA‘ 10 DIM AA(20) 20 SET ARR AA,10 30 A=SUM(AA) 40 E-ELEMENTS(AA) 50 PRINT "THE TOTAL SUM OF AA=",A 60 PRINT "THE TOTAL NUMBER OF ELEMENTS IN AA="\E RUN THE TOTAL SUM OF AA= 210 THE TOTAL NUMBER OF ELEMENTS IN AA= 21 A=MIN(array name) PRINT MIN(array name) To return the lowest number in an array. The MIN function returns the value of the lowest element in a specified array. The parameter enclosed in brackets is the variable name of the array whose minimum element you wish to determine. To determine the minimum value in array AA: 10 DIM AA(20) 20 READ ARR AA 30 PRINT "AA=":;PRINT ARR AA,1:PRINT 40 MN=MIN(AA) 50 PRINT "MINIMUM VALUE IN AA=";MN 1000 DATA -40,-31,22,-29,23,7,-50 4010 DATA -17,-28,45,-7, 5-20 1020 DATA 40,17,27,18,7,1 TYPE: DISPLAY: 3.2.20 MAX FORMAT or: PURPOSE: EXAMPLE ENTER, TYPE: DISPLAY: ARRAY MANIPULATION RUN AA= -40 -31 22 -29 23 7 -50-17 -28 45 -7 47 -44-20 40 1727 187 13-40 MINIMUM VALUE IN AA=-50 variable = MAX(array name) PRINT MAX(array name) To return the highest number in an array. The MAX function returns the value of the largest element in a specified array. The parameter enclosed in brackets is the variable name of the array whose maximum element you wish to determine. To determine the maximum value in array AA 10 DIM AA(20) 20 READ ARR AA 30 PRINT "AA=":;PRINT ARR AA,1:PRINT 40 MX=MAX(AA) 50 PRINT "MAXIMUM VALUE IN AA=";MX 1000 DATA -40,-31,22,-29,23,7,-50 1010 DATA -17,-28,45,-7,47,-44,-20 1020 DATA 40,17,27,18,7,1: RUN AA= -40 -31 22-29 237 -50-17 -28 45 -7 47 -44 -2040 1727 187 13-40, MAXIMUM VALUE IN AA= 47 SIMONS' BASIC EXTENSION 3.3 STRING ARRAY MANIPULATION 3.3.1. SORT FORMAT: PURPOSE: EXAMPLE: ENTER TYPE SORT arrayS,dflag,startend To sort a single dimension string array. The SORT command sorts any single dimension string containing alpha and/or numeric characters into ascending or descending order. The first parameter, array§, is the name of the string array. The next parameter, dflag, specifies whether the array is to be sorted into ascending, or descending order. A “1” in this position denotes ascending order, and a"0” in this position denotes descending order. The last two parameters, start and end, dictate which part of the string element is sorted. Either the whole of each string element, or just a part. For example, SORT AS,0,3,255 sorts the string array A$ into descending order. But only from the third character of each element onwards. This is especially useful should you wantto sortan array containing names, but wish to ignore the initials. For more information on string arrays see Appendix C of your COMMODORE 64 USER'S MANUAL, and pages 4 - 9 of the COMMODORE 64 PROGRAMMER'S REFERENCE GUIDE. To read names froma DATA statement into the array AS, and sort that array into descending order: 10 DIM A$(5) 20 PRINT “UNSORTED NAMES" 30 PRINT A 40 FOR TOS 50 READ AS(I) 60 PRINT AS(!) 70 NEXT | 80 SORT AS,0,3,255 90 PRINT 100 PRINT "SORTED NAMES” 110 PRINT "-- — 120 FOR |-OTOS 130 PRINT AS(\) 140 NEXT | 1900 DATA "MR JONES",”MR SMITH”,"MR BLOGGS” 1010 DATA "MR BROW! MR WHITE”,"MR BLACK” RUN ARRAY MANIPULATION DISPLAY: UNSORTED NAMES MR JONES MR SMITH MR BLOGGS MR BROWN MR WHITE MR BLACK SORTED NAMES MR WHITE MR SMITH MR JONES MR BROWN MR BLOGGS MR BLACK a7 NUMERIC AIDS. SECTION FOUR NUMERIC AIDS 4.1 INTRODUCTION Section Four contains additional commands to help you when manipulating numeric data. GRAD and DEG are two additional trigonometrical functions. The first converts a number expressed in gradians into radians, while the second converts a number expressed in degrees into radians. Also included in this section are commands to convert decimal numbers into their binary or hexadecimal equivalent, 4.2, ADDITIONAL TRIGONOMETRICAL FUNCTIONS 4.2.1 GRAD FORMAT: variable=GRAD (number) PURPOSE: To convert gradians into rads. The GRAD function converts a value expressed in gradians into rads, It is used like any normal mathematical function EXAMPLE To use the GRAD function to plot a sine wave: ENTER: 10 HIRES 11,15 20 FOR 1-0 TO GRAD(400) STEP GRAD(400)/64 30 Y=SIN(1I) *50+100 40 x50 50 PLOT X,Y,1 60 NEXT | 70 PAUSE 10 TYPE: RUN RESULT: A sine wave is plotted on the high-resolution screen. 4.2.2 DEG FORMAT: variable-DEG (number) PURPOSE: To convert degrees into rads. The DEG function converts a value expressed in degrees into rads. It is used like any normal mathematical function, SIMONS' BASIC EXTENSION EXAMPLE: To use the DEG function to plot a sine wave: ENTER 10 HIRES 11,15 20 FOR I=0 TO DEG(360) STEP DEG(360)/64 30 Y=SIN(I)*50+100 40 X=1450 50 PLOT X,Y.1 60 NEXT! 70 PAUSE 10 TYPE: RUN RESULT: A sine wave is plotted on the high-resolution screen. 4.3 NUMERIC CONVERSION 4.3.1 BINS - DECIMAL/HEXADECIMAL TO BINARY CONVERSION FORMAT BINS(n) PURPOSE: To convert from decimal, or hexadecimal into binary. The BINS command converts a decimal, orhexadecimal number into its binary equivalent. If a decimal number outside the range 0-255, or a hexadecimal number outside the range $0000-S00FF is used as the argument in the command, the message: 7 ILLEGAL QUANTITY ERROR is displayed. EXAMPLE: To convert the decimal number 135 into its binary equivalent COMMAND: — PRINT BINS(135) DISPLAY: 19000111 4.3.2. HEXS - DECIMAL/BINARY TO HEXADECIMAL CONVERSION FORMAT: HEXS(n) PURPOSE: To convert from decimal, or binary into hexadecimal The HEX$ command converts a decimal, or binary number into its hexadecimal equivalent, 42 EXAMPLE COMMAND: DISPLAY: NUMERIC AIDS If a decimal number outside the range 0-65535 is used as the argument in the command, the message: 2 ILLEGAL QUANTITY ERROR is displayed Only 8-bit binary numbers in the range %00000000-%11111111 may be used. If a negative binary number is used as the argument in the command, the message: 2 ILLEGAL QUANTITY ERROR is displayed To convert the decimal number 220 into its hexadecimal equivalent: PRINT HEX$(220) oop 4.4 SPECIAL CALCULATIONS 4.4.1 CALCX FORMAT: or: PURPOSE. EXAMPLE, A=CALCX(x,y,angle,xryr) PRINT CALCX(x,y.angle,xryr) To calculate the x coordinate of a point on the circumference of a circle. The CALCX function returns the x coordinate of a point on the circumference of a circle. Itis essentially ANGL (see section 6.5.13 of your SIMONS' BASIC MANUAL), but without the y coordinate, and instead of drawing a line, CALCX returns the point. The first two parameters, x and y, are the centre coordinates of the imaginary circle. The next parameter, angle, is the angle of the point to the perpendicular, and xr and yr are the x and y radii of the circle. To use the CALCX function to draw a pattern on the high-resolution screen; 43 SIMONS' BASIC EXTENSION ENTER 10 HIRES 1,0 20 FOR R-10 TO 100 30 FOR A=0 TO 180 STEP 20 40 X=CALCX(160, 100,A+R,R,R) 50 Y=CALCY (160, 100,A+R.R,R) 60 PLOT X.Y.1 70 NEXT 80 NEXT TYPE: RUN RESULT: A pattern is drawn on the high-resolution screen. 44 NUMERIC AIDS WARNING IN CERTAIN SITUATIONS CALCX AND. CALCY MUST NOT BE INCORPORATED IN, HIGH-RESOLUTION COMMANDS, IF YOU, RECEIVE AN ERROR MESSAGE, ALTER YOUR PROGRAM SO THAT THE RESULTS OF THE CALCX AND CALCY CALCULATIONS ARE STORED IN VARIABLES, AND USE THE VARIABLES IN THE HIGH-RESOLUTION, COMMAND. 4.5 EVALUATING A STRING AS A BASIC EXPRESSION 4.5.1 EVAL FORMAT: PURPOSE. EXAMPLE: ENTER EVAL str$ To evaluate a string as a BASIC expression. EVAL evaluates a string as a BASIC expression. The single parameter, strS, is any string that is stored in the 64's memory, This command is extremely useful for any program that requires data entry of expressions that need to be calculated. NOTE Temporary strings will not work with EVAL, i.e. 10 AS="Y=X+10:BACK" 20 EVAL AS 30 PRINT Y AS in this example is a temporary string, and will not be evaluated. If you are uncertain, use a string add on any string that needs to be evaluated, ie. 10 AS="Y=""X+10:BACK" 20 EVAL AS 30 PRINT Y To enter the “x” part of the equation, evaluate the whole equation, and give the answer: 10 AS="Y="+"X#10:BACK” 20 PRINT "Y=X#10' 30 INPUT “ENTER NUMBER FOR X”;X 40 EVAL AS 50 PRINT "Y=": 60 GOTO 30 45 SIMONS' BASIC EXTENSION TYPE. RESULT: 45.2 BACK FORMAT: PURPOSE: EXAMPLE: ENTER: TYPE: RESULT: RUN A large grid, with a smaller grid inside one of its squares is drawn on the high-resolution screen. TICK x,y,tx,ty,n.n1,plot type To draw the axes of a grid The TICK command differs from GRID (see the previous section) in that it only draws and calibrates the x and y axes of a grid. This allows you to use the grid to produce graphs, histograms etc. The Parameters are the same as those used in the GRID command. Note that, if the calibration marks go off the screen, the message: BAD MODE is displayed and you must amend your code accordingly. To “tick” the x and y axes of the large grid 10 HIRES 15,0 20 GRID 10,190,60,60,4,3,1 30 GRID 70,130,5,5,12,12,1 40 TICK 10,190,5,5,48,36.1 50 PAUSE 5 RUN The x and y axes of the large grid are “ticked 6.2.3 HSAVE FORMAT: or: PURPOSE: EXAMPLE ENTER: or TYPE: RESULT: HIGH RESOLUTION AND MULTI-COLOUR GRAPHICS. HSAVE 2,8,2,"drive number:program name,S,W' HSAVE 1,1,1,"program name” To save a graphics screen to disk or tape. The HSAVE command stores a graphics screen on diskette or cassette. The first figure following the command is a logical file number. This tells the COMMODORE 64 to opena channel to the disk drive or cassette unit. The second figure specifies the storage device you wish to use. This number is 1 for cassette or 8 for diskette. The third figure is a secondary address. This is a special instruction telling the computer how to store the information. For example, a secondary address of 1 for cassette, instructs the COMMODORE 64 that a file is to be written and that an end-of-file marker is to be placed at the end of the tape when the file is closed. When using HSAVE, the secondary address must be 1 for cassette, and any number in the range 2-14 for disk. The ‘name’ is the title you wish to give to the screen data. This name must be unique for each screen you store. You may then use this name in the HLOAD command (see the following section) to recall and display the stored data. The parameter S indicates that the file being accessed is sequential. W instructs the COMMODORE 63 that this file is to be written to rather than read from, When stored, each screen occupies approximately 41 blocks. Note that the parameters are separated by commas and quotation marks are placed around name and S.W. To drawa picture on the high-resolution screen, and save it on disk or cassette: 10 HIRES 15,0 20 FOR R=10TO90 STEP 5 30 CIRCLE 160,100,R,100-R,1 40 NEXT 50 PAUSE 5 60 HSAVE 2,8,2,"HIRES SAVE,S,W":REM *xx FOR DISK *** 60 HSAVE 1,1,1,"HIRES SAVE":REM *** FOR CASSETTE *** RUN ‘A design is drawn on the high-resolution screen, and is saved on disk or cassette after a pause of five seconds. 63 SIMONS’ BASIC EXTENSION 6.2.4 HLOAD FORMAT: or: PURPOSE: EXAMPLE: ENTER or: TYPE: RESULT: HLOAD 2,8,2,"drive number:program name” HLOAD 1,1,0,"program name" To recall and re-display a previously saved graphics screen from diskette or cassette, The HLOAD command allows you to recall and display a graphics screen that has been stored with the HSAVE command (see the previous section). The first figure following the command is a logical file number. This tells the COMMODORE 64 to open a data channel to the disk drive or cassette unit. The second figure after the command specifies the device on which the data has been stored. This number is 1 for cassette or 8 for diskette. The third figure is a secondary address. When using HLOAD, the secondary address must be 0 for cassette, and any number in the range 2-14 for disk. The title you assigned to the screen data is the final parameter and must be enclosed in quotation marks NOTE Before you recall a graphics screen, you must ensure that the screen is in the same graphics mode as it was when the screen was stored. For example, before using HLOAD, enter HIRES 0,1:MULTI 2,3,4 For recalling a multicolour screen. HIRES 0,1 For recalling a high resolution screen. To recall a previously saved high-resolution screen from disk or cassette: 10 HIRES 15,0 20 HLOAD 2,8,2,"HIRES SAVE,S,R”:REM x4* FOR DISK x« 30 PAUSE 5 20 HLOAD 1,1,0,"HIRES SAVE”:REM *x* FOR CASSETTE ##* RUN Your high-resolution screen is recalled from disk or cassette. 64 6.2.5 LABEL FORMAT: PURPOSE: EXAMPLE: ENTER TYPE: RESULT: HIGH RESOLUTION AND MULTI-COLOUR GRAPHICS LABEL xy,"text” plot type.xe,yeshxty1.r To print a character string on a graphics screen LABEL allows you to print character strings ona graphics screen ata defined size, slant and rotation. The parameters x and y specify the screen coordinates of the first letter of the string. The next parameter is the string itself, Plot type is as described in Section 6.4 of the SIMONS' BASIC manual. The parameters xe and ye specify the expansion factor of each character in the string in the horizontal and vertical directions respectively. Normal expansion is “1". Any increase in this figure causes a corresponding increase in size, €.9. a value of "3" for the x expansion would cause the characters to be displayed at three times their normal width. Note that you may not use an expansion factor greater than "30". The parameter si refers to the slant of each character to the vertical. A value of “1” is used to display characters vertically. “O" displays the characters slanted to the left, while “2" causes the characters to be slanted to the right. The final two parameters in the LABEL command indicate the offsets in the horizontal and vertical directions respectively between each character in the string To display text of various sizes, slants, and angles of rotation on the high-resolution screen: 10 HIRES 15.0 20 LABEL 10,10,"LL THESE LETTERS",1,2,4,1,12,0,0 30 LABEL 250,0,"ARE PRODUCED"1,4,2,0,0,16,1 40 LABEL 20,160,"USING".1,4,2,0,30,-5,0 50 LABEL 10,80,"LABEL",1,4,4,1,30,5.0 60 PAUSE 5 RUN Different parts of the message: “All these letters are produced using LABEL" are displayed in different sizes, slants, and angles of rotation on the high-resolution screen. SIMONS' BASIC EXTENSION 6.2.6 DRAW TO FORMAT: or: PURPOSE: EXAMPLE ENTER TYPE: RESULT: DRAW TO x,y,plot type DRAW TO,x,y,plot type TO x1,y1 TO x2,y2 (ete.) To draw a line from the last plotted point ‘The DRAW TO command draws a line from the last plotted point to the position specified. The parameters x and y specify the horizontal and vertical screen coordinates of the point to be drawn to. Plot type is as described in Section 6.4 of your SIMONS' BASIC MANUAL. The DRAW TO command may also be used to draw a series of lines by adding extra TOs. When using this second type of format, plot type need only be specified once. To draw a design on the high-resolution screen using the DRAW TO. command 10 HIRES 15,0:PLOT 0,0,.0 20 X1=0:X2-320:Y1-0:Y; 30 REPEAT 40 DRAW TO X2,1,1 50 DRAW TO Xx2,¥2,1 60 DRAW TO x1,Y2.1 70 DRAW TO X1,¥195,1 80 X1=X145 90 X2=X2-5 100 Y1=V1+5 110 Y2=¥2-5 120 UNTIL Y1>200 130 PAUSE 5 RUN 160 130 PAUSE 5 RUN 160 130 PAUSE 5 RUN A design consisting of decreasing rectangles is displayed on the high-resolution screen, 6.3 SCALING FUNCTIONS 6.34 SCALE FORMAT: PURPOSE: EXAMPLE SCALE hx,hy To set up a scaling factor. The SCALE command sets up a scaling factor for the high-resolution screen. The parameter hx is the largest number that the x coordinate can be, and the parameter hy is the largest number that the y coordinate can be. These numbers can be as large or as little as you wish, within the standard floating point limits (see pages 26 and 27 of your COMMODORE 64 USER'S GUIDE). To set up a scaling factor, and draw a sine wave on the high- resolution screen using that scaling factor: 68 ENTER: TYPE, RESULT: 632 SCX FORMAT: PURPOSE EXAMPLE: ENTER: TYPE: RESULT: HIGH RESOLUTION AND MULTI-COLOUR GRAPHICS. 10 HIRES 15,0 20 SCALE 1000,1000 30 C=500 40 FOR |-0T01000 50 P=SIN(1/160)*400+C. 60 X-SCX(I) 70 Y=SCY(P) 80 PLOT X,Y.1 90 NEXT | RUN A sine wave is drawn on the high-resolution screen: A=SCX(expression) To return a scaled value of X. The SCX function returns a scaled value of X. It is used like any normal mathematical operator. To set up a scaling factor, and draw a sine wave on the high- resolution screen using that scaling factor 10 HIRES 15,0 20 SCALE 1000,1000 30 C=500 40 FOR I-0TO1000 50 P=SIN(I/160)*400+C 60 X=SCX(I) 70 Y=SCY(P) 80 PLOT X,Y,1 90 NEXT | RUN ":COLOUR 5,0 20 LOW RES 10,11 30 CIRCLE 10,25,10,10,1 40 PAINT 10,25,1:FCOL 8,0,10,10,2 50 LINE 25,15,45,15,1 60 DRAW TO 45,35,1 70 DRAW TO 25,35,1 80 DRAW TO 25,15,1 90 PAINT 26,16,1:FCOL 7,12,12,12,1 100 LINE 50,35,70,35,1 110 DRAW TO 60,15,1 120 DRAW TO 50,35,1 130 PAINT 60,30,1:FCOL 7,25,12,12,6 RUN Ared circle, white square, and blue triangle are displayed on the low- resolution screen. NOTE If the low-resolution graphics mode has been initialized (through LOW RES 10), then LOW RES 0 must be used to terminate low-resolution plotting, or before using HIRES. LOW RESOLUTION GRAPHICS COMMANDS. 7.22 PREPARE FORMAT: PURPOSE: EXAMPLE TYPE: RESULT: 7.2.3 PUSH FORMAT: PURPOSE: EXAMPLE: PREPARE x To prepare a low-resolution screen for storage in another part of the 64's memory. This command, used in direct mode, prepares a low-resolution screen, text or graphics, for storage in one of four buffers behind KERNAL. The parameter x, which must be a number between 0 and 3, specifies which buffer the information is sent to. Once the command has been initialized, text or graphics may be typed anywhere on the screen, You can use the cursor keys to move around screen, and change colour by using the colour keys. When your screen is ready, press to send it to the selected buffer. You are then returned to direct mode. NOTE For purposes of data integrity, the key has been disabled in PREPARE mode. PREPARE must NOT be used in MEM mode. To prepare a low-resolution screen for storage in the first buffer behind KERNAL. PREPARE 0 to store it in the first buffer behind KERNAL. Type PULL 0 to retrieve your screen PUSH x. To store the current screen in another part of the 64's memory, This command can be used as part of a program to store all information currently on screen in a buffer behind KERNA\. It is essentially the same as PREPARE. The parameter x, which must bea number between 0 and 3, designates which buffer the screen will be sent to. When the screen has been stored, program execution continues. To save a screen to the first buffer behind KERNAL from within a program SIMONS' BASIC EXTENSION ENTER: TYPE RESULT: 7.24 PULL FORMAT: PURPOSE: EXAMPLE ENTER TYPE: RESULT: 10 PRINT CHRS(147) 20 COLOUR 5,15:LOW RES 10,0 30 CIRCLE 40,25,10,10,1 40 PUSH 0 50 PRINT CHRS(147) 60 PAUSE 2 70 PULL 0 RUN A black circle is drawn on the low-resolution screen. The screen is saved, and retrieved from the first buffer behind KERNAL. 7.3 SCREEN FUNCTIONS 7.3.1 FONT FORMAT: PURPOSE. FONTn To select one of the two built-in character sets of SIMONS’ BASIC EXTENSION ro EXAMPLE) ENTER TYPE RESULT: 7.3.2 UPPER FORMAT: or PURPOSE: LOW RESOLUTION GRAPHICS COMMANDS FONT, similar to the MEM command in SIMONS' BASIC downloads one of the two SIMONS' BASIC EXTENSION character sets. The parameter n, which must be either 1 or 2, specifies which character set is selected. FONT1 downloads the first 128 characters normally, then the next 128 characters are loaded such that the first 64 are the upper parts of the non-inverse characters, and the second 64 are the lower parts. Using FONT1 in conjunction with UPPER (see next section) allows double-sized characters in normal text modes. FONT2 downloads a futuristic, computer-style character set. The FONT command may be used either in direct mode, or as part of a program. The NRM command returns you to the standard character set NOTE Because there are no inverse characters in the FONT 1 character set, the cursor does not appear in this mode. There is no space between the command FONT, and the parameter, n To display the numbers, letters, and symbols of the futuristic character set 10 FONT2 20 FOR 1=32TO90 30 PRINT CHRS(I); 40 NEXT | 50 PAUSE 5 60 NRM RUN The message "THIS TEXT IS DOUBLE HEIGHT" is displayed using double height letters. ECOL In,ac,x+y+,col1,col2 To exchange one colour for another on a low-resolution screen The ECOL command allows you to exchange one colour for another in a specified area of a low-resolution screen. The first two parameters, In and ac specify the top left coordinates of the screen area to be checked. The next parameter, x+ is the distance between the top left corner, and the top right corner. The parameter y+, is the distance between the top left corner, and the bottom left corner. Colt is the colour to be exchanged, and col2 is the colour that it will be exchanged for. To draw, and paint a circle in dark grey, and exchange it for red 10 COLOUR 5,15:LOW RES 10,11 20 CIRCLE 40,25,10,10,1 30 PAINT 40,25,1 40 ECOL 0,0.40,25,11,2 RUN A circle is drawn, and painted in dark grey, and then exchanged for red 7-6 7.3.4 CCOL FORMAT: or: PURPOSE: EXAMPLE: ENTER: TYPE: DISPLAY: 7.3.5 SCOL FORMAT: or: PURPOSE: EXAMPLE ENTER: TYPE DISPLAY. LOW RESOLUTION GRAPHICS COMMANDS A=CCOL PRINT CCOL To determine the current cursor colour. The CCOL command returns the current cursor colour, the colour currently being used for all print statements. To use the CCOL command to determine the current cursor colour: 10 PRINT CHRS(28) 20 LOW COL 2,0,0 30 PRINT "COLOUR=";CCOL 40 PRINT CHRS(30) 50 PRINT "COLOUR=";CCOL RUN COLOUR= 2 (in red) COLOUR= 5 (in green) A=SCOL(x,y) ‘ PRINT SCOL(x,y) To determine the colour at a specified screen location The SCOL command returns the colour at a specified screen location. The parameter x, is the number of columns across, and the parameter y, is the number of rows down To clear the screen, set the colour to green, and determine the colour at screen location 0,0: 10 PRINT CHRS(147);CHRS(30) 20 COLOUR 5,0 30 PRINT “THIS IS GREEN" 40 PRINT "THE COLOUR AT 0,0=";SCOL(0,0) RUN A line of red, white, and blue is printed at the top of the screen. DESIGN 3,$E000+ch+8 To design multi-colour characters. The DESIGN command, implemented in SIMONS’ BASIC, may be used in conjunction with MCOL (see previous section), and enables you to design your own multi-colour characters. Ch is the poke code of the character to be redesigned. The line containing the DESIGN command is followed by eight lines of four characters. All the characters on one line MUST be the same, and determine the structure of the multi-colour character. Aor. displays the background colour B displays colt (from MCOL) c displays col2 (from MCOL) D displays the current cursor colour NOTE As in MCOL, CTRL colours are standard, and CBM colours are multi-colour. This means that if CTRL BLK is selected, normal black characters are printed. If CBM BLK is selected, multi-colour characters are printed, with black being colour D. As in the other DESIGN applications, ALL lines of the design grid must begin with the @ symbol. To use DESIGN in conjunction with MCOL to design a multi-colour character, SIMONS' BASIC EXTENSION ENTER 10 MEM 20 DESIGN 3,$E000+0«8 30 @BBBB 40 @BBBB 50 @BBBB 60 @CCCC 70 @CCCC 80 @DDDD 90 @DDDD 100 @DDDD 110 MCOL 2,1 120 PRINT CHR$(154):REM *** LIGHT BLUE CURSOR #+* 130 PRINT “@@@@@@@@@@@@@" TYPE: RUN RESULT: A line of red, white, and blue is printed at the top of the screen. 7.3.9 ROTATE FORMAT: ROTATE $E000+chx8 or: ROTATE $E000+ch+8,$E000+an+8 PURPOSE: To rotate a group of eight bytes. The ROTATE command rotates a character, a group of eight bytes clockwise through 90 degrees. The address is the same as the one used for DESIGN; the parameter ch is the poke code for the character you wish to rotate. There are two types of format. The first rotates the character clockwise through 90 degrees, and stores it back in its original address. The second also rotates the character clockwise through 90 degrees, but instead of returning it to its original address, places it in another address. The parameter an, specifies which address the rotated character will be placed in. NOTE When using the second type of format, it is important to remember that the new rotated character overwrites the character whose poke code is an. However, this is only temporary and you may return to the normal character set by pressing . ROTATE can only be used in MEM mode. EXAMPLE: To rotate the letters of the alphabet through 180 degrees: 710 ENTER: TYPE RESULT: LOW RESOLUTION GRAPHICS COMMANDS 10 MEM 20 PRINT "ABCDEFGHIJKLMNOPQRSTUVWXYZ”" 30 FOR I=1TO26 40 ROTATE SEO0+1+8 50 ROTATE SEO00+1+8 60 NEXT | 70 PAUSE 5 80 NRM RUN The letters of the alphabet are displayed upside-down. 7.3.10 BCKFLASH FORMAT: or: PURPOSE EXAMPLE ENTER, TYPE RESULT: BCKFLASH speed, colt, col2 BCKFLASH 0 To flash, or stop flashing two background colours. The BCKFLASH command allows you to flash two background colours. The first parameter, speed, must be a number between 1 and 255, and determines the speed at which the flashing takes place, 1 being the fastest, and 255 the slowest. The next two parameters, col and col2, must be two integers in the range 0-15, and specify the two colours which are flashed. BCKFLASH 0 turns background flashing off, without affecting sprite handling. The BCKFLASH command proves more useful than FLASH (see Section 7.3 in your SIMONS’ BASIC manual) in certain situations, because speed of execution is not affected so badly NOTE You must call INIT (see Section 8.3.8) before background flashing can take place. The BCKFLASH command can only be used as part of a program. To flash two background colours: 10 INIT 20 BCKFLASH 8,14,6 30 PAUSE 10 RUN ‘The background colour flashes alternatively between light blue, and dark blue for ten seconds. SIMONS' BASIC EXTENSION 7.341 FORMAT: PURPOSE EXAMPLE: ENTER TYPE: RESULT: any command To direct the output from any command to the printer. An asterisk inserted before any command sends the output from that command to the printer, thus eliminating the need to OPEN a channel, and send output via the CMD command, This command can be used either in direct mode, or as part of a program To send the output from PRINT and LIST commands to the printer: 10 *PRINT “THIS PROGRAM USES THE '*’ COMMAND” 20 *PRINT “TO SEND COMMANDS TO THE PRINTER” 30 *LIST RUN The message THIS PROGRAM USES THE ‘*’ COMMAND. TO SEND COMMANDS TO THE PRINTER: and a listing of the program are printed out on the printer. SPRITE MANIPULATION COMMANDS. SECTION EIGHT SPRITE MANIPULATION COMMANDS 8.1 INTRODUCTION This section contains additional commands for use with sprites. 8.2 SPRITES 8.2.1 INTRODUCTION For more information on sprites, see Section 8 of your SIMONS'’ BASIC MANUAL. 8.2.2 WHAT IS A VECTOR DRIVEN SPRITE? SIMONS’ BASIC EXTENSION takes the sprite commands implemented in SIMONS’ BASIC one step further, by introducing VECTOR DRIVEN SPRITES. A vector quantity is something that has both direction and magnitude. The SPRITE command allows you to set up the vectors for each sprite, direction and magnitude, or speed. However, the SPRITE command does not end at vectors. You can set up four barriers, low x, low y, high x, high y, and specify what your sprite does when it reaches one. Having set up your sprites, you can START them moving at exactly the same time. Using BARRIER, you can change x and y flags, and using CHANGE, you canalter the enab register, which controls sprite movement, and detects sprite /barrier collisions. CLEAR enables you to stop one or more sprites at the same time, and the INFO ‘command returns the status of a specific sprite. SPRX and SPRY respectively return the coordinates of a selected sprite, and SPR LOC tells you the start location of your sprite data in RAM. The INVERT command turns a sprite upside-down, and REVERSE reverses a sprite Using ON DETECT you can check for sprite/text collisions, sprite/sprite collisions, or both. You also specify a line, which the program jumps to in the event of a collision. The CONTINUE command is used at the end of sprite collision routines, it returns program execution to where it was before the collision took place ‘The SHOW command can be used to examine the sprite data in a specific memory location, or to set up the sprite design grid SIMONS' BASIC EXTENSION The INIT command sets the sprite handler into operation, and NORMAL disables it Finally, TRANSFER and CREATE. The TRANSFER command transfers sprite data to high-resolution data, and the CREATE command creates sprite data from high- resolution data, Using TRANSFER and CREATE, you can create the illusion that there are many more than eight sprites on screen 8.2.3 WHAT IS A FRAME? Most televisions and monitors work along the “raster scan” principle. Imagine a dot that starts off in the top left-hand corner of the soreen, and moves horizontally to the top right-hand corner of the screen. When it reaches the right-hand edge of the screen, it simultaneously jumps down a line, and returns to the left-hand side of the screen. It then moves horizontally to the right-hand edge of the screen again. In this way the dot continues until it eventually reaches the bottom right-hand corner of the screen. Once it has reached the bottom right-hand corner of the screen, the dot jumps up to the top left-hand corner, and starts all over again. This dot is the raster beam. The reason we don't see the raster beam is that it moves incredibly fast. As the raster moves across and down the screen, it receives information from the video chip. This information tells the raster beam which parts of each line, or raster, to “light up”, in this way we can see that a television picture is made up of many horizontal lines, orrasters. ‘One complete “frame” is the time that it takes for the raster beam to travel from the top left-hand corner of the screen, to the Bottom right-hand corner of the screen. There are approximately 60 frames a second! With SIMONS' BASIC EXTENSION, all sprites are moved while the raster beam is off the screen. Because of this, sprite movement (even with eight sprites moving at once) is very smooth, and flicker 8.3 SPRITE MANIPULATION COMMANDS 8.3.1 SPRITE FORMAT: SPRITE spr,xvec,yvec,sp or: SPRITE spr.xvec,yvec,sp,lox,loy,hix,hiy,flx,fly,enab PURPOSE: To set up a sprite vector, speed, barriers, sprite flags, and an enab register. The SPRITE command sets up a sprite vector, speed, up to four barriers, sprite flags (which determine what happens in the event of a sprite/barrier collision), and the enab register (which checks for sprite/barrier collisions) SPRITE MANIPULATION COMMANDS, The first parameter, spr, is the sprite number. It is unique for each sprite, and is set up in the MOB SET command (see Section 8.2.5 of your SIMONS' BASIC MANUAL). The next two parameters, xvec and yvec, are the two elements of the sprite vector. The parameter xvec, determines how many pixels the sprite moves along the x-axis each time it is updated, and the parameter yvec, determines how many pixels the sprite moves along the y-axis each time it is updated. The next parameter, sp, is the speed. This dictates the frequency with which sprite updates take place, a1" in this position means that the sprite is moved every frame, a "2" in this position means that the sprite is moved every other frame, and so on. Lox, loy, hix, and hiy are the four barriers, lox and loy are the low barriers of the x and y axes, and hix and hiy are the high barriers of the x and y axes. The next two parameters, fix and fly, specify what happens in the event of a sprite/barrier collision. The commands are as follows: 1 - turn sprite off 2- set INFO(spr) (see Section 8.3.8) 4- reverse xvec 8 - reverse yvec 16 - stop sprite NOTE If you require two or more of the above functions, add their respective numbers together, i.e. to reverse both xvec and yvec, use 12" The final parameter of the SPRITE command is enab, this controls sprite movement, and checks for sprite/barrier collisions. The commands are as follows: 1 = move sprite, this sets a sprite moving, But, you may not want this to happen. To start a number of sprites moving at the same time, see Section 8.3.4 do x comparison, this checks to see if either the lox or hix barriers have been crossed. If either of the x barriers are crossed, then control is transferred to the fIx register. If neither of the x barriers is crossed, then the sprite continues along its vector. - do y comparison, this checks to see if either the loy or hoy barriers have been crossed. If either of the y barriers are crossed, then control is transferred to the fly register. If neither of the y barriers is crossed, then the sprite continues along its vector. 83 SIMONS' BASIC EXTENSION NOTE As with fix and fly, if you require two or more functions, add their respective numbers together, i.e. to do both x and y comparisons, use “6”. if a “0” is put in the enab register, then the sprite in question travels along its vector with total wrap-around, i.e. if a sprite goes off one side of the screen, it reappears in the same position on the opposite side. EXAMPLE: To use the SPRITE command to set up a sprite vector, speed, barriers, sprite flags, and an enab register: ENTER 10 PRINT CHRSC147> 20 INIT 3@ MOB OFF a 40 M08 OFF 1 5@ DESIGN 1,2a@+64 Cart aeeeconae 70 ©. .BBBBB.. 20 @.8EBEEB..... 90 ©.acR8EB.. 100 CBBBBRBE..... .BBBEB, 119 eBaBB. 120 BBB... .8B6. 120 @BBB....BBB.. 149 e8ee....BB. 150 @8RB.... 0... 180 GBR... 600... 17a epBe....cCC.. 158 BEB... .CCCC. i9@ eBBeB...cCCCe 200 GBBBESEB..... 210 @.BBB68B..... 220 ©.BEE8B. 28a cMoB 6,2 238 RLOCMOB 8, 100,108,0,1 300 SPRITE 0,2,2,1,23,43,323,231,4,8,7 319 PAUSE 5 TYPE. RUN RESULT: The sprite moves around the screen diagonally, and bounces off the screen border. NOTE If the first type of format (ie. SPRITE spr.xvec,yvec,sp) is used, then all the other parameters in the SPRITE command are set to zero. aa 8.3.2 XVEC FORMAT: or: PURPOSE: EXAMPLE: ENTER TYPE RESULT: SPRITE MANIPULATION COMMANDS. A=XVEC(spr) PRINT XVEC(spr) To read the x vector. The XVEC command returns the x vector of sprite spr. To read the x and y vectors: 1@ PRINT CHREC147) 2@ INIT 3@ MOB OFF a 4@ MOB OFF 1 5@ DESIGN 1,240%64 62 © 70 ©..BBBBB..... 8@ ©.58B558... 3@ ©.868588... 108 @BBaBBBE.. 110 @8BBB...68585 120 eBBB....8888. 130 @BBB....868.. 140 @8BB....68 15@ e8BB...... 160 @BBB....CC 17@ e8BB....cCC. 180 @BBB....cccc. 192 eBBBB...ccCcC 208 @BBBEEBB..... 210 ©.8B688B.. 220 ©.8BBBER. 230 @..8B88B.. aaanesnererets 25a e. 260 @..... ee ee 278 MOB SET 0,240,2,0,1 250 CMB 6,2 290 RLOCMOB 0, 100, 100,0,1 300 SPRITE 0,2,2,1,23,49,323,/231,6,10,7 310 PRINT "KVEC=":XVEC(@), "YVEC="# YVECC@> 320 GoTO310 RUN After a pause of five seconds, the sprite barriers are altered such that the sprite is confined to the central part of the screen. 86 SPRITE MANIPULATION COMMANDS 8.3.5 CHANGE FORMAT: CHANGE spr.enab PURPOSE: To change the enab register. The CHANGE command allows you to alter the enab register whilst a program is running. Spr is the sprite number, and the parameter enab, is the enab register. This controls sprite movement, and checks for sprite/barrier collisions. The commands are as follows: 1- move sprite, this sets a sprite moving. But, you may not want this to happen. To start a number of sprites moving at the same time, see Section 8.3.4 2- do x comparison, this checks to see if either the lox or hix barriers have been crossed. If either of the x barriers are crossed, then control is transferred to the fix register. If neither of the x barriers is crossed, then the sprite continues along its vector. 4- do y comparison, this checks to see if either the loy or hiy barriers have been crossed. If either of the y barriers is crossed, then control is transferred to the fly register. If neither of the y barriers is crossed, then the sprite continues along its vector. EXAMPLE: To change the enab register whilst the program is running: ENTER: 350 CHANGE 0,5 360 PAUSE 5 TYPE: RUN After a pause of five seconds, a second sprite is set up. Both sprites are relocated, and set into motion at the same time. CLEAR spr CLEAR spr.spr To stop one or more sprites. This command stops one or more sprites. Spr is the number of the sprite that you wish to stop, for example, to stop sprites 0, 5, and 6all at the same time, use CLEAR 0,5,6. The CLEAR command ensures that all the sprites specified stop moving at exactly the same time. Using CLEAR with no parameters, stops all the sprites that are currently moving along their vectors. Up to eight sprites may be stopped at any one time. To stop both sprites at the same time: 430 CLEAR 0,1 440 PAUSE 5 RUN After a pause of five seconds, both sprites are stopped at the same time. a8 SPRITE MANIPULATION COMMANDS 8.3.8 INIT FORMAT: INIT PURPOSE: To set the sprite handler into operation. INIT sets the sprite handler into operation, and also sets INFO (0-7) to zero. INIT must be called before any of the SIMONS' BASIC EXTENSION sprite commands can be used. The INIT command also enables background flashing to take place, although flashing does not start until BCKFLASH is used, see Section 7.3.10. WARNING Sprites must not be in motion when INIT is called. If there is any possibility that the sprites are moving, use CLEAR 0,1,2,3,4,5,6,7 before calling INIT. EXAMPLE To initialize the sprite handler, and set up a sprite: ENTER: See example program in Section 8.3.1 TYPE: RUN RESULT: Because the sprite handler has been initialized, all SIMONS’ BASIC EXTENSION sprite commands now function correctly. 8.3.9 NORMAL FORMAT NORMAL PURPOSE: To disable the sprite handler. NORMAL disables the SIMONS' BASIC EXTENSION sprite handler, and should be used whenever VECTOR DRIVEN SPRITES are no longer required. This command is executed automatically whenever you leave a program. EXAMPLE: To disable the sprite handler: ENTER: 450 NORMAL 460 PRINT "SPRITE HANDLER DISABLED! 470 PAUSE 5 TYPE: RUN RESULT: After a pause of five seconds, the sprite handler is disabled 89 SIMONS' BASIC EXTENSION 8.3.10 INFO FORMAT: or: PURPOSE: EXAMPLE: ENTER: NFO(spr) PRINT INFO(spr) To determine the status of a selected sprite. The BASIC variable INFO is initially set to zero. If the sprite collides with a boundary, then INFO is set to one. It is cleared as soon as it is read. The single parameter, spr, is the sprite number. NOTE In order to be able to read the BASIC variable INFO, you must first set it in the x and y flags, which are part of the SPRITE command, see Section 8.3.1 To return the status of sprite 0: 10 PRINT CHRS(147) 2@ INIT 30 MOB OFF @ 4@ moe OFF 1 5@ DESIGN 1,29a464 62 @.... 70 ©. .BEBBB.. 8@ @.8BEEBB.. 90 ©.88888B.. 100 @BBBBBEB. 11@ @BBBB... 28888 120 @BBB... 2888. 130 @BBB....668.. 140 BBB... .88. 15@ e888... 160 @BBB....CC... 170 @BBB....CCC.. 160 @BBB....ccec. 19@ eBBBB...CCCCC 200 SBEBEEEB. 21@ ©.B86888. 220 ©.BBBEEB. 220 ©. .88888. 2an e@... asa @... 260 @.. eee ee 270 MOB SET @,240,2,0,1 280 cmp 6,2 290 RLOCMOB @,100,100,0,1 300 SPRITE 0,2,2,1,23,49,323,231,6,10,7 319 PRINT "SPRITE INFO"? INFOCa> 320 GOTOs10 810 SPRITE MANIPULATION COMMANDS TYPE: RUN RESULT: The sprite's status is returned. Normally it is 0, but changes to 1 when. the sprite collides with a boundary. 8.3.11 SPRX FORMAT: A=SPRX(spr) or: PRINT SPRX(spr) PURPOSE: To determine the x position of a selected sprite. ‘The SPRX command returns the x position of a selected sprite. The parameter spr is the sprite number. NOTE Even though sprite movement may actually be taking place ona low-resolution or multi-colour screen, all sprite coordinates are returned as if ‘on a high-resolution screen, i.e. x coordinates are on ascale of 0-320, and y coordinates are on a scale of 0-200. However, in most situations the scaling deviates slightly from the standard high-resolution screen. limits, ie. for an unexpanded high-resolution sprite, the x coordinates are on a scale of 23-323, and the y coordinates are on a scale of 49-231. EXAMPLE: To return the x and y positions of the sprite: ENTER: 10 PRINT CHRSC147) 20 INIT 20 MOB OFF @ 40 moe OFF 1 5@ DESIGN 1,240464 caleneeenrets 72 &. 28888. 80 ©. 5BB5BB. 99 ©.5B888B... 109 SBBBEBBE.. 110 @BBBB. .. 85888 120 @8B8....8BBE. 130 BBB... .8eB. 149 BEB... 168 150 @8BB.. 2... 160 @BBB....CC 17@ eBBB....ccc. 130 @BBB....cccc. 19@ eBBRE...cCCCC 200 @BBBEBBB..... ant ‘SIMONS’ BASIC EXTENSION e.eenees ©. BBBEEB :-BBBBE © 2 MOB SET 0,240,2,0,1 cme 6,2 RLOCMOB 2,100, 100,0,1 SPRITE @,2,2,1,23,49,323,231,6,10,7 PRINT "K="sSPRKC@> , GoTO310 TYPE: RUN RESULT: As the sprite bounces around the screen, its x and y positions are displayed. 8.3.12 SPRY FORMAT: A=SPRY(spr) or: PRINT SPRY(spr) PURPOSE: To determine the y position of a selected sprite. The SPRY command returns the y position of a selected sprite. The parameter spr is the sprite number. NOTE Even though sprite movement may actually be taking place on a low-resolution or multi-colour screen, all sprite coordinates are returned as if on a high-resolution screen, i.e. x coordinates, are on a scale of 0-320, and y coordinates are on a scale of 0-200. However, in most situations the scaling deviates slightly from the standard high-resolution screen. limits, ie. for an unexpanded high-resolution sprite, the x coordinates are on a scale of 23-323, and the y coordinates are on a scale of 49-231. EXAMPLE: See example program in Section 8.3.12 SPRITE MANIPULATION COMMANDS. 8.3.13 SPR LOC FORMAT: or PURPOSE EXAMPLE: ENTER, TYPE. DISPLAY: A=SPR LOC(spr) PRINT SPR LOC(spr) To determine the start location of the sprite data fora selected sprite. The SPR LOC command returns the start location of the sprite data for the selected sprite. The parameter spr is the sprite number, i.e. if sprite 0 is set to block 32, then PRINT SPR LOC(®) returns 2048. To return the start location of the sprite data in memory: 10 PRINT CHRSC147) 20 INIT 39 MOB OFF a 40 moe OFF 1 5@ DESIGN 1,240464 eokoeee rere 70 @..BBEBB. 80 ©.8BBEEB... 90 ©.5SBEEB. 109 PBBBBBBE 110 C8888... e888 120 @888....868B. 120 BBB... .88B.. 140 @6BR....6B... 180 @BBB......... 160 @8BB....CC... 170 eBeB....ccc.. 180 @ABB....CCCC. 198 @BBBB...CCCCC 200 GBEBBERB..... 219 @.pe0888e 220 ©.888Be8 230 ©..88BRE..... coke perenne) 250 @ - 260 @....... 270 moe SET @ 280 CMOB 6,2 230 RLOCMOB @,100,100,0,1 309 SPRITE 0,2,2,1,23,49,323,231,6,10,7 318 PRINT "SPRITE BLOCK="2SPR LOC(O) 320 PAUSE 5 402.01 RUN SPRITE BLOCK= 240 a3 SIMONS' BASIC EXTENSION 8.3.14 INVERT FORMAT: or: or: PURPOSE EXAMPLE: ENTER: TYPE: RESULT: INVERT A INVERT 8192 INVERT $2000 To invert a sprite. The INVERT command turns a sprite upside-down. The number following the INVERT command must be the address of the first byte of the sprite data, the same address as in DESIGN, see Section 8.2.2 of your SIMONS’ BASIC MANUAL. To invert the sprite while it is in motion: 1@ PRINT CHRS(147) 20 INIT 3@ MOB OFF 0 49 M08 OFF 1 5@ DESIGN 1,240464 60 @.. oldest eren) a0 @.. sae... AED iCoosnogonoocs 110 @....ccecceco 12a @...cceccccoo 13@ @. .cceccecnno 14@ @.cccececoono 159 eeBResBes0000 16@ G6BB6BB880000 178 eBRBBABREODO 180 ©BBBEEBEG0000 19 S6BBESBBB0000 200 expeEeeee0000 21@ easREseee0000 220 eHBBBBBE60000 230 SEGBREBEB000. 240 GHBBEBBEBDD. . 250 WRBBESBEED... 260 CHEBEGBBE. 270 MOB SET 0,240,2,0,1 280 CMOB 5,5 290 RLOCMOB 0,100, 100,0,1 300 SPRITE 0,2,2,1,23,49,323,231,6,10,7 21@ INVERT SPR LOC(a)46a 320 PAUSE 3 33@ GoTos1e RUN The sprite bounces around the screen, inverting every three seconds. ang ‘SPRITE MANIPULATION COMMANDS 8.3.15 REVERSE FORMAT: or: or: PURPOSE: EXAMPLE ENTER, TYPE, RESULT: 8.3.16 SHOW FORMAT: or: or: or: PURPOSE REVERSE A REVERSE 8192 REVERSE $2000 To reverse a sprite. The REVERSE command reverses a sprite. The number following the REVERSE command must be the address of the first byte of sprite data, the same address as in DESIGN, see Section 8.2.2 of your SIMONS' BASIC MANUAL. The reversal procedure uses an exclusive-or, i.e., the following happens: HIGH-RESOLUTION SPRITES MULTI-COLOUR SPRITES dot on - dot off colourd - colour3 dot off - dot on colourt - colour2 colour? - colourt colour3 - colourd To reverse the sprite: 310 REVERSE SPR LOC(0)*64 RUN The sprite bounces around the screen, reversing every three seconds. SHOW addr SHOW addr.line SHOW addr,line,inc SHOW addr,line,inc,mes To show the sprite data at a particular address, or to set up a sprite design grid. SIMONS' BASIC EXTENSION EXAMPLE: ENTER: TYPE: RESULT: The SHOW command shows the sprite data at the specified address. The first parameter, addr is the address of the first byte of sprite data, the same address as in DESIGN, see Section 8.2.2 of your SIMONS’ BASIC MANUAL. The sprite data is taken from memory, and displayed using "@”, °.”, and “B”. Spaces are left for you to insert line numbers. Using the second format, where the parameter line is the start line number, the sprite data is displayed with line numbers starting from line in increments of ten. The third format allows you to specify the increment (inc), as well as the start line number. If, in the fourth format, the parameter, mes, is anything other than a zero, then the sprite is displayed as a multi-colour one. To show the sprite data 10 PRINT CHR#(147) 20 INIT 3@ MOB OFF @ 40 MOB OFF 1 S@ DESIGN 1,240464 68 8. 7e e@. 30 e. gee... hoglasreer reer 110 @....cccccccn 128 @...cccccccop 13@ e@. .cccecccoop 14a e@.cccceccoono 158 @8B86BB860000 160 e8BB888e80000 17@ eBB86BB860000 18@ eBBBBEB880000 19@ esBaeReeB0000 20@ esBssBB880000 210 eesse6BR680000 220 eepsBsBe80000 230 eeseeeBeson0. 240 @BBBESBEEDD. . 250 @BBEGBBERD... 260 @BBBESBBB.... 270 MOB SET 0,240,2,0,1 280 Choe 5,5 290 RLOCIMB 0,180, 100,0,1 300 SHOW SPR LOC(O>+#64,1000,10,1 RUN The multi-colour sprite, and the data used to create it are displayed ‘SPRITE MANIPULATION COMMANDS 8.3.17 ON DETECT FORMAT: PURPOSE: EXAMPLE ON DETECT comm,line To check for sprite/sprite, and/or sprite/text collisions. The ON DETECT command provides continuous detection for sprite/sprite, and/or sprite/text collisions. The first parameter, comm, is the command. This must be a number between zero and three, and specifies the collision type to be checked for. The second parameter, line, is used with command numbers 1, 2, and 3. It specifies the line number that the program jumps to if a collision is detected, just like a GOTO, or GOSUB. The commands are as follows: ON DETECT 0 - disables any active ON DETECT. ON DETECT j,line ~ initializes sprite/sprite collision detection, and specifies a line number that the program will jump toin the event of a collision. ON DETECT ine - initializes sprite/text collision detection, and specifies a line number that the program will jump toin the event of a collision. ON DETECT 3\line1,line2 - initializes sprite/sprite and sprite/text collision detection. If a sprite/sprite collision occurs, then the program will jump to line 1, and if a sprite/text collision occurs, then the program will jump to line 2. To set two sprites into motion, and transfer the sprite data onto the multi-colour screen every time they collide: SIMONS' BASIC EXTENSION ENTER: TYPE RESULT: 10 HIRES 15,0 20 MULTI 6,2,5 3@ COLOUR 5,15 4@ sc=scaae 5@ INIT 5@ MOB OFF @ 70 MOB OFF 1 8@ DESIGN 1,SC+40%64 30 8... 100 Geese 110 @. 120 e. 130 @. 140 @....ccccceco 15@ e...cceccecoo 168 @. .cceeccenon 17@ @.cecceccnooD 189 eese6Reee0000 190 &B8BESBBE80000 200 PEEBR66R60000 210 eeBBeBBe80000 220 S6BBE88R80000 240 eeBBeBBe80000 248 eBsBEse880000 250 esBpeeBe80000 260 esBssBBe8000. 270 G8BBESBEB0D. . 28@ ©BBB6BBE8D... 230 SBBBEBBEE 3@@ MOB SET 0,40,2,0,1 310 MOB SET 1,40,2,0,1 320 CMOB 6,5 330 RLOCMOB,49,123,0,1 348 RLOCMOBI,260,123,0,1 350 SPRITE ©,-3,1,1,23,49,323,231,4,8,7 360 SPRITE 1,1,-3,1,23,49,323,231,4,8,7 378 ON DETECT1, 1000:DETECTO 380 GoTO380 1808 X=(SPRX(O)-239ANDS10 1010 Y=(SPRY(@)-49AND2S4 1820 A=SPR LOC(@>*64+SC 1038 TRANSFER 1,1,%,Y,A 1840 CONTINUE RUN Every time the two sprites collide, the sprite data is transferred onto the multi-colour screen. e186 SPRITE MANIPULATION COMMANDS. 8.3.18 CONTINUE FORMAT: PURPOSE: EXAMPLE: RESULT: CONTINUE To return program execution to where it was before a collision was detected. The CONTINUE command returns program execution back to where it was before a collision was detected, just like a RETURN at the end of a sub-routine. CONTINUE should be used at the end of sprite collision routines. To return program execution after a sprite collision routine - See Section 8.3.17 line 1040 After the sprite data is transferred onto the multi-colour screen, program execution resumes. 8.3.19 TRANSFER FORMAT: PURPOSE: EXAMPLE: RESULT: TRANSFER expx.expy,x.y,addr To transfer sprite data to high-resolution data. The TRANSFER command transfers sprite data to high-resolution data. The first two parameters, expx, and expy, are the x and y expansion factors; a “1” denotes normal size, a "2" denotes double size, etc. The next two parameters, x and y, are the top left-hand coordinates of the area to which the sprite data is to be transferred. X and y must always be coordinates for a high-resolution screen (0- 320, and 0-200), even if you are in multi-colour mode. The final parameter, addr, is the start address of the sprite data, the same as that used in DESIGN, see Section 8.2.2 of your SIMONS' BASIC MANUAL. NOTE If you are transferring multi-colour sprites to a multi-colour screen, then the colours are converted as follows SPRITE CODE PLOT TYPE A o B 1 Cc 2 D 3 To transfer sprite data onto the multi-colour screen - See Section 8.3.17 line 1030. Every time the two sprites collide, the sprite data is transferred onto the multi-colour screen. ‘SIMONS’ BASIC EXTENSION 8.3.20 CREATE FORMAT: PURPOSE: EXAMPLE: ENTER TYPE: RESULT: CREATE x,y,addr To create sprite data from high-resolution data The CREATE command creates sprite data from high-resolution data. The first two parameters, x and y, are top left-hand coordinates of the area from which the sprite data is to be created. The final parameter, addr, is the start address of the sprite data, this is where the sprite data will be written to when the CREATE command is executed NOTE Even though the sprite data is written into memory when the CREATE command is executed, you will still have to use the MOB SET command (see Section 8.2.5 of your SIMONS’ BASIC MANUAL) if you wish use the sprite. To create sprite data from high resolution data: 1@ HIRES 15,0 20 CIRCLE 110,110,10,10/1 3@ PAINT 110,110,1 4@ CREATE 100,100, scae0+40%64 5@ MOE OFF @ 5@ RLOCMOB 0,123,143,0,1 78 MOB SET @,40,15,0,0 ge@ INIT 9@ SPRITE 0,2,2,1,23,49,323,231,4,8,7 10 GoTO100 RUN 1C5D5€5 G5A5B5C6" 70 PLAY 1 80 GOTO 70 RUN A filtered, ascending scale is played. MODE resonance,voice,type,volume To set up the filter mode, resonance, and volume. The MODE command sets up filter mode, resonance, and volume for single or multiple voices. The first parameter, resonance, is any number in the range 0-15, and specifies how strongly the band of frequencies at the cutoff point are emphasized. The next parameter, voice, selects which voice, or voices are put through the filter. The voice number isa "1" for voice 1, a2" for voice 2, and a4” for voice 3. Multiple voices are specified by adding together the numbers of the voices that you wish to filter. The next parameter, type, denotes the filter type, a “1” specifies the low pass filter (all frequencies or harmonics below the cutoff frequency are allowed to pass through), a "2" specifies the high pass filter (all frequencies or harmonics above the cutoff frequency are allowed to pass through), and a4” specifies the band pass filter (all frequencies or harmonics around the cutoff frequency are allowed to pass through). The final parameter, volume, is a number in the range 0-15, and controls the output volume. Itis the same as VOL (see Section 11.2.1 of your SIMONS' BASIC MANUAL). 92 EXAMPLE: ENTER TYPE: RESULT: 9.3.3 PULSE FORMAT: PURPOSE: EXAMPLE: ENTER: TYPE RESULT: MUSIC COMMANDS WARNING IF MODE HAS BEEN USED TO SET UP THE, VOLUME, THEN VOL MUST NOT BE USED AFTER IT. To use MODE in conjunction with FILTER to set up the filter mode, resonance, and volume: 10 VOL 15 20 WAVE 1,01010000 30 ENVELOPE 1,10,10,8,1 40 FILTER $031A 50 MODE 15,3,7,9 60 MUSIC 9,”1C5D5E5 G5A5B5C6” 70 PLAY 1 80 GOTO 70 RUN A filtered, ascending scale is played PULSE voice,value. To set up pulse width The PULSE command sets up pulse width for a voice, or number of, voices. The first parameter, voice, is the voice number, a1”, “2”, or "3", To set up pulse width for multiple voices, just add the voice numbers together. The second parameter, value, is any number in the range 0-4095, and specifies the actual width of the pulse, 2048 being a perfect square wave. In order to work out the precise pulse width, use the formula on page 462 of the PROGRAMMERS REFERENCE GUIDE. To vary the pulse width for voice 1: 10 VOL 15 20 WAVE 1,01000000 30 ENVELOPE 1,5,10,8,1 40 MUSIC 9,”1C5D5E5 G5A5B5C6 50 FOR I=TO4096 STEP 128 60 PULSE 1,1 70 PLAY 1 80 NEXT RUN An ascending scale with varying pulse width is played. 93 SIMONS’ BASIC EXTENSION 9.3.4 BEEP FORMAT: BEEP PURPOSE: To produce a “beep”. The BEEP command has no parameters, and simply produces a “beep” from voice 1 EXAMPLE: To produce a beep: TYPE: BEEP RESULT: ‘A beep is produced from voice 1 o4 EXAMPLE PROGRAMS SECTION TEN EXAMPLE PROGRAMS 19.1 INTRODUCTION This section contains three programs that demonstrate what may be achieved when using SIMONS' BASIC and SIMONS' BASIC EXTENSION commands. Simply type each program in and RUN it 19.2 PROGRAM 1 - GRAPH PLOTTER This program allows you to define formulae, and plot graphs derived from these formulae in high-resolution mode. 1@00 DIM K<255),£a8¢27) 1818 KS="9123456789 ABCOEFGHIJKLMNOPORSTUVLIXYZ +-#/t. (06>* 1020 K$=KS+CHRS (20) +CHREC 13) 1030 FORI=1 TO LENCKS> 1040 KCASC(MIDS(KS,1,1))9=1 1050 NEXT 1060 HIRES 15,0 1070 LABEL 10,10, "ENTER EQUATION ",1,1,2,1,10,0,0 1080 LABEL1@,38,"USE VARIABLES 'X' AND '¥'",1,1,2,1,10,0,8 1098 LABEL10,58,"¥ =",1,1,2,1,10,0,0 1100 Sx*SQ:SY=S@!EXEC GET. CHAR 1118 EXEC EVAL.STRING 1120 cas-evs 1130 HIRES 15,0 1140 LABEL 10,10, "ENTER RANGE*,1,1,2,1,10,0,0 1150 LABEL 10,3@,"MIN X*,1,1,2,1,10,0,0 1160 Sk=70:SY=30:EXEC GET.CHAR 1178 EXEC EVAL.STRING 1180 LX=VAL (EVs) 1190 LABEL 10,5@,*MAX X*,1,-1,2,1,10,0,0 1200 SX=70:SY=SOrEXEC GET.CHAR 121@ EXEC EVAL.STRING 1220 HX=VALcEVs) 1238 IF HX<=LX THENI130 1240 LABEL 10,78,"MIN ¥",1,1,2,1,10,8,0 1250 SX=701SY=7@!EXEC GET.CHAR 1260 EXEC EVAL.STRING 1278 LY=VAL 1280 LABEL 10,38,*MAX Y",1,1,2,1,10,0,0 1290 SK=701SY=90!EXEC GET.CHAR 1300 EXEC EVAL.STRING 10-4 SIMONS' BASIC EXTENSION 1310 HY=vaALcevs> 1320 IF HYC=LY THENI13@ 1330 HIRES 15,0 1348 LABEL 10,10, ENTER STEP VALUE",1,1,2,1,10,8,0 1950 Sx=190:SY=101EXEC GET.CHAR 136@ EXEC EVAL. STRING 1378 SP=vAL ,@,a:GOTOISae 1530 DRAW TO SCK(X+NMK> ,200-SCYCY+MY) 1 1542 NEXT 155@ LABELES, 192, "PRESS MSPACEM@ TO CONTINUE", 1,1,1,1,8,0,8 1560 GET EStIF ES<>" " THENISEG 157@ RUN 158@ PROC GET.CHAR 1530 D=sx 1608 LABEL 0,SY,"_ 1610 LABEL D,SY," 1620 FORI=1T010 1630 GETES: IFES<>"*THENIE6@ 164@ NEXT 1650 GoTO1sa0 1660 © = ASCCES> 1678 IF KCE) = @ THENIG00 1688 IF E=2@ THEN O=D+10#(0>Sx 1690 IF E=13 AND DDSx THENI770 1788 IF E=13 THENIGO0 1710 LABEL 0,SY,"a @*,0,1,2,1,10,0,0 1720 LABEL 0,SY,E#,1,1,2,1,10,0,8 1738 EQS((0-SH)/10)=ES 1740 D=D+10 1750 IF 0>31@ THEN o=310 1768 GoTO1se0 1778 ENO PROC 1788 PROC EVAL.STRING 1798 Evse"= 1898 FOR 1=@T0<320-sx)/10 1610 IF EQS(1>=* "THENIB40 1828 EVS=EVs+Easc1> 1630 Easc1)=* 1640 NEXT 1658 END PROC 71/1,2/1,10,8,0 O-1,2,1,18,0,8 coToisea 102 EXAMPLE PROGRAMS 10.2 PROGRAM 2 - DOGGY This program draws a famous dog on the multi-colour graphics screen. 1000 1010 1020 103@ 1eaa 1050 1960 1078 1980 19se 1100 1118 1120 1130 1140 1150 1160 1200 1210 1230 126e 1278 1ese 1358 1360 1308 1398 1400 1420 1aae 1ase 1478 1480 1490 1500 HIRESe.1 MULTI 5.2.11 coLour 6,3 BLOCK @,100,168,200,1 VLIN 48,160, 199,3 VEIN 118, 160,198,3 BLOCK 43, 161,118,199,2 LINE 135, 182,131,160, DRAW TO 34,160,3 TO 30,152 TO 135,152 DRAW TO 125,69,3 TO 116,63 HUIN 192,48, 119,3 CIN 176,48, 119/3 HLIN 165,49, 119,93 HLIN 97,59,127,3, HLIN 97796 ,51,3 LINE 48/69,38,65,3 RAW TO 31,153,3 PLOT 57,729, ORAU TO 58,109,3 ARC 54,110,90,300,9,4,6-3 DRAW TO 5198/3 TO S471 ORAL TO 74,67-3 TO 88-69 TO 89,72 LINE 91,68,91,73,3 DRAW TO'95,73.3 LINE 78,60,93/60,3 DRAW TO 98,66,3 TO 93,70 LINE 99-68,116.71,3 DRAW TO 119,68,3 TO 118,64 To 113,35 DRAW TO 187,36,3 TO 187,43 TO 110,57 DRAW TO 100/55.3 LINE 199-56. 105,52,3 DRAW TO 105,35,3 TO 187,35 HLIN 39,110,114,3 HIN a3yt1t,114,3 HLIN 68/38, 107,3, HUIN 63,82,88,3 HLUIN 63/68,79,3, VLIN 70,47,67,3 YLIN 73,47,67,3 LINE 103,54, 102,543, DRAW TO 101,43,3 TO 180,42 To 98,38 ORAL TO 91,30,3 TO 85,29 TO 82,32 DRAW TO 78,36/3 TO 78.39 TO 77,43 RAW TO 76/45, TO 70,87 TO 69.24 DRAl TO 6S,19/3 TO 59,19 TO 56,20 DRA TO 52,23,3 TO 50,27 TO 50,41 DRAM TO S2,6,3 TO 52,49 TO 46,55 DRAW TO 44,57,3 TO 44,64 TO 47,70 10-3 SIMONS' BASIC EXTENSION 191@ LINE 52,50,58,54,9 1520 LINE 50,60,40,53,3 1530 CIRCLE 61,16,4,2,3 1540 LINE 96,72,90,69,9 1558 PAINT Se, 156,2 1960 PRINT Se, 146,2 1570 PAINT S@,120,2 1588 PRINT S@,98,2:PAINT 100,98,2 1590 PRINT 50,90,2:PAINT 108,902 1600 PAINT 55,80 ,3:PAINT SS, 110/39 1616 PAINT 6e, 16,3 1620 PAINT 71,60.2 1690 Low COL 1/2/11 1640 PAINT 62,58, 11PAINT 88,48,1 1650 PAINT 186,50,1 1668 LOW COL 7/2/11 1670 ARC 2,290, 18, 10,20,20 1680 PRINT 0,0, 1 169@ FOR T=s@ TO 188 STEP 18 1700 ANGL 2,@,T,40,40,1 1720 DESIGN @,sccee 1760 @......8888008..68.... 1790 ©. .es8s5BBEEEBBEBEREE.... 1799 @.See9peHREBBERBABEBEEE 1200 eHsEEEsERRREEERREREBEEES. 1910 eessseesBeeEenEEEBEEEERE 1920 eppseEebEEREEEEERAREEEBAR 1930 @eepPsceRReRREREERRRABEEE 1940 0. SRepBEERBEEEBBREBEEEED. 1950 #...BeEREREABARBAREEER. . 1920 1830 eee 1940 MOB SET 1-48,11-8 1950 MOB SET 2.48,1,1,€ 1950 MOB SET 3/48/1,1,0 1970 OB SET 4.48,1,1-0 1980 WoB SET 549.1,1.0 1990 MOB SET 6.48,1,1-0 2000 MWS 1, 100,50, 100,50,3,2 2010 mewe 2,120,110,120,118,1,0 2020 mene 3/300 /60,320,08,1,0 2230 hOB 4,70 ,00,78,00,1 2040 ME 5.200,50,200,47/1,0 2250 MWe 6,150.80, 150,20,9,0 260 INIT 2870 FORT=1T061READ x 2080 SPRITE T,Xx,0,2,0,0,0,0,0,0,0 2080 NEXT 2100 START 2118 corToe11e 2120 DATA 1,-1,2,-2,1, eeasesss3 19.3 PROGRAM 3 - ROAD RACER ‘A winding road, and a fast car. How long can you last? 1000 1010 1220 1030 tea 1050 1060 1070 1ee0 1098 1100 1118 1120 1130 1140 1158 1160 1170 @ 1180 1190 1200 1219 1220 1230 1240 1250 1260 1270 1260 1290 1300 1310 1320 1339 1340 1359 1360 1378 1380 1390 1400 DIM K¢32>,J¢8), PKC? ,PYC7) KC109=-12K C18) =1tKY=197 READ ARR J DATA 0,0,1,1,1,8,-1, READ ARR PX READ ARR PY oa DATA @,25,45,35,230 245,260,250 DATA 0,80, 160,240,25,85,145,205 DEF FNOCI)=(RND(1)48)-4 DEF FNECID=INTCRND( 141) +1 FOR I=9 TO RNOCTID#10 G=RNOCTID © NEXT DESIGN 1,240%64 --Deocn. . Qocoodeoace @.88.CCC.88 e.eBncccoee. . ©.88.CCC.6B.. eee coCeeey @....cDc... eae coca eee CoceES @...cccce.. eee .ccccc.BB. @B8.CCCCC.BB. esspcccccose. eB8.ccocc.BB. e88...0...88. e...00000.. @...cococ.... DESIGN 1,241464 lemmecccoos e. .ccccccc. ®.cccceccce emecaccccoss ®...cccccccc. ®.ccecccecece 10-5 EXAMPLE PROGRAMS SIMONS' BASIC EXTENSION 1410 1420 1430 1490 1450 1460 1470 1460 1age 1500 1518 1520 1530 1saa 1558 1560 1578 1580 1590 1600 1610 1620 1630 1640 1650 1660 1670 1680 1690 1720 1710 1728 1730 1740 1750 1760 178 1780 1798 1800 1810 1320 1830 1840 1850 1860 1970 1see 1890 1900 eccececcceece e@.ccccpeeccc. @.ceccecccac. @c.cBBBceBcc. ®.cccepacc... ecceccecc.c.. ®. .BccBCccEC. ®. cepceceeccc eccecesscccc. @.cccescece.. ®...eceBBcccc ©®....8BCCEB.. ©... .BBBCC.. Choond eres uerne. IFPEEK (16008 )=128 THENISSO POKE 16000, 126 EXEC DEF.ExPL HSs="a00000" Lestat Ltao-e6 SL=15#e: s=54272 F181:L (2) =eatL¢3 (5) =721L(6)#89#L 67 =07 x8: SR=SL +0. 0-500 ye21a M245: Mx=200 SC=SCREEN vo. @ EXEC MOBS.OFF PRINT CHR$C147> :COLOUR 2,12 PRINT ATC12,10) "MKEYBOARD (F13" PRINT AT(12,12) " — OR* PRINT ATCI2,14) “JOYSTICK CF73" A = INKEY. IF AC>1 AND AC>7 THENI730 IF 27 THENIE20 IPs PRINT ATC11,16> "USE KEYS+-* PRINT ATC13,17) "SAM TO MOVE LEFT" PRINT AT(13,18) "SDM TO MOVE RIGHT™ PAUSE 3 soTo1sse 1P=2 PRINT AT(8,16> "PLUG JOYSTICK IN PORT 2" PAUSE 3 COLOUR 5,13 PRINT CHRS¢147> FORI=24 TO @ STEP-1 PRINT ATC14,1)" "2SPCC6>" |" PRINT ATC14,1>* -3SPCC6)* NEXT 183 10-6 1910 1920 1930 1940 195@ 1960 1970 1980 1980 2000 2010 2020 2030 2e4a 2050 2e6o 2070 zea 2030 2100 2110 2120 2130 2140 2150 2160 2170 2180 2190 2200 2210 2220 2230 2240 2250 2260 2270 2260 2290 2300 2318 2320 2330 2340 2350 2360 2370 2380 2290 2400 EXAMPLE PROGRAMS PRINT AT(34,1) "SCORE" PRINT AT(34,5) "HIGH" PRINT AT(34,6) "SCORE" PRINT AT(34,7) RIGHTSCHSS,4) POKES3265, 16 RLOCMOB @,Sx,SY,0,1 INIT © ON DETECT 2,2350:DETECTI FORI=1 TO 7 RLOCMOB 1,PXCI),PYCI),O-1 SPRITE 1,0,2,3,0,0,0,8,0,0,0 MOB SET 1,241,5,0,1 NEXT. MOB SET ©,240,1,0,1 cMos 0,2 START 1,2,3,4,5,6,7 voLis WAVE 1,e@ae1e@a:uAVE 1,01000001 ENVELOPE 1,3,8,8,8 PULSE 1,2046 DOKE s,5e0 T1s="a90000" X=FNOCO) FORI=1 TO FNECS)+2 SL=SL+x'SR=SL+0 IF SLCMN THENSL=MNISR=SL+0 IF SR>MX THENSR=Mx!SL=SR-O INT POKE SC+R,L(SR AND7) TH IF T/SQ=INTCT/S@> THEN EXEC INC.LEVEL ON IP GoTOze4e,2270 K=PEEK (KY ANOS 1 Dx=K CKD coTozesa (OY ANDIS Dx=sCI> XX=SPRX(@) SX=SK+0x SPRITE 0,0X,0,2,0,0,0,0,0,0,1 PRINT AT(34,2) RIGHTSCTIS,4) NEXT. goTo2 120 CLEAR IF TI$>HS$ THEN HSS=TIS FOR I=1 To 6a WAVE 1, 10000001 DOKE s,aaa0 MOB SET @,241+1AND3,1,0,1 10-7 SIMONS' BASIC EXTENSION 2419 VoL 15-174) 2420 NEXT 2430 EXEC MOBS.OFF 2aa@ coTo1see 2450 PROC DEF.EXPLN 2460 FORI=242%64 TO 244%64 2470 POKEI,2tINTCRNOC1)#5) 2480 NEXT 2490 END PROC 2500 PROC INC.LEVEL 2519 O=D+<0>309 2520 SY=sY+(Sy>120)43 2530 RLOCMOB 0,SPRX(O),SY,0/1 2540 sD=sD-(s0< 140040 2550 DOKE S-so 2560 END PROC 2570 PROC MOBS.OFF 2500 FORI = @ TO 7 2590 mop OFF I 2600 NEXT 1 2610 END PROC 10-8 ERROR MESSAGES APPENDIX A ERROR MESSAGES In the course of using SIMONS' BASIC with SIMONS' BASIC EXTENSION, an error message may appear. These messages are unique to SIMONS’ BASIC and SIMONS’ BASIC EXTENSION, and along with the HELP command (see section 2.5), make debugging much easier, and faster. Each error message, its meaning and probable cause is given in this appendix. 2 BAD MODE This occurs when any parameter in a command is outside the range allowed. 2. NOT HEX CHARACTER An attempt has been made to convert a non-hexadecimal number into its decimal equivalent 2 NOT BINARY CHARACTER An attempt has been made to convert a non-binary number into its decimal equivalent. 2 UNTIL WITHOUT REPEAT ‘The UNTIL command has been used without any previously declared REPEAT. 2 END LOOP WITHOUT LOOP. The END LOOP command has been used without any previously declared LOOP. 2 END PROC WITHOUT EXEC. The END PROC command has been used without any procedure having been executed. 2 PROC NOT FOUND An attempt has been made to select a procedure that does not exist. ? NOT ENOUGH LINES Not enough lines have been set up for a MOB design grid 2 BAD CHAR FOR MOB IN LINE n A parameter within the MOB design stage is outside the range defined. The line number of the error (n), is always that where the DESIGN command was executed, although this does not necessarily mean that the fault is in that line. SIMONS' BASIC EXTENSION 2 STACK TOO LARGE This occurs if you have nested more than nine procedures or program loops. 2 NULL STRING ERROR ‘An attempt has been made to pass an empty string to another command a2 GLOSSARY GLOSSARY A list of terms used in this manual. ADDRESS Each memory location has its own identification number. This number is called the address. BASIC INTERPRETER Since binary is all that the processor really understands, a BASIC INTERPRETER (i.e. SIMONS’ BASIC) is a program that translates the commands that you type, into strings of binary numbers that the computer will be able to understand, and act on. BINARY Number system to the base 2, the only number system that the processor really understands. Applications of binary in computers result from simple two-state devices, i.e. on, or off. BIT A single binary number, either a, or a 1. The word bit comes from combining Binary with digIT. BUFFER A temporary storage area in the computer's memory. BUG ‘A mistake in the program that causes it to “crash out”. BYTE An eight-bit binary number. The largest decimal number that a byte can represent is 256. DEBUGGING Going through the program, and taking out all the bugs. DEVICE NUMBER Because data can be sent to a number of devices external to the computer (e.g screen, printer, disk drive), each device has its own identification code, so that the computer can distinguish between them, DIRECT MODE In DIRECT MODE you may type a command (without a line number), and that command is executed as soon as you press . Whereas in PROGRAM MODE, none of the commands are executed until the program is RUN. SIMONS' BASIC EXTENSION FLAG A flag is a pointer in memory, that helps the computer keep track of what's going on. If a condition occurs, then the flag is hoisted up the flag-pole, and the computer can act accordingly FLOATING-POINT LIMITS Floating-point constants allow you to work with figures of up to nine digits, representing values between -999999999 to +999999999. Numbers smaller than 0.01, or larger than 999999999 are printed in scientific notation HEXADECIMAL Another major number system (the other is binary) used by computers. Hexadecimal is to the base 16, and is closely related to binary. INTEGER LIMITS Integer values must be within the range -32768 to +32767. KERNAL The operating system of the COMMODORE 64. All input, output, and memory management is controlled by the KERNAL. NYBBLE Half a byte, or a four-bit binary number. PIXEL The smallest addressable location on the screen. Everything that your computer displays, from text to high-resolution graphics, is made up of pixels. PROGRAM CRASH An unwanted halt in program execution, usually resultant in an error message RAM Random Access Memory; this is free memory available to the user. The contents of RAM are not retained when the computer is switched off. ROM Read Only Memory; ROM is not available to the user, it contains the computer's operating system, and is retained when the computer is switched off. SECONDARY ADDRESS The secondary address is a supplementary command used when transferring data between the computer, and one of its peripheral devices. SPRITE UPDATE Calculations relating to the current position of the sprite, and its new position. The frequency with which these calculations, and actual sprite movements take place are determined by the parameter sp, in the SPRITE command INDEX INDEX ADD ALL.. ADD ARR ALTER... BACK... BARRIER BCKFLASH BEEP BINS CALCX CALCY cecoL CHAIN CHANGE CLEAR... CONTINUE occ , Converting from decimal/binary to hexadecimal . Converting from decimal/hexadecimal to binary . COPY ARR : CREATE DEEK . DEG... DELETE DESIGN DIV ALL. DIVARR ... Dogay program .. DOKE 5 DRAW TO Dss ECOWe teers ELEMENTS ....... EVAL ... FILTER GRAD coonoo.s00 : Graph plotter program . GRID SIMONS' BASIC EXTENSION HELP . HEXS . High-resolution graphics HIMEM . HLIN HLOAD | HSAVE.. INFO INIT INPUT ARR . INVERT . LABEL . 6-5 1-3 Loading SIMONS’ BASIC EXTENSION LOMEM......... LOW RES . MAX... MCOL MIN. MODE MUL ALL. MUL ARR : Multi-colour graphics . Music commands . NORMAL. . ON DETECT PREPARE . PRINT ARR . PROTECT PULL .. PULSE PUSH .. READ ARR. RENUMBER REVERSE . Road racer prog 10-5 ROTATE .... 710 INDEX SCALE SCHR . SCOL. SCRATCH . SCREEN SUB ALL SUB ARR. SUM. TICK... ae TRANSFER . UPPER. . VLIN.. XVEC ... YVEC ZER ARR..... we = 7A2 @COMMODORE BUSINESS MACHINES eis All rights reserved. No part of this program or er i MW Au Ao tet cele copied, transmitted or otherwise reproduced Ree cn uke et Lav oa COMMODORE BUSINESS MACHINES Oe 675 Ajax Avenue, Slough Trading Estate, Slough, Peeecey a aes | Poa en commodore COMPUTER

You might also like