This series of tutorials is a beginners guide to using HiSoft BASIC. By the end of the series you should be able to use menus, dialogs, window dialogs, text windows, picture windows, alert boxes, windows, the file selector and understand how to make accessories. I'll also be explaining the tricks of the trade including how to add 'Shareware delays' and 'progress meters' to your programs. Later on, depending on the feedback, I may cover other topics. Don't worry if you don't understand everything I'm saying as I will include plenty of pictures, diagrams and examples as we go along. I'm going to assume you have managed to get to grips with the HiSoft BASIC editor so if you haven't it's time to dig the manual out and experiment with it before reading on. Lets go, Mr. Driver... We start our tutorial off by a very simple program. Once you've loaded up HBASIC, type in this listing: *** 0001.GIF here *** You can run the program by using [Control]+X. Notice after the program has executed 'Hello!' has been printed - or written - to the HiSoft BASIC window. This is one of the simplest commands available. Whatever is inside the speech marks is printed to screen. Try some other texts until you've got the hang of it and once you're finished, try this... *** 0002.GIF here *** This is a slightly more complex program. Run the program as for the previous example. This time, notice a series of 'Hello!'s, a space, and then a number is printed. These numbers are the contents of the variable A. I hope you're good with maths, since it's really like algebra. The FOR tells HBASIC our variable A should start at 1 and go to 10. The semi-colon (";") tells HBASIC to print the A variable next to 'Hello!'. Change 'PRINT "Hello!";a' to 'PRINT "Hello! a"', and try that. Notice this time 'a', instead of the variable 'A', is printed. Notice the difference between the text and the variable? The 'NEXT a' tells BASIC this is where the FOR loop ends. This command tells it to continue with the 'FOR' command until it has finished. Time to try something a little more interesting... *** 0003.GIF here *** I couldn't resist it - but it does serve to introduce the STEP command. The STEP command tells HBASIC to jump numbers. For example, FOR a=2 to 8 STEP 2 starts at 2, then jumps 2 to 4, then jumps another 2 to 6, and finally jumps another 2 and stops at 8. Do you notice 'What do you think goes here?' only appears after the FOR loop? How long is a piece of string? Adding text to your programs is easy to do. A text string always has a name ending in "$". For example 'mytext$' can contain any text string, whereas 'mytext' without the dollar sign can only contain numbers. Try this program: *** 0004.GIF here *** An alternative to 'PRINT ac$;a' would be to write out 'PRINT "Atari Computing issue";a', however as programs become longer it makes sense to store text which may be needed more than once in strings. Try this program next: *** 0005.GIF here *** A number, a gap then a letter should appear on the screen - all 26 letters of the alphabet to be exact. Notice there is a comma (",") instead of the semi-colon (";") in the PRINT statement. This is responsible for the gap between the objects being printed. You can of course replace the comma with the semi-colon to experiment. Every command in HBASIC is detailed in the 'Technical Reference' section of the manual. CHR$ is detailed on page 16 which explains this function produces a character numbered ASCII code in its brackets. In the above example, this is our variable A. ASCII stands for American Standard Code for Information Interchange and enables text created on one platform to be read on any other. Using ASCII and CHR$ any available characters can be displayed. This example displays the copyright symbol: *** 0007.GIF here *** Here's another way string commands can be used efficiently: *** 0008.GIF here *** A program generating the same result, without using string commands, could look like: *** 0009.GIF here *** Either method is fine for short strings but imagine how tedious the second method would become if the text to be output is increased to several hundred letters long... Well, that's it for this issue. Next time we will look at creating our resource file in WERCS, and make a start on our tutorial project to produce a printer utility, named PDO. In the meantime why not try experimenting with the programs presented here and figure out how the 'Triangle' program works?... You could even look at examples of printing utilities to give you a grasp of what I'm on about... *** boxout *** *** On Reader disk logo here *** You can find a copy of HiSoft BASIC on this issue's Readers Disk along with an offer to buy the manual or upgrade to v2 at special prices direct from HiSoft. Please do feedback your comments to Paul Jones via the Atari Computing office or direct to him at: ** BC on ** paulat.jones@zetnet.co.uk ** BC off ** *** end boxout ***