Home

SAM Coupé Users` Manual - SAM Coupé and other Spectrum

image

Contents

1. Da LIA EHE Add 70 to obtain map position of a key plus SHIFT Add 140 to obtain map position of a key plus SYMB Add 210 to obtain map position of a key plus CNTRL E g a is at position 70 A is at position 140 180 Index 181 Index ABS ACS addition address AND animation apostrophes arrays array variables ASCII code ASN AT ATN attributes AUTO BEEP BIN BIN bit BLITZ block graphics BLOCKS BOOT BORDER brackets BREAK button BRIGHT BUTTON byte cables calculations CALL CAPS lock cassettes cassette recorder channels character set CHR CIRCLE cleaning CLEAR CLOSE CLOSE SCREEN CLS CNTRL key 46 132 47 132 44 60 113 114 132 54 132 82 35 168 38 132 39 133 47 133 87 133 47 133 70 133 49 133 94 134 90 134 134 110 134 78 134 89 178 88 134 115 134 67 135 45 167 9 135 70 135 135 110 135 3 4 10 171 44 113 135 14 135 178 15 10 20 107 118 88 136 59 89 136 76 136 15 39 114 136 112 136 79 136 34 79 137 85 138 178 CODE colons colour chart commands commas conditions CONTINUE conttol codes COS CSIZE cursor cursor keys Customer Care Line DATA DEFAULT DEF FN DEF KEYCODE DEF PROC DELETE DELETE key DEVICE DIM DIR disks disk drives DISPLAY DIV division DO DPEEK DPOKE DRAW DUMP DUMP CHR
2. one and the same thing and that a value of 0 represents silence all the way up to 16 for maximum noise By changing volume levels over two channels the stereo effect is created See if you can locate which SOUND instructions control which effect and alter their codes 102 Chapter 9 EXPANDING THE SYSTEM O the Euroconnector O using a printer O LPRINT and LIST O DUMP f the SCART socket Ht SY O joysticks V 4 a of mice and m BD light pens Tis pleasant Sure to see one s Name in print Lord Byron 103 Chapter 9 EXPANSION CONNECTOR SCART SOCKET Expanding the System One of the main design philosophies behind the SAM Coup has been to build in as many features as we can that will allow you to expand your system and to upgrade the computer when new products come onto the market So the machine will not fall out of step with innovations because it s ready and waiting for the future The last two Chapters explained how the computer works with music and sound generators This Chapter deals with the many other devices that can he linked to the machine and the following Chap ters deal with additional memory and communicat ing with other computers and networks The SAM Coup s main expansion connector is the 64 pin Euroconnector at the back of the machine It is capable of sending power to other devices and handling data colour and sound sign
3. O BORDER 1 changes the screen BORDER to deep blue with the normal PALETTE An attist needs something to paint on as well as tools to paint with and you ate provided with a PEN and PAPER to achieve this Every character or graphic image that you PRINT onto your screen can have a different background or PAPER colour and you can select a different colour PEN as well You may use the command INK instead of PEN if you prefer it will still appear in the programme listing as PEN Try changing the colour of your screen background with CJ PAPER 6 PRINT bumble bee which will appear as black on yellow Now change your PEN to red with O PRINT PEN 2 well red and experiment with different colour combina tions If you prefer a temporary state the command OVER can be used Please see Glosaty This computer can change its style of video display to suit your needs There are four screen MODES available for your use and each one uses different amounts of memory and offers different attributes A new screen MODE is selected simply by typing in MODE n with n being the number from 1 to 4 as explained below 67 Chapter 5 Spectrum Compatible MODE Alternative cells Utility MODE High tesolution Colour and Light MODE 1 gives you 24 lines to use with each line consisting of 32 cells made up of a pattern of 8 x 8 dots and spaces like the A illustrated later in this chapter Your choice of
4. 52 Chapter 4 Tt is a capital Mastake to Theorize before One has data Sir Arthur Conan Doyle READ RESTORE ADVANCED SAM BASIC same way as it waits for you to INPUT via the keyboard and each DATA statement is made up of a list of expressions separated by commas The way you call up these items of DATA is to READ them Try out this routine CJ 10 READ w y 2 20 PRINT w x y z 30 DATA 1 22 333 4444 40 STOP What you have done is to tell the machine to READ four items of DATA and allocate them with the variables w x y and z When the computer READs the list of DATA for the first time it takes the first expression Next time round it takes the second expression and so on until all the DATA has been READ Now change the order of your PRINT state ment and see what happens Finally remove the last item of DATA from line 30 and watch the computer search in vain You can make further use of the expressions in a list of DATA by instructing the computer to RESTORE or reset the variables Repair lines 20 and 30 of that last routine and then add the following lines O 5 READ p q 6 PRINT q 7 RESTORE 5 Run it once and note the effect Now remove line 7 and see what effect the missing RESTORE has Variables are also automatically RESTOREd when ever a BASIC program is LOADed or RUN 53 Chapter 4 ADVANCED SAM BASIC READ LINE String variables can also be READ e g READ a b
5. Blue Lin Qut 18 12v Power In 8 STROBE 1 8 Red TTLOut 19 Comp Video Out 9 STROBE 2 9 Green Earth 20 Bright TTL Out 10 Green TTL Out 21 GND 11 Green Lin Qut 173 Appendix Pin Connections EXPANSION CONNECTOR Standard 64 pin Euroconnector socket with rows A C fitted Note that row A is at the bottom of the Euroconnector and row C is located at the top thus 1C 32C 1A 32A PIN SIGNAL PIN SIGNAL 1A DBDIR 1C IORQ 2A RD 2C MREQ 3A WR 3C HALT 4A BUSAK 4C NMI 5A WAIT 5C TNT 6A BUSREQ 6C CD1 7A RESET 7C CDO 8A CMI 8C CD7 9A REFRESH 9C CD2 OVOLTS IOC 5 VOLTS 11A AO 11C 12A Al 12C CD5 13A A2 13C CD3 14A A3 14C CD4 15A 4 15C CPU CLK 16A A5 16C 15 17A A6 17C 14 18A A7 18C 13 19A A8 19C 12 20A A9 20C A11 21A 10 21C DISK2 22A NO CONNECTION 22C 23 23 _ 24 8MHz 24C DISK1 25A RED1 25C PRINT 26A GREEN 1 26C BLUE1 27A CSYNC 27C ROMCSR 28A SPEN 28C AUDIO RIGHT OUTPUT 29A BLUEO 29C AUDIO LEFT OUTPUT 30A REDO 30C COMP VIDEO 31A BRIGHT 31C GREEN 0 32A 5 VOLTS 32C 0 VOLTS 174 System Variables There are over 600 bytes of system variables available for the advanced programmer The full list is contained in the SAM Coup Technical Manual available from MGT The following list is of the most useful system variables which are altered by e g POKE SVAR 8 10 or POKE SVAR 1 LU They can be examined by e g O PRIN
6. RETURN Now wind back the cassette to the beginning and try LOADing my name The Sam Coup will recog nise the first program on the cassette but will ignore it because it was called amnesia and continue searching until it finds the correct program title MERGE Switch off the computer finish your tea switch it back on and rewind the cassette LOAD amnesia again and press RETURN to display the program Now you ate going to try something smart by joining your two programs together and making them MERGE Type in the instruction MERGE my name RETURN and send the program into the Sam Coup s memory in exactly the same way as a normal LOADing procedure Now examine your listing You will notice that line 50 of amnesia has been replaced by line 50 of my name and your origi nal program is now nine lines long RUN it and enjoy your first home grown computer game It may be primitive but it s not a bad start d What you have just done is to lake your first steps in a computer language called BASIC and the next Chapter is devoted to explaining how BASIC works Before you plough into it here s a summary of the four important instructions you have been using SAVE name christens a program and commands the computer to send a copy of that program from its memory to be recorded 25 Chapter 3 Software LOAD loads the first program recognised by the computer wiping out the old memory LOAD name loa
7. axis and the line from the centre of the circle to point b because the Sam Coup uses radians instead of degrees To convert from radians to degrees you divide by PI and then multiply by 180 And to convert degrees to radians you divide by 180 and then multiply by PI SIN is a function that calculates how far point b is above the x axis and this distance is known as its SINe COS calculates how far point b is to the right of the y axis the distance being known as its COSine If b goes to the left of the y axis its COSine value becomes negative Similarly if it drops below the x axis the SINe results in a negative value is the function that gives the TANgent of a which is simply the SINe divided by the COSine ASN ACS and ATN are short for arcsine arcosine and arctangent and these are the functions used to find values of a that have given a particular SINe COSine or TANgent Functions Those mathematical and trigonomettical key words act equally well inside computer programs along with several others you have yet to come across Collectively they known as functions and what they have in common is the fact that they all work 47 Chapter 4 EVERYDAY BASIC with numbers in order to give a result Functions are used by typing them in and then giving them an argument to work on They can be mixed in with other sorts of operations in the same expression but they will always be worked ou
8. c DATA one fine day READ UNE allows quotes in DATA statements to be omitted So if O DATA sam dog 123 was part of your program READ LINE a would first make a sam then dog and finally 123 with successive READs Any words without quotes that are used in DATA statements must be legal numeric values So sam is fine but 1x is not TRUNC Another useful function for taking DATA from string arrays is the ability to TRUNCate them be deleting any trailing spaces So whereas DIM a 10 10 LET a 1 sam PRINT 1 my will PRINT sam my the use of PRINT TRUNCS 1 results in sammy It should be made deat that names up to 10 charac DIMensions ters long are allowed when DIMensioning arrays not including any spaces The DIMensions that appear as numbets inside brackets can be between 1 and 65535 and the total size of the array is limited only by the available memory This example would use up 200K CJ DIM name 10000 20 DIM coords 100 2 LENGTH Array DIMensions can be returned by using LENGTH for one or two dimensional arrays and variable addresses So for example after DIMensioning a as 4 6 O LENGTH 2 would give 6 54 Chapter 4 ADVANCED SAM BASIC The addtess of the first byte of a number can be found by using LENGTH 0 n which is useful for telling CALL the location of a variable so that it can be modified Brackets ate required after the name of
9. 129 Chapter 12 ERROR CODES the error so if there is another mistake within the error handling routine it will be handled normally Subroutines and procedures will return to the state ment that comes after the rogue that caused the error when they RETURN or END PROC Now ON ERROR will activate itself once again and go hunt ing for the next mistake You can CONTINUE to go back to the state merit that caused the error without re enabling ON ERROR but if you CONTINUE while the error is BREAK then you will go back to the next state ment To keep the Basic stack correct you can use POP to get rid of aRETURN or END PROC address should you decide to CONTINUE instead of RE TURNing Intelligence isn t To make no Mistakes but to See how to make Them good Bertolt Brecht 130 GLOSSARY like short words and vulgar fractions Winston Churchill 131 Glossary This section of the User Manual is your reference guide to all the words and expressions you are likely to need when programming the SAM Coup It includes commands functions keywords and definitions of technical terms and jargon The easiest way to understand what each of these paragraphs means is simply to try out the techniques and see what happens You can t harm your computer by experimenting Keywords that can be used in BASIC programs are printed in bold upper case letters only such as AND Definitions and
10. 21 pin socket capable of handling all video and stereo audio outputs See Chapter 9 Expanding the System 12 POWER INPUT A dual purpose 6 pin DIN connector which accepts 15 volts DC from the Power Supply Unit plug It also carries TV video signals and mono sound back to the socket located in the power supply unit See Chapter 1 Setting Before you read any further make sure that you know exactly what each of the back panel sockets and buttons is for 1 4 6 7 9 11 12 BREAK MIDI JOYSTICK RESET EXPANSION LIGHT SCART POWER 2 3 5 49 OUT IN MOUSE CASSETTE ON OFF 11 Chapter 2 What s What Life is like a tin of sardines We re all looking For the key Alan Bennett function keys letters numbers and symbols cursor keys space bar SYMBOL The SAM Coup Keyboard 12 Chapter 2 THE OF THE MACHINE A trip round The keyboard Characters And SPAC s What s What Rest your hands over the top of the computer It slopes like the top of a racing car and that s one reason we christened it the Coupe MGT have designed it to be practical as well as attractive and if you have ever used an old fashioned computer you will soon discover how much more comfort able your sloping keyboard feels It s deliberately set back from the front edge with a special wrist support panel for easy typing The whole range of Sam Coup keys is used to communicate wi
11. 52 160 80 159 18 160 22 32 160 19 22 25 115 160 11 104 78 161 161 67 69 80 161 33 79 35 168 46 162 13 85 162 47 162 SOUND sound effects SPACE bar specifications SQR stack statements STEP streams STOP STR strings STRING string variables subroutines substrings subtraction SYMB key system variables SVAR TAB TAN television sets THEN TO trouble shooting TRUNC user defined graphics UDG UNTIL USR USR VAL vatiables VERIFY welcome scieen WHILE WINDOW x axis y axis x y coordinates 100 162 100 13 162 170 45 162 162 29 163 42 50 163 107 119 32 163 58 163 37 58 163 37 163 39 43 163 37 44 21 36 85 163 178 61 164 175 61 163 175 34 87 164 47 164 4 6 16 36 146 42 164 6 16 122 1 164 89 89 164 54 165 113 165 113 58 165 38 60 165 19 22 26 115 165 5 55 166 79 80 166 46 77 77 166 184 185 186 MILES GORDON TECHNOLOGY ILS8N 1 8 258 00 b 9 781872 3890081 Y Sam s User Guide Front amp Back Covers This User Guide was OCRed with Textbridge Pro 11 amp MS Word 2003 The PDF document was compiled with JAWs Creator pdf version 6 3 by Steve Parry Thomas 10 December 2004 For SAM Coup uses everywhere SAM Users Manual PDF version 1 10 December 2004 Version number may change as errors and text formatting are corrected Ther
12. C 199 AND b gt 1 c 195 OR C 198 OR c 201 AND b 30 100 IF x lt tail THEN LET x x 1 GO TO 40 110 IF aa x lt gt a OR bb x lt gt b THEN GO TO 130 120 GO TO 40 130 LET aa aa l LET bb bb l LET z 1 140 IF z tail THEN PRINT AT aa bb GOTO 40 150 LET aa z aa z 1 LET bb z bb z 1 LET z z 1 GO TO 140 Before you RUN that try and understand how line 20 sets up the length of the tapeworm s tail and how line 40 creates its colour and shape Line 30 sets up variables fot screen coordinates Lines 50 and 60 get ready to recognise certain key codes and lines 80 and 90 set up 8 way direction controls if certain F 83 Chapter 6 Text and Graphics keys are pressed and their codes recognised F4 gives West F7 North West F8 North and so on clockwise Line 60 gives F5 a special function Try controlling the worm s travels by holding down various F keys Now change its length by altering the variable tail in line 20 The longer it is the more tired it becomes so don t go much beyond LET tail 10 The shorter the worm the faster it moves due to the speed of the PRINTing Just try LETting tail 1 Now alter its colour and shape in line 40 Next take a look at line 140 and see how the space between the PRINT quotation marks rubs out the last segment as the worm moves along Finally change line 140 so that a full stop gets printed instead of a space and watch the little devil leave a slimy trail You wi
13. DRAW TO DRAW TO x y z draws an absolute line from the current position to the coordinates x y while creating a cutve by turning through the angle z DUMP 15 used with certain types of printer to stop complicated screens turning into a mess when they get printed out in black and white DUMP can be used in any screen MODE and will result in unshaded printed copy Note that in MODE 3 the result will be twice as wide as other MODEs because the screen employs 512 pixels instead of 256 horizontally and that most screen DUMPs in this MODE won t fit on little printers DUMP CHR executes a text screen DUMP of the current screen window EDIT If you press the EDIT key the program line containing the gt cursor appears in the editing area If you type a line number and then press EDIT the desired line appears for editing The gt cursor is moved left right up or down in the edited line by using the cursor keys or up and down the listing 142 Glossary ELSE is part of an IF THEN structure and must come at the beginning of a new statement Normally when the statement following IF is false the program will jump to the next line But if the IF THEN pair has an associated ELSE later in the line the program will continue with the statements following the ELSE On the other hand if the condition after the IF is true the line will only be executed up to the ELSE ELSE IF has a special meaning so that once an
14. OF ERROR SOUND LENGTH OF KEYBOARD CLICK FUNCTION KEYS IF EVEN NUMBER PAD IF ODD 8 IF CAPS LOCK ON OTHERWISE 0 3 BYTES TV FRAMES SINCE COMPUTER TURNED ON 2 BYTES ADDRESS OF CHARACTER PATTERN FOR CHR 144 2 BYTES ADDRESS OF CHARACTER PATTERN FOR CHR 169 177 Appendix Predefined Keys Numbers in brackets are character codes Characters with codes of 128 and above can have several interpretations depending on BLOCKS 0 or 1 being used or if they are enclosed by quotation marks E g SYMB L gives the key word LET if used outside of quotes or if used inside them SYMB RETURN toggles the keys F0 to F9 to give numbers CNTRL P gives the PAPER control code and CNTRL I gives the PEN control code press 0 to 7 to select a colour number CNTRL B gives the BRIGHT control code press 0 or 1 to force PEN and PAPER to be in the range 0 to 7 or 8 to 15 Obviously some characters occur in several places on the keyboard and this 15 for the convenience of users familiar with different keyboard layouts NORMAL CAPS SYMBOL CNTRL Top line of keys ESCape ESCape ESCape ESCape 1 129 142 2 130 F 141 3 131 140 4 132 m 139 F 5 133 138 6 amp 134 n 137 7 135 i 136 8 128 143 9 0 E E DEL Lt DEL Rt DEL Rt F7 199 209 7 F8 200 210 8 F9 201 211 9 Second line of keys TAB TAB TAB q
15. S BASIC This is the Chapter that outlines how the SAM Coupe s own programming language works The enhanced BASIC has been specially designed by Dr Andy Wright and anyone used to primitive BASIC is in for a pleasant surprise There isn t enough room in this manual to explore all of its possibilities but the Glossary section does give every command and function available to you and advanced users can dip in and out of this Chapter Games players might want to stop reading here because this Chapter is for anyone who wants to experiment and create programs It s in three sec tions Beginner s BASIC Everyday BASIC and Ad vanced BASIC so if you re a beginner here goes BEGINNER S BASIC The Sam Coup will obey your instructions called commands exactly so you have to type them in very precisely The commands that you give your computer make use of some special words and throughout this Manual they are printed in bold capital letters We call them keywords and you normally type them in full There 1s a special way of programming single keys to generate complete keywords which is dealt with later in this Chapter Your Sam Coup auto matically recognises every keyword that it comes across and convetts it to capital letters in your pro gram listing but you must be careful not to tack extra letters on if you don t mean them to be there For instance if you type in O 10 print x RETURN this will become PRINT x in your
16. a numeric array such as O LENGTH Ln 0 Apart from commands like RESTORE and FOR NEXT there are other ways of making certain sec tions of computer programs even more useful DO LOOP A loop refers to any part of a computer program that is repeated The command LOOP is always marked by the instruction DO in much the same way as a FOR NEXT routine so that 010 DO 20 PRINT PLAY IT AGAIN SAM 30 LOOP will go round in circles for ever So it is useful to qualify DO and LOOP commands if you don t want to repeat something for a specific number of times WHILE and DO WHILE condition results in the part of the UNTIL program between DO and LOOP being executed WHILE that particular condition remains true Al ternatively you can use the computer to execute that part of the program between DO and LOOP while a condition is false but to stop as soon as it becomes true using DO UNTIL condition Similarly LOOP WHILE and LOOP UNTIL will allow conditional LOOPing at the end of a DO LOOP Conditions can be used at both the entry 55 Chapter 4 ADVANCED SAM BASIC and exit to the LOOP if you like And finally IF can be used to affect DO LOOPs in two ways EXIT IF condition can be used to leave the routine from somewhere in the middle rather than at the DO or LOOP If the specified condition after the EXIT IF is true the program will jump to the statement that follows LOOP otherwise the routine carries on LOOP IF con
17. an assembler and there are many ready made soft ware packages on the market If you want to code them yourself there are several excellent books to teach you how and this isn t one of them Information can be SAVEd and LOADed in bytes by using the keyword CODE without any need to define what the purpose of that information is 112 Chapter 10 Memory For example SAVE name CODE LOAD name CODE or F8 Machine coders will benefit from the following in formation PEEK addr is the function that reveals the contents of the ma chine s memory at an address in the range from 0 to 528K It returns a result from 0 to 255 DPEEK addr allows a double PEEK and is the equivalent to PEEK addr 256 PEEK addr 1 POKE addr x is used to store a number directly into an address of POKEing memory in the range from 0 to 524287 Up to 32 numbers can be POKEd at once into successive addresses like this POKE addr 255 129 129 129 129 129 129 255 You can POKE strings into memory as well as numbers by typing POKE addr a for example POKE addr testing DPOKE addr value allows a double POKE The value must be in the range from 0 to 65535 USRn is used to run machine code with the given number as the start addtess Values from 0 to 52487 can be used 0856 addr gives the string result of a machine code program at 113 Chapter 10 Memory a designated address Machine code shoul
18. aubergine 88 25 Mediterranean 57 blueberry 89 26 violet 58 Coupe rose 90 27 dusk blue 59 coral pink 91 28 dolphin 60 damp squid 92 29 sapphire 61 bilberry 93 30 powder blue 62 tuna 94 31 Wedgewood 63 twilight 95 grass slime leaf green sick parrot lime jade apple green mint dulep algae sage kiwi fruit olive green bowling green greenfly gooseberry lettuce cold steel baby blue shark lapis lazuli ghostly green turquoise sea spume duck egg blue cold fish pastel blue pumice purple haze blue bile Neptune blue Sargasso sea storm cloud Colour and Light 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 damp straw slug belly wild honey weak tea fern green spring bud cowardice papyrus sweetcorn oyster apricot piglet pink envy China tea cold custard daffodil mushroom glazed grape salmon pink shrunk violet pistachio frost bite parchment dandruff turnip iris caucasian rose pink chlorophyl ice blue flax moonlight 66 Chapter 5 BORDER PEN and PAPER The pen is mightier than the sword Cardinal Richelieu SCREEN MODES Colour and Light Don t forget that you can change the colour of the BORDER around the useable screen area and the command BORDER changes the picture s surround ing frame to any colour in your PALETTE from 0 to 15 For example
19. comma and spaces Howevet it is very important to understand that punctuation used OUTSIDE of quotes in PRINT statement can act as special instructions Commas instruct the computer to start PRINTing at the left hand margin or to start PRINTing at the next TAB position depending on which of these choices comes next Try RUNning this example 34 Chapter 4 BEGINNER S BASIC CJ REM columns 10 PRINT 1 2 3 4 5 6 7 8 9 10 Semi colons tell the machine to PRINT whatever follows immediately after whatever precedes it PRINT semi Colons Apostrophes cause whatever follows to be PRINT PRINTed at the left hand margin of the next line apostrophes Try out various combinations of these punctuation instructions to see how they operate For example 10 PRINT 1 2 3 4 56 7 8 9 10 Because PRINT can be used to show the results of calculations as explained in the Everyday BASIC part of this Chapter the numbers in the last two examples dutifully appeared on screen But now try replacing them with letters or words and watch the computer refuse to PRINT However as soon as you put any characters inside quotation matks you can RUN the program like this J 10 PRINT wham barn thank you SAM More information about PRINTing on screen can be found in Chapter 6 and commands for PRINTing out on paper are dealt with in Chapter 9 So far this Chapter has offered a lot of theory but not much fu
20. envelope and amplitude control plus wave form choice GRAPHICS Motorola MC 1377P Video Chip ASIC serves as graphic processor All Modes allow 128 colours to be displayed on screen by redefining line interrupt Mode 1 32 x 24 character cells per screen cacti cell with 2 colour capability 16 colours selectable from 128 Spectrum attribute compatible Mode 2 as Mode 1 but 32 x 192 cells each cell with 2 colour capability 16 colours selectable from 128 Mode 3 up to 85 column text display 512 x 192 pixel screen with each pixel colour selectable 4 colours per line selectable from 128 Mode 4 256 x 192 pixel graphics screen each pixel colour selectable 16 colours per line selectable from 128 INTERFACES UHF TV Channel 36 through power supply unit Colour composite video digital and linear RGB all through SCART Atati standard joystick dual capacity with splitter cable Mouse Coup standard Light pen Light gun Coupe standard Domestic cassette recorder MIDI In MIDI Out MIDI Through via software switch Network screened microphone cable via external MCT interface to Expansion Port 64 pin Expansion Port for further peripherals DISK DRIVES 1 or 2 removeable and internally mounted 3 5 ultra slim Citizen drives 1Mb unformatted 780K formatted DC POWER Power Supply 4 75 volts to 5 25 volts CONSUMPTION Power Consumption 11 2 Watts SHOCK Operating 3 non operating 60 VIBRATION Operating 5 to 500Hz 0 5 non
21. image back This is NOT a fault it is a protection routine for your screen 16 Chapter 3 SOFTWARE O what software does and how it gets done O writing a program SAVEing O VERIFYing O LOADing O MERGEing When I was a kid I couldn t even spell PROGRAMMER But now I are graffiti Sussex University 17 Chapter 3 ROM Drain noun an apparatus with which we think we think Ambrose Bierce Commercially available software Software The computer comes equipped with two types of brain In the first type information that has been taught in the Sam Coup factory lies buried in special memory cells You can read what s in these cells but you can t change the contents so they are known as READ ONLY MEMORY ot ROM for short The computer remembers what is in them even when switched off The second type of brain contains empty memory cells that are waiting to learn something new You can plant all sorts of fresh ideas here and gain access to them as you choose which is why they are called the RANDOM ACCESS MEMORY or RAM for short This type of memory gets erased every time the machine is switched off So we need a method of teaching new ideas to the brain quickly and accu rately by LOADing computer programs already stored up somewhere else When you wete setting up you instructed your machine to change the BORDER colours of the screen and to BEEP a sound so that
22. in O LET XOS 128 YOS 69 which moves the origin of all graphics coordinates to the centre of the screen Similarly changing XRG and YRG alters the scale to which PLOT and DRAW wotk Combined with a WINDOW you can even create split screen special effects Normally position 0 0 of the x y coordinates is at the lower left hand corner of the screen just above the bottom editing section with coordinates 255 173 at the top right hand corner If thin pixels are used in MODE 3 the x range is expanded so that the top right becomes 511 173 The SAM Coup also allows the area normally allocated for the two editing lines to be used for PLOTtng by O LET XOS 18 if characters are 9 pixels high or O LET XOS 16 for those with a height of 8 pixels This makes coordinates 0 0 the extreme bottom 77 Chapter 6 Text and Graphics left hand corner of the screen and makes 0 191 the top left BLITZ a is used to execute a string of graphics commands very quickly Although it works in all it s especially effective in MODE 4 BLITZ responds to the special graphics scaling variables XOS and YOS which enable a graphic shape to be BLITZed anywhere on screen and the size of the BLITZed shape can be altered by changing the special graphic vatiables XRG and YRG BLITZing USING When you switch on the SAM Coup there is only SCREENS one screen available called SCREEN 1 But you have access to a total of 16 scr
23. inverse symbol The EDIT line cursor is represented by an inverse in the normal keyboard state and by an inverse when CAPS lock is engaged The current line program cursor is represented by an inverse gt symbol Cursor keys are the four directional arrow keys used to move the program cursor around the screen as well as to control movement during game play DATA DATA statements can include keywords like go to without them being changed into tokens Other than this words without quotes must be legal numeric variables Thus Sam 1 is acceptable but 1x is not Debug is the slang expression for tracking down programming mistakes or bugs and correcting them DEFAULT is used mainly with procedures and creates a variable only if it does not already exist 138 Glossary DEF FN is short for user defined function Function names can have any length and must start with a letter They can continue with letters numbers or under score String functions must end with The location of the DEF IN statement has no effect on the execution speed of the program DEF KEYCODE is used to create shorthand codes which will be automatically expanded when they are called up from the keyboard For example O DEF KEYCODE 195 PRINT 123 PRINT sam ENTER will assign PRINT 123 etc to code 195 the code assigned to key F3 So whenever you press F3 it will have the effect of PRINTing 123 Sam on the upper screen are
24. jargon are shown in upper and lower case letters for example Array Actual keys that can be found on the computer keyboard are represented as upper case letters enclosed by square brackets like this RETURN ABS stands for ABSolute magnitude and is a function for converting an argument into a positive number ACS stands for arccosine and is a function for finding out the value of a number that has a given cosine Address is the numeric location of a unit of data in the computer s memory AND is used to combine conditions just like in English language such as O IF a Sam AND x gt 0 THEN PRINT x ARRAY An array is a set of variables which are only distinguished from one another by a number written in brackets after the name of the array Before an array can be used space must be made for it in the computer s memory by using a dimension statement the command for which is DIM 132 Glossary ASCII stands for American Standard Codes for Information Interchange and is the widely used system of character codes for transferring data between comput ers and various peripherals such as printers ASN stands for arcsine and is the function for finding out the value of a number that has a given sine AT tells the computer where to PRINT anywhere on the screen when qualified by a line number followed by a column number ATN stands for arctangent and is a function for finding out the value of a
25. most useful system variables are listed at the end of this Manual There are hundreds more listed in the Sam Coup Technical Manual TAB is a PRINT qualifier used to indent text and set up columns of text or numerals into orderly columns TAN is a trigonometrical function that calculates a TANgent a sine divided by a cosine TO 15 used to set the limitations in FOR NEXT loop for example OFOR play 1 TO 69 NEXT play TRUNCS a gives a with any trailing spaces deleted This is useful when you take data from string arrays so that normally O DIM a 10 10 LET a 1 7 sam PRINT a 1 will result in sam being PRINTed whereas you can use O PRINT TRUNCS a 1 which results in Sam UDG gives the address of any user defined graphic character from CHR 32 to 168 The range from CHR 169 to 255 is available to advanced users 164 Glossary UNTIL is a condition used with DO and LOOP Please refer to these commands USR When a numeric argument is a start address USR is employed to run machine code and allows values from 0 to 524287 VAL Is a very powerful function that converts strings back into numbers The string can be any numeric expression VAL takes away the quotes from a string evaluates the arguments and finally evaluates whatever is left as a number VALS is similar to VAL with a string for an argument but giving a result which is also a string Variable There are four
26. no NEXT statement to go with it FN without DEF FN A user defined function is missing RETURN without GOSUB There is a RETURN statement without GOSUB to welcome it back Missing LOOP You have forgotten to follow a DO marker with the necessary LOOP LOOP without DO Even though there is a LOOP waiting to jump back there is no DO to start it off 123 Chapter 12 ERROR CODE NUMBER 11 12 13 14 15 16 17 ERROR CODES ERROR MESSAGE No POP data You are trying to use POP but there is no data on the stack Missing DEF PROC You want to end a named procedure with END PROC but it is missing This error can also result from a simple spelling mistake such as PRUNT No END PROC You have forgotten to mark the end of a named procedure BREAK into program BREAK has been hit or ESC pressed in between two statements and the line and statement number that are shown refer to the statement before BREAK was used When you CONTINUE the program goes to the statement that follows and allows for any program jumps that you have made BREAK CONTINUE to repeat BREAK has been hit while a peripheral operation was taking place so when you CONTINUE the last statement is repeated STOP statement When you want to CONTINUE after this the pro gram will start again at the next statement STOP in INPUT When you want to CONTINUE after this the pro gram will start again by repeating the last INPUT st
27. ones 6 PUT the stored area over itself with OVER 1 7 GRAB the area again 8 PUT it back using OVER 0 INVERSE 1 9 GRAB it for the last time to get a useable mask Movies and videos are really a rapid sequence of still images each one a little different from the last Computer animation works in exactly the same way to fool the eye The simplest form of animation alternates graphic characters to give an impression of movement such as O 10 PRINT PAUSE 3 CLS PRINT PAUSE 3 CLS PRINT PAUSE 3 CLS GO TO 10 which is supposed to be a propellor Pathetic isn t it What is needed is a method to make our graphic images move around the screen and to achieve this we must PRINT them in the right place then wipe them off and PRINT them at the next position and so on What we also need is a method of controlling their speed and direction of movement 82 Chapter 6 Text and Graphics The next program creates an animated tapeworm Television No Good will come Of this device O 10 PEN 15 PAPER 0 BORDER 0 CLS 20 LET tail 3 DIM aa tail The world is half DIM bb tail Greek and half 30 LET x 1 LET a 9 LET b 15 Latin 40 PRINT AT a b PEN 12 0 50 LET cc CODE INKEYS C P Scott IF c lt 193 OR c gt 201 THEN GO TO 50 60 IF c 197 THEN CLS LET x 1 70 LET aa x a LET bb x b 80 LET gt 192 AND c 196 AND a lt 18 c gt 198 AND c lt 202 AND a gt 1 90 LET b b c 193 OR c 196 OR
28. string a for a target string b starting from position n and returns its position if found If it fails to find the target string it returns 0 INSTR A B starts from position 1 and you can use as a match anything character INT is short for INTeger part and this function converts a fractional number into a whole number known as an integer It always rounds the fraction down INV is the key used to highlight screen characters by throwing them into a negative display Pressing SYM INV returns the display to its normal state INVERSE changes the way characters and graphics are displayed on the screen INVERSE 1 turns all new characters and graphics into a sort of negative of themselves and swaps over their PAPER colour with their PEN colour INVERSE 0 changes them back to normal I O ports is short for Input Output ports and these are used by the processor for communicating with the keyboatd printers other computers etc ITEM is a function that gives information about the next ITEM to be READ in the current DATA statement ITEM has the following values and meanings 0 means there are no more ITEMs in the current DATA statement 1 means that the next ITEM is a string type 2 means that the next ITEM is a numeric type When used with procedures ITEM can reveal the nature of the first ITEM in a DATA list passed to the procedure K is the abbreviation for kilo that is inaccurately used to repre
29. string arrays SAVE string LINE number tells the computer to record a program in such a way that when it is LOADed it jumps to a particular line number and RUNS itself Screen dump is the process of reproducing what is displayed on screen to a printer SCREEN n selects a SCREEN for BASIC commands to use IN must be between 1 and 16 and the SCREEN must first be OPENed So that SCREEN 2 SCREEN 2 makes commands like PRINT LIST PLOT and DRAW use a second SCREEN leaving SCREEN 1 intact until SCREEN 1 is typed again Please also see DISPLAY SCREENS r c is a function that works in any mode and identifies user defined graphics in the range CHR 32 to 168 as well as normal characters It does not recognise block graphics and it makes no difference if BLOCKS 0 or 1 has been specified SCROLL d p works in exactly the same way as ROLL d p except that there is no wrap around effect Blank background replaces the lost data SCROLL commands only work in Modes 3 and 4 SCROLL d p x w L works in exactly the same way as ROLL d p x y w L except that there is no wtap around effect SCROLL CLEAR disables the Scroll prompt on screen so that when a screen becomes full it will scroll without any message or the need for a key to be pressed 161 Glossary SCROLL RESTORE turns the Scroll prompt back on SGN is the sign function which is sometimes known as the signum So if you want to know the resul
30. the ability to define shorthand codes that can be automatically expanded when they get called up from yout keyboard The command DEF KEY CODE is also explained in the Glossary Anyone writing a novel making a shopping list or cataloguing their record collection can use the SAM Coup as a video typewriter and there are several features on board to help in the presentation of text Decide which of the screen is best suited for the particular document you want to wtite and then experiment with the size and shape of the characters you can print using this command Character CJ CSIZE width height size which instructs the computer to change the size of the characters on screen to x pixels wide by y pixels high In MODE 3 your characters can be either 6 or 86 Chapter 6 TABulating AT ye uv Tu ES E Text Graphics 8 pixels wide and you can adjust their height in any MODE from a squashed 6 pixels to a very stretched 32 pixels high for use with headlines early learn ing displays or special needs Any character height specified as being 16 or more results in genuine double height characters rather than normal acters on widely spaced lines If you want to make yout text look neat by indenting paragraphs or need to create orderly columns of wotds and numbers there is a built in TABulation facility ready to help TABs are set by the usual method used by typewtiters and
31. to swap between a series of factory made typefaces But with the SAM Coup you can make most keys give you any symbol you want as well as use them for drawing complex pictures There is a whole host of special comands for creat ing shapes patterns and works of art We have included some very simple but highly effective graphics routines on your FLASH demonstration cassette and you are welcome to use your ESC key or BREAK button to help examine their list ings PLOT x y 15 a statement used for pinpointing a graphic start position on your screen This graphic process begins wherever you instruct the first picture ele ment pixel to be located It s done by typing PLOT followed by two numbers The first number is the x coordinate which tells the pixel how far it must be from the left hand side of your screen and the second number is the y coordinate saying how far it is from the bottom of the screen So that O PLOT 128 86 will target a spot near the centre of your screen in MODES 1 2 or 4 or left of centre in MODE 3 You can pick a colour before using PLOT so try giving your computer red measles with this program in MODE 4 74 Chapter 6 Text and Graphics CJ 10 PLOT PEN 10 INT RND 255 INT RND 173 GO TO 10 DRAW x y Spots are all very well but individual pixels are easily manipulated into lines DRAW 15 used to draw a line relative to wherever you are on the screen The value of x is the numb
32. to the cassette s MIC socket It is Recorder best to set any TONE controls to neutral and you will have to use trial and error to discover the best VOLUME level for RECORDing and PLAYing back information If your tape recorder has a VU meter that displays the level of recorded sound with a dial a bar of light or a digital meter in decibels the signal should not go much higher than 1dB Make sure that the cassette tape is wound on past any non magnetic leader tape and that the knock out lug is in place at the back of the cassette Please use a new blank cassette and ON NO ACCOUNT use the FLASH demonstration cassette for recording over Your first Now you ate ready to test the system by writing a program simple program A program is the word used for a collection of commands that you use to tell the SAM 20 Chapter 3 Line Numbers Begin at the beginning the King said Gravely to Alice and go on till come to the end then stop Lewis Carroll RETURN Software Coupe what to do Don t forget how to use the SHIFT key and where the DELETE key is in case you make any mistakes Computers aren t very imaginative unless you en courage them and they will obey all your com mands one after the other starting at the beginning right through to the end This works just fine until you decide to make changes in your programming and need to find the relevant part of your list of commands To
33. wordprocessots and each column is defined by its position from the left hand edge of the screen using the PRINT state ment For example O PRINT TAB 2 Sam will indent sam by two spaces in MODE 1 whereas CJ PRINT TAB 82 1 is allowed if you are using MODE 3 with characters 6 pixels wide because TAB 84 is the right hand column Don t forget that the use of a comma in your listing will cause the PRINT statement that follows it to be automatically tabulated by 16 columns Its effect depends on the MODE you happen to be in with TABs at the centre or left hand side of the screen in MODES 1 2 and 4 with normal sized characters and all sorts of permutations in MODE 3 AT tells the computer where to PRINT anywhere on the screen when qualified by a line number fol lowed by a column number So that in screen MODE 4 O PRINT AT 10 16 PRINT an exclamation mark near the centre of the 87 Chapter 6 Text and Graphics screen at line 10 column 16 If you are not satisfied with the choice of pre set characters in the computer s memory there is plenty of scope to change them to your own needs ot to invent completely new designs These special character positions have been allocated for your use in a group of user defined characters First let s look at the group of 16 mosaic shapes known as block graphics These are called up by pressing keys 1 to 8 at the same time as the SYMB or CNTRL keys a
34. you could test the system It only took a few seconds so it wouldn t matter much if you had to do it again next time you poweted up the computer But what if you had spent all day slaving over a complicated piece of programming only to have it forgotten when you pulled the plug Fortunately you can SAVE programs onto cassettes ot disks for use later If you are only interested in using your Sam Coup to play computer games written by other people you re in luck There are thousands to choose from Computer games useful educational programs and special utilities that have been produced by private 18 Chapter 3 Software individuals and companies can be purchased for your own use and these packages come in the form of pre recorded cassettes and disks They are known as software Apart from software written specially for the Sam Coup you are able to use a whole range of games and programs that have already been written for another less sophisticated com puter called the Spectrum The Sam Coup will automatically examine this software using a special program that you will find on your FLASH demon stration cassette and if all is well convert it into a form that will RUN for your enjoyment To be honest dedicated games players can stop reading this Manual now but you ll be missing out on creativity and home grown fun All you have to do is follow the LOADing instruc tions that come with the games If in doubt follo
35. you have been concerned with This indicator is called a cursor and more will be explained about its uses later on Let s make the computer work by RUNning your RUNing a program and type in Program O RUN RETURN This makes the Sam Coup BEEP a note change the colour of the screen BORDER and PRINT up your test successfully ending with a little OK mes sage at the bottom of the screen to show at which line the program stopped The program can RUN as many times as you like while the computer is switched on by typing in RUN RETURN again and your listing of lines can be examined by press ing RETURN on its own You can go away and make a cup of tea in a minute SAVE but before you switch off the computer you ll want to SAVE your amnesia program so that you can LOAD it in after the kettle has boiled For SAVEing to cassette just type in J SAVE amnesia RETURN and a message appears on screen prompting you to start off the recording process on your tape recorder with the cable connected to its MIC socket for taking information IN and then press a key on the keyboard Any key will do The screen s centre usually goes blank while waiting for the SAVEing process to begin and the border will change colour 22 Chapter 3 Software Narrow coloured bars indicate that your program is being transferred to tape After a short while the reassuring OK message appears and you can stop the cassette recording To ma
36. 10 REM secret numbers Whoever can 20 PRINT Think of a number between 1 and Predict win ning 100 and type it in secretly 30 INPUT a Numbers has no 40 INPUT Find the secret number b Need to let off 50 IF b lt a THEN PRINT WRONG go higher Craker 60 IF b gt a THEN PRINT WRONG try lower 70 IF b a THEN PRINT RIGHT Well done Kai Lung STOP 80 GO TO 40 36 Chapter 4 EVERYDAY BASIC EVERYDAY BASIC The following section contains the back bone of this introduction to BASIC programming In it you will find all of the every day ideas and practices needed for writing programs so make sure you understand and try out each concept before tack ling the next one and don t try to rush through them First you need to learn three definitions known as strings variables and arrays A string is simply a number of characters all strung together These characters can be letters numbers spaces or graphics and a single string can be as short as you wish up to 65520 characters long You might need that many to display a whole screen of graphic shapes that make up a complex picture In a program each string is defined by giving it its own name and immediately sticking on a special string symbol after that name and then LETting it be equal to whatever follows in quotation marks We use the dollar symbol to represent string for example String O 10 LET sam string along with me If you lo
37. 6 colours out of the range of 128 over the 49252 dots on screen There is a way to use all 128 colours on screen at once which is explained later Because everything on a screen can alter instantly as the PALETTE is changed some spectacular ef fects are easily achieved as the demonstration programs on your FLASH cassette prove Experiment with a few lines of coloured text in each MODE Now try out two special settings that can be used in 1 and 2 only PEN 16 or PAPER 16 means transparent and PEN 17 or PAPER 17 means contrast Here is a summary of the SAM Coup s four screen MODEs MODE 1 32 cells 24 lines 768 character cells each cell has individual choice of PEN and PAPER colout 256 192 pixels choice of any 16 screen colours from 128 MODE 2 32 cells 192 lines 5 444 cells each cell has individual choice of PEN and PAPER colout 256 192 pixels choice of any 16 screen colours from 128 MODE 3 512 pixels 192 lines each pixel has individual choice of colour choice of any 4 screen colours from 128 MODE 4 256 pixels 192 lines each pixel has individual choice of colour choice of any 16 screen colours from 128 69 Chapter 5 Attributes BRIGHT FLASH These attributes are not just limited to PEN and PAPER You can create a series of special effects by using two more attribute controls called BRIGHT and FLASH If you want to make a colour more brilli
38. CREEN n m 1 opens a common screen so that if several programs are present in the machine s memory they can all use the screen when they are running OR is a condition that can be used as part of a condition after IF WHILE UNTIL etc so that an IF statement will work when one relationship OR another is true Of course it will still work if both relationships are true Origin is the term used for the screen graphic coordinates 0 0 OUT p x is a statement like POKE and writes the given value to the designated port with the given address P must be between 0 and 65535 x must be between 0 and 255 OVER 15 a statement for controlling the pattern of graphic dots on the screen and causes a sort of OVERprinting of points lines and characters OVER 1 turns the effect on and OVER 0 turns it off In modes 1 and 2 the character repeatedly prints over itself in a character blank character sequence In 154 Glossary modes 3 and 4 the sequence is character colour character the usual colour being black Other effects can be created when used with DRAW CIRCLE PLOT and PUT where OVER 2 gives ORing of each pixel with the screen and OVER 3 gives ANDing Using OVER 1 for a PLOT DRAW or CIRCLE and then repeating the process will result in the original screen being restored PALETTE stops all changes to the colours you can use and resets the original colours to their start up values PALETTE position colour sets the po
39. DG CHR 170 etc will wotk 89 Chapter 6 Text and Graphics To store your own pattern for a home made charac ter you will need to tell the computer how the character cell is to be represented by a grid repre senting every pixel that makes up that character If you understand the concept of binary numbers this is easy and if you don t it is not too difficult A pixel that is to be filled by the current PEN colour is represented by a 1 and a pixel that has nothing in it except the current PAPER colour is represented by a 0 Take a look at the following pair of UDGs We have chosen a simple 8 x 8 pixel grid from MODE 1 but the character cell will vary depending on MODE and CSIZE Once you know what your own UDG should look like choose an existing character that is available for you to overwrite and store its new pattern in BINary code The smiling face graphic would be written as BIN followed by these numbers representing PEN and PAPER CJ BIN 00111100 BIN 01111110 BIN 10011001 BIN 11111111 BIN 10111101 BIN 11000011 BIN 01100110 BIN 00111100 90 Chapter 6 Text and Graphics i Now see if you can write out the equivalent numeric pattern for the musical UDG in our example These numeric patterns can now be POKEd into memory and the correct address will be UDG chosen character for the first byte or group of eight digits followed by UDG chosen character 1 for the next group down to UDG
40. EDIT key education ELSE ELSE IF END IF END PROC ERASE error codes error trapping ESC key equals Euroconnector 58 112 137 31 168 65 137 31 34 87 168 36 137 33 137 137 180 47 137 86 118 138 30 138 12 138 2 52 59 138 60 138 57 139 139 59 139 30 140 14 30 139 115 140 38 54 140 115 140 15 140 9 115 140 79 141 141 44 55 141 113 141 75 142 106 142 142 30 142 118 40 143 41 143 40 113 60 143 115 143 23 29 129 129 26 33 143 36 10 182 Index EXIT IF EXP expansion connector exponentiation expressions FATPIX FILL FLASH floating point FOR FORMAT FREE functions function keys GET GO SUB GO TO GRAB graphics coordinates graphics scaling system greater than HEX IF IN INK INKEY INPUT INSTR INT INV key INVERSE ITEM joysticks joystick port key positions keyboard keyboard map KEYIN keywords LABEL lead connections LEN 56 143 45 143 10 104 44 45 44 76 144 76 70 144 52 42 144 115 144 48 111 144 45 47 145 57 143 84 145 43 145 33 145 76 81 145 75 77 145 77 36 146 36 40 56 146 114 146 67 84 24 33 119 146 59 111 147 45 147 49 71 147 71 81 147 60 147 105 10 148 178 12 181 148 28 148 61 148 171 48 148 LENGTH less than LET light pen line numbers LIST LIST FORMAT listing LLIST LIST FORMAT LN LOAD L
41. GE SENT TO PRINTERS AFTER A DUMP TABVAR 47 0IF TH E PRINT COMMA SHOULD TAB BY 16 COLUMNS NOT 0 IF AN 8 COLUMN TAB IS TO BE USED SOFE 50 _ FLAGFOR SCREEN OFF ENABLE DISABLE NOR MALLY 0 ON THE SCREEN WILL GO BLACK IF YOU DO NOT USE THE KEYBOARD FOR 22 MINUTES POKE SVAR 50 1 TO DISABLE THIS FEATURE TPROMPTS 51 BIT 0 1 TO SUPPRESS PRINTING OF FILE NAMES DURING LOAD 1 1 TO SUPPRESS PROMPTS DURING SAVE TO TAPE BGFLG 52 BLOCK GRAPHICS FLAG 0 IF BLOCKS 1 NOT 0 IF BLOCKS 0 FL6ORS8 53 0 MODE 3 IS USING 6 PIXEL WIDE CHARAC TERS OTHERWISE NOT 0 CSIZEH 54 CHARACTER HEIGHT CSIZEW 55 CHARACTER WIDTH UWRHS 56 UPPER WINDOW RIGHT HAND COLUMN UWLHS 57 UPPER WINDOW LEFT HAND COLUMN UWTOP 58 UPPER WINDOW TOP ROW UWBOT 59 UPPER WINDOW BOTTOM ROW 176 Appendix LWRHS LWLHS LW TOP LWBOT MODE YCOORD XCOORD LASTH KBHEAD REPDEL REPSPD CHARS ERRSOUND CLICK KPFLG KLFLAG FRAMES UDG HUDG 60 61 62 63 64 65 66 513 520 521 522 566 568 569 615 618 632 635 637 System Variables LOWER WINDOW RIGHT HAND COLUMN LOWER WINDOW LEFT HAND COLUMN LOWER WINDOW TOP ROW LOWER WINDOW BOTTOM ROW SCREEN MODE MINUS 1 CURRENT GRAPHICS Y COORDINATE 0 AT THE TOP 2 BYTES CURRENT GRAPHICS X COORDINATE LAST KEY PRESSED KEY AT HEAD OF KEYBOARD BUFFER QUEUE DELAY BEFORE KEYS AUTO REPEAT SPEED AT WHICH KEYS AUTO REPEAL 2 BYTES ADDRESS 256 BYTES BELOW MAIN CHARACTER SET LENGTH
42. J 500 LABEL tea PRINT two sugars please 600 GO TO tea The variables are re created if CLEAR is used or the program is EDIT ed There are certain bytes of the Sam Coup s memory that have been set aside for special uses known as system variables You can have a look at them by PEEKing and some of them can be POKEd without doing any harm to the system but they are not the same as the variables used in BASIC and the com puter won t recognise their names The hundreds of system variables are detailed in the Technical Manual and the most useful system variables are listed in the Appendix of this Manual SVAR is used 61 Chapter 4 ADVANCED SAM BASIC to give the address of a system variable when followed by its number This can be used to customise system variables such as changing the lower case cursor from to x in the following way POKE SVAR 1 x Finally if you ve been looking for PEEK and POKE details you can treat yourself to the examination of memoty in Chapter 10 62 Chapter 5 COLOUR AND LIGHT O using the PALETTE PEN and PAPER the four video MODES Q making decisions IF and THEN BRIGHT and FLASH O INVERSE and OVER Enjoy rain bow without for getting the forces that made it Mark Twain You can have any colour you want so long as it s black Henry Ford 63 Chapter 5 The PALLETE Colour and Light In the past anyone wa
43. LH IN LCHAN IN BLUE BLUE IN FUNCSW GRNGND GREEN GREEN IN REDGND CSGND RED RED IN CSYNC CSYNC CMPGND CSGND CVD OUT CVIDIN CSYNC 21 Screen EARTH EAHTH Linear RGB Cable Type 8 core with Screen length 2m UHF TV lead 1 Signal 4 TvAERIAL J V 2 5 2 Aerial Plug Phono Plug Cable Type 1 core with Screen length 2 172 Appendix Pin Connections Pin connections All plugs and sockets are viewed from the back of the SAM Coup Please see the following page for Expansion Connector Details MIDI MOUSE LIGHT PEN POWER OUT IN 1 Down 1 5v INPUT 2 Up 2 Audio LH Output 1 5y NET LOOP 1 NET LOOP 3 CTRL 3 Jv 2 By Signal Gnd 2 NC 2 GND i 4 Left 4 Spen Input 3 By Digital Gnd 3 NET LOOP 3 LOOP 5 Right 5 Audio RH Output 4 Composite Video 4 MIDI IN 4 MID OUT 6 Mouse Interrupt 5 12v 5 MIDI IN 5 MIDI OUT 7 Read M S Input 6 Sound Output Mono 6 NET LOOP 6 NET LOOP 8 5y 7 100 7 LOOP Screen ground 7 6 6 rs V s tee 3 7 6 STEYR ISAC as 2 9 2 2 4 JOYSTICK RESET BUTTON 1 Up EXPANSION 1 Out 12 5v Power In 2 Down PORT 2 SPEN 13 Red Earth 3 Lett See following page 3 L H Out 14 CSYNC Eartr 4 Right 4 Audio Earth 15 Red Lin Qut 5 By 5 Blue Earth 16 CSYNC 6 Fire 6 Blue TTL Out 17 Comp Video Earth i Sv 7
44. NEXT day Easy isn t it STEPping is not limited to whole numbers or positive values Try out this sort of example CJ FOR n 1 TO 100 STEP 3 142 FOR x 500 TO 250 STEP 25 42 Chapter 4 EVERYDAY BASIC FOR NEXT variables are treated just like ordinary numeric variables so there are no special rules to learn However if you want to do something more ambitious than writing lists there are several com mands that are ready and able to help you Luckily they all behave in BASIC very much as you would expect in English DO LOOP WHILE UNTIL and EXIT IF all explained in the last section of this Chapter Advanced SAM BASIC A collection of statements arranged in lines that all act together is known as a routine In computer programs it is very common to want similar tasks to be performed in different places but it is also very tiresome to type in the same lines over and over again So these lines are isolated in what are known as subroutines and they can be called up from anywhere in the program to do their job as many times as necessary If you think of how the command GO TO works then you will easily understand how to GO to a SUBrouline for example subroutine GO SUB GO SUB 500 instructs the computer to leave its present place in program and jump to line 500 in order to carry out whatever task awaits it there RETURN It may be helpful to mark the start of each subrou tine with a REM statement for
45. NYLOSS HOWEVER ARISING WE RESERVE THE RIGHT TO ALTER THE SPECIFICATIONS OFTHE SAM COUPE AND TO UPDATE THIS MANUAL AS NECESSARY Whats the use of computers They will never plat chess draw Art or make music Jean Genet Play it SAM play it Humphrey Bogart CONTENTS Chapter 1 Chapter 2 Chapter 3 Chapter 4 SETTING UP testing video amp audio First Aid checklist WHAT S WHAT sockets amp ports the keyboard computer care SOFTWARE ROM and RAM cassette recorders RUN and SAVE VERIFY and LOAD INPUT MERGE SAM BASIC Beginner s BASIC keywords and commands EDITing DELETE and REM Punctuation RUN STOP PAUSE INPUT GO TO CONTINUE PRINT statements IF and THEN Everyday BASIC strings vatiables arrays ELSE LOOPS and STEPs Subroutines Calculations Functions beautified BASIC Advanced SAM BASIC random numbers DATA DO WHILE UNTIL IF AND OR NOT defining functions handling strings procedures references and labels system variables 28 30 31 32 33 34 36 37 40 43 44 45 49 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 COLOUR amp LIGHT the PALETTE the colour chart PEN and PAPER the four screen Modes attributes TEXT amp GRAPHICS graphic commands graphics scaling SCROLL ROLL WINDOW GRAB Animation the character set block graphics and UDGs MAKING MUSIC BEEP Shortcut
46. O 1000 will give you a listing starting at line 500 up to and including line 1000 If the line number you want to statt from is left out then the first line of the program is assumed Simi larly if the line number you want to end with is omitted the last line of the entire program is as sumed Try out a few LIST commands now There are several tricks of the trade that can help make the layout of your BASIC programs easier to refer to and a whole lot more pleasing to the eye If you want to highlight something for your own reference and a REM statement doesn t fit the bill then use the INV key to make that part of the program stand out in INVerse video The highlight ing is turned off again by pressing SYMB INV to gether The first rule of BASIC is that every line of program must have its own line number and your number ing system can get very messy after a while The Sam Coup is ready and willing to help out It has a vety convenient feature that AUTOmatically numbers your lines of program Enter AUTO by itself and the computer takes the current line number where the program cursor is then adds ten at every new line This won t work if the current line number is less than 10 or more than 61439 If you need to skip over a block of line numbers just delete the AUTOmatic number and type in a new one fol lowed by the rest of the line AUTO will carry on from there numbering in steps of ten 49 Chapter 4 RENU Mb
47. OCAL LOOP LPRINT machine code memory MEMS MERGE MIDI IN MIDI OUT MOD MODE mouse MOVE multiplication nesting networks NEW NEXT NOT numeric variables ON ON ERROR ON OFF button OPEN OPEN SCREEN OR OUT OVER PALETTE PAPER parameter PAUSE PEEK 54 148 36 37 149 11 105 149 21 29 149 48 149 51 149 51 106 149 51 149 45 150 20 22 26 115 150 60 151 55 151 106 151 112 151 110 151 111 151 20 25 26 115 152 9 97 110 152 152 67 152 10 105 152 115 153 43 41 153 10 118 153 34 153 42 153 54 153 39 57 153 129 153 410 112 153 78 111 154 54 154 114 154 71 81 154 64 71 155 67 155 155 32 97 155 113 155 183 Index PEN PI pin connections pitch values Pixels PLOT POINT POKE POP power supply unit PRINT statements Printers procedures program names punctuation PUT radian RAM RAMTOP random numbers RANDOMIZE READ RECORD REF REM statements RENUM RESET button RESTORE RETURN RETURN key RND ROLL ROM RUN SAVE SCART socket SCREEN SCREEN screen modes SCROLL scroll semi colons SGN SHIFT key SIN 67 156 46 156 173 95 68 74 86 156 74 156 71 156 113 156 60 156 3 4 11 34 157 105 59 157 24 31 34 167 81 157 47 157 18 157 111 158 51 52 158 53 54 158 85 119 158 61 31 49 50 158 6 10 159 53 159 43 159 5 21 29 159
48. Q lt w gt r R t T y Y Y u U i l INVERSE PEN CC PRINT PAPER CC s 4 196 206 4 F5 197 207 5 F6 198 208 6 178 Appendix Predefined Keys NORMAL CAPS SYMBOL CNTRL third line of keys CAPS Lk CAPS Lk CAPS Lk A A STOP S S SAVE D D DRAW F F G G H H 7 K K L L LET RETURN RETURN RETURN F1 193 203 1 F2 194 204 2 F3 195 205 3 fourth line of keys SHIFT SHIFT SHIFT SHIFT z Z X C CSIZE VERIFY b B BORDER BRIGHT CC n N BRIGHT m m N INVERSE lt gt INV TRU VID SHIFT SHIFT SHIFT SHIFT FO 192 202 0 UP UP UP bottom line of keys SYMB SYMB SYMB SYMB CNTRL CNTRL CNTRL CNTRL SPACE SPACE SPACE EDIT EDIT toggle SYMB SYMB SYMB SYMB LEFT LEFT LEFT DOWN DOWN DOWN RIGHT RIGHT RIGHT 179 Appendix Control Codes 6 When printed PRINT COMMA TAB When coming directly from the keyboard CAPS LOCK TOGGLE 7 When printed When coming directly from the keyboard EDIT 8 CURSOR LEFT 9 CURSOR RIGHT 10 CURSOR DOWN 11 CURSOR UP 12 DELETE LEFT 13 RETURN 14 When printed SPACE When coming directly from the keyboard DELE T E RIGHT 15 When printed When coming directly from the keyboard KEY PAD TOGGLE 16 PEN 17 PAPER 18 FLASH 19 BRIGHT 20 INVERSE 21 OVER 22 23 Keyboard DOCS Coo oo
49. SAM Coup Users Manual By Mel Croucher MILES GORDON TECHNOLOGY plc 1989 This manual is something like the one I wanted when I started programming I could have read through the Glossary and begun to understand what all the jargon obscured I could have let SAM lead me by the hand for a bit of instant enjoyment But in those days computers were mysterious as big as a bus and as daft as a brush If you think I m going to waste too much of the Manual s space on simple ideas and not devote enough pages to advanced concepts you re probably right Read through it because I think that the Sam Coup is a wonderful machine If only it had been around when I was you Mel Croucher October 1989 This is Mel s manual and as soon as you start reading you ll see what a great job he s done All credit to him and his team for making the unreadable readable and especially for introducing us to SAM a special word of praise to Robin Evans the SAM cartoonist But are other heroes too and without them we d never have managed to turn our Coupe dream into reality Ever since the Coupe was just a gleam in our eyes Bob Brenchley and John Wase have encouraged and guided us Simon Goodwin discovered MGT and SAM in Cambridge told the world and then contributed in so many ways Andy Wright had faith in us in the early days too and has gone on to write the best Basic we ve ever seen Later Bruce Everiss played a vital role in making
50. SIC and an advanced version of this is built into the SAM Coup s memory to make programming as easy as possible LEN is a function used to calculate the LENeth of a string LENGTH d array name is used to tell you the size of an array If n 1 the first dimension is returned 148 Glossary and if n 2 the second dimension is returned LENGTH can also be used to find the location of a string or array in memory by using for example LENGTH 0 A which gives the address of the first byte in the string or array data area This is useful for telling CALL where the location is when you want to modify the data For numeric arrays you have to use brackets after the name e g D LENGTH 1 LET is used to give a variable a value such as O LET x 1 The Sam Coup allows long string and array names and several can be made at once Light pen When plugged into the correct port at the back of the Sam Coup this device can be used to communicate directly with a computer program by touching the screen The x and y coordinates of the light pen may be read by using the functions XPEN and YPEN Line numbers All lines entered into a computer program must begin with their own number so that they can be stored away in order to be acted on when the program is RUN It is usual to number lines in tens in case you want to add extra lines between the existing ones You can tidy up messy line numbering with the RENUMb
51. STEP 8 20 FOR p 0 TO 7 30 PALETTE 8 40 PRINT p c TAB 3 PAPER p 8 STRINGS 29 50 NEXT p 60 PRINT 70 PRINT Press any key 80 PAUSE 90 CLS 100 NEXT c 110 PALETTE Make sure there is a space between the quotes in Line 40 and RUN the program What you should see on your screen now is a colour chart of the new tubes of paint on offer eight at a time with their code numbers printed in front of them It s possible that some users have only got a black and white television for displaying pictures and I apologise but I can t think up names for 128 different shades of grey For anyone enjoying glorious colour displays you can see if you agree with my descriptions in the colour chart table be low 65 Chapter 5 COLOUR CHART TABLE 0 pitch black 32 Burgundy 64 1 true blue 33 plum 65 2 brick red 34 hellfire 66 3 magenta 35 strike me pink 67 4 leaf green 36 butterscotch 68 5 cyan 37 hog foot 69 6 banana 38 orange 70 7 paper white 39 shrimp 71 8 charcoal 40 sunset red 72 9 electric blue 41 mauve 73 10 poppy 42 scarlet 74 11 lavender 43 shocking pink 75 12 emerald green 44 sandstorm 76 13 sky blue 45 doggy tongue 77 14 primrose 46 pineapple 78 15 snowflake 47 guava 79 16 navy blue 48 woad 80 17 peacock 49 misery blue 81 18 deep purple 50 geranium 82 19 Picasso 51 amethyst 83 20 denim 52 moleskin blue 84 21 bluebell 53 Pluto blue 85 22 Parma violet 54 terracotta 86 23 bluegrass 55 pomegranate 87 24 Atlantic 56
52. T PEEK SVAR 8 NAME SVAR NUMBER LNCUR 0 CURRENT LINE CURSOR CHAR NORMALLY LCCUR 1 CURSOR CHARACTER WHEN CAPS LOCK IS OFF NORMALLY UCCUR 2 CURSOR CHARACTER WHEN CAPS LOCK IS ON NORMALLY BINIDIG 3 CIIARACTER USED BY BIN AS 1 NORMALLY 1 BINODIG 4 CHARACTER USED BY BIN AS 0 NORMALLY INSTHASH 5 CHARACTER USED BY INSTR AS MATCH ANY TIIING CHARACTER NORMALLY SLDEV 6 CURRENT DEVICE LETTER USUALLY I ON A TAPE SYSTEM SLNUM 7 CURRENT TAPE SAVE SPEED OR DEFAULT DRIVE NUMBER WHEN A DISK DRIVE IS IN USE SPEEDINK 8 SPEED OF FLASHING COLOURS SEE PALETTE COMMAND PRRHS 14 RIGHT HAND TEXT COLUMN FOR PRINTERS 1 LESS THAN THE MAXIMUM LINE LENGTH DE SIRED AFTERCR 15 CHARACTER CODE SENT TO THE PRINTER AFTER CHR 13 IF CHANNEL P IS IN USE NORMALLY 10 TO GIVE AUTOMATIC LINE FEED POKE SVAR 15 0 TO STOP ANY CHARACTER BEING SENT DMPTL 16 2 BYTES ADDRESS IN SCREEN OF TOP LEFT CORNER FOR GRAPHIC DUMPS 175 Appendix System Variables DMPLEN 18 GRAPHIC DUMP LENGTH IN 8 PIXEL UNITS NORMALLY 22 DMPWID 19 GRAPHIC DUMP WIDTH IN 8 FAT PIXEL UNITS NORMALLY 32 DMPWM 20 GRAPHIC DUMP WIDTH MULTIPLIER 12NORMAL 2 OR 3 CAN BE USED FOR DOUBLE OR TRIPLE WIDTH DMPHM 21 GRAPHIC DUMP HEIGHT MULTIPLIER 1 NOR MAL NOT 1 DOUBLE GCMI 22 9 BYTES INITIAL MESSAGE SENT TO PRINTERS BEFORE A DUMP GCM2 31 8 BYTES MESSAGE SENT BEFORE EACH DUMPED ROW GCM3 39 7 BYTES FINAL MESSA
53. TCH 36 34 32 31 29 27 25 24 22 20 19 17 15 13 12 10 8 7 5 3 1 BEEP 3 0 113 15 18 2 2 125 2 30 32 34 PITCH xs 9 11 12 14 16 17 19 21 23 24 26 28 29 31 33 35 M I played Mozart last night Mozart lost Les Dawson 95 Chapter 7 Making Music If you want to use more complex scales for special effects or certain types of oriental music smaller intervals are allowed such as BEEP 1 0 5 which will give a quattertone above middle C Frequencies The computer has an eight octave output frequency range from 31Hz to 7 81kHz and for specialist notation using frequencies in cycles per second frequency can be calculated by typing in the follow ing formula where P equals pitch O PRINT 440 2 P 9 12 Shortcuts There is no need to re type your musical creations every time you want to fine tune yout computer to other musical instruments or change the key of anything you have written For instant key and timing changes simply setup variables for duration and pitch before typing in your music Now try this example 10 LET d 1 20 LET p 0 30 d 4 d 4 d 5 d 7 d 7 BEEP d p 5 d 4 d 2 4 d p BEEP d p 2 BEEP d p 4 BEEP d 4 BEEP d p 2 BEEP d p 2 If p has a value of 0 that piece of Beethoven will play in the key of C major but by LETting p 7 for example
54. a If you add a final colon to the DEF KEYCODE line the automatic RETURN is suppressed so CJ DEF KEYCODE 195 PRIM sam has the effect of PRINTing sam in the editing area Instead of a line you can also use this technique with a string such as O DEF KEYCODE 195 TESTING defined code can be cleared by omitting the expansion or whatever was between quotes as in either of the following examples CJ DEF KEYCODE 195 O DEF KEYCODE 195 DEF PROC Is a statement that precedes the DEFinition of a PROCedure which has a name and a list of any variables that are being used to pass data to the procedure DELETE The DELETE key deletes to the left when pressed SHIFT and DELETE pressed together will delete to the right 139 Glossary DELETE n TO m deletes a block of program lines between a pair of chosen line numbers If the line numbers are the same a single line is deleted If n is omitted line number 1 is used If m 1s omitted the last line of the program is used DEVICE lets you use the commands SAVE LOAD MERGE and VERIFY with a disk drive or network of computers You can use DEVICE in the following ways DEVICE d which tells the computer to use Disk Drive 1 DEVICE d1 which does the same thing DEVICE D1 which also does the same thing DEVICE N5 use Network Station 5 DEVICE T use tape running at standard speed to SAVE data DEVICE T35 use tape running at fast speed to SAVE data 35 1s the top sp
55. alent of a number as an eight character string if the number is less than 256 or as a sixteen character string if the number is between 256 and 65535 The following functions are also available BAND m and BOR m which give binary AND OR Bit is the smallest piece of data which can be represented in a computer s memory by 1 or 0 BLITZ a is used to execute a string of graphics commands very quickly It works in all modes but is especially effective in mode 4 BLITZ responds to the special graphics scaling variables XOS and YOS which enable a graphic shape to be BI ITZed anywhere on screen and the size of the BLITZed shape can be altered by changing the special graphic variables XRG and YRG BLOCKS turns the block graphic characters on and off BLOCKS 0 turns the block graphics off and allows the pre defined foreign character set CHR 128 to 143 to act as user defined graphics UDGs BLOCKS 1 turns the block graphics back on Luckily UDGs don t get forgotten and you can call them up again by using BGRAPHICS 0 BOOT loads the Disk Operating System DOS from the disk into the computer s memory 134 Glossary BORDER changes the colour of the screen border to any colour in your palette from 0 to 15 For example BORDER 6 changes the screen border to yellow BREAK when pressed this button at the back of the machine will interrupt the program Programmers can use software techniques to change the function of thi
56. als The func tion of each pin is set out in a table that can be referred to in the Appendix This is the socket that accepts devices such as PRINTERS SCANNERS and VIDEO DIGITISERS This 21 pin socket can handle superb quality video as well as full stereo audio outputs from the SAM Coup which results in better audio visuals than normal composite signals output from the UHF socket to a television aerial input With the SCART socket the red blue and green components of the video display are handled separately and synchroni sed and the audio signals are delivered as separate left hand and right hand channels This is particu larly useful when using monitors video digitisers and professional audio visual recording equipment The function of each pin is set out in the Appendix 104 Chapter 9 JOYSTICK MOUSE Burn not your House to fright Away the mice Thomas Fuller LIGHT PEN Using a Printer Expanding the System One of the simplest and cheapest add ons for your computer system is used to control movement and action in game playing A JOYSTICK allows very fast reactions to be achieved by manipulating a short lever tracker ball or steering device which acts in the same way as the cursor controls with the additional facility of an action controller or fire button Although the joystick port is a standard 9 pin Atari type two players can each have their own joystick control because an extra strob
57. an PAPER prints out as black DUMP will not work with a listing that gets CLEARed In the event of you changing your mind after the printer has begun to operate you can rescue things by BREAKing into the program DUMP on its own does a graphics copy of whatever is on screen Unless you tell it otherwise this will be at the normal current width and height of the char acters If you want to shovel a screenful of text into your printer then use the command DUMP CHR Experienced users should also note that LPRINT works via stream 3 which is normally open to channel p a parallel printer There is a flexible system for translating characters with codes greater than 128 into sequences that allow alternative char acter sets to be selected while any of these charac ters is being PRINTed 107 Chapter 9 Expanding the System SAM Coup Ready to Expand d NETWORK Pm mt i _ 3 MOUSE i PRINTER SCANNER VIDEO CAMERA DIGITISER Dno VCR DATABANI BANK 108 Chapter 10 MEMORY O handling memory FREE RAMTOP and MEM O OPEN and CLOSE O machine code O PEEKing and POKEing USR CALL CLEAR O IN and OUT O using a disk drive memory is the Thing you forget With Alexander Chase 109 Chapter 10 Available memory Bits and Bytes Memory gobblers Truth is the most valuable thing
58. and produce a pattern of dots These patterns are similar to the grids of pixels that make up characters on screen and they can be as flexible and numerous as anything you create on screen DAISY WHEEL PRINTERS use a ribbed wheel with each petal rep resenting a pair of characters but you have to change the wheel every time you want a different style of typeface LASER PRINTERS use a laset beam to reproduce character codes sent from the computer onto paper Apart from the operating instructions that come with your printer you will need to know how to use the following statements The pair of instructions LPRINT and LLIST act in LPRINT and exactly the same way as PRINT and LLIST except LLIST that they tell the computer to use the printer instead of the television screen You can use TAB in the same way as described in Chapter 6 with AT acting like TAB with printers To print graphic screens onto paper the instruction DUMP DUMP is used Supposing that you ve created a multicoloured graphic masterpiece that you want to keep on paper but your printer only outputs in monochrome DUMP deals with certain types of printer to stop complicated screens turing into gar bage when they get printed out in black and white It can be used in any screen mode and will result in unshaded printed copy like this In MODE 1 and 2 all set pixels print out as black 106 Chapter 9 Expanding the System In MODE 3 and 4 any colour other th
59. ant BRIGHT 1 turns the instruction on and BRIGHT 0 sets the colour back to normal There is a special setting using BRIGHT 8 or BRIGHT 16 which means transparent in other words the brightness on the screen is to be left unchanged when a character is printed there The FLASH instruction works in MODES 1 and 2 only This particular attribute of a given colour makes it appear to FLASH rhythmically FLASH 1 turns it on and FLASH 0 turns it off FLASH 8 or 16 sets a transparent state that is left unchanged at any character position Whenever a character appears on the screen it appears as a pattern of coloured dots chosen by your PEN on a background colour chosen by your choice of PAPER So when you press the SHIFT and A keys together the symbol for a capital may appear as the pattern of dots in the left hand diagram Colour and Light 70 Chapter 5 Colour and Light INV key Now look at the right hand diagram By pressing the INV erse key before SHIFT A the pattern of dots is reversed with the PEN colour becoming what evet the PAPER colour was and vice versa INVERSE There is also an INVERSE command used to cause characters that follow it to be printed as PAPER colour on a background of PEN colour This is set by INVERSE 1 and turned off by INVERSE 0 OVER OVER is a statement for controlling the pattern of graphic dots on the screen and causes a sott of OVERprintng of poin
60. atement 124 Chapter 12 ERROR CODE NUMBER 18 19 20 21 22 23 24 25 ERROR CODES ERROR MESSAGE Invalid file name You are trying to SAVE a file but have forgotten to give it a name or the name is longer than 10 char acters Loading error The file you want to LOAD has been found but there is something wrong with it and it refuses to LOAD properly or fails to VERIFY Check your cables vol ume level cassette tape and dirty play back heads of the cassette player Invalid device You are trying to SAVE or LOAD data but you are using the wrong thing for input output such as a disk drive instead of a cassette recorder or have forgotten to plug it in Invalid stream number You are trying to use a stream number that is inap propriate Streams 0 to 16 are the paths to the various channels E g 5 P K End of file The end of a file has been reached usually a disk file Invalid colour You have tried to specify a colour with a number that is not appropriate Colours range from 0 to 127 Invalid palette colour The palette s paint pots range from 0 to 15 Too many palette changes The maximum number of PALETTE changes is 127 per screen 125 Chapter 12 ERROR CODE NUMBER 26 27 28 29 30 31 32 33 ERROR CODES ERROR MESSAGE Parameter error Either you have used the wrong number of argu ments the wrong type of argument like a nu
61. atest news and advances concerning SAM Please fill in your Registration Guarantee form and we ll do the rest If you need any extra information ot specialist details we have prepared a Technical Manual for advanced users Write to us at the address below or telephone the Sam Coup Cus tomer Care Line with any enquiries ideas or achieve ments 9 am to 7 pm Monday to Friday MGT want to know what the most important component in our business thinks and that means you MILES GORDON TECHNOLOGY LAKESIDE PHOENIX WAY SWANSEA ENTERPRISE PARK SWANSEA SA7 9EH UK SAM CUSTOMER CARE LINE tel 0792 791100 Chapter 1 Setting Up What you get is What you see Now that you have opened the SAM Coup pack Age please check that everything is present and Correct and identify the following items 1 your Sam Coup computer 2 this User Manual 3 the Guarantee Registration card 4 the power supply unit with a phono socket for connecting SAM to a TV set a cable with a 6 pin DIN plug that delivers power to SAM and another cable waiting for the fused plug sup plied that will take power from the mains 5 a connecting cable with 3 5mm jack plugs at either end to transmit and receive computer data via a cassette recorder 6 the connecting cable between the TV socket on the power supply unit and your own televi sion set 7 our data cassette and booklet of demonstra tion computer programs including th
62. atives Keys NORMAL simply pressing the key on its own SHIFT which is the same as pressing the CAPS SHIFT key on a typewriter or wordprocessor to give capital letters SYMBOL resulting in a series of alternative charac ters graphic blocks or codes CNTRL which is a control status providing some specialised codes direct from the keyboard as well as alternative graphic blocks Advanced programmers can make use of the key board map in the Appendix which shows the special number codes allocated to each key to indicate their position but we don t want you to confuse these with the SAM Coup s system for coding all the alpha numeric and symbol chacac 85 Chapter 6 Text and Graphics ters The command KEY position x is explained in the Glossaty You ve got access to 256 possible characters each one with a code between 0 and 255 All the codes below 32 are used for special purposes like con trolling inverse video and characters 32 to 168 have been predefined on your SAM Coup If you want to take a look at them now RUN this small program Character Set CJ 10 FOR a 32 168 PRINT CHR a NEXT a You can try that again when you understand how to turn the special BLOCKS of graphics on and off but for the time being if you want to discover individual character codes try O 20 FOR a 32 TO 168 PRINT CHR 23 a NEXT a Another technique available for advanced program mets is
63. ber of pixels long X is rounded to an even coordinate and the width is rounded to an even number of pixels This technique only works in MODES 3 and 4 SCROLL direction number of pixels works in exactly the same way as ROLL except that there is no wrap around effect Blank background replaces the lost data SCROLL direction pixels x y width length works in exactly the same way as its ROLL counter part except that there is no wrap around effect Windows A screen window is rather like the picture within picture on some video recorders and refers to a specified area that is to be manipulated independ ently from the rest of the screen WINDOW left right top bottom sets up a text WINDOW The limits are set by designating which left hand column to use 0 or above followed by the right hand column usually 80 Chapter 6 Text and Graphics column 31 but this can be up to column 84 in MODE 3 with 6 pixel wide characters followed by the top line to be used 0 or above with the fourth number giving the bottom line of the WINDOW If the requested borders are not allowed in the current MODE or character size then Invalid WINDOW is reported GRAB a x y width length stores a screen area to a string which can be PUT somewhere else The screen area to be GRABbed is defined by x y as the top left hand corner fol lowed by its width and then its length in pixels GRAB and PUT only work in MODES 3 and 4 and the x coo
64. blic tele phone nearby and the wee alien calls home revers ing the charges The first cuckoo of spring is heard O 10 REM sound effects 20 GO SUB 3000 30 REM steam locomotive 40 LET L 7 GO SUB 2000 50 LET p 20 GO SUB 1000 100 REM flying saucer 110 LET L 3 GO SUB 2000 120 LET 20 GO SUB 1000 200 REM sonic scooter 210 SOUND 17 4 SOUND 16 64 220 LET 5 GO SUB 1000 PAUSE 200 300 REM telephone 310 GO SUB 3000 320 LET L 7 GO SUB 2000 330 FOR n 0 TO 3 340 SOUND 2 255 PAUSE 18 350 SOUND 2 0 PAUSE 8 360 SOUND 2 255 PAUSE 18 370 SOUND 2 0 PAUSE 80 380 NEXT n 400 REM cuckoo 410 BEEP 0 2 19 BEEP 0 4 15 420 STOP 1000 stereo heft to Right 1010 LET a 0 LET b 0 101 Chapter 8 Sound Effects 1020 LET L 1 LET R 0 GO SUB 1500 1030 LET L 0 LET R 16 GO SUB 1500 1040 LET L 1 LET R 0 GO SUB 1500 1050 LET L 0 LET R 16 GO SUB 1500 1060 RETURN 1500 REM output subroutine 1510 SOUND 2 a b PAUSE 1520 FOR n 1 TO 15 1530 LET a a L LET b b R 1540 SOUND 2 a b 1550 PAUSE p NEXT n 1560 RETURN 2000 REM output sound data 2010 DATA 9 64 16 16 17 0 24 138 28 1 21 4 20 0 2020 DATA 9 255 17 1 20 4 2030 DATA 24 142 20 4 10 111 17 6 9 128 16 32 28 1 2040 FOR n 1 TOL 2050 READ a d SOUND a d NEXT n 2060 RETURN 3000 REM clear the sound 3010 FOR n 0 TO 31 SOUND n 0 NEXT n 3020 RETURN The experts among you can detect that stereo and volume
65. calculate random numbers RANDOMIZE or RANDOMIZE 0 sets it to the number of frames generated since the computer was switched on RANDOMIZE n sets the random number seed to a specified number READ is a statement that is followed by a list of the names of variables separated by commas It works like an INPUT statement but saves you the trouble of typing in the values of the variables by looking them up itself from DATA statements You can also use READ LINE with string variables allowing you to omit quotes in DATA statements RECORD STOP turns off the graphic recording This command works in any mode RECORD TO lets you record graphic commands as STRINGS so they can be executed a lot faster when you BLITZ them While RECORD is on the following commands will be recorded CIRCLE CLS DRAW DRAW TO OVER PAUSE PEN PLOT but not PLOT PEN REM is simply a REMinder statement in a program put there for your use not the computer s REM can be followed by anything you like and the computer will ignore it You can use it to title blocks of information such as O 10 REM income tax routine RENUM automatically RENUMhBbers an entire program in steps of 10 starting with line 10 RENUM n to m automatically RENUMberts part of a program starting from line n and includ 158 Glossary ing line m If line n is left out the first line is assumed If line m is omitted the last line is assumed RENUM STEP s make
66. chosen charac ter 7 in our example Please see Chapter 10 regarding PEEKing and POKEing Don t forget that you can change the PEN and PAPER colour for any UDG so if you redefine a block graphic as a checkerboard pattern of alternate 0 and 1s any two colours can be effectively mixed together lt 0 0 0 O OP We very pleased to include a full range of options for several different type fonts as well as a user defined character set that you can customise in our FLASH demonstration cassette You will be able to use the whole range of graphic options included in this art package for your own programs and the FLASH instruction booklet will introduce you to all the possibilities of computer art using your SAM Coup Let no one say Have said noth ing new the arrangement of the subject is 33 new Pascal 91 This page was blank in the original manual 92 Chapter 7 MAKING MUSIC BEEP hitting the right note frequencies and shortcuts volume and stereo SAM Coup and sampler 00000 0 the wonders of MIDI Music has charms to soothe the savage beast to soften rocks or bend a knotted oak William Congreve Doobie doobie doo Prank Sinatra 93 Chapter 7 Making Music The Sam Coup is an excellent music synthesiser If you using the UHF TV aerial socket sound
67. ck of the computer are ready to be used in setting up this network NETWORKS At its simplest level there is no need for any sophis ticated equipment or software because everything is built in Cassette based systems work very well and you can play multi user games at two more different locations The only limit is your own imagination More serious networking is achieved by using disk drives and printers and there arc even methods of communicating with other networks all over the world EDICATION As a stand alone machine the Sam Coup has been designed to excel as an educational computer From primary school to university its colour sound and add on facilities offer a complete range of options Early learners and disabled users can take advantage of the MGT Mouse for simple control as well as the MGT Light Pen for help with reading The CSIZE command will create instant large scale characters for users with impaired sight As many as 16 machines can be linked up in a classroom network with obvious advantages when it comes to sharing the resources of disk drives and printers Data is LOADed to every computer and progress of the whole network can be monitored and SAVEd from the teacher s machine Channel 0 is normally the broadcast station in an educational netwotk with channels 1 to 15 used for the personal operator stations allocated to the stu dents computers There is a wide range of educa tional software fo
68. ck of your computer Because MIDI is a world standard there are thousands of manufacturers producing different lumps of musi cal kit that can all synchronise and play together through the computer The SAM Coup handles this data at the international standard rate of 31 25Kbaud 31 250 bits of information every sec ond receiving it through the MIDI IN port and transmitting it via its MIDI OUT socket 97 Chapter 7 Making Music So the computer not only creates its own music but thanks to MIDI you can use it to memotise syn chronise learn teach and control the musical wonders of piano keyboards synthesisers sam plers rhythm machines special effects processors audio video units real time music clocks and dedi cated sequencers Of course the SAM Coup will also perform as any one of these items itself The next Chapter explains how to use the sound chip to create sound effects and the use of volume and stereo this plugged In Bruce Gordon 98 Chapter 8 SOUND EFFECTS O sound effects in programs ZAP POW ZOOM BOOM O stereo and multi channels Nosse is the most Impertinent of All forms of Interruption Schopenhauer 99 Chapter 8 Pre Set Sounds Awophop aloobop Alopbam boom Little Richard Sound Effects The SAM Coup is capable of producing wonderful sound effects which can enhance computer pro grams in any way you choose They can cr
69. colouts for the PEN and PAPER of each cell can be made from 16 paint pots selected from a range of 128 colours Each screen will consist of 768 character cells This is the screen MODE used by the Spectrum computer so Spectrum users can feel at home simply by ENTER ing MODE 1 for using their games library The SAM Coup will examine their software with the conversion utility included on the FLASH demonstration cassette MODE 2 offers 192 lines with 32 cells each giving a total of 6144 character cells of 8 x 1 dots with colour selec tions the same as in MODE 1 MODE 3 allows up to 85 columns of characters which is especially useful for applications like word proc essing Only four colours are used MODE 3 doesn t use cells at all but lets you use the individ ual dots or pixels You are given 192 lines with each line having 512 pixels giving 98304 dots to play with The first time you select MODE 3 the first four PALETTE positions are redefined to black blue red and white If you switch to another MODE your previous selection of colours is poured back into these paint pots and returning to MODE 3 sets them back again to whatever was used last in this MODE Of course you can change the pres elected colours to any one of the 128 on offer MODE 4 is the SAM Coup s favourite and is selected every time you switch on There are 192 lines of 256 pixels 68 Chapter 5 Colour and Light each and you can use 1
70. cs mask the second mask ing string must be the same length as the original string Missing END IF You are using a long IF statement over a number of lines and have chosen to omit THEN but you have forgotten to end the statement with END IF Invalid variable name Your numeric variable name does not start with a letter or is longer than 32 characters Your string and string array variable name does not end with ot is longer than 10 characters BASIC stack full Please see Chapter 10 for dealing with memory stacks String too long Your string is more than 65520 characters long or in the case of STRINGS only 512 characters are al lowed 127 Chapter 12 ERROR CODE NUMBER 43 44 45 46 47 48 49 50 ERROR CODES ERROR MESSAGE Invalid screen number When the computer is switched on there is only one screen numbered 1 You are trying to OPEN a screen with a number outside the range 2 to 16 This error message also appears if you select a screen with the SCREEN or DISPLAY commands that has not been OPENed Screen is already open You are trying to use OPEN SCREEN with a number that already exists Stream is already open You want to open a stream which is already occu pied Invalid channel You are attempting to use an inappropriate chan nel Stream is not open You are trying to use a stream number that is CLOSEd Invalid CLEAR address You are trying to CLEAR with a number be
71. d end with BC length DE start A page of start if DE gt 3276 CALL n can be used to summon up a particular address with a list of numeric or string parameters if desired E g CJ CALL address x y SAM This is explained in the Technical Manual CLEAR is used to free up all of the space in the computer s memory occupied by variables by CLEARing them away CLEAR n acts like CLEAR but it alters the system variable RAMTOP to a position specified by the number n N must be within the 4 pages allocated to BASIC when the computer is switched on and must be lt 81919 unless extra pages have been OPENed IN and OUT The computer has 65536 INput OUT put ports or I O potts for short and these are used to commu nicate with internal devices such as the keyboard and sound chip as well as external devices like printers Each port can be controlled with the function IN and the statement OUT CJ IN address reads the byte from the addressed port and gives that byte as the result C OUT address value wtites a given value between 0 and 255 to the addressed port between 0 and 65535 114 Chapter 10 Memory Disk A choice of one or two ultra slim disk drive units can drives be slid inside the front panel of the SAM Coup These ate removeable consoles and each one can accomodate one megabyte of memory on a 3 5 floppy disk offering 780K per disk after it has been formatted for use Disks offer very fast SAVE
72. d refers to a single addressable dot of the computer s screen display PLOT x y is a statement used for setting the start position for drawing pictures and diagrams on your screen The drawing begins wherever you instruct the first pixel to be located This is done by typing PLOT followed by the x coordinate which tells the pixel how far it must be from the left hand side of your screen and the y coordinate saying how far it is from the bottom of the screen POINT x y gives a pixel s colour at coordinates x y In MODES 1 and 2 it can be 0 or 1 showing if a pixel is PAPER or PEN in MODEs 3 and 4 it can be from 0 to 15 to indicate the pixel s colour POKE is an impolite statement that barges its way past the rules of BASIC and stores a number directly into a memory location which we call an address For the memory that comes with your Sam Coup addresses can be from 0 to 528K in the range 0 to 16384 are not normally effective as this area is occupied by ROM POP takes away a line number from the GO SUB PROC DO stack and throws it away When POP is followed by a variable then the discarded line number becomes assigned to that variable so you can jump out of GO SUB routines DO loops PROCedures without messing things up with unused line 156 Glossary numbers POP x assigns the discarded return line number to a variable such as x PRINT is the command that instructs the computer to PRINT out speci
73. decimal point can often give very messy results in BASIC programming It would be much mote convenient to use whole numbers which are known as INTegers This function always rounds down to the relevant whole numbet which can be either a positive or a negative number 45 Chapter 4 don t believe in mathematics Albert Einstein TRIGONOMET RICAL FUNCTIONS EVERYDAY BASIC SGN is a function that shows whether a mathematical argument is positive or negative It is short for signum or sign and can give three alternative tesults 0 if the argument is zero 1 if it is positive and 1 if the argument is negative ABS converts an argument into a positive number by completely ignoring any negative signs You would expect your computer to cope with the sort of trigonometrical functions to be found on a pocket calculator and of course it can PI is the Greek letter and is used to summon up a useful number which begins 3 14159653 and goes on for ever In trigonometry PI is the tool for calculating aspects of circles and spheres such as the perimeter of a circle PI diameter and so on x axis x axis 46 Chapter 4 EVERYDAY BASIC Supposing you want to know more about a circle where a point has moved from the right hand side of the x axis up along the perimeter for a distance a and stopped at the position b We don t refer to a as the number of degrees in the angle between the x
74. dition branches from the middle of the routine back to the DO if that condition is true If the condition isn t true then again everything continues to the end of the routine Because these BASIC commands consist of words which have a similar meaning in English their use should become clear very quickly There is also a group of three functions that consist of short English words whose use is equally obvious AND OR and NOT are used to combine two or more logical operations IF something is true AND something else is also true THEN that relationship can be exploited for ex ample O 10 IF a true AND x 1 THEN GO SUB 500 But a relationship can be made true whenever one thing OR the other is true such as O 10 IF x gt 1 OR sky blue THEN PRINT x Perversely the use of NOT makes false things true and true relationships false when used on its own or in combination with AND or OR Try LET ting x y and a have suitable values then RUN this until you understand how it works 56 Chapter 4 ADVANCED SAM BASIC O 10 IF NOT x lt gt y OR NOT a sam THEN NEW GO TO 10 These logical expressions can be put in brackets just like numerical expressions and they are worked through with NOT having he highest priority fol lowed by AND and with OR having the lowest priority In actual fact by changing relationships you can dispense with NOT altogether A particular statement can be selected from the rest ON o
75. ds the program specified by its name ignoring any other program that may be on the tape VERIFY name checks that the information just SAVEd is exactly the same as the information in the computer s memory with the same name MERGE name adds new information from the named program to information already in the computer s memory overwtiting any existing pro gram lines that conflict with the new program CUP OF TEA is a whole lot more hit and miss than any other procedure in this chapter Finally if you ever get into difficulties while a ESC program is RUNning you can ESC ape from trouble by holding down the key at the top left corner of the keyboard This will stop the machine RUNning and then BREAK into its memory After ESC aping simply press the RETURN key to display the program listing 26 Chapter 4 SAM Basic Beginner s BASIC keywords REMinders starting and stopping PRINT statements making decisions IF and THEN Everyday BASIC OOCOOOCO vanced SAM BASIC strings variables and arrays ELSE LOOPing FOR NEXT STEP subroutines calculations functions beautified BASIC random numbers DATA READ RESTORE DIM DO WHILE UNTIL AND OR NOT DEF EN string conversions PROCedures REFs and LABELs system vatiables 21 Chapter 4 Let all things be done decently and in order Corinthians 14 40 Keywords BEGINNER
76. e is bound to an error two over looked ot some text formatting that s been g left for another day 187
77. e line and power line has been included This will accept a special MGT plug socket adaptor for dual joystick control This little beast is connected to the mouse hole at the back of the SAM Coup and is used to control a screen cursor by sliding it over a non slip flat surface special mouse mat Various on screen options can also be selected by clicking buttons or tracker balls built in to the mouse The position of the mouse coordinates can be read by using the function XMOUSE to find its x coordinate and YMOUSE to discover the current y coordinate The status of a mouse button from 1 to 3 can be revealed by the function BUTTON n Please see Glossary for de tails This device is used to communicate directly with the screen by physically pinpointing x and y coor dinates with a so called beam of light It is espe cially useful when used with graphic art packages and often operates with a graphics tablet scratch pad The light pen coordinates can be read by using the functions XPEN and YPEN to show the x and y coordinates To use the SAM Coup as an effective word process sor simply to PRINT out computer programs and 105 Chapter 9 Expanding the System screen images onto paper as hard copy you will need one of the many printers that are commercially available The most common kind and usually the cheapest is called DOT MATRIX PRINTER which uses a tiny grid of pins to strike a type ribbon
78. e spec tacular graphic art package FLASHT Chapter 1 CONNECTING THE POWER CABLES Tt ain t what you do it s the way that you do it Bananarama CONNECTING TO AN ORDINARY COLOUR TV SET Turn on Tune in setting Up The fact that you might have to fit the power supply unit 4 with the supplied mains power plug is not because MGT are lazy but because cabling require ments and mains socket outlets vary in different regions and countries For UK users you ll proba bly have wall socket outlets that take 3 pin 240v fused mains plugs so connect the power plug in the normal way with the BROWN cable to the live terminal and BLUE to neutral The plug should have a 3 amp fuse Don t plug into the mains yet and make sure the ON OFF button at the back of the computer is in the OFF position As you look at the back it s the third item from the right on the control panel and it sticks OUT for OFF and stays IN for ON Now identify the cable from the power supply unit with the 6 pin DIN plug on the end and connect it to the power socket at the back of your Sam Coup As you look at the back panel there s only one socket that can take a 6 pin DIN and it s the one on the extreme right hand side Next identify the TV cable 6 and plug the correct phono plug into the aerial socket of your television set with the other end plugged into the TV phono socket on the power supply unit Now you can plug into t
79. eate at mosphere act as markers add realism soothe shock and bring comic relief Sound effects often use mixed frequencies Their manipulation is not eay to undrstand but to start you off we have pre programmed some special comic strip effects that can be summoned and used in your programs simply by calling up their names just as if they were ordinary commands ZAP is exactly what it sounds like the noise of a bellig erent laser beam POW provides an impact effect a bit like dry flesh hitting wet fish ZOOM Call be used to illustrate fast movement of anything from a jet plane to a skateboard BOOM is what happens when bombs stock markets and gluttons explode Advanced programmers can use the command SOUND to send special codes to the sound chip It routes data bytes d to individual sound chip Regis ters and up to 127 pairs of such numbers can be used like this O SOUND r d etc Full details are to be found in the Technical Manual but beginners in BASIC are welcome to cheat by copying in the following soundtrack First let me 100 Chapter 8 Sound Effects set the scene All is dark An old steam locomotive moves from the West towards the dawn Suddenly a tourist flying saucer passes overhead on its way to Alpha Centauri for breakfast But the crew have forgotten to pick up one of the younger extra terrestrials who tries to catch up on her sonic scooter and fails Luckily there is a pu
80. ed by a string of letters or numbers or Spaces are NOT allowed as any part of this name and upper and lower case letters are treated exactly the same But you can follow the procedure name by a list of parameters which must be the names of variables or you can use the DATA keyword They automatically become LOCAL to the procedure When DATA is used instead of a parameter list no assignments are made but the list of actual parameters that occur after the procedure has been called can be dealt with by using READ plus the function ITEM which is explained below 59 Chapter 4 ADVANCED SAM BASIC The location of a procedure in the program has no effect on the speed of the program whatsoever LOCAL specifies a list of variables including arrays which you want to be local to any procedure anywhere in the program ITEM is a function that relays information concerning the next ITEM to be READ in a DATA statement The result 0 is given when there are no more ITEMs 1 is given if the next ITEM is a string type and if it is a numeric type 2 is given ENDing END PROC PROCedures acts as you would expect by marking the end of a named procedure This allows the computer to avoid ploughing through all the statements between DEF PROC and END PROC unless that particular procedure is called up END PROC erases any LOCAL variables and restores their normal values if they exist DEFAULTed DEFAULT Variables There certa
81. eed likely to prove feasible for saving data on to tape 112 is a standatd relatively slow speed Unfortunately fast speeds are less reliable than slow ones There is no need to remember at what speed you saved your data because the LOAD command automatically copes with the full range of speeds DIM makes space for an array in the computet s memory The name of the atray can be up to 10 characters long excluding spaces The numbers that make up the DIMensions follow in brackets and they can be between 1 and 65535 The total size of the array is only limited by the available memoty DIR only wotks with disks Disk is a magnetic device for the rapid SAVEing storing and LOADing of computer data The SAM Coup can use 3 V inch floppy disks Disk drive The SAM Coup is fitted with two sockets for custom made extra memory disk drives Each drive can contain an additional 256K DRAM 140 Glossary DISPLAY n alters which screen is being DISPLAYed but not the screen used by BASIC One screen can be building up invisibly while another is currently DIS PLAYed DISPLAY or DISPLAY 0 shows the current screen DISPLAY 1 to DISPLAY 16 shows the required screen number DIV is the equivalent of dividing one integer by another so that OPRINT 241 DIV 24 results in 10 DO DO acts as a market to which a matching LOOP statement can return So O 10 DO 20 PRINT PLAY IT AGAIN SAM 30 LOOP will go round in circles for
82. eens to use in anyway that you need SCREEN number selects a particular SCREEN for use by BASIC commands Its number must be between 1 and 16 and it must first be OPENed like this C OPEN SCREEN 2 This allows commands like PRINT PLOT and DRAW to use a second SCREEN leaving SCREEN 1 intact until it is selected again OPEN SCREEN number mode reserves memoty for a screen when qualified by the screen number followed by the screen MODE The screen number must be between 2 and 16 and MODES 1 to 4 can be selected Each screen retains its own MODE PALETTE details PRINT positions and so on OPEN SCREEN n m 0 acts the same as OPEN SCREEN n m OPEN SCREEN n m 1 opens a common screen so that 1f several programs are present in the 78 Chapter 6 Obedience A mechanised Automation Shelly Scrolling and rolling Text and Graphics machine s memory they can all use the screen when they are running CLOSE SCREEN number releases the numbered screen s memory for an other use If you CLOSE a screen that doesn t exist nothing will happen DISPLAY number alters which screen is being DISPLAYed but not the screen used by BASIC One screen can be building up invisibly while another is currently DISPLAYed DISPLAY or DISPLAY 0 shows the current screen DISPLAY 1 to DISPLAY 16 shows the required screen number CLS stands for clear screen and wipes off the display file fro
83. en this is RUN truth is rewarded but now change line 20 by giving x another value and RUN into trouble You can think of that example as a short IF But a long IF can work over a number of lines by omitting THEN Try changing the value of x after RUNning this O 10 REM moody 20 LET x 1 30 IF x 1 40 PRINT HAHAHA 50 PRINT snort 60 ELSE PRINT BOOHOO 70 PRINT SNIFF 80 END IF So if x 1 HAHAHA and snort results but if x lt gt 1 we would get BOOHOO SNIFF Of coutse the lines can contain more than one state ment but the IF routine must end with END IF 40 Chapter 4 EVERYDAY BASIC ELSE IF The condition ELSE IF has a special meaning Try typing this in O 5 REM vague numbers 10 PRINT type in a number between 1 and 9 20 INPUT x CLS 30 IF x 1 40 PRINT one 50 ELSE IF x 5 60 PRINT less than 5 70 PRINT honestly 80 ELSEIFx 8 90 PRINT eight 100 ELSE 110 PRINT something else 120 END IF 130 STOP Disorder is If line 40is executed followed by line 150 always in a Yojf 2 If x 2 3 ot 4 lines 60 and 70 are executed and then D line 130 Napoleon Bonaparte If x 8 line 90 is executed then line 130 If x any other value line 110 is executed then line 130 So once the computer knows that any condi tion is true the lines and statements after it are executed and when another ELSE IF or ELSE is encountered the program jumps straight to a posi tion immediatel
84. er SHIFT also changes what appears when you use it with all the number and most of the symbol keys CAPS You can lock everything into capitals by pressing the CAPS key on the left hand side of the key board This state is unlocked simply by pressing CAPS again to go back to normal upper and lower case Because you can t use an eraser or correcting fluid ona TV screen without making a filthy mess we DELETE have ptovided a DELETE key near the right hand side of the top row This will deal with any mistakes that get typed in accidentally Press DELETE once and the last character you typed gets rubbed out If you hold down the DELETE key characters continue to be erased very quickly from right to left on your TV screen SHIFT DELETE erases to the right The remaining keys have more specialised func tions but don t worry what they do yet just locate them on the keyboard RETURN is the large corner shaped key near the centre right on the keyboard ESC is an ESCape key at the extreme top left Both of these keys are explained in the next Chapter The whole group of keys on the far right of the keyboard is explained in Chapter 4 It includes ten 14 Chapter 2 CARING FOR YOUR SAM COUPE CARING FOR DISKS AND CASSETTES What s What special function keys numbered FO to F9 a decimal point key and four keys at the bottom with directional arrow heads on them known as c
85. er facility or the automatic AUTO feature and line numbers can be up to 65279 LIST or LLIST LIST n lists a specified line number LIST n TO m lists a specified block of lines If the first line number is omitted the first line after 0 is assumed If the second line number is omitted the last line of the program is assumed LIST FORMAT or LLIST FORMAT allows you to produce an automatic pretty listing with each statement given its own line and these lines indented to help program readability The first six 149 Glossary columns on the screen are reserved for line numbers and spaces and programs can have up to 65279 lines LIST FORMAT 0 gives unindented listings LIST FORMAT 1 or 2 gives an automatically indented listing by one or two spaces when certain keywords are recognised in the program DEF PROC DO and FOR indent all following statements by one or two spaces until they are cancelled by END PROC LOOP or NEXT IF ON ERROR and ON indent all statements in the rest of the line by one or two spaces ELSE and EXIT IF cancel one or two indentation spaces for the current statement only END IF cancels indentations due to a long IF LN calculates natural logarithms A logarithmic function is the inverse of an exponential function LOAD is used to LOAD information from cassette or disk into the computer If you are using a cassette player LOAD loads the first program recognised by the computer wi
86. er of pixels to be moved to the right and y determines the number of pixels to be moved upwatds If you want to move to the left or downwards simply give x or y a DRAWing negative value DRAW x y z works in the same way but by adding the angle z the line is turned and becomes a curve DRAW TO x y is the command for drawing an absolute line from the current position to the point x y You can use PAPER PEN OVER etc after DRAW TO and after DRAW PLOT and CIRCLE commands The fol lowing example draws random lines that never go off screen O 10 FOR n 1 TO 100 20 DRAW TO RND 255 RND 173 30 NEXT n DRAW TO x y z draws an absolute line from your current position to the coordinates x y while creating a curve by turning through the angle z Draw a smile like this 1110 PLOT 90 86 20 DRAW TO 166 86 2 Leave the smile on your screen and draw a circle round it 75 Chapter 6 Text and Graphics CIRCLE x y radius draws a citcle on the screen when it is followed by the position of the centre of the circle on screen the x y coordinates and the radius of the circle Now surround the smile with O CIRCLE 128 100 50 If larger circles go far enough off the top or bottom of the screen they will wrap around to the opposite edge of the screen FILLing FILL colour x y is a graphics command for FILLing any enclosed shape with one colour Colours are specified by using their code numbers and the target area i
87. ering Mathematics 15 the subject in which we never know what we re talking about Bertrand Russell EVERYDAY BASIC Here are some variations O AUTO numbers after here in steps of ten O AUTO 150 numbers from line 150 in steps of ten O AUTO 150 5 numbers from line 150 in steps of five Of course you can choose any line number and any step you want Direct commands such as STOP or deleting the line number offered will turn AUTO off RENUM This instruction will RENUMber all your program lines in steps often starting with the first line as 10 RENUM n TO m RENUM bets part of the program starting from line n up to and including line m If n is omitted then it statts from the first line and ifm is left out the last line is assumed RENUM LINE L makes number L first new line number RENUM STEP s uses numbers in whatever step s you instruct The slice of program LINE and STEP can be used ot left out as you wish but they must occur in the follow ing order O RENUM n TO m LINE L STEP s When RENUMbering all your instructions like GO TO GO SUB RESTORE RUN LINE ON etc are dealt with but any expressions such as GO TO VAL 100 will be ignored The screen is used to hold temporary data during a RENUM operation and is cleared at the end of the task 50 Chapter 4 EVERYDAY BASIC LIST FORMAT or LUST FORMAT is a technique that creates an automatic pretty LISTing in which each sta
88. ever so it is useful to qualify a DO command You can use DO WHILE which will result in the part of the program between DO and LOOP being executed WHILE a specified condition is true Alterna tively you can use DO UNTIL which is the opposite condition instructing the program to execute that part between the DO and LOOP while condition is false but to stop as soon as it becomes true DOS is the abbreviation for Disc Operating System DPEEK addtess a double PEEK which is the equivalent to PEEK address 256 PEEK address l See DPOKE address executes a double POKE which is the equivalent to POKE address number INT number 256 256 POKE address 1 INT number 256 In other words the least significant byte of the number is POKEd to the address and the most significant byte is POKEd to the next higher address The value must be between 0 and 65535 141 Glossary DRAM is an abbreviation of Dynamic Random Access Memory DRAW x y is the command for drawing a line relative to the current position by moving x pixels to the right and y pixels up If x or y has a negative value then movement becomes leftwards or downwatds DRAWx y z draws a relative line from the current position to the coordinates x y while creating a cutve by turning through the angle z DRAW TO x y is the command for drawing an absolute line from the current position to the point x y You can use PAPER PEN OVER etc after
89. f a line of program by using the keyword ON CJ ON x PRINT one PRINT two GO SUB 100 will PRINT if x l two if x 2 and GO SUB line 100 if x 3 If x has a value of zero or is greater than the number of statements following ON the program continues with the next line FUNCTION The function keys on the right hand side of the SAM KEYS Coupe keyboards have been pre defined as fol lows FO LIST RETURN Fl RENUM RETURN F2 PRINT F3 MODE F4 RUN RETURN F5 CONTINUE RETURN F6 CLS RETURN F7 LOAD RETURN F8 LOAD code RETURN F9 BOOT RETURN Please refer to Chapter 6 for redefining key codes Si Function names can have any length must begin DEFining with a letter and continue with letters or numbers FuNctions 57 Chapter 4 ADVANCED SAM BASIC For example O DEF EN charset DPEEK SVAR 566 256 would give the location of the character set with the command PRINT FN charset String function names must end with such as O DEF EN Left a n a TO n Functions do not have to have brackets if there are no arguments but any variable names used inside brackets will be local to the FN and can only be one letter long Here are a few more useful functions that you should become familiar with They are all designed to help with the handling of strings String STR Conversion converts numbers and numeric expressions into strings giving the same result as i
90. f the number was to be displayed on screen by a PRINT statement O PRINT STR 30 5 VAL converts strings back into numbers and the string which is used as its argument can contain any nu meric expression A similar function is also avail able called VAL which uses a string as an argu ment and gives a string as its result E g O PRINT VAL 69 2 3 CODE can be used to give the first character in a string and if the string is empty the result 0 is given O PRINT CODE a PRINT CODE x 58 Chapter 4 Searching Strings PROCEDURES DEFining PROCedures ADVANCED SAM BASIC CHR gives a single character string when it is applied to the code number of that character Please see Chapter 6 for character codes E g O PRINT CHR 65 INSTR n a b will search for b inside a starting at position n Its position is returned when found or the result 0 is given if the search is unsuccessful By omitting n the search begins from position 1 You will be pleased to discover that there are certain procedures that make programming easier Mod ules can be created that execute a specific task without affecting the main program but first they have to be defined DEF PROC name kicks off the DEFinition of a named PROCedute and DEF PROC must be the first keywotd in a program line although preceding spaces and colour control codes are allowed The procedure name must start with a letter follow
91. fied charac tets graphics or results on screen See Chapter 4 for full details of how this wotks Printer is a machine that can produce images of text and graphics on paper known as hard copy when connected to the appropriate port on the Sam Coup Procedures make programming easier By using the statements DEF PROC END PROC DEFAULT LOCAL and REF program modules can be created that do a specific task without affecting the main program Please see Chapter 4 Program is simply a collection of commands used to instruct the computer PUT x y a places a stored area on the screen which has already been GRABbed The x coordinate is rounded up to an even value PUT x y a m makes use of a second string which has to be the same length as the first string to act as a graphic mask which determines which pixels will be used from the first string This allows a complex shape to be placed on a background as if it was a cut out without a border OVER has no effect in this masking mode but INVERSE will still work Radian A radian is the angle subtended by an arc whose length is equal to the radius of a circle RAM stands for Random Access Memory Data stored in RAM is lost when the RESET button is pressed or the computer is switched off 157 Glossary RAMTOP is the function that shows you the top address in the computer s Random Access Memory which is usable by BASIC RANDOMIZE uses a seed number to
92. for as many frames as you want or until a key 1s pressed Your screen displays 50 frames evety second so we can use numbers counted in frames to give a very accurate freeze frame timing For example O 100 PAUSE 10 will freeze an image for one fifth of a second 32 Chapter 4 Waiting for INPUT Jumping with GO TO ESC aping CONTINUEing BEGINNER S BASIC INPUT tells the computer to halt everything until some thing is typed in We will be using STOP INPUT and the next command GO TO to write a guessing game at the end of this Beginner s BASIC section GOTO is recognised as one keyword in BASIC even though itis two words in English and may be typed go to or goto It is used to command the computer to im mediately GO TO a particular line of program and can also be used to give the same instruction when a particular condition has been met Try this ex ample CJ 10 REM greetings 20 PRINT happy birthday to you 30 PAUSE 50 40 GO TO 20 When you run this greetings are printed all the way down the screen every second But before the program fills up the screen press the ESC ape key to halt the process CONTINUE Once a program has ground to a halt because of an error ot a deliberate ESC ape break in it can be kick started by typing in the keyword CONTINUE Try using it now and allow the greetings to CON TINUE until the screen is full and asks you if you want to scroll scroll a
93. he mains switch on the TV set and push SAM S power switch ON which is the IN position The computer sends out signals that can be picked up by Channel 36 of a domestic TV set If you are using specialist monitors ot stereo SCART type sockets connections are explained in Chapter 2 and Chapter 9 This Chapter applies to ordinary UHF televisions only Fine tune your set around Channel 36 until you see a test pattern with the following message appeating on the screen Chapter 1 Welcome screen Testing Testing bate television as much as peanuts 1 can t stop eating peanuts Orson Welles Setting Up MILES GORDON TECHNOLOGY plc 1989 Sam Coup 256K This is the welcome screen that appears every time the computer is switched on or restarted from scratch and the number at the end reports how much memory your Sam Coup has on board If it has been fitted with extra memory the end number will read 512K You can now test out SAM for colour and sound to make sure that everything is in order In this Manual the symbol is used every time we want you to type something on the computer keyboard so without any explanations try typing this O BORDER 1 You can type in capital letters or lower case letters it doesn t make any difference Now locate the large RETURN key near the centre right of the key board and press that The BORDER around the TV screen picture should have changed to bl
94. in circumstances usually to do with procedures when you might want to create a vari able only if it doesn t already exist This is achieved buy using the command DEFAULT For example O DEFAULT x 20 will make x 20 if x is not already existing other wise x will keep its current value Discarded POP addresses will discard GOSUB PROCedure RETURN ad dress and POP x will assign a discarded RETURN 60 Chapter 4 REFerences LABELing Today there s law and order in everything Maxim Gorky System variablse ADVANCED SAM BASIC line number to a variable such as x In a DEF PROC Iist variables including atrays are passed by REFerence if their parameter is preceded by REF This means that the variable is renamed to the name given in the DEF PROC Iist and any changes to it will persist outside of the procedure Otherwise variables will have values assigned to them from the list in the procedure call It is possible to omit any all values and supply them from inside the procedure using DEFAULT With non REFerenced variables only the value is passed to the procedure and the variable is LOCAL Variables can be created by using LABEL at the start of aline followed by a legal numeric variable name When any part of the program is run via GO TO etc the newly created variables are given the name after any LABELs in the program and their values are set to the line number with that LABEL E g C
95. ing and LOADing of programs and are the most con venient way of storing large quantities of data And if this massive capacity isn t enough then you can connect up to gigantic networks of data as outlined in the next Chapter To take full advantage of the extra speed and Using a disk memory available with the MGT removeable disk drive drives a few mote commands have to be learned First of all the Disk Operating System DOS for short must be loaded into memory BOOT loads DOS from disk and allows you to use the special DOS operations FORMAT to prepate a new disk for accepting data DIR which examines the DIRectory of files on disk MOVE which shuffles files around and ERASE to wipe out any files you don t need DEVICE makes the commands SAVE LOAD MERGE and VERIFY work with the disk drive or with a network of several computers Please refer to the Glossary of this Manual for details and rest assured that MGT disk drives are accompanied by their own illuminat ing manual 115 This page was blank in the original manual 116 Chapter 11 COMMUNICATIONS O networks O education O streams and channels O piracy is theft Soap and edu cation are not as sudden as a massacre Mark Twain 117 Chapter 11 COMMUNICATIONS One of the most exciting features of your SAM Coup is its ability to communicate with one or mote similar machines The MIDI IN and MIDI OUT connections at the ba
96. ing the machine even more useful The Sam Coup has a large built in memory and can call up information stored on magnetic tapes and disks Memory and disks are dealt with in Chapter 10 MGT produce special slim line DISK DRIVES that fit right inside your computer via the twin dock ing slots at the front of the machine The slots exposed by unclipping their protective covets with access for DISK DRIVE 1 on the left and DISK DRIVE 2 on the right To connect your computer to the outside world a bank of special sockets ports and buttons is pro vided at the back of the machine They are num bered on the diagram as follows 1 BREAK BUTTON When pressed this button will halt whatever is going on in a computer program Programmers can choose to use it as an ESCAPE BREAK or CRASH button 2 MIDI OUT Musical Instrument Digital Interface Output for sending musical information The standard 7 pin DIN connector can also be used to talk to other computers in a NETWORK 3 MIDI IN Musical Instrument Digital Interface Input or MIDI IN for short can receive pulses of information from drum machines synthesisers and other instruments as explained in Chapter 7 This interface socket Chapter 2 What s What takes a standard 7 pin DIN connector not supplied and can also be used to listen to other computers as part of a NETWORK 4 JOYSTICK PORT Socket for a standard 9 pin Atari type joystick plug The joys
97. ion colour LINE y is a command that sets a temporary palette position and colour when the y axis of the graphics coordi nates system of a specified LINE on the screen is reached The new setting continues to operate until the bottom of the screen unless another setting is chosen This is a way of displaying more than sixteen colours on one screen PALETTE position colour a colour b LINE is a command that lets you choose temporary alter native flashing colour at a given y coordinate with a maximum of 127 changes per screen PALETTE position LINE y deletes any colour change that would affect PAL ETTE position p at line y She comes in Colours every Where she s like A rainbow The Rolling Stones 72 Chapter 6 TEXT AND GRAPHICS graphic commands PLOT DRAW CIRCLE FILL FATPIX and graphics scaling SCREENSs WINDOW GRAB and PUT animation INKEY and GET the character set CSIZE TAB AT BLOCK graphics user define graphics The difficulty is not to mean what you write but write what you mean Robert Louis Stevenson Art is a he Pablo Picasso 73 Chapter 6 THE GRAPHIC COMMANDS Text and Graphics This chapter explains how to use the advantages of your computer for manipulating written text and graphic images Old fashioned typewriters use keys to print out pre set characters and more modern machines allow you
98. isk drive ot another computer the polite message Invalid device will appeat If you don t specify a program name and just type Program Names O LOAD the computer will LOAD the first program that it finds The reason for identifying individual pro grams with their own name is to make it easy for the computer to locate a particular set of instructions from a whole series of programs that maybe stored on the same tape You can now write another program and SAVE it onto cassette leaving a gap of blank tape after your amnesia program First type in O 50 PRINT please tell me your name RETURN 60 INPUT n RETURN 70 BORDER 6 RETURN 80 BEEP 3 12 RETURN 90 PRINT I remember now Hello n RETURN RUN INPUT When you type in RUN this time you will be able to talk to your Sam Coup for the first time This is because you have used a very special instruction in the program INPUT tells the machine to wait until you type something in before responding So when the screen asks you to tell it your name it waits for yout INPUT before recognising you Type in your name and see how SAM recognises it You don t have to use your real name you can INPUT who ever or whatever you feel like 24 Chapter 3 Software You can call this or any other program anything you want using a name up to 10 characters long Identify the program you have just written by using your own name and SAVE it as before with O SAVE my name
99. it all happen marshalling industry support and raising public awareness Bojangeborg gave up a summer in Sweden to write Flash Fouad Katan Keith Turner and David Whittaker not only got involved in developing material but also turned out to support us at public events Dave Hood who designed our otiginal logo now proves his graphic skills with the demonstration software Thanks too to Simon White Mike Burns and Paul Bater for their invaluable support Nor should we forget the MGT team we can t mention one of you without mentioning all let s just say that collectively you re the best in the business And finally thanks to our loyal customers We ve often said that our best ideas come from our customers Now we hope you ll be able to see just how hard we ve been listening to you Alan Miles Bruce Gordon and Rob Collins THIS SAM COUPE MANUAL IS WRITTEN AND DESIGNED BY MEL CROUCHER LASER TYPESET BY KATE CAMERON DAUM AND ILLUSTRATED BY ROBIN EVANS FOR YOUR ENJOYMENT FIRST PUBLISHED 1989 BY MILES GORDON TECHNOLOGY plc LAKESIDE PHOENIX WAY SWANSEA ENTERPRISE PARK SWANSEA SA7 9EH U K MILES GORDON TECHNOLOGY plc 1989 All rights reserved NO PART OFTHIS MANUAL MAY BE REPRODUCED ORADAPTED BY ANY MEANS UNLESS FORTHEPURPOSESOFREVIEWORFORTHEUSEOFTHE OWNER OF THIS MANUAL IN ENTERING PROGRAMS INTO THEIR SAM COUPE EVERYTHING IN THIS MANUAL IS OFFERED TO YOU IN GOOD FAITH AND MILES GORDON plc WILL NOT BE LIABLE IN ANY EVENT FOR A
100. ke doubly sure that what s on tape is the same VERIFY as what s in the computer s memory wind back your cassette and reconnect the cassette cable to the EAR socket for sending signals OUT to the SAM Coupe Now type in the checking command for your program O VERIFY amnesia RETURN and play back your SAVEd program If all goes well more border patterns will appear as well as a recognition message at the top of the screen program amnesia followed by the OK confirma tion When the program is safely stored and you ve found the confidence to switch off your computer to wipe out its memory and the kettle has boiled you can switch back on and LOAD the SAVEd information Check that the cassette is wound back and ready to send information OUT via its EAR socket and give the command O LOAD amnesia RETURN As you may have guessed what you see on screen is the same as when you used VERIFY with your program safely stored on tape ready for use when ever you need to use it ot change it If it doesn t work first time off cassette check that the cables are connected correctly and then wind back and adjust the volume until SAM is happy Error The Sam Coup will let you know if it s having any Messages problems in SAVEing and LOADing your informa tion by displaying the message Loading error 23 Chapter 3 Software on screen And if you try to SAVE information to a device which doesn t exist like a d
101. keep things in a neat and simple order computer programs are broken up into lines just like the lines in a printed book of instructions Each line is given its own reference number at the beginning so that the computer knows exactly which part of its program you are talking about and we usually number lines in tens to make it easier to add extra lines between the original line numbers Because you want the computer to obey each line of program you will want to send your typed instructions to be stored in its memory and this 1s where the corner shaped RETURN key comes into play RETURN has several uses and the First one is to achieve just this Remember the key symbol is used to mean in whatever follows this so have a go at typing the following program exactly as it appears below press RETURN at the end of each line and don t wotty how it all works for the time being You type a question mark by pressing SYMB X together O 10 BORDER 3 RETURN 20 PRINT I HAVE AMNESIA RETURN 30 BEEP 3 0 RETURN 40 BORDER 1 RETURN 50 PRINT What is my name 21 Chapter 3 Software RETURN You will see your lines of program appearing at the bottom of the screen as you type them in and as soon as they are committed to the computer s memoty by pressing RETURN they are listed at the top of the screen as part of the computer pro gram with a little arrow character gt pointing out which line of program
102. l instruments talk to each other and stands for Musical Instrument Digital Interface The Sam Coup is able to control and communicate with all sorts of music devices via its MIDI IN and MIDI OUT ports MOD is a mathematical function whose result is a load of left overs e g O PRINT 110 MOD 60 will result in 50 MODE n cleats the screen and selects the numbered screen mode Modem is the abbreviation for MOdulator DEModulator a device for transmitting data between computers via telephone lines Mouse is a little device that is connected by a cable to the correct port at the back of the computer When slid around over a flat surface it can control a screen cursor and when its buttons are clicked it selects various options The x and y coordinates of the mouse may be read by using the functions XMOUSE and YMOUSE 152 Glossary MOVE only works with disks Nesting is the process of placing one or more program blocks inside each other Network Up to 16 Sam Coup s can be linked in a network with Channel 0 as the broadcast station and Channels 1 15 as personal operator stations NEW gets rid of all old programs and old variables that are in the computer s memory When you use the NEW command the computer forgets everything it has learned since you switched it on NEXT is a special counting command used in a loop It is always used in conjunction with the FOR command and you should refer to the FOR section t
103. lent to a paper document self contained and in its own named binder FILL is a graphic command for FILLing a shape with a colour See Chapter 6 FLASH works in modes 1 and 2 only and is an attribute of a given colour making it FLASH rhythmically FLASH 1 turns it on FLASH 0 turns it off FLASH 8 or 16 sets a transparent state that is left in changed at any character position Font describes the style and appearance of the letters numbers and symbols as they appear when PRINTed on screen or onto paper Character fonts can be changed as described in Chapter 6 FOR is a command which is always used in conjunction with NEXT and it is used to cut down repetitive programming For example instead of entering a hundred lines for a hundred similar calculations you can shortcut the procedure by writing CJ FOR times 1 TO 100 NEXT times FORMAT only wotks with disks FREE is the function that shows you exactly how much free memory you have left for BASIC programming and variables 144 Glossary Functions work on numerical values called arguments in order to give another value called the result and are used by typing in the name of the function followed by the argument Function names in SAM BASIC can have any length GET is a way of reading the keyboard without the use of ENTER It is like INKEYS except that GET waits for a key to be pressed before continuing When used with a string variable GET ac
104. listing But if you forget to leave a space and type 28 Chapter 4 BEGINNER S BASIC 10 printx RETURN the computer will assume that you have given it the name of a special procedure This only happens with letters so you can get away with typing things like 20 print RETURN which automatically becomes PRINT 1 in the pro gram Commands can be given directly to your computer Giving for instant action all you have to do is type one in commands and then press the RETURN key They can also be used within program lines to work with other in structions later on Whenever RETURN is used after you have written a line of program that line becomes part of the listing From now on we ll assume you know that and stop printing RETURN at the end of every line in our examples As lines of program are being written they appear as a listing in the top section of your screen if all is well but any mistake in syntax the grammar of SAM BASIC gets pointed out by a question mark asking you to correct it before it can become part of the program The bottom two lines of the screen are reserved for special reports that help you spot mistakes and your computer will display all sorts of messages to pin down what the problem is and where it s hiding These messages are called error codes and they are all explained in Chapter 12 You may well need this sort of help because each line of your program can be as long
105. ll have seen in line 50 of the last example INKEY how the INKEYS function can be used to read which keys are being pressed if any GET is a way of reading the keyboard without the use of RETURN It is like INKEY except that GET GET waits for a key to be pressed before continu ing When used with a string variable GET acts like a type writer so that CJ 10 DO GET a PRINT a LOOP prints keys as you hit them and you can SHIFT between upper and lowercase as normal If GET is used with a numeric variable such as GET x then the variable will equal 1 if 1 is pressed up to 9 if 9 is pressed A or a has a value of 10 B or b 11 and so on GET is very useful in menu driven programs 84 Chapter 6 Text and Graphics RECORD RECORD TO a lets you record graphics commands as strings so they can be executed a lot faster if you BLITZ them While RECORD is on the following commands will be recorded CIRCLE CLS DRAW DRAW TO OVER PAUSE PEN PLOT but not PLOT PEN or other temporary commands RECORD STOP turns off the graphics recording Both RECORD TO and RECORD STOP work in any MODE HANDLING The second part of this Chapter explains how you TEXT can make the best use of the SAM Coup s text handling facilities Each key has been pre set to deliver text or graphic symbols and there is a table in the Appendix that shows what happens when you press each key using the following altern
106. m ber instead of a string Invalid argument You are using an argument that is not suitable for the function you want Number too large Your calculations have resulted in a number that is too enormous for the SAM Coup to handle Not understood The computer is confused by your mis use of BASIC Integer out of range A whole number called an integer is required but the argument you are using has been rounded to an integer that is outside of a suitable range Statement doesn t exist The computer can t make a decision or obey an in struction without the necessary statements For example you may have deleted statements after a GO SUB and then RETURN ed Off screen The graphic requirements that you have asked for cannot fit on the screen No room for line There is not enough room in the available memory for the line you are trying to insert or the line numbering requested in a RENUM is impossible 126 Chapter 12 ERROR CODE NUMBER 34 35 36 37 38 39 40 41 42 ERROR CODES ERROR MESSAGE Invalid screen mode There four screen modes numbered 1 to 4 Invalid BLITZ code You have used BLITZ with a string that does not contain sensible graphics commands Stored area too big You cannot fit the area you want to GRAB into store Invalid PUT block The string that you want to PUT on a screen is not a real block of screen data PUT mask mismatched When creating a graphi
107. m the screen CLS or CLS 0 clears the entire screen whereas CLS 1 cleats the current WINDOW area of a screen only see WINDOW below There is a more powerful clearing command CLS not only clears the screen but executes the commands OVER 0 INVERSE 0 FLASH 0 PAPER 0 PEN 7 BORDER 0 PALETTE at the same time Sometimes your screen isn t big enough to show everything you need especially if you are produc ing complex documents and tables When this happens the screen displays the question Scroll and waits for a response in order to scroll the screen upwards But you can adjust what you see on the screen in a variety of other ways either by moving the entire screen display vertically or horizontally ot by moving a particular section of the screen display known as WINDOW 79 Chapter 6 Text and Graphics SCROLL CLEAR disables the Scroll prompt altogether when the screen becomes full and makes the screen SCROLL upwards automatically SCROLL RESTORE turns the Scroll prompt back on ROLL direction number of pixels moves the picture on your screen and wraps it around itself Movement is controlled by direction 1 left 2 up 3 right 4 down followed by the number of pixels to be moved 1 2 4 6 8 10 etc ROLL direction pixels x y width length only ROLLS the screen section designated by x y coordinates marking the top left corner followed by the number of pixels wide and the num
108. n By taking on board a few more complex ideas you can write your first computer game If the computer just obeyed lists of instructions line MAKING after line programs would be very limited and DECISIONS boring The magic begins when your machine thinks for itself and starts making decisions 35 Chapter 4 BEGINNER S BASIC The easiest way to get the computer to make a IF and THEN decision is to show it a condition and offer it a choice between ttue and false so that IF some thing is true THEN the computer will take one A course of action If it is false THEN the machine en S does something else The Sam Coup understands 1 Ko the following symbols which you can use as short pw hand with IF THEN statements means is equal to lt gt means 1 not equal to gt means is greater than lt means is less than gt means is greater than or equal to lt means 1 less than or equal to Use NEW to wipe out any old programs in the computer s memory then type in this guessing game and RUN it The lt and gt characters are typed by pressing SYMB Q and SYMB W Get a friend to think up and type in secret numbers which the computer will help you to discover See how the GO TO PAUSE IF and THEN wotk how evety thing between the quotations marks gets PRINTed exactly on screen and how the STOP brings the game to an end when the number is guessed cor rectly
109. n in brackets after the name of the array This number represents a DIMension or a space in the computer s memory that is reserved for the atray to occupy The name of an array can be up to ten characters long excluding any spaces and the number in brackets can be anything between 1 and 65535 The statement for setting up the DIMensions of an DIM array is DIM and is used like this CJ DIM a 100 We ll come across it again at a more advanced level So far we have glossed over one of the most impor LET i tant processes in the computer s brain The key word LET is at the heart of all BASIC programming It is used to define all variables or to give them some sort of value as in 38 Chapter 4 EVERYDAY BASIC O 10 LET x 1 But your Sam Coup allows you to make as many as you want at the same time You can use long string and array names and set up all sorts of variables in a single line simply by dividing them with commas For example CJ 10 LET x 1 flag 2 alph yummy A variable that represents a number is called not surprisingly a numeric variable You can choose any name you want for it providing you follow these simple rules the name must begin with a letter any letters or numbers or spaces can follow the first letter up to a total of 32 characters Spaces don t count as characters So the following numeric variable names are acceptable x SAM ENCHANTED EVENING or R2D2 But 2R2D is not acce
110. ndles expressions in a strict order of priority Any multiplication and division are calcu lated first in order of appearance from left to right Only after they have been dealt with will additions and subtractions be attended to again in order from left to right You can get round this rigid system by 44 Chapter 4 MATHEMATI CAL FUNCTIONS EVERYDAY BASIC using brackets and then anything inside the brackets is evaluated first and treated as a single number For example DJ PRINT 10 10 25 4 These days an electronic calculator is expected to do a whole lot more than simple arithmetic and your Sam Coup has already been taught to handle mathematical and trigonometrical functions using these abbreviations We can t teach you maths or trigonometry here so if you are not interested in these subjects you may as well skip the following section EXP 15 an exponential growth function defined by EXP x efx SQR calculates the SQuare Root of a positive number n That is to say it finds out what number has to be multiplied by itself to give n LN is the inverse of an EXPonential function and is the Logarithmic Number function Common loga rithms use the numeric base 10 but LN calculates natural logarithms which use the base e To find logatithms to any other base just divide the natural logarithm by the natural logarithm of the base INT Arguments that consist of a load of numbers either side of a
111. nting to enjoy a wide range of superb colours in computer programs had to invest in relatively expensive machines The SAM Coupe changes all that It has four video MODES built into it and each of them offers no less than 128 colours to choose from Imagine yourself as an artist equipped with one of those gently shaped boards on which you squeeze out colours from different tubes of paint Artists call this board a PALETTE and the Sam Coup provides you with just such a board for holding all the colours that you can use The paint manufacturers make 128 different coloured tubes and your PALETTE has room for 16 at a time which it holds in num bered paint pots Every time you switch on and each time you use the command PALETTE you are given 16 pre set colours to work with and they are coded from 0 to 15 as follows 0 black 8 black 1 deep blue 9 bright blue 2 deep 10 bright red 3 magneta purple 11 bright magneta 4 deep green 12 bright green 5 cyan light blue 13 bright cyan 6 deep yellow 14 bright yellow 7 white 15 bright white There ate two tubes of black paint simply because your computer prefers things that way Now imag ine that you are choosing which extra colours you want to use for painting your own masterpiece and you want to see the whole range available for use 64 Chapter 5 Colour and Light Displaying the Switch on and type in this colour chart program Colour Chart 10 FOR c 0 TO 127
112. number CIRCLE x y t draws a circle on the screen when it is followed by the position of the centre of the circle on screen the x y coordinates and the radius of the circle If the circle goes far enough off the top or bottom of the screen it will wrap around to the opposite edge of the screen CLEAR gets rid of all variables and frees up the space in the computer s memory which they occupied CLEAR n acts like CLEAR but alters the system variable RAMTOP to the point specified by the number CLOSE is used to shut off streams which are normally OPEN to specified channels CLOSE n frees up n pages of 16k each which are normally used by the BASIC program and variables if RAMTOP allows this After being CLOSEd the freed pages can be used for screens DOS or other programs CLOSE SCREEN n releases a specified screen memoty if it already exists so that its memory can be used again e g O CLOSE SCREEN 2 136 Glossary CLS stands for clear screen and wipes off the display file from the screen CLS ot CLS 0 clears the entire screen whereas CLS 1 cleats the current WINDOW only and CLS not only clears the screen but executes OVER 0 INVERSE 0 FLASH 0 PAPER 0 PEN 7 BORDER 0 PALETTE CODE is applied to a string and it gives the code of the first character in the string If the string is empty it gives 0 Command is a word or short phrase like OPEN SCREEN DRAW and GO SUB used in a program to ins
113. number that has a given tangent Attributes of a character or graphic block at any given position consist of its colour brightness and in MODE 1 or 2 its flash condition AUTO automatically numbers your program lines If you enter AUTO by itself the computer will take the current line number where the program cursor is and add ten at every new line It will not work if the current line number is less than 10 or more than 61439 You can skip over a block of line numbers while using AUTO by deleting the line number provided and typing in your own line number followed by the rest of the line AUTO will carry on from there numbering in steps of ten You can choose your own step values if ten doesn t suit you AUTO number after here in steps of 10 AUTO 150 number from line 150 in steps of 10 AUTO 150 5 number from line 150 in steps of 5 BASIC stands for Beginners All purpose Symbolic Code and is the single most used computer language in the world An advanced version of BASIC is built into the memory of your SAM Coup 133 Glossary BEEP duration pitch is the instruction we use to make the computer produce sound BIN is short for binary and is not a function or a command but mote like a gear change acting as an alternative notation for numbers BIN is followed by a sequence of up to 16 digits made up of is and Os each different sequence rep resenting a particular number BIN automatically gives the binary equiv
114. o see how this works NOT is similar to the AND OR conditions in an IF THEN statement except that it is completely perverse The NOT relation is true when the relation is false and false whenever it s true NOT can be regarded as a low priority function which does not need brackets around it unless it contains AND or OR or both ON allows you to GO SUB or GO TO a particular line number in a list of line numbers according to the value of the numeric expression immediately after ON ON ERROR intercepts mistakes in your programming to allow the program to cope without stopping and giving an error message This is known as error trapping and is detailed in Chapter 12 OPEN is used to OPEN streams that are normally closed 153 Glossary OPEN n reserves n additional 16k memory pages for use by BASIC This allows CLEAR to set a higher RAMTOP OPEN SCREEN n m reserves memory for a screen when qualified by the screen number followed by the screen mode The screen number must be between 2 and 16 and modes 1 to 4 can be selected There is only one screen called 1 when your computer is switched on OPEN SCREEN n m reserves memory for a screen when qualified by the screen number followed by the screen mode The screen number must be between 2 and 16 and Modes 1 to 4 can be selected There is only one screen called 1 when your computer is switched on OPEN SCREEN n m 0 acts the same as OPEN SCREEN n m OPEN S
115. ok at sam you will see that it consists of 20 consecutive characters made up from letters and spaces When a number of consecutive characters are taken from a string one after the other in the same sequence this is called a substring So whereas long wit is a substring of sam bring along whip is not When you sure you understand this idea try the next concept Substrings You can repeat a string for as many times as you like String n a by putting it inside a pair of brackets with the number of repeats you require The special command STRINGS is used to achieve this RUN this little joke 37 Chapter 4 EVERYDAY BASIC O 10 PRINT STRINGS 8 ha Now you ate ready for a more serious idea Using In a calculation when numbers are represented by VARIABLES something else they are called variables If you think of a variable as something that represents a value then you will begin to understand one of the most powerful features of the computer We have already come across variables in the simple form of O 10 LET x 2 20 PRINT THE ANSWER IS x x which when the program is RUN results in THE ANSWER IS 4 appearing on the screen Now try changing the value of x and RUN it again Arrays Very often you will want to use a whole set of similar variables for a weekly bank balance ot a list of football results An array is a group of such variables that are distinguished from one another by a number writte
116. ommercial games you hurt the writers and manufacturers Piracy puts up the price of software and it can drive people out of business If there is less and less original software produced this harms everyone including you By using special routines the Sam Coup s BREAK button can be used to transfer cassette based soft wate to disk for your own convenience Please don t abuse this feature and turn it into a public convenience MGT wants to make it clear that we will provide software producers with all the infor mation we have on how to protect games than run on the SAM Coup and we expect help from re sponsible adults to discourage piracy using our products 120 Chapter 12 ERROR CODES O spotting mistakes error codes and messages using ON ERROR A spent Making mistakes Is more useful Than a life spent Doing nothing George Bernard Shaw 121 Chapter 12 ERROR CODE NUMBER ERROR CODES When a mistake is made in programming or when you ask your computer to do the impossible the Sam Coup helps you spot the error and explain the problem This results in special codes automatically appearing at the bottom of your screen to point out what s gone wrong and where the error is When a programming mistake is encountered helpful messages arc given in the following order one of the code numbers and messages listed below telling you exactly what sort of mistake has been made foll
117. operating 5 to 500Hz 2 ENVIRONMENT Ambient Temperature operating 5 to 45C storage 20 to 50C HUMIDITY Relative Humidity Wet Bulb Maximum 29 AC nil condensation RELIABILITY MTBF 10 000 POH MTTR 30 Mins Component Life 75 years WEIGHT 2 26Kg 4 971b 170 Appendix Lead Connections MIDI SOCKET PLUG DIN 5 MIDI DEVICE SOCKET PLUG DIN 5 _ 4 X MiDIOut Screen 4 __ L uo WC REEL CB MN o 005 5 MiDiOu Signal 5 _ Signal 5 3 Cable Type 2 core with Screen length 2m NETWORK lead MIDI SOCKET PLUG DIN 7 FROM NETWORK PLUG DIN 7 6 NET LOOP Screen 1 6 NET LOOP Me te 4 WA 24x Hs bea ME 13958 MEE UE 3 NET LOOP m ow 7 NET LOOP Signal Cable Type 1 core with Screen length 2m MOUSE lead COMP END PLUG DIM 8 MGT Mouse 8 5v Mouse Interrupt als d i CTRL Mouse Button Read Mouse Select Screen GND Cable Type 8 core flex length 1 25m JOYSTICK lead JOYSTICK PLUG DB9 Atari Compatible Joystick Cable Type 8 core with Screen length 1 25m 171 Appendix Lead Connections CASSETTE lead COMP END 3 5MM Jack EAR MIC 3 5mm Jack 2 Screen 2 EE 1 Signal 1 Cable Type 1 core with Screen length 0 75m LIGHT PEN lead LIGHT PEN LIGHT PEN PLUG DIN 5 Cable Type 4 core with Screen length 1 75m SCART lead SAM SCART MONITOR STD SCART RH RH IN RCHAN IN LH OUT GND AUDIO EARTH BLU GND
118. or short as you like It can contain up to 127 individual statements and each statement can consist of a command like PRINT followed by something else You can have up to 65279 lines in any one program so the error messages can save houts of searching for mistakes Spotting mistakes 29 Chapter 4 The EDIT key and Cursors DELETE BEGINNER S BASIC When writing your own computer programs the most useful key on your keyboard is the EDIT key If you press it you jump into the part of your program that the computer is thinking about marked by a special symbol on your screen that looks like an arrow head gt This marker symbol is known as a cutsor and it appears in front of the line number to be EDITed If you already know which line number you want to EDIT then all you have to do is type in that number and press the EDIT key and watch it appear You can then move around your EDIT line up and down right or left by holding down any of the four cursor keys located at the bottom right corner of your keyboard They are clearly marked with arrow heads to show which direction they control You will notice that the Sam Coup uses two other cursors on screen An inverse points out where you are EDITing when the keyboard is in its normal state but when CAPS lock has been engaged upper case is indicated by an inverse To change you program rub out your old instruc tions before typing in new ones by u
119. owed by the line number where the error is lurking followed by the number of the statement in that line responsible for the foul up For ex ample 5 NEXT without FOR 700 3 tells you that the type of error is code 5 meaning that you have written a NEXT command but forgotten the FOR command and that the problem is at line 700 in statement 3 The code you want to see is 0 which means that everything is OK but even the most experienced programmer can be expected to make mistakes is a list of all the error codes and their error messages with explanations of what they mean ERROR MESSAGE OK No problems successful completion everything is OK Out of memory There is not enough room in the computer s memory for what you want to do 122 Chapter 12 ERROR CODE NUMBER 2 10 ERROR CODES ERROR MESSAGE name of variable not found The computer cannot find a variable either be cause it has not yet been loaded not been assigned set up or you have not set its dimensions Data has all been read You are trying to READ past the end of the existing DATA listing Subscript wrong Either the number of subsctipts is wrong or the subsctipt is outside the dimensions of the array NEXT without FOR Even though there is an ordinary variable with the same name the control variable has not yet been set up by a FOR statement FOR without NEXT Even though there is a FOR loop waiting to run there is
120. p bottom sets up a text WINDOW The limits are set by designating which left hand column to use 0 or above followed by the right hand column maximum 84 in Mode 3 with 6 pixel wide characters followed by the top line to be used 0 or above with the fourth number giving the bottom line of the WINDOW If the requested borders are not allowed in the current mode or character size then Invalid WINDOW is reported x axis y axis are nominal reference lines used in trigonometry cutting a circle from side to side x axis and from top to bottom y axis x coordinate y coordinate coordinates locate an exact point on the screen X is the distance from the left hand side of the screen and Y is the distance from the bottom of the screen XMOUSE YMOUSE please see MOUSE 166 Glossary XOS XRG YOS YRG are special functions that control the graphics scaling system in terms of scale and origin Please see Chapter 6 XPEN YPEN please see PEN The following symbols have specific meanings when used within a SAM Coupe BASIC program which may be different from their meanings in conventional English plus minus multiplied by divided by equal to not equal to greater than less than greater than or equal to less than or equal to raise to the power of is used to introduce hex numbers act as conventional brackets in numerical expressions is used in this Manual to indicate a specific key to be pressed can be used
121. ping out the old memory LOAD name loads the program specified by its name ignoting any other program that may be on the disk or tape LOAD name CODE loads the bytes from the first address at which the bytes were SAVEd overwriting any bytes which were previously there LOAD name CODE start loads the bytes beginning at start overriding the start address from which the bytes were originally SAVEd LOAD name LINE number loads the program and goes to line number n automatically LOAD name DATA a or a deletes any specified array then searches for a new one to load If you wish to LOAD from one of the internal disk drives you must first tell the computer which drive to use with the command 150 Glossary CJ DEVICE d or DEVICE 41 or DEVICE D1 for disk drive 1 and O DEVICE 42 or DEVICE D2 for disk drive 2 LOCAL specifies a list of variables which are to be LOCALised to a procedure They can include arrays if you want LOOP is used in conjunction with DO with LOOP WHILE and LOOP UNTIL wotking in exactly the same ways as DO WHILE and DO UNTIL LOOP IF condition makes the program jump out of a DO loop from the middle and carry on again at the statement after LOOP only if a condition is true If it s not true then the program carries on LPRINT instructs the computer to output to a printer instead of the television screen Please see Chapter 6 Machine code is the set of instructions tha
122. ppears when the computer discovers that the screen is full of characters and wonders if you want to see mote by scrolling up the text It s not a command which is why it is displayed in lower case letters Simply press RETURN to scroll up the screen 33 Chapter 4 Clear Screen a NEW start PRINT statements PRINT statement punctuation PRINT commas BEGINNER S BASIC CLS stands for Clear Screen and instantly erases all text and graphics that are currently displayed on your television screen NEW is a very powerful command which is the equivalent of giving the Sam Coup a brain transplant so think carefully before using it NEW wipes out the entire computer program with all of its variables and the only thing left is a blank screen It has the same effect as pressing the RESET button on the back panel of the computer causing all your current work to be flushed to oblivion PRINT PRINT statements are used to display characters on screen There some simple rules of punctuation to learn and the first of these is the use of quotation marks If there is anything in the Sam Coup s memory now get rid of it by typing NEW followed by RETURN Now carefully type in the following PRINT statement O 10 PRINT G day how are you SAM Now press RETURN and RUN it You will see that what is contained inside the quotes appears exactly as you typed it including the apostrophe colon
123. ptable and neither is the use of a keyword like PRINT FOR NEXT variables are treated like ordinary numeric variables numeric variables Variables can also be used to represent strings and arrays The rules are the same except the variable name is limited to a total often characters long and it must be followed by the character For example A R2D2 and GUITAR String and array variables CLEAR Variables can be ordered to vanish by using a command telling them to CLEAR off When CLEAR is typed in it destroys every variable in your pro gram and frees up the space in the computer s memory which they occupied If you have set up any variables use CLEAR now and get ready for the next important concept If necessary read through the last section of Beginner s BASIC con cerning IF and THEN because things are about to get more complex 39 Chapter 4 EVERYDAY BASIC ELSE END IF The Sam Coup also understands the idea of IF qualified by ELSE which must come at the start of a new statement in a line Normally when the statement following an IF is false the program jumps to the next line But if the IF THEN pair has an associated ELSE later in the line the program continues with the statement following the ELSE On the other hand if the condition is true the line will only be executed up to the ELSE For example O 10 REM liar 20 LET x 1 30 IF x 1 THEN PRINT TRUE ELSE PRINT FALSE Wh
124. r the SAM Coup and MGT are always happy to talk to parents teachers and of 118 Chapter 11 COMMUNICATIONS coutse younger SAM Coup users who want the latest information on educational programs and add ons This next section is a little bit technical and you can skip over it if you wish In NETWORK Channel 0 is normally the broad cast station with Channels 1 to 15 used for personal operator channels Streams 0 and 1 are normally OPEN to Channel O PRINT 0 testing PAUSE will PRINT at the bottom of the screen whereas PRINT 2 will PRINT on the upper part of the screen as usual using Channel S PRINT 3 acts like LPRINT using Channel and you may choose to use it like this O OPEN 6 P PRINT 6 hello in order to send output to a printer via Stream 6 INPUT 2 is also allowed and can be used to gain access to the upper part of the screen as in the following example for typing in a value next to a value prompt O INPUT 2 value v Unlike the lower screen the line is left uncleared after you press RETURN The RECORD command works via Stream 16 Stream 16 prints to the string variable specified by RECORD and it will continue to do so after a RECORD STOP 119 Chapter 11 COMMUNICATIONS PIRACY There s nothing clever about theft If you make a copy of a program as a back up for your own use that s sensible but if you steal by making pirate copies of c
125. rdinate for fat pixels is rounded up to an even value For MODE 3 s thin pixels the x and y values are rounded to a multiple of 4 PUT x y a Places a stored area on the screen which has already been GRABbed The x coordinate is rounded up to an even value PUT will respond to the following commands INVERSE as in INVERSE 1 PUT x y b ot as in PUT INVERSE 1 x y ANY OVER 0 which overwrites whatever is already there OVER 1 which gives KOR OVER 2 which gives OR OVER 3 which gives AND but PEN and PAPER will not get a response so you re stuck with the colours that you originally GRABbed PUT x y a n masking allows you to use a second string which has to be the same length as the first string to act as a graphic mask determining which pixels will be used from 81 Chapter 6 MOVEMENT and ANIMATION Cinema is truth twenty four times a second Jean Luc Godard Text and Graphics the first string This allows a complex shape to be placed on a background as if it was a cut out without a border The mask will not respond to OVER but INVERSE will work perfectly There is another way of making a mask by follow ing these stages 1 create the original shape on screen 2 DRAW a box round it slightly bigger than the area to be GRABbed 3 FILL the box with PEN 0 to give it a border of zeros 4 GRAB the area 5 FILL the border area with PEN 15 to give a border of
126. rking the top left corner followed by w pixels wide and L pixels long X is rounded to an even coordinate and w is rounded to an even number of pixels ROLL commands only work in modes 3 and 4 ROM stands for Read Only Memory and is the unchangeable part of computer s brain that has been educated in the factory RND generates so called random numbers starting at a point in a fixed sequence of 65536 numbers Please see Chapter 4 RUN commands the program to be RUN To RUN a program from any particular line you should use RUN n SAVE name christens a program and commands the computer to send a copy of that program from its memory to be recorded SAVE name LINE number is a neat way of getting the program to GO TO a particular line when it gets LOADed SAVE name CODE start address length records information without any reference to what that information is to be used for The first number start address must be the address of the first unit of storage memory known as a byte The second number length is the number of bytes to be stored The address is a number between 0 and 528K Length can be from 1 byte to 512K SAVE name CODE start length execute address will SAVE an auto running CODE file SAVE name SCREEN SAVEs a screen with its PALETTE and MODE information 160 Glossary SAVE name DATA a saves an array or string designated by its own particular name Quotes are optional for strings or
127. s MIDI SOUND EFFECTS ZAP POW ZOOM and BOOM SOUND EXPANDING THE SYSTEM add ons printers MEMORY extra memory machine code disk drives COMMUNICATIONS Education streams and channels ERROR CODES GLOSSARY of SAM computing SAM Coup Specification and Appendix INDEX CONTENTS Page 63 64 66 67 68 70 73 74 77 79 82 86 93 94 96 99 100 100 103 104 105 109 110 112 115 117 118 119 121 131 169 181 Chapter 1 SETTING UP O unpacking the computer O setting up O switching on O testing testing O First Aid checklist To begin at the beginning Dylan Thomas Chapter 1 DON T SWITCH ON Your SAM Coup TALK TO US Ae X Setting Up This User Manual is intended to help you enjoy all the benefits of the Sam Coup micro computer Please read this chapter BEFORE you plug it in and turn it on The manual is designed to assist and entertain those of you who are new to computing as well as inform experienced users who will also benefit from the specialist information The Sam Coup is an advanced machine offering a large memoty brilliant graphics and superb sound It s your vehicle for creative entertainment educa tion and above all fun But your new computer is as important to Miles Gordon Technology as it is to you which is why we want to hear from everyone who enjoys using it and keep you up to date with the l
128. s shown in the chart opposite and can be used to build up diagrams and simple images in a pattern of several characters PRINTed together Block graphics are made up from a pattern of pixels in exactly the same way as normal charactets as desctibed in Chapter 5 and they can be turned on and off at will BLOCKS BLOCKS 0 turns off the predefined block graphics in the chart allocated from 128 to 143 and frees up those characters for you to redesign as user defined graphics or UDGs for short When you type BLOCKS 0 and take a look at them by PRINTing their CHR you will discover that they have already been redesigned as foreign characters BLOCKS 1 turns the original block graphics back on again but your redesigned UDGs kept safe for later use every time BLOCKS 0 is used 88 Chapter 6 Text and Graphics Block Graphics m SYMB 1 CNTRL 1 Chart a SYMB 2 a CNTRIJ 2 SYMB 3 E CNTRL 3 ml SYMB 4 CNTRL 4 inm SYMB 5 CNTRI 5 m SYMB 6 CNTRL 6 SYMB 7 na CNTRL 7 H SYMB 8 CNTRL 8 144 to 168 are also foreign character UDGs e and CHR 169 to 255 are available as UDGs for a S advanced users You can find the address of any user defined character with UDG So that O UDG A will give the address of the character pattern for A in the main character set and if the upper range of UDGs has been set up then U
129. s specified by pinpointing anywhere within the boundary area to be FILLed by the usual x y coot dinates So that leaving your smiling circle on screen O FILL PEN 3 128 86 FILL PEN 6 1 1 fills the shape around the target point and any colour other that the one at x y acts as the bound ary Special effects can be created by FILLing with patterns held in a string so that O FILL USING a x y will use whatever pattern is specified by a The most convenient way to scoop up such a pattern is to GRAB it from an existing screen which is ex plained later FATPIX In graphics MODE 3 the pixels are thin only half the width used by the other MODESs because there are twice as many of them horizontally By using the command FATPIX 1 you can double the width of MODE 3 pixels making vertical lines the same 76 Chapter 6 Text and Graphics thickness as horizontal lines and thin circles truly circular To get back to the normal thin state of affairs use FATPIX 0 which doubles the x axis range in MODE 3 We can now examine ways of manipulating the x axis and y axis The scale and origins used by the PLOT DRAW DRAW TO CIRCLE GET and FILL commands can be changed using four special variables XOS controls the x axis off set of the graphic origin YOS controls the y axis off set XRG controls the x axis range YRG controls the y axis range The off sets have a value of 0 unless they are used with a LET statement as
130. s are relayed through your television speaker in mono A stereo signal is available via the SCART socket at the back of your machine or you can enjoy top quality sound by connecting a hi fi system to the light pen stereo socket outlet and use personal headphones if you want privacy BEEP BEEP d p The computer is instructed to produce a sound by typing in the command BEEP followed by two numbers representing the duration in seconds d and the pitch p of a musical note See if you are wired for sound by typing in the following routine with apologies to Beethoven BEEP 0 5 0 BEEP 0 5 0 BEEP 0 5 0 BEEP 1 5 4 The duration and pitch of those first three notes was 0 5 or half a second long and 0 which is the equiva lent to middle on a piano keyboard I Higher notes are created by making p a positive number up to 71 which is the sort of high frequency that your dog will appreciate and lower notes requite a negative value all the way down to 60 which can cause a small earthquake given enough amplification BEEPS can be as short as you like but the maximum duration is 16 seconds Try this FOR p 60 TO 71 BEEP 3 p NEXT The following diagram shows all the BEEP pitch values that are equivalent to the black and white musical notes on a grand piano along with their musical notation 94 Chapter 7 Making Music BEEP PITCH VALUES BEEP 35 33 30 28 26 23 21 18 16 14 11 9 6 4 2 PI
131. s interruption BRIGHT is used to make a chosen colour more brilliant BRIGHT 1 turns the instruction on BRIGHT 0 sets the colour back to normal There is a special setting BRIGHT 16 which means transparent in other words the colour on the screen is to be left unchanged when a character is printed there Bug is a slang expression that refers to a mistake in a computer program which causes problems when the program is RUN Buffer is an area of memory set aside for temporary storage of data BUTTON n shows the status of the MOUSE button with n being the number of the button from 1 to 3 When the specified button is pressed 1 will be displayed or 0 if it is not pressed If you make n 0 then 1 is displayed if any or all buttons are pressed Byte is a unit of memory made up of 8 bits and is large enough to store one character or a whole number lt 255 CALL n summons up a machine code program at an address with a list of numeric or string parameters if desired Please refer to the Technical Manual CAPS LOCK the CAPS LOCK key causes all key entries to appear in upper case until it is disengaged by pressing it again 135 Glossary Character set There ate 256 possible characters each with a code between 0 and 255 The pre defined character set can be printed out by O 10 FOR a 32 TO 168 PRINT CHR a NEXT a CHR is applied to a number and it gives the single character string whose code is that
132. s is so fast that it may be simpler to search through the entire memory To find every location of a particular string you could use O 10 LET adr 1 20 I ET adt INSTR adr MEM 0 TO 65534 a 30 IF adr gt 0 THEN PRINT adr LET adr adrt l GO TO 20 111 Chapter 10 Extra memory pages Machine code never forget a face but in your case T U make an exception Groucho Marx CODE Memory You could also search and replace a string by using POKE details of memory locations and arrangements can be found in the Technical manual There atc two commands that allow you to reserve and free up pages of memory OPEN n reserves n extra memory pages of 16K each for use by BASIC where possible This allows CLEAR to set a higher RAMTOP CLOSE n frees n 16K pages from use by the BASIC program and variables but only i RAMTOP allows it This is because BASIC insists that it keeps all pages up to and including the one where RAMTOP is located All freed pages can be used for screens DOS and other programs Large chunks of memory are saved and programs speeded up if BASIC keywords and routines can be bypassed and you communicate directly with the computer s codes Machine Code is the set of in structions that the Sam Coup s Z80B microproces sor chip uses and you can write programs directly to it in assembly language This type of program has to be coded into a sequence of bytes using
133. s the new line numbers go up in steps of s if there is enough space STEP LINE and the program slicer can be used or left out as you wish but must occur in the following order O RENUM n TO m LINE L STEP s RESET button when pressed this button at the back of the machine DOES reset the CPU memory the floppy disk controllers the memory page registers MIDI IN MIDI OUT and the BORDER registers It does NOT reset the colour look up table sound chip registers or the LINE INTerrupt RESTORE n RESTORE the DATA pointer to the first DATA statement in line n or the nearest line after the designated number If the number is omitted RESTORE will be 0 i e set to the first DATA statement if any A RESTORE also happens every time a BASIC program is LOADed RETURN is the key used to commit a line of instructions into a program Technically RETURN terminates a subroutine RETURN a RETURN address gives a line and statement that is jumped to after a GO SUB RGB is the abbreviation for the system of coloured dots that make up any colour on your screen by combining Red Green and Blue ROLL d p moves the picture on your screen and wraps it around itself Movement is controlled by direction d 1 left 2 up 3 right 4 down followed by the number of pixels to be moved p P can be 1 2 4 6 etc but not 3 5 7 etc 159 Glossary ROLL d p x y w L only ROLLs the screen section designated by x y coordinates ma
134. sent 1 024 bytes of computer memory So for example 128k represents 131 072 bytes 147 Glossary KEY posn x makes a KEY in a specified position in the key map produce a chosen character when it is pressed KEY positions must be between 0 and 279 and x must be between 0 and 255 Codes 192 to 254 can be given expanded definitions please see DEF KEYCODE The key map is in the Appendix KEYIN a enters a stting as if you had typed it in yourself so that it allows programs to wtite themselves For example KEYIN 100 DATA a p will add a new line to the program after this is RUN Keyword A keyword is a word which can have a simple meaning in English but is recognised by the computer as having a special meaning and treated as a command to do something very precise When a keyword is recognised it is converted to capital letters in the program listing LABEL can only be used at the start of a line but preceding colour control codes or spaces are allowed When any part of the program is run by RUN GO TO GO SUB etc variables are created with the name given after any LABELs in the program and their values are set to the line number with that LABEL The name after LABEL must be a legal numeric variable name These variables are recreated when CLEAR is used or the program is EDIT ed Language is simply a collection of related commands that allow a computer to perform useful tasks The most common language is BA
135. sing the DE LETE key near the top right of the keyboard Remember DELETE on its own rubs out charac ters to the left one at a time and if you press DELETE and SHIFT together characters on the right get erased Delete n TO m Apart from having its own key DELETE is also a keyword that can be typed in to erase whole blocks of program lines If the first line number to be DELETE n is left out everything from line 1 is deleted up to line m If m is omitted the last line of the program is assumed A single line can be 30 Chapter 4 BEGINNER S BASIC DELETEd by making n and m the same number Neither n m actually has to exist and any lines contained in their slice of the program will be deleted An alternative way of deleting a line you don t like 15 to type in its number followed by nothing at all and press RETURN LOAD up amnesia now and experiment with the EDIT DELETE CAPS and cursor keys You can include shott memos in SAM BASIC which will help to REMind you what a particular section of REMinders your program is for These statements or special comments are stuck in to jog human memories and not for the computer to worry about and they are called REM statements It s good practice to leave youtself a note or a heading before each new section of your program so just pop in a REM after a line number like this O 10 REM amnesia and you can call it up or refer to it later on When yo
136. sition of the palette to any colour you want There are sixteen different positions 0 to 15 and 128 different colours available 0 to 127 Please see Chapter 5 for all other PALETTE commands PAPER when followed by the selected code number determines the background screen colour on which any particular character is to be PRINTed and can also be used by typing PRINT PAPER n whatever follows Parameter refers to a unit that is constant in a given procedure but can vary in different arguments PAUSE n allows you to make part of a program take an exact amount of time Your screen displays 50 frames every second so we use numbers counted in frames to give a very accurate freeze frame timing For example C PAUSE 125 will freeze your screen for two and a half seconds or until a key is pressed PEEK is a function used to reveal what s in the computer s memory at an address within the range 0 to 528K 155 Glossary PEN is used to select a colour on screen for your text and graphics The values 0 to 15 are the same as those on your PALETTE If you prefer you can use the command INK instead of PEN it will do the same thing is the Greek letter that is used to denote the ratio of the diameter of a circle to its circumference In fact PI is an infinite non recurring decimal but you can always try to confuse your Sam Coup by typing PRINT PI Pixel is supposed to stand for picture element an
137. t before those operations unless they are placed inside brackets FREE Discover how much FREE memoty is available for programming by using this function now O PRINT FREE and then type in a line or two of program Check and see how much memory that has been taken up by using FREE again You will discover how mem oty is calculated and what gobbles it up in Chapter 10 LEN Another function you can try out is the one that tells you what the LENgth of a string is like this O PRINT LEN antidlsestablishmentari anism or if you prefer O PRINT LEN SAM Even though you may be in the early stages of learning to program your Sam Coup you have probably grown impatient by now and LOADed up some of the programs on the Flash demonstration cassette and I can t really blame you Before we go on to more advanced SAM BASIC choose one of the longer ready made demonstration programs and LOAD it now because you ate about to take a few enjoyable liberties with it LIST If you tell the Coupe to LIST the current program it will do just that and display the listings from begin ning to end What may be more useful is to ask for a listing from a particular line number or for a part 48 Chapter 4 HOW TO BEAUTIFY YOUR BASIC AUTOMATIC LINE NUMBERS EVERYDAY BASIC of the program contained between two line num bers For example CJ LIST 500 will display everything from line 500 to the end of the program O LIST 500 T
138. t of an argument SGN will give 1 if the argument is positive 0 if it is zero and 1 if the argument is negative SHIFT when pressed simultaneously with other keys the SHIFT ed keys are used to PRINT upper case letters and alternative characters SIN is a trigonometrical function that calculates SINe Slicers are specified strings or substrings A slicer can be a numerical expression an optional numeric expression TO another optional numeric expression or it can be empty Software is a list of instructions used to control the computer which is stored to and LOADed from cassette or disk SOUND r d sends data byte d to sound chip register r Up to 127 pairs of numbers can be used like this O SOUND r d r d r d etc Space The long SPACE bar at the bottom of the keyboard acts the same as any conventional typewriter or wordprocessot SQR commands the computer to calculate the square root of a number n The result is a number that when multiplied by itself gives n Stack refers to a number of data items stacked in order of usage with a specific 162 Glossary purpose in a computer program such as a GO SUB stack or a calculator stack Statement consists of an individual instruction in a program line Multiple statements in a single line are separated by colons STEP n is used in a FOR NEXT loop to qualify the control variable which normally goes up 1 every time like this C FOR control
139. t the Sam Coup s Z80B microprocessor chip uses and you can write programs directly to it in assembly language Such programs have to be coded into a sequence of bytes using an assembler but if you want to code them yourself there are plenty of books to teach you how Memory The Sam Coup comes with 32k ROM and 256k DRAM on board There are two internal sockets for an additional 256k DRAM to be installed inside the machine Please see Chapter 10 MEMS n TO m assigns a section of MEMoty to a string Both n and m must be included n can be 0 and the length of the memory slicer must be less than 65536 Large areas of memoty can be moved by POKEing the string to a new location and you can use INSTRing to search it Menus for computers are the same as menus for restaurants They provide a table of 151 Glossary options on screen from which you make your choice MERGE MERGE name adds new information from the named program to informa tion already in the computer s memory overwriting any existing program lines or variables that conflict with the new program MERGE name CODE suppresses auto running of BASIC programs that have already been LOADed MERGE can t be used with any arrays that may have been SAVEd MGT Plc stands for Miles Gordon Technology possibly the most fascinating computer manufacturers ever to operate from the Swansea Enterprise Park MIDI is the international standard by which musica
140. tement of the program is automatically given its own line and these lines are indented to help you read the program more clearly The first six columns on the left hand side of the screen have been reserved for line numbers and spaces and programs can have up to 65279 lines O LIST FORMAT 1 or 2 produces an automatically indented listing by one two spaces every time a certain keyword is recog nised with other keywords restoring the original setting These keywords are IF ELSE END IF ON DEF PROC END PROC FOR NEXT DO LOOP EXIT IF and LOOP IF And if you wonder what some of those keywords mean you about to find out in the final section of this Chapter O LIST FORMAT 0 returns the listing to its normal unindented state Try a pretty listing of one of your programs and see what happens ADVANCED SAM BASIC Imagine asking your Sam Coup every morning NUMBERS How ate you today and the answer was always the same Very well thank you What a predict able relationship that would be The easiest way to introduce an element of chance or surprise into a program is to throw numbered options into an electronic pot and allow the computer to pull one out at random After one has been selected and used it gets thrown back into the pot So all sorts of responses could result from your prompt each with an equal chance of random selection RANDOM 51 Chapter 4 EVERYDAY BASIC RANDOMIZE is the key
141. ter 2 PROTECT AND SURVIVE Out Out Dame Spot Lady Macbeth CARING FOR YOUR TV SET What s What move and carrying software watch out for under floor magnets in trains and baggage x rays at air potts Keep computer data out of direct sunlight and away from heaters dust and high humidity The back window of a car is a disaster zone Don t stand drinks next to software they don t mix and don t poke anything inside disk or cassette cases If you want to keep an important piece of software then knock out the lug at the back of your cassette or push in the special tab on a 3 5 inch disk after you ve SAVEd the data to prevent accidental era sure Always make back up copies of important software as explained in the next chapter Everyone should know by now that television screens can be tricky but you can stay healthy and happy if you follow some simple advice Because you may find it hard to drag yourself away from your Sam Coup sit as far away from the screen as you can and take a short break every couple of hours Give the screen a wipe with a soft cloth to remove electrostatic dust every time you use it and your skin will thank you for not touching the screen and fingering your face Television screens can burn out if the same image is displayed for too long so a special safety feature will black out your screen if you don t press a key for about 22 minutes Simply press any key to get your last
142. th the machine but they are much better than those of an ordinary typewriter key board because you can instruct most keys to do all sorts of things Let s suppose you are a beginner and need to know what the keys do The next section of this Chapter is a guided tour around the keyboard so refer to the illustration on the opposite page which shows the Sam Coup keyboard as it appears on your com puter with certain groups of keys outlined with thick border lines Throughout this Manual we refer to individual keys that must be pressed to achieve results by putting them inside square brackets such as A When two keys must be pressed at the same time we write that as SHIFT A for example The illustration shows a large group of keys inside a thick black line and these are all the keys you would expect to find on a typewriter The top row includes numbers and symbols the middle three rows tepresent all the letters of the alphabet and some mote symbols and the bottom row features a long SPACE bar for typing in blank spaces 13 Chapter 2 What s What SHIFT There is a long SHIFT key at either side of the lower row of letter keys and as you would expect when this is pressed at the same time as a letter key it SHIFTS from lower case to upper case and makes a capital letter appear So that pressing A on its own PRINTS the character a on your TV screen whereas pressing SHIFT A together displays the charact
143. the entire piece is transposed to the key of The bad news is that the Ode to joy sounds more like a funeral march because it is much too slow The good new is that the tempo can be changed just as easily as pitch by LETting d 0 5 for example 96 Chapter 7 The wonders Of MIDI Music is best understood by children and animal Igor Stravinsky Making Music You can also use d as a shorthand method for writing exact note values no matter what tempo you select So if d represents a whole note taking up four beats to the bar then d four beats d 2 two beats d 4 one beat d 8 one half beat and so on To create silent notes or rests in your music the PAUSE command is used just as in graphic PAUSEs Because there are six separate frequency genera tors musical power chords can be produced and two chords can overlap Each frequency generator can produce 256 tones in every octave so that different musical instruments and special effects carn be synthesised The FLASH demo cassette provides an excellent introduction to the audio aspects of your computer and the Technical Man ual contains full details on how to address and control the machine s sound chip as well as writing data bytes to the MIDI ports MIDI stands for Musical Instrument Digital Inter face and you can control a whole electronic orches tra just by pumping information through the MIDI sockets at the ba
144. tick is used to control actions in game playing A second joystick can be connected for two player options by using a special MGT dual joystick adaptor 5 MOUSE INTERFACE Socket for an 8 pin DIN mouse connector The mouse is used to move a pointer around the screen and select on screen options and is available from MGT 6 RESET BUTTON When pressed this button resets the machine Please see Glossary for details 7 EXPANSION CONNECTOR This interface is a standard 64 pin Euroconnector Expanding your computer system is explained in Chapter 9 8 CASSETTE JACK standard 3 5mm mono jack socket for connection to a cassette recorder When taking information IN it should be connected to the EAR socket of the recorder When giving information OUT it should be connected to the MIC socket If your tape recorder allows it EAR and MIC may be connected together 10 Chapter 2 What s What 9 LIGHT PEN amp STEREO SOUND This standard 5 pin DIN connector acts as an input for a light pen or light gun and also functions as a stereo sound output when connected to the AUX input of a sound system 10 ON OFF BUTTON Even though power is supplied to the computer all the time its power supply is plugged in and switched on at the mains this button interrupts the power when it is pushed to the OUT position for OFF Power is allowed through to the machine when the button is pushed IN for ON 11 SCART SOCKET A special
145. to introduce a stream or channel number or as a match anything token It is sometimes referred to as hash or number 167 Glossary apostrophes in a PRINT statement cause whatever follows to appear at the left hand margin of the next line quotation marks enclose strings all characters inside quota tion marks will be PRINTed exactly as typed Please see Chapter 4 for other details commas tabulate the following PRINT statement by 16 columns a colon is used to separate commands in a line of program semi colons cause PRINT statements to appear concurrently the full stop can be used instead of the decimal point key appears in your EDITing lines whenever you manage to confuse the Sam Coup 168 SAM Coup Appendix O General Specifications O Lead Connections O Pin Connections O System Variables O Predefined Keys O Keyboard Map O Control Codes Yoghurt is very ee good for yf appendicitis Eug ne Ionesco y E A d 22 rm Man is still the Most extraordi Nary computer of all John F Kennedy 169 Appendix General Specifications MILES CORDON TECHNOLOGY Sam Coup ENGINE Z80B microprocessor running at 6MHz CONTROL Customised VLSI 10 000 gate ASIC chip ROM 32K including SAM BASIC disk bootstrap BIOS RAM 256K upgradeable to 512K 256K x 4 100nS DRAM SOUND Philips SAA 1099 Synthesizer 6 channel 8 octave stereo with
146. truct the computer to perform a specific task Condition condition is something that the program has to decide to be true or false before making a decision and can be used after EXIT IF WHILE or UNTIL A condition always gives a numeric result 1 for true or 0 for false try PRINTing 2 1 CONTINUE instructs the program to begin again after it has been stopped by an error report Control Codes are special characters that do not appear on the screen but have actions when PRINTed or PLOTted When certain codes are called up from the keyboard the computer will search to see if there is an expanded definition for them See DEF KEYCODE COS when followed by an angle in radians is the function that calculates the cosine CPS stands for Characters Per Second and refers to the theoretical top speed that a printer can LPRINT on paper 137 Glossary Crash is the slang expression for a computer program blowing its own brains out and getting splattered beyond rescue CSIZE width height lets you change the shape of your characters by squashing them down or stretching them out For example in mode 3 O CSIZE 6 9 will make all your characters inhabit cells six pixels wide and nine pixels high The width can be 6 or 8 and the height can be from 6 to 32 pixels CTRI the CTRL key is used to change the keyboard into the CONTROL status Cursors are position indicators usually shown on screen in the form of an
147. ts lines and characters OVER 1 turns the effect on and OVER 0 turns it off In MODEs 1 and 2 a character is repeatedly printed over itself in a rapid sequence that goes character blank character In MODEs 3 and 4 the sequence is character colour character the usual colou rbeing black Other effects can be created when used with DRAW CIRCLE PLOT and PUT which exam ined in Chapter 6 POINT x y If you want to find out the status or colour of a graphic dot or pixel anywhere on the screen you can use the function POINT which is explained in the Glossary Finally here is a summary of all the ways you can use your PALETTE PALETTE stops all changes to the colours you can use and resets the original colours PALETTE position colour sets the position of the paint pots on your PAL to any colour you want There are sixteen different positions 0 to 15 and 128 different colours 71 Chapter 5 Colour and Light available 0 to 127 so that O PALETTE 14 43 BORDER 14 will pour shocking pink paint into paint pot number 14 and display it on your screen PALETTE position colour a colour b lets you choose two different colours to appear at the same palette position and swaps between them three times every second You can create flashing special effects by using this command for example pour multi coloured flashing paint into pot number 7 on your PALETTE with O PALETTE 7 8 36 PALETTE posit
148. ts like a type writer so that O 10 DO GET a PRINT a LOOP prints keys as you hit them and you can SHIFT between upper and lower case as normal If GET is used with a numeric vatiable such as GET x then the variable will equal 1 if Ill is pressed up to 9 if 9 is pressed A or a has a value of 10 B or b 11 and so on GET is very useful in menu dtiven programs see ON GO SUB n is the statement that tells the program to GO to a numbered SUBroutine up to 65279 It must be qualified by RETURN statement GO TO n instructs the program to GO TO any line number up to 65279 GO TO can be used with LABEL for example CJ GO TO blazes Please see LABEL GRAB a x y w L stores a screen area to a string which can be PUT somewhere else The screen area to be GRABbed is defined by x y as the top left hand corner followed by w for its width and L for its length in pixels The x coordinate for pixels is rounded down to an even value and the y coordinate is rounded up to an even number For mode 3 s thin pixels the x and y values are rounded to a multiple of 4 GRAB and PUT only work in modes 3 and 4 Graphics coordinates are normally 173 at the top to 18 at the bottom of the screen Two lines of 9 pixel high characters are used for the editing area with point 0 0 above them on the left of the screen By selecting MODE 1 character height changes 145 Glossary to 8 pixels and the vertical y a
149. types of variables which are the names given to identify certain values in programs Numeric variable names must start with a letter and be followed by numbers letters underlining and spaces up to 32 characters long Spaces don t count as characters FOR NEXT variables atc similar to numeric variables but are treated differ ently internally String variable names and array variable names are similar but can be no longer than 10 characters long and must be followed by VDU stands for Visual Display Unit and generally refers to any unit housing a screen for displaying computer generated images VERIFY name checks that the information on tape or disk is exactly the same as the infor mation in the computer s memory with the same name 165 Glossary VERIFY name CODE checks the bytes on tape or disk starting at the address from which the first byte was saved VERIFY name CODE start checks the bytes on tape or disk against those in memory starting at the address number given VERIFY name CODE start length checks the bytes on tape or disk against the bytes in memory starting at the address number given If the file on tape or disk is longer than the designated length the Loading error message will be given VERIFY name DATA checks the named array on tape or disk against the one stored in memoty WHILE is a condition used with DO and LOOP Please refer to these commands WINDOW left right to
150. u want to use a number of different com Program mands in a single line they must be separated to punctuation allow the computer to clearly understand them This is done by using colons like this O 10 PAPER 6 PEN 2 PRINT red on Colons yellow If you want to include several similar items in a line Commas like numbers to be examined or calculations to be made they must be separated using commas E g O 10 READ x y z 20 PRINT x y z 30 DATA 1 2 3 4 5 31 Chapter 4 BEGINNER S BASIC You are going to write a computer game in a while but instead of just copying some lines from this Manual there are a few BASIC concepts you need to know first Starting and There ate several ways to manage the progress of Stopping your programs as you create them but the first step is to get them going RUN followed by RETURN of coutse is all that needs to be typed to command the program to RUN from the start RUN n instructs the program to get going from the particu lar line number that you choose STOP is a command that does exactly what it says It STOPing STOPS the program at any predefined point PAUSE PAUSEing allows you to make part of a program take an exact amount of time If you type in PAUSE by itself or PAUSE 0 then your program will PAUSE for ever and a day until a key is pressed For shorter timings just type in PAUSE followed by a number This will stop the program and freeze whatever is on the screen
151. ue with a message OK 9 1 in the bottom left corner Adjust the tuning if it s still a little bit out then go for a red border by typing O BORDER 2 followed by a press of the RETURN key Make sure that the TV volume control is turned up a little and type in the following instruction BEEP 1 1 followed by RETURN A short BEEP of sound should have squirted out of the TV speaker Congratulations If the BORDER has changed colour and the speaker is BEEPing you ve already started programming your new computer Now read through the next couple of Chapters and find out what s going on Chapter 1 FIRST AID CHECKLIST for domestic TV sets Why pay money to see bad films Stay home and See bad televi Sion for notherg Sam Goldwyn Setting Up There is probably a simple explanation for any problems experienced in setting up your computer Identify what s wrong then go through this First Aid Checklist in order PROBLEM the TV screen is blank the TV screen shows random white dots or is broadcasting quiz shows the colour TV picture is washed out or black and white only the TV picture is good but there is no sound there are strange geometric patterns or random characters on the screen or the screen turns black FIRST AID Check computer ON OFF switch is in ON position Check is switched on Check power supply plugs for loose ot bad connections Check fuse in po
152. upy varying amounts of space For example each MIDI data item is made up of 8 bits 1 byte plus one bit each for start and stop Channel voice messages can carry information about the tones being used and the channel number using them and each message takes up to 3 bytes plus one bit each for start and stop 110 Chapter 10 Memory SCREEN 32K of the Sam Coup s memoty is dedicated to the memory screen If extra screens are opened using OPEN SCREEN each one will gobble up another 32K Memory The following functions have been provided to amp help you handle available memory FREE instantly informs you how much free memoty is available for use with your BASIC program and its variables As with other functions just type O PRINT FREE RAMTOP starts at 81919 and tells you the top address avail able for use by BASIC and is set by using the CLEAR command e g CJ CLEAR 70000 PRINT RAMTOP MEMS n TO m assigns a section of memory to a string You can seatch it with INSTR and POKE it wherever you want The length of the memory dicer must be less than 65536 both n and m must be included and n can be 0 MEMS gives you the power to move large areas of memory very quickly when used with the Sam Coup s ability to POKE strings Another valuable use of the MEMS function is to allow rapid searches of memory using INSTRing and although you can search a specified area of rnemot y the seatching proces
153. ursor keys You will also learn about the EDIT key on the bottom line Typing in text and graphics is covered in Chapter 6 where the remaining keys are explained TAB near the top left hand corner INV which is above the EDIT key and finally the two SYMBOL keys and CNTRL key in the bottom row You can t hurt your SAM Coup6 by bad program ming or pressing the wrong key but don t try to stick silly things in its sockets or ports or mess about with its insides You wouldn t like that and neither will your computer The Sam Coup prefers similar working conditions to you so keep it clear of freezing cold and sweltering heat as well as harmful sunbathing drizzle and thunderstorms Let fresh air circulate beneath and around all sides when in use and your computer won t rise above blood temperature The small amount of heat generated while SAM is switched on is quite normal Using the wrong power supply is dangerous and beating up your machine or pouring drinks into it are not good ideas Use a soft cloth to clean the case but please avoid abrasive pads powders and sol vents like alcohol or benzine Programs are stored on disks and cassettes as magnetic recordings so they may get damaged or made totally useless if they get exposed to magnets or radiation Keep all disks and cassettes away from loudspeakers and don t leave them on top of tele vision sets ot under telephones If you are on the 15 Chap
154. variable first value TO last value STEP n The STEP need not be a positive or a whole number for example CJ FOR x 100 to 1 STEP 1 5 STOP halts the program and displays the STOP code on screen When the program is started off again with CONTINUE it resumes at the next statement Strings in theory can be 65520 characters long and their maximum legal names may be up to 10 characters long STRINGS n a repeats a string for the number of times you choose STR converts numbers into strings The function ends in a symbol to show that its result is a string Please see VAL Subroutine is a block of numbered statements which perform a specific duty and can be called up many times by the GO SUB statement SVAR n gives the address of System VARiable n SYMB when pressed the SYMB shift key gives access to alternative characters and operations from the keyboard 163 Glossary Syntax error in BASIC is similar to making mistakes in the English language when rules are broken The computer is unforgiving if an error is made in the use of pun ctuation marks or a keyworp is missplleed Certain errors will be automati cally corrected such as gosub and RANDOMISE and the easiest method of wtiting programs is to type in lower case and observe key words turning into capital letters as they are displayed in their lines System variables control all sorts of operations and each has its own SVAR number The
155. w the LOADing instructions in the next section of this chapter If you want to use the computer for creating and keeping your own ideas you will need to use a few software simple techniques for SAVEing them somewhere safe and LOADing them back into your machine next time you need them Home grown SAVE is the command used to tell the computer to get ready to record your lists of instructions onto tape or disk VERIFY is used to ask the computer to check that whatever has just been SAVEd is all present and correct and that whatever is now stored onto tape or disk is exactly the same as what the computer still has in its memoty 19 Chapter 3 Software LOAD tells the computer to empty its memory and get ready to receive new information which has already been stored on cassette tape or disk MERGE commands the computer to LOAD in new informa tion but to keep any existing information in its memory provided that it does not conflict with what s being MERGEd If you are lucky enough to have an MGT Coupe disk STORING drive follow the instructions and fit it in Drive 1 via INFORMA the special slot in the front of your computer All the TION instructions you need are in the Disk Drive Manual and in Chapter 10 of this Manual The following information is for cassette usets Connect up a cassette tape recorder as detailed in Setting up Chapter 2 ready to send information OUT from the A cassette 3 5mm jack socket
156. we have Let us economize it Mark Twain MIDI memory Memory The mote you write programs the more you ll appreciate that your limitations are not restricted by imagination or creativity but by your computer s memory So you must make the best possible use of the large but unforgiving memory provided Your SAM Coup has 512 1024 bytes of Dynamic Random Access Memory with 256K already pro vided for your use You can double this on board memory to the full 512K by plugging in two extra memory chips available from MGT The simple fitting intructions come with the package A byte is a unit of storage in memory which can hold a number between 0 and 255 and each byte has an address which is a number between 0 and 528K Each byte is made up of eight smaller units of memoty called bits and advanced users can refer to the discussion of machine code later in this Chapter Complex BASIC routines use a surprisingly small amount of memory but full colour screens of graph ics will gobble up great chunks of the stuff The largest possible program line can have up to 127 individual statements consuming as many as 16 127 bytes and your arrays can fill every aspect of avail able memory Strings can be up to 65520 characters long When the computer recognises a command it only takes the equivalent of one character s storage space whereas all functions are stored as two characters in memory Other types of information will occ
157. wer plug and any fused socket outlet Check computer is switched on Check TV is tuned to Channel 36 Check cable between computer and is properly connected Check TV channel for fine tuning Check TV colour adjustment Check for loose cable connection between computer and TV Check volume control on TV Check TV channel for fine tuning Press any key Press the BREAK button which is at the far left as you look at the back of the computer Press the RESET button which is on the left of the long connector socket as you look at the back of the computer If all else fails phone the Sam Coup Customer Care line Chapter 2 WHAT S WHAT O what the sockets pots and buttons do O a trip round the keyboard O caring for your computer and its software This morning I abused my Electric toaster Tonight the elevator held me hostage in revenge Woody Allen Chapter 2 What s What es d DISK DRIVE 1 7 DISK DRIVE 2 protective cover FRONT VIEW 1 4 6 7 9 11 12 BREAK MIDI JOYSTICK RESET EXPANSION LIGHT SCART POWER 3 5 4g OUT IN MOUSE CASSETTE ON OFF Chapter 2 SOCKETS PORTS AND BUTTONS THE FRONT OF THE MACHINE THE BACK OF THE MACHINE What s What If you imagine your computer to be like an intelli gent Mother Ship then all sorts of service modules and communications devices can dock with it mak
158. word that kicks off this selection process It uses the number of frames elapsed since the SAM Coupe was switched on to make its choice RANDOMIZE n sets the random number seed to your own choice with n between 1 and 65535 RND is the function that pulls a number out of the pot from a fixed sequence of 65536 numbers which has been thoroughly stirred up and gives a result that 1s a floating point number Floating point arithmetic keeps the digits of a number separate from the position of the decimal point You can use the INTeger function to cut off all those digits after the decimal point but there is a much easier way to generate whole random numbers by using D RND x which returns a whole number between 0 and x So you can now go back to the Secret Numbers game on page 36 and let the computer act as your play mate in thinking up the number without any help Simply get rid of line 20 and replace line 30 with O 30 LET a RND 100 By using the random numbers technique you can y using que you program the Sam Coup to act as a pair of dice a card dealer an ever changing galaxy or to choose from hundreds of unpredictable answers to the question How are you today DATA But what if you don t want a random number element and need the computer to refer to a strict order of given information This information or DATA can be put anywhere you want in a program waiting to be used by the computer in much the
159. xis runs from 175 to 16 The horizontal x axis runs from 0 to 255 except in MODE 3 s thin pixels of 0 to 511 The coordinate system will change if you alter CSIZE directly HEX converts the human counting system based on ten fingers decimals to a form of computer binary counting based on the digits 0 to 9 plus the letters A to F hexadecimals e g O HEX 10 A HEX 32768 8000 HEX 100000 0186A0 HEX numbers can be introduced by amp for example O amp OA 10 amp 8000 32768 Icon is a small graphic likeness of an object concept technique or message like the symbol used in this Manual to represent type in the following data IF is a conditional instruction which is qualified by THEN A long IF that works over several lines is achieved by omitting the THEN and terminating the IF with END IF IN is a function in BASIC which acts a bit like PEEK When followed by an address IN reads the Input Output port address and its result is a byte read from that port OUT acts in a similar way like POKE INK Please read the section titled PEN INKEY is the function that reads the keyboard to see which key if any is being pressed INPUT Normally what gets typed during INPUT is shown in the bottom two lines of the screen but other streams can be used e g O INPUT 2 a or INPUT 2 number x allows use of the upper screen 146 Glossary INSTR n a b is a function that searches one
160. y after END IF Line numbers and the numbers of statements in any line are irrelevant You ate allowed to nest long and short IFs inside a long IF but you can t nest a long IF between a short IF and its associated ELSE 41 Chapter 4 EVERYDAY BASIC If you feel like taking a BREAK at this point in the proceedings THEN now is the time ELSE get ready to make your computer work for a living END IF Imagine you have to prepare a list of items for every day of the year You could start by typing in a line for day 1 and keep typing until you reach 365 unless it s a leap year This would be so tedious that there are four BASIC commands dedicated to making this sort of task as easy as possible FOR NEXT TO and STEP and they are used to make the computer perform the same job over and over again FOR NEXT FOR and NEXT are always used together to cut down repetitive programming RUN this example O 10 REM calendar 20 FOR day 1 TO 365 PRINT day NEXT day As you scroll up the screen by pressing RETURN TO you can see that the use of TO in your FOR NEXT loop has instantly set the limitations of the values in yout PRINT statement Naturally the numbers go up one at a time but by introducing the idea of handling values in STEPs this can be varied STEP For example your Sam Coup will instantly change its calendar from days to weeks if you tell it to work in STEPs of 7 CJ 20 FOR day 1 TO 365 STEP 7 PRINT day
161. y condition is true the lines or statements after it executed and when another ELSE IF or ELSE is encountered the program jumps straight to a position immediately after END IF END IF must be used to end an IF condition END PROC is used to mark the end of a PROCedure already defined by DEF PROC ERASE only works with disks ESC ape key when pressed allows you to BREAK into the program EXIT IF is part of the DO LOOP structure and is used to leave the structure from somewhere in the middle rather than at the DO or LOOP If the specified condition after the EXIT IF is true program execution jumps to the statement following LOOP otherwise nothing happens EXP is a mathematical function to calculate exponential numbers and can be defined by EXP x efx F keys are the group of function keys labeled FOJ to F9 Each of these keys has been pre set to provide a specific function as shown in Chapter 4 allowing single key entry during programming and may be redefined 143 Glossary FATPIX In graphics mode 3 the pixels arc thin only half the width used by the other modes By using the command FATPIX 1 you can double the width of MODE 3 pixels making vertical lines the same thickness as horizontal lines and XRG will be halved get back to the normal thin state of affairs use FATPIX 0 and XRG is doubled File is computerised data that can be SAVEd and act like the magnetic equiva
162. yond the limits of memory allocated to BASIC Invalid note The note you want is too high or too low You must stick between the range 60 to 71 Note too long A note must be shorter than 16 seconds so your command must be no greater than BEEP 16 128 Chapter 12 ERROR CODES ERROR CODE ERROR MESSAGE NUMBER 51 FPC error You have made an error in a machine coded float ing point calculation 52 Too many definitions May be produced by the use of DEF KEYCODE DEF FN 55 NoDOS There is no DOS system to BOOT from disk ot no disk 54 Invalid WINDOW The borders of your WINDOW ate not allowed in the current MODE and CSIZE You can lay plans for handling program errors by telling the computer that if an error occurs then it should go to a special error handling routine Error trapping is turned on by ON ERROR and is turned off by ON ERROR STOP When this routine is turned on some special variables are created as follows ERROR the error code numbet as listed above LINO the line number where the error is located STAT the statementwhere the error is to be found Expetienced users can devise their own error han dling routines which must be used within a pro gram such as CJ 10 ON ERROR GOTO 100 which tells the program to GO TO line 100 if it detects an error and then execute any instructions placed there or GO SUB a subroutine ON ERROR is automatically turned off while you try to correct
163. your own conven ience This is optional of course but there is no choice in how you matk the end of a subroutine The command RETURN is always used like this non working example O 500 REM pretend subroutine 510 all the lines that form this subroutine 600 RETURN 43 Chapter 4 EVERYDAY BASIC CALCULA If you look at the multiple sound effects program TIONS that is featured on the demonstration cassette as well as in Chapter 8 you will see how useful subroutines If all this theory seems concerned with complicated programs BASIC allows some very common every day operations You can use the Sam Coup as a simple calculator to perform arithmetic tasks After typing PRINT followed by your calculation all you have to do is hit the RETURN key Nothing can be simpler than this O PRINT 2 2 You don t even have to RUN it The computer will obey all of these commands 1 the plus sign always signals addition in calculations the conventional minus sign is used but for multiplication an asterisk is recognised and division is made using this symbol 1 this is the exponentiation symbol It means raise a given number to a given power which is exactly the same as multiplying a number by itself so that CJ PRINT 3 5 is the same as typing in O PRINT 3 3 3 3 3 expressions A combination of calculations is called an expres sion and you should be aware of the fact that your computer ha

Download Pdf Manuals

image

Related Search

Related Contents

Samsung 460DRN  303 05 00 Rev2 Folheto de Instruções Panificadora Crome.cdr  Samsung Galaxy Gran Neo Duos manual do usuário(CLARO)    User manual to the GH11NA controller  MHC-RG190/RG290  1 RNS 150 d 1-15•  SNT-EX101 Installation Manual  NOTICE SW SERIE  Samsung NP870Z5GE User Manual (Windows8.1)  

Copyright © All rights reserved.
Failed to retrieve file