______________________________________ |Volume3|SYNDICATE ZMAGAZINE ISSUE #92 |Issue 6|_____________________________ |(c)1988|February 8, 1988 |_______|_____________________________ |EDITOR:|Ron Kovacs |_______|_____________________________ |Asst Pb|Ken Kirchner |_______|_____________________________ |Hdq BBS|XBN BBS 1-617-770-0026 |_______|_____________________________ |INDEX92| |_______|_____________________________ | -=1=- |Oasis Under New Management | -=2=- |Atari News Update from GEnie | -=3=- |Guest Commentary--Dave Brehm | -=4=- |Plents Page--NX1000 Review | -=5=- |Review of SP408/808-NiteLite | -=6=- |Best Of 1987 Survey Results | -=7=- |From The Editors Desk | -=8=- |**This Article Removed** | -=9=- |Basic Programming--Part 6 |_______|_____________________________ | -=1=- |ZMag Newswire -=SPECIAL=- |_______|_____________________________ ...OASIS BBS Finds New Owner... Reported by Zin Marie Just before Christmas, 1987, a deal was struck that transferred ownership of OASIS BBS software from Leo Newman to Z INNOVATORS Co. A few days later, on Christmas day, OASIS III was released to OASIS SysOps, and in January, 1988, this new version of the software was made available for purchase by the general public. OASIS 3 represents the last revision of the BBS done my Mr. Newman and his partner, Mr. Ralph Walden. In 1987, Leo and Ralph put together four updates to OASIS, in March, April, May, and July. The 5/27/87 update to OASIS, enabled the BBS to run separate machine language modules. Toward the latter half of 1987, OASIS became a more popular BBS software for the Atari 8-bits. The final update of 1987, was a revision that brought us OASIS 3. Some of the features of OASIS 3 are: - ARCVIEW function in the download directories and in the message bases. - Change message subject when replying to messages. Ends the long chains of messages under one non-related subject headings. - Enabled modules to call other modules automatically. - Ratio restrictions on downloads. The OASIS SysOp can set the user level exempt from ratios. When OASIS was enabled to run machine language modules, a bright future opened up for OASIS BBS software. Under its new ownership, OASIS will continue to be updated and revised. Z- INNOVATORS Co. will employ the programming skills of Miss Glenda Stocks for this purpose. Miss Stocks has been writing OASIS modules since May, 1987. The first was the SURVEY program, which conducts user surveys from specially formatted text files, created by anyone, even users themselves. Other modules written by Glenda include: - EZMENU. Allows SysOps to create sub-menus with a text editor. The submenus allow downloading, reading text files, displaying Atari animation, and executing other modules. EZMENUS can be linked together to make adventure games and maze games. - TRIVIA. Conducts a trivia question and multiple choice answer game, with topten scorers list, where the score on each correct answer is based on how quickly the answer is given. Users can write trivia text files for this module also. - ADD-BBS-NUM. Users add BBS numbers to a list that they can view. - STATS LISTERS. Various modules that display user activity, including a LAST 51 CALLERS log. When asked about her plans for OASIS in the future, Miss Stocks responds: -In the long term, I expect to see a version, not an update, but perhaps even OASIS IV, to be compatible only with a DOS like SpartaDos 3.x and higher. In the short term, my plans involve splitting XBN into two boards. The split will allow for a more full and fair support of OASIS/RELIGION, and ZMAG/ATARI. I invite everyone to give the boards a call.- Z-INNOVATORS distributes OASIS 3 software for $20.00 from the following address: Z INNOVATORS 1344 Park St. Stoughton, MA 02072 Dept. 187 Answering Service Phone: 617-586-3385 BBS Phone Numbers: 617-770-0026 617-770-0197 For OASIS Sysop support call: XBN-MISSION 617-770-0026 (PC Pursuitable MABOS node) HELP BBS 918-251-5450 OASIS SYSOPS!! BONUS ! The $5.00 update fee to upgrade to OASIS 3, is hereby waived and done away with as of February 8th, 1988. TREAT ! The February 3rd, 1988 UPDATE is posted on XBN-MISSION at 617-770-0026. Call and download your NEW UPDATE! ______________________________________ | -=2=- |Atari News Update |_______|_____________________________ ATARI PRODUCT NEWS UPDATE: 1/27/88 (C) 1988 by Atari Corp. May be reprinted only with this notice. MICROSOFT WRITE In mid-January, the first shipments of Microsoft Write arrived at Atari's warehouse and were shipped to Atari dealers. This advanced word processor, with a list price of $129.95, is a direct port of Microsoft Word 1.05 from the Macintosh. It features true footnoting, a sophisticated variety of page setup features, and the cleanest mouse interface of any ST word processor. Microsoft Write fully supports GDOS. Included with the program is GDOS version 1.8, along with a variety of proportional fonts. The fonts are supported on the screen for a WYSIWYG performance. In addition to GDOS output, Microsoft Write supports a wide variety of common printers in their own text fonts. Printer drivers can be edited by the user to support virtually any printer on the market. Microsoft Write includes extras such as Mail Merge, Glossary, Undo, Clipboard, Ruler, and page format changes throughout the document. ATARI LASER PRINTER The Atari SLM804 Laser Printer arrived to authorized dealers beginning before the new year. This 8-page-per-minute system uses the TEC engine, a write- white device which provides the sharpest possible blacks. Dot density is 300 dots per inch. The SLM804 connects directly to any ST or Mega computer via the DMA port. Included is the SLMC804, which allows additional DMA devices (such as hard disk drives) to be plugged into the DMA while the laser is attached. The Atari Laser Printer's unique design has the ST or Mega driving the engine directly, without mandating costly and slow electronics within the laser. Even with only 512K of system RAM, an ST can drive the engine in Diablo emulation mode and for screen dumps. The Diablo emulator supports up to 8 type styles using GDOS fonts (GDOS itself is not required). Also included with the printer are 2 disks of GDOS fonts. These laser fonts correspont to the screen fonts provided with Microsoft Write. Various point sizes are supported, from 6 point up to 48 point. Existing software that takes advantage of GDOS includes MS Write and Easy Draw. Using Easy Draw, outputs make full use of the 300 dpi resolution of the printer for fine lines at any angle, smooth fonts, and bit images from scanners. Easy Draw with Supercharger can output full pages of text and graphics in well under a minute -- recent tests averaged 20-30 seconds per page. Multiple copies of a page take less time than the original page. The Atari Laser Printer has a list price of $1999. Replacement toner cartridges sell for $59.95, and replacement drums list for $199.95. By separating toner from drum, replacement costs and price per page come in lower than other laser printing systems. ______________________________________ | -=3=- |Guest Commentary on Atari |_______|_____________________________ by Dave Brehm Being a great fan of Zmag, I read with interest an article from a conversation with the folks at Analog on the recent Buy-out. Being an avid 8-Bit'er, I was understandably concerned over a statement that Analog MAY drop the Analog Magazine if the interest in 8 Bit drops. As far as I am concerned, the Atari 16 Bit ST's are super fine machine, Don't get me wrong, However people who still slave away over the good old 800XL and 130XE's are either not interested in the ST LIne at the moment or can't afford one. I for one am in the catagory of not interested right now, as I feel the 8 BIT still has alot of potential. The problem seems to be a lack of interest by the Softwear companies NOT the users. Some of us use the machines for MORE than Games and that is the area we are hurting in. Some examples, SYNFILE+ is a Real good database, HOWEVER, why has it not been updated to make use of the additional memory..too lazy? I would love to be able to load the Data into Ram disk and manipulate it at a much faster rate...impossible??..I don't think so. That is just one example of many, of ways to keep 8 bit alive. Take people like DATAQUE and their MTOS, here are people who must still believe in 8 bit to write a dos that will Multi-task...right on an 8 bit. How about IMP Softwear and their SUPER DATABASE 1-2-3. Excellent program that write programs for you. I use it all the time and have had conversation with the folks who are taking some suggestions and putting it in the softwear, and told me that is there was enough interest they would write it to support the XE and XL Expanded memory... These are the kind of people we need more of to keep the 8 bit alive, and the users to support them. With the 8 Bit survival at stake...I for one would like to go on record and ask all user's to start talking up these dependable machine again, get the User groups Hyped up again...Get uploading to your favorite BBS the exceptional software in the public domain that is out there and distribute it..Take the time..we need the support. To the third party programmers, keep working up the GOOD stuff..I think the potential of the 8 BIT hasn't even been tapped yet. and Thanks to Ron and Zmag for getting the word out. I would be interested in hearing any comments on the subject. I can be reached on the MOUSE BBS at 219-674-9288. ______________________________________ | -=4=- |Plents Page |_______|_____________________________ ...NX-1000 Review... by Eric Plent The Star Micronics NX-1000 printer is the next generation of fast, affordable dot matrix printers from Star. It is the successor to the Star NX-10 printer (which was discontinued), but still carries on the quality I have come to expect from Star. There are four (4) different versions of this printer. The most used version (as far as I know) is the 1000 model. It is also available as the 1000c (with a direct connection to the Commodore 64 computer), the 1000 Rainbow, and the 1000c Rainbow. The Rainbow models are color printers that offer multicolor printing for almost every application. FEATURES: Starting with the front control panel, there are four buttons and 10 indicator lights. The buttons are as follows: (from left to right) NLQ Type Font Selection Print Pitch Selection Paper Feed On/Off line The NLQ font selection button controls which of the four built-in fonts are available while printing. They are -Courier-, -Sanserif-, -Orator- and -Italic-. You can also use any of the above fonts in Pica, Elite, Condensed and Proportional pitches (which are selected from the next button over). In total, it gives you a great flexability in your printing. In addition, you can change the font style you are using WHILE PRINTING A DOCUMENT! Simply press the On/Off line button, select the font style and print pitch you want with the other selection buttons, and press the On/Off line button again. It will continue right were it left off without missing a character. Print speed is 144 characters per second in Draft (default) mode, and 36 characters per second in any Near Letter Quality mode. I found the print very readable in all modes, but I particularly liked the Orator font for printing letters and other documents. It is very difficult to tell the Orator from the output of a letter quality printer or a typewriter, is so good. The Star NX-1000 operates with full IBM emulation mode, as well as Epson LX800 emulation. This is selected with the dip switches located under the print ribbon. I am currently using the NX-1000 with my Atari 800XL and a 256K MIO from ICD, Inc. Since the MIO has a printer interface built in, I do not need an Atari 850 or ICD P:R: Connection to use it. However, I tested it with a Graphix AT interface and it worked flawlessly. Both pin feed and single sheet operation is supported. To save space, the pin feeder is located in the back of the machine under a lock-down cover. Pin feed paper can be fed in through the back, and single sheets can be fed in through the top. In fact, by moving a switch, you can disable the pin feed operation and use single sheets, without having to remove the pin feed paper. I was very impressed with that. I hope I have given you some food for thought if you are in the market for a new printer. The NX-1000 is an excellent printer, and I highly recommend it. Approximate Retail Price: $179-$200. Eric Plent StarBase I BBS (201)/938-6906 300/1200/2400 Zmag carrier! ______________________________________ | -=5=- |SP408/808 Review |_______|_____________________________ As many of you know. There aren't any cheap ways to do MultiLine stuff for the Atari, or any other computer for that matter. I mean, there are ways. But, how good are they?? Well, the SP series, by NiteLite system. Is one anwser to the question -How am I gonna do this?-. It is a serial modem interface. That has everything you need built in. All you need to do, is make up 4-8 cables. The SP408, is 4 lines (That's 3 RS232 ports, plus 0). The names, SP stands for. Serial Programmable. The 408 is similair to the 808. The only differance between the two, is the 808 has more lines. The price for the 408 is also less then the 808 ($199/$349 respectfully). It is also and intellegent interface. It's not a multi-plexer, as Paul Swanson has told me many times. It has a 65C02 Microprocessor built in. So if you know 65C02, you can do many things inside the SP itself. And the only thing you need your computer for (if you are using code inside the SP) is to load up the SP with your code. There is 8K of RAM inside of it. So there is lots of room for a simple chat board. Also, you can write code inside of it, to take some stress of your main system. I have worked with the SP. There are no bugs in the OS from what I could tell. However, there is no error checking. So you can crash the SP by sending it wrong commands. Oh yah, commands. The SP has about a dozen or so special commands that it uses in what I like to call 'SP Immediate mode', so you don't need to have to actually go out and scan the ports yourself. It does it for you. It can run at all baud rates from 50-19,200 BPS, with no trouble at all, from what I have seen. Currently he is change the ROM around. So it's not 100% complete yet. Although runable. I still see some ideas for some good upgrades to the OS, and am now giving Paul Swanson some of my ideas. He is on REV 3.1 of the ROM. And with the needs of some of the boards, who knows where it will stop. I have written several programs for the SP (OmniChat 8-Bit and OmniChat ST). So far, I haven't encountered any problems with the SP itself. Although somethings in it could do for some changes. But all in all, it's the best (and ONLY) salution to the MultiLine needs arising. I give the SP 4 Stars. NiteLite Systems PO BOX R Billerica,Ma 01862 Imager, AfterImage NiteLite 617-273-3065 PS: There is a good example of the SP at that Number running MultiLine NiteLite for the ST. ______________________________________ | -=6=- |Best Of 1987 Survey Results |_______|_____________________________ Compiled by Ron Kovacs The following survey results were captured from a few Oasis BBS systems running the Best of 1987 Survey. The survey was created from the Best of 1987 Poll created in December 1986. All the nominees were listed by system users. Then I compiled the survey from the entries and created the survey. The highest amount of entries were listed in the survey for the users to vote on. The accumulations of the systems captured, are included here. A few of the questions have been deleted because they contained regional and local information which is not of use in other areas. Total amount of votes per question: 272 ZMAGAZINE BEST OF 1987 SURVEY | Question Number 1 | Choose Your Favorite Atari 8 Bit BBS. 0> Express BBS (not pro) 1> Oasis (all versions) 2> Carina I (not II) 3> FoReM 8 Bit 4> NiteLite 5> AMIS 6> BBCS [#0] 47 [#1] 167 [#2] 38 [#5] 13 [#6] 07 Best BBS Program of 1987> Oasis BBS | Question Number 2 | Choose Your Favorite Atari 16 Bit BBS. 0> FoReM ST 1> Express ST 2> Michtron 3> BB/ST [#0] 202 [#1] 56 [#2] 11 [#3] 03 Best 16 Bit BBS Program of 1987 >FoReM ST | Question Number 3 | Choose Your Favorite Printer. 0> Star Series 1> Epson Series 2> Atari Series 3> OkiData (not Okimate) 4> NEC Series 5> Juki 6> Okimate 20 7> Texas Instruments 8> Kiss Lazer Printer 9> Panasonic Series [#0] 66 [#1] 89 [#2] 31 [#3] 12 [#9] 74 Best Printer of 1987> Epson Series | Question Number 4 | Choose Your Favorite Atari Corp Product. Atari only! 0> Mega ST 1> XEP80 2> 130XE 3> 1040ST 4> 1050 Disk Drive 5> 520ST 6> SC1224 7> XF551 8> XMM801 9> SX212 [#0] 35 [#1] 11 [#2] 95 [#3] 13 [#4] 30 [#5] 88 Best Atari Corp Product of 1987> 130XE | Question Number 5 | Choose Your Favorite 8 Bit Game, PD or Other. 0> Alternate Reality 1> Arkanoid 2> HardBall 3> Gauntlet 4> Superman 5> World Championship Karate 6> Ultima 4 7> Gemstone Warrior 8> Flight Simulator II 9> Fooblitzsky [#0] 59 [#1] 23 [#2] 27 [#3] 54 [#5] 31 [#6] 54 [#8] 24 Best 8 Bit Game of 1987>Alternate Reality | Question Number 6 | Choose Your Favorite 16 Bit Game, PD or Other. 0> Pro Wrestling 1> Shanghai 2> Gauntlet 3> StarGlider 4> Flight Simulator II 5> Alternate Reality 6> Wizardy 7> The Bards Tale 8> Mercenary 9> Gridiron [#0] 40 [#2] 29 [#3] 39 [#4] 28 [#5] 32 [#6] 26 [#7] 55 [#8] 23 Best 16 Bit Game of 1987>Bards Tale | Question Number 7 | Choose Your Favorite Bulletin Board Service. This question omitted because contents were targeted at local area systems. | Question Number 8 | Choose Your Favorite Online Service. 0> GEnie 1> CompuServe 2> PC Pursuit 3> Delphi 4> Games Computers Play (Off Line) 5> The Source 6> Dow Jones [#0] 64 [#1] 98 [#2] 54 [#4] 33 [#5] 11 [#6] 12 Best Online Service of 1987>CompuServe | Question Number 9 | Choose Your Favorite SysOp. | Question Number 10 | Choose Your Favorite Co-SysOp. These 2 questions were targeted at local area sysops and co-sysops so they were deleted from the survey. | Question Number 11 | Choose Your Favorite Magazine, Online or Printed media. 0> Analog Magazine 1> ZMagazine 2> Antic 3> Atari Explorer 4> ST-Log 5> STart 6> ST-World 7> Compute 8> ST-Express 9> TeleTalk [#0] 19 [#1] 84 [#2] 109 [#3] 17 [#4] 18 [#5] 07 [#7] 14 [#9] 04 Best Magazine of 1987>Antic Magazine | Question Number 12 | Choose Your Favorite Programmer. 0> Keith Ledbetter 1> Tom Hudson 2> Ralph Walden 3> David Small 4> Matt Singer 5> Bill Teal 6> Phillip Price 7> Matthew Ratcliff 8> Jerry Horanoff 9> Bill Wilkinson [#0] 65 [#1] 23 [#2] 26 [#3] 29 [#5] 19 [#6] 49 [#7] 12 [#8] 25 [#9] 24 Best Programmer of 1987>Keith Ledbetter | Question Number 13 | Choose ICD's Best Product. 0> Multi I/O 1> P:R: Connection 2> SpartaDos Consrtruction Set 3> R-Time Cartridge 4> US Doubler 5> Rambo XL [#0] 94 [#1] 27 [#2] 86 [#4] 49 [#5] 16 Best ICD Product of 1987> Multi I/O | Question Number 14 | Choose Your Favorite Modem. 0> Avatex 1200HC 1> Avatex 2400 2> XM301 3> Supra 2400 4> USR Courier 2400 5> SX212 6> Everex 2400 7> Hayes 1200 8> Capetronic 1200 9> SmartTeam 2400 [#0] 47 [#1] 67 [#2] 32 [#4] 38 [#5] 29 [#7] 40 [#9] 19 Best Modem of 1987>Avatex 2400 | Question Number 15 | Choose Your Favorite Hard Disk System or Drive. 0> Seagate ST213 1> Supra 8 Bit 20 Meg 2> Supra 16 Bit 20 Meg 3> Atari SH204 4> NEC 5> Control Data 6> Seagate ST225 7> Seagate ST251 8> Seagate ST138 9> Seagate ST125 [#0] 11 [#1] 109 [#2] 71 [#3] 09 [#4] 57 [#9] 15 Best HD System of 1987> Supra 8 Bit 20 Meg HD ______________________________________ | -=7=- |Editors Desk |_______|_____________________________ As you can tell we have changed ZMag once again. I hope you find this new style a bit more pleasant to the eye- balls. Leave me feeback should have any questions. The Kovacs Baby update still has us waiting! The due date has been placed at February 15, 1988. The Syndicate BBS will be returning March 1, 1988 or before. Already scheduled to make a return to the system is our old friend Rum-Runner. A mailing is being put together to those who left me their addresses on the ZMag BBS. Look for it soon after the arrival of the baby. Thank you for supporting ZMag. Since the BBS will be returning to the phone lines in a few weeks, look for an update next week. XBN will REMAIN the headquarters for ZMagazine and will be joined by the Syndicate as the exclusive places to get ZMag FIRST. Regional headquarters are being established also. Till next week will hopefully news of the arrival.... ______________________________________ |..<9>..>|Atari Basic Programming |________|____________________________ ...Part 6 of a continuing series... LESSON 3 Version 1.13 (C) COPYRIGHT 1987 by Jackson Beebe CONTENTS: LOOPING, GOTO Statement, ON-GOTO Statement, FOR-NEXT Statement. This is Part 6 Lesson 3 of Learning to program in Atari BASIC, brought to you by Jackson Beebe. Contact me at the address at the end of this lesson. LOOPING: Up to this point, our programs have executed -straight down- when RUN. This means execution began at the lowest numbered line, and proceeded sequentially until the last line was executed. Straight down program logic is very limiting, as each line may only be used once, and no decisions or branching may occur. Most importantly, the program cannot -loop.- Looping, or sending program control back through earlier lines, is one of the most powerful features of a computer. It's what separates computers from calculators. For example, we could write a program that converts Fahrenheit temperatures to Centigrade, prints the output, then -loops- back to the beginning of the program to convert more data. This would use the code over and over again. Very handy. Try this program: 10 REM * TEMP CONVERSION * 20 ? -INPUT Centigrade temp -; 30 INPUT CTEMP 40 FTEMP=CTEMP*1.8+32 50 ? CTEMP;-=-;FTEMP;- Fahrenheit- 60 ?:? 70 GOTO 20 This lesson will present an introduction to the concept of looping, and covers the GOTO and the FOR-NEXT statement. GOTO Statement: This is the simplest of all UNCONDITIONAL TRANSFER statements. It's format is: 80 GOTO 20 A line number, followed by the word GOTO (some BASIC'S allow GO TO) followed by the destination line number. When encountered in a program, control goes immediately to the specified line number. (You'll receive an error message if there is no such number.) An example of the GOTO is: 10 PRINT 20 PRINT -TYPE YOUR NAME- 30 DIM NAME$(15) 40 INPUT NAME$ 50 PRINT:PRINT NAME$ 60 GOTO 10 This program will loop forever, prompting, printing your name, prompting, etc. This is an INFINITE LOOP, as was the temperature conversion program earlier. The GOTO statement is the subject of much controversy in BASIC. Many programmers feel it should NEVER be used, as it allows terrible sloppy programming, that defies tracing. For example: 10 GOTO 60 20 PRINT -HI- 30 GOTO 50 40 END 50 GOTO 40 60 GOTO 20 BASIC doesn't -protect you from yourself.- It will allow your programs to wander aimlessly, and/or take wild leaps, that are nearly impossible to figure out. More structured languages don't permit this. This feature of BASIC is a mixed blessing. There are times I find a GOTO pretty handy, e.g. at the end of a menu. When you've tested for every possible correct input, and haven't found one, then it must be an error, so you erase the invalid entry from the screen and send control back to the input to try again, with a GOTO. It's clear enough there. Go easy on these, and don't use them to fix a sloppy kludge that you've got going, that REALLY needs to be re-written into cleaner code. Please don't give BASIC a bad name !! ON GOTO Statement: This is like the GOTO, in that it is an UNCONDITIONAL transfer statement. This has a built-in feature of sending the program to one of several places, depending on the value of some variable. It has the syntax: 25 ON (variable) GOTO XX,YY,ZZ If the variable named, has the value 1, control goes to line XX. If variable = 2, control goes to line YY, and to ZZ if variable = 3, etc. For example, let's say we have a menu like the one below, and we use a variable named CHOICE to bring in our input. <1> Load a file <2> Save a file <3> Directory <4> Quit to DOS CHOICE > ? Code would look like this: 5 REM ** MENU DEMO ** 10 ? CHR$(125) 20 ? :? :? - <1> Load a file- 30 ? :? - <2> Save a file- 40 ? :? - <3> Directory- 50 ? :? - <4> Quit to DOS- 60 ? :? :- CHOICE > -; 70 INPUT CHOICE 80 ON CHOICE GOTO 150,200,250,300 90 etc 100 GOTO 70 110 etc 120 etc - - 900 END This uses an INPUT statement to bring in a value in CHOICE, either a 1, 2, 3, or 4. Depending on the value, it sends the program to 4 different places, line 150,200,250,or 300. If CHOICE is 1, control will go to line 150. If 2, then line 200. If 3, then line 250, and if 4 then line 300. If the value of the variable is 1, then it goes to the first line #, if 2, it goes to the second, and so on. These can string out to more choices that you or I will probably ever need. The destination line numbers don't need to be in any order. For instance, this is okay: 120 ON CHOICE GOTO 15,150,25,95,450 Very handy for menus, and small numbers 1-6 or so. If CHOICE is not exactly equal to one of these integers, the program will -fall through- the line. Sometimes you can force large numbers down to low integers by dividing, and taking the INTEGER value, etc. FOR-NEXT Statement: This is used when you know you want to -crank- a loop a certain NUMBER OF TIMES (like looping 6 times to guess the LOTTO number (6 digits) or by using a variable to determine how many times to loop. We usually put a FOR and a NEXT -around- code that we want to execute a set number of times. For example: 50 FOR X = 1 TO 10 60 PRINT -SUPER- 70 NEXT X 80 END This would -loop- from line 50 to 70, 10 times, printing SUPER each time. The syntax is: 10 FOR (variable) = start# to finish# ...then our routines in here... 20 NEXT (variable) FOR-NEXT loops count from the starting number specified, to the ending number. When you reach the ending number, it will not loop back to the FOR statement again, but will -fall through- the NEXT statement to the next lines of the program. The loop is -finished.- For example: 25 FOR NUMBER = 1 TO 5 . . . . code. . . . . 55 NEXT NUMBER or 25 FOR COUNT = -3 to 27 . . . . code. . . . . 95 NEXT COUNT There's also an optional ending called STEP, to specify how many numbers to step each time you count. If you leave it out, it steps 1 at a time by default. It looks like this. 10 FOR X=1 TO 6 STEP 2 ....... 90 NEXT X This steps 2 at a time. This loop would only run a total of 3 times (X=1,X=3,X=5). X starts at 1, then is 3, then 5. (The next value would be 7, and be greater than 6.) When the value of the variable is greater than the ending number, it DOESN'T execute the code in the loop (between FOR and NEXT), but goes to the next line AFTER the NEXT statement. It -falls thru- the FOR-NEXT loop. FOR-NEXT loops may step from a higher to a lower or negative number, by specifying a larger starting than ending number, and using a negative STEP value. For example: 10 FOR NUM = 3 to 1 STEP -1 20 ? NUM 30 NEXT NUM 40 END This would print a list of numbers from 3 to 1. You may even step by decimal values. We will use FOR-NEXT in MOST programs we write for one purpose or another. EVERY FOR NEEDS A NEXT. They must match up in number (3 of each, etc.) Atari BASIC allows more NEXT than FOR statements like: 125 FOR NUM = 1 to 50 130 IF NUM = 27 THEN NEXT NUM 135 IF NUM = 28 THEN NEXT NUM 140 IF NUM = 29 THEN NEXT NUM 145 PRINT NUM 150 NEXT NUM 160 END This program just loops 50 times, and prints the value of the loop variable NUM each time, except when NUM equals 27, 28, or 29. For those values, the NEXT NUM statements in lines 130-140 send control immediately back to the FOR statement in line 125, not passing through line 145's PRINT statement. If you have a BASIC compiler, and try to compile the above program (more on compilers in much later lessons), it probably will blow the compile, seeing too many NEXT statements. This could be fixed by changing lines 130-140 from saying NEXT NUM to saying GOTO 150. Just a handy household hack! We usually put a FOR-NEXT loop -AROUND- other code, to get the program to do that code, a certain number of times. The true power of the FOR-NEXT loop comes from the fact that it can use VARIABLES for the starting and finishing number, as well as numbers. This allows it to do something like -check every letter in a word.- To do that, we could write a FOR-NEXT loop from 1 to the length of the word. Lets assume we INPUT a word, using the variable WORD$. Like this: 15 REM * DEMO * 20 DIM WORD$(20) 25 PRINT -Type in an uppercase word.-; 30 INPUT WORD$ 35 FOR X = 1 TO LEN(WORD$) 40 IF ASC(WORD$(X,X)) < 65 OR ASC (WORD$ (X,X)) > 90 THEN PRINT -**ERROR**-:END 45 NEXT X 50 PRINT -THIS WORD IS UPPERCASE- 55 GOTO 25 60 END This program INPUTs a word to the variable WORD$, and checks the ATASCII code to see if it's right for uppercase letters. More on ATASCII later. Look in your manuals. All the letters, numbers, punctuation, etc are assigned numbers, i.e. A = 65. Type in the program above, and try it. Type in short words in uppercase, then in mixed upper/lower case. Now to be technical! (I know it's a pain, but you need this one.) The value of the loop variable (the one specified in the FOR and the NEXT statement) increments each time it LEAVES the NEXT statement, and zooms back up to the FOR. Again, the place that the loop variable or counter, is incremented, is as it leaves the NEXT statement (line 45) and returns to the FOR statement (line 35.) A small programming trivia thing to remember, is that the value of a FOR-NEXT variable is always ONE greater than the value of the loop, after it finishes. See, it drops though one last time when it's done, and gets incremented a final time, even though it's done looping. Programs begin execution at the next line after the NEXT, when the loop is finished. Again, think of the FOR-NEXT loop as -falling through- when finished. FOR-NEXT is frequently used for a timer, to make the program sit there and wait for a moment. For instance, when printing an intro screen like this: 10 ? CHR$(125) 20 ?:?:?:? -* * WELCOME TO * *- 30 ?:?:?:? - SNAZZO- 40 ?:?:? - by B. Mudflap- 50 FOR X = 1 TO 400:NEXT X 60 ? CHR$(125) 100 main body of program etc. This would clear the screen, print your introduction, wait there aprox. 10 seconds, then clear the screen and begin the program. A larger value in the FOR-NEXT loop will take longer to count up to. Try these timers yourself. SUMMARY: Up to this point, we know: TWO WAYS TO LOOP: 1) GOTO statement 2) FOR-NEXT statement Next lesson we'll learn the basic 3rd, the IF-THEN statement, that tests and loops or branches. BLAST FROM THE PAST: Do you know three ways to get data into a program? ANSWER: 1) the LET statement 2) the READ-DATA statement 3) the INPUT statement ------------------------------------ SAMPLE Problems: PROBLEM 3 Write a program that prompts for input in inches, and shows labeled output in centimeters, using the formula 1 inch = 2.54 centimeters. When it finishes, it should loop back and prompt for input to run again and again. (Quit using BREAK key.) PROBLEM 3A Write a FOR-NEXT program that produces the printout: 6 5 4 3 2 1 ZERO PROBLEM 3B Write a program that prints out all the even numbers between 0 and 50. PROBLEM 3C Write a program that produces a table of numbers, their squares, and their square roots, using the format below. The table MUST start at 10, and finish at 1. NUMBER SQUARED SQ. ROOT 10 100 3.3XXXX 9 81 3 8 64 2.XXXXX . . . . . . 1 1 1 This concludes Part 6 and lesson 3 of Learning to Program in Atari BASIC. Be sure to catch Part 7 Lesson 4 next week. Contact me at: Jackson Beebe Prairie Data Fields 807 W. Hill St. Urbana, IL 61801 or CompuServe 72550,317 ______________________________________ Syndicate Zmagazine Issue #92 (c)1988 Syndicate Publishing Company ______________________________________