
GETTING INTO MICROPROCESSORS Software/Firmware developments-1 SC/MP gets Tiny-BASIC If you've tended to scorn microcomputer systems because of the need like FORTRAN and BASIC have mainly to program in machine or assembly language, think again. National been available only on larger corn- Semiconductor is releasing shortly a Tiny-BASIC interpreter for its puters. In the last couple of years, however, SC/ MP systems. It will be sold resident in 4k-bytes of PROM, on a a number of people working with various PC card.- Plug in the card, and you can have programs running in Tiny- microcomputer systems have come up BASIC within the hour! with interpreters capable of fitting into small systems, and which provide a lim- by JAMIESON ROWE ited sub-set of the full original BASIC lan- guage. Naturally enough the language Although microcomputers haven't which again is also a computer program. provided by these interpreters has been around for very long as yet, already But unlike a compiler, an interpreter quickly become known as "Tiny- many of the people using them have doesn't produce a separate object code BASIC". begun to show interest in the possibility version of your program. Instead it must Now National Semiconductor has of programming in one of the problem- be put in the machine alongside your announced that a Tiny-BASIC interpreter orientated or "higher" languages like program, which it interprets into will very shortly become available for its FORTRAN or BASIC. No doubt these machine language and executes all at the SC/MP microprocessor systems. thoughts tend to be generated most same time. National's Australian subsidiary, NS Elec- often when one is slogging through a Which approach is used depends tronics, expects to have it available by program written in hexadecimal code! mainly on whether you have a compiler late January. It will be sold as a product Of course in order to be able to run or an interpreter program available, package which comprises the interpreter programs written in a problem- although an interpreter tends to be a little itself resident in 4k of PROM on a plug-in orientated language, one needs to have more convenient because it allows faster PC card, a 2k static RAM card for the them translated into language which the program development. user's source program, and a user's computer can understand. At present this The problem with either approach is manual. The complete package should must be done in one of two ways. that both compilers and interpreters tend sell for around $305 plus tax, where One is to use a compiler, which is itself to be rather long. They are rather tricky applicable. Those who already have a computer program. When fed into the and tedious to write, and when written SC/MP systems with at least 2k of RAM machine, the compiler will take your they need quite a deal of computer may also be able to buy just the "source code" program as written, and memory. The latter is especially true with interpreter and the manual, if they wish, produce from it an "object code" interpreters, which are loaded into by quoting the serial number of their equivalent in machine language. It is this memory along with the source existing RAM board. version which you then feed into the program. National has called its version of Tiny- machine to get your program running. Because of the requirement for a fairly BASIC "N I BL", which stands for National The other way is td use an interpreter, large memory, until recently languages Industrial BASIC Language. This is meant to emphasise that they see its applica- tions not only in educational and hobby computing, but also and perhaps more importantly in industrial control situa- tions. .Like most other Tiny-BASIC interpreters, NIBL is not fast. A program written in NIBL executes somewhere This is the pre- between 1000 and 2000 times more release version of slowly than an equivalent program writ- N1BL, which was in ten in machine or assembly language. But only 3k bytes of this can still be fast enough for most PROM. The final human interfaces, and for slow real-time version is in 4k control applications. bytes, with the PCB And the point is that NIBL lets you having eight of the write programs and get them running PROMs instead of very much more easily and quickly. It six. also provides "instant" error messages during program execution, to help you in debugging. And it lets you execute sin- gle instructions in real-time conversa- tional mode, if you wish. Naturally enough, NIBL doesn't provide all of the facilities of full BASIC— after all, it has to fit into only 4k bytes of memory. But it does provide a very 90 ELECTRONICS Australia, December, 1976 GETTING INTO MICROPROCESSORS 10 PRINT "HI, I WORK OUT FACTORIALS." 10 PRINT "HI! I WILL THINK OF A NUMBER BETWEEN 0 AND 255." 20 PRINT "WHAT NUMBER WOULD YOU LIKE"; 20 PRINT "WHEN I HAVE, TRY TO GUESS ITS VALUE. CI WILL HELP)" 30 INPUT N 30 LET B=1 40 LET F=1 40 LET A=OB 50 IF N<=1 THEN GO TO 90 50 PRINT "OK, I HAVE A NUMBER" 60 PRINT "WHAT IS YOUR GUESS"; 50 LET F=F*N 70 INPUT C 70 LET N=N-. 1 80 IF C=A THEN GOTO 140 80 GO TO 50 90 IF C>A THEN GOTO 120 90 PRINT "ITS FACTORIAL I S", F 100 PRINT "TOO SMALL. NEXT GUESS"; 91 PRINT "DO YOU WANT TO WORK OUT ANOTHER C 1=YESa 0=N0) "; 110 GO TO 70 92 INPUT A 120 PRINT "TOO BIG. NEXT GUESS"; 93 IF A=1 THEN GO TO 20 130 GO TO 70 100 END 140 PRINT "YOU GUESSED IT!!! LET'S PLAY AGAIN." 150 LET B=B+1 RUN 160 GO TO 40 NI, I WORK OUT FACTORIALS. 170 END WHAT NUMBER WOULD YOU LIKE? 6 ITS FACTORIAL I S 720 >RUN HI! I WILL THINK OF A NUMBER BETWEEN 0 AND 255. DO YOU WANT TO WORK OUT ANOTHER C 1=YESs 0=N 0)? 1 WHEN I HAVE, TRY TO GUESS ITS VALUE.. CI WILL HELP) WHAT NUMBER WOULD YOU LIKE? 7 OK, I HAVE A NUMBER ITS FACTORIAL I S 5040 WHAT IS YOUR GUESS? 200 DO YOU WANT TO WORK OUT ANOTHER C 1=YES, 0=N0)? 0 TOO BIG. NEXT "GUESS? 180 TOO SMALL. NEXT GUESS? 196 YOU GUESSED IT!!! LET'S PLAY AGAIN. Here are the two simple Tiny-BASIC programs which the OK, I HAVE A NUMBER author wrote to try out the pre-release version of NIBL. One WHAT IS YOUR GUESS? 128 TOO BIG. NEXT GUESS? 64 works out factorials, the other is a number game. TOO BIG. NEXT GUESS? 32 TOO BIG. NEXT GUESS? 0 TOO SMALL. NEXT GUESS? 16 useful subset. Here's a summary of what YOU GUESSED IT!!! LET'S PLAY AGAIN. you get: OK, I HAVE A NUMBER WHAT IS YOUR GUESS? 128 Valid statement forms include INPUT TOO BIG. NEXT GUESS? 0 (for numbers only), LET, GO TO, GO TOO SMALL. NEXT GUESS? 64 TOO BIG. NEXT GUESS? 32 . SUB and RETURN, IF THEN, and PRINT. TOO SMALL. NEXT GUESS? 45 There is also a CALL statement, to allow TOO SMALL. NEXT GUESS? 56 TOO BIG. NEXT GUESS? 60 calling machine-language subroutines. TOO BIG. NEXT GUESS? 50 The latter facility is very valuable, of TOO SMALL. NEXT GUESS? 54 course, because it will allow NIBL to be YOU GUESSED IT!!! LET'S PLAY AGAIN. OK, I HAVE A NUMBER expanded. WHAT IS YOUR GUESS? The final version of NIBL may also have ! 7 AT 70 the ability to interpret DO . UNTIL sta- tements, if PROM space permits. "@" sign. When placed immediately keyboard. It prompts the user for a num- Program control statements provided preceding a variable this causes the varia- ber, prints out the answer and then asks are LIST, RUN, END, and CLEAR. The first ble to be interpreted as a decimal if the user wishes to work out another. of these may be used to list either the address in SC/MP memory space. If A is A negative reply causes it to halt. whole program, or alternatively a single a variable with value 256, the statement Incidentally, this little program soon line. An inbuilt editor allows lines to be LET B= @A gives variable B the value comes up against the inability of NIBL to replaced, and also additional lines added equal to the data byte in decimal cope with numbers greater than 32,767. as required. All that is necessary for cor- memory location 256. In fact the largest number it can find the rect execution is that lines are numbered What is NIBL like in practice? Well, at factorial for is 7; 8 causes overflow. consecutively between 1 and 32, 767. the time of writing the final version was The longer program is a simple num- If statement lines begin with a number, not yet available in Australia, but thanks ber guessing game. As the pre-release NIBL stores them away as a program for to NS Electronics I was able to try an version of NIBL didn't have the RND deferred execution. If a statement is not earlier pre-release version. This was in function, I had to use the indirect opera- numbered, NIBL executes it immediately only 3k of PROMs, and didn't have some tor to generate pseudo-random numbers upon entry (following the user terminat- of the features which will be in the full by fetching instruction bytes from NIBL's ing the line with a carriage return).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages31 Page
-
File Size-