______________________________________ SYNDICATE ZMAGAZINE February 1, 1988 Issue #91 Atari News and Information ______________________________________ Editor: Ron Kovacs ______________________________________ Assistant Publishers: Ken Kirchner Tony Santos ______________________________________ Regional Zmagazine Headquarters ------------------------------- National:>XBN BBS 617-770-0026 Stairway 216-784-0574 ------------------------------- NJ Area> StarbaseI 201-938-6906 JACG BBS 201-298-0161 E.B. BBS 201-247-8252 ------------------------------- Hawaii> W.W.of OZ 808-423-3140 ------------------------------- Midwest> Lions Den 312-690-3724 Mouse 219-674-9288 Balloon 419-289-8392 ------------------------------- East> Ratcom 301-437-9813 NY City 718-604-3323 ------------------------------- Others> FACTS BBS 313-736-3920 Please note that there are over 250 BBS systems carrying ZMagazine each week. During the next few weeks, the above systems will be supplied a list of ZMag BBS system in their area. If your system carries ZMag and your system has not appeared in any ZMag BBS list. Please let me know. ______________________________________ Xx Contacting ZMagazine ______________________________________ I can be reached at any of the following places: XBN BBS, JACG BBS, StarBase I (numbers listed above. On CompuServe at 71777,2140 On GEnie at R.KOVACS on Source at BDG793 Modem link up between 7pm-11pm at 201-968-8148. ZMagazine transfers and chats during the above times only. Will change over to answer machine and voice line very soon. Any submissions or advertising info should be left on XBN or Starbase I or on CompuServe or GEnie. ______________________________________ Xx INDEX 91 ______________________________________ Editors Desk................Ron Kovacs ZMag Newswire ICD/OSS Merge......Genie Bulletin...........................XBN Permanent Ram.............Russ Babylon ZMag Reports (A New Column)........ICD BBS Watch.....................Stairway CO Chat Transcripts.........CompuServe 1200XL Modification.........Bob Wooley Basic Programming Part 5.Jackson Beebe ______________________________________ Xx EDITORS DESK ______________________________________ Well, It has been 2 weeks since the downfall of the ZMAG BBS and I have to be honest and say that I miss it. I have had more time to edit and plan the issues and dont want to lose it right now. However... I have received 38 letters via email requesting my return to the BBS world and many of them have been on the border of hate mail. I have been accused of letting down alot of people. I could make this issue a complete essay on the subject, but I dont want any death threats.(hehe) I know that taking the BBS down wasn't a popular decision, and I haven't left anyone stranded. There are a number of places around that are better run and better organized then Zmag. Once again however, I am going to be returning to BBS land. No date has been set, but the system will return with new software, a possible new name, and contain Zmagazine. I will keep you updated on this as the weeks roll by. Current systems designated as Regional systems will continue and the XBN BBS will continue as national headquarters for Zmagazine. I hope this decision will ease up the amount of negative feedback. ______________________________________ Xx ZMAGAZINE NEWSWIRE ______________________________________ DATELINE: 1-27-88 *GOOD NEWS FOR ATARI OWNERS!* ICD, Inc. and OSS, Inc. (Optimized Systems Software) have just signed an agreement which will -add new life to all Atari computers-. Under this agreement, ICD will add the manufacture, marketing, and support of all current OSS software titles for Atari computers to ICD's already powerful Atari product line. ICD's friendly, helpful staff is now trained in all aspects of support for the complete OSS product line including: MAC/65 MAC/65 Toolkit ACTION! ACTION! Toolkit BASIC XL BASIC XL Toolkit BASIC XE Writer's Tool DOS XL Personal PASCAL for the Atari ST Ordering and support for ICD/OSS products are available by calling 815/968-2228 from 8AM to 5PM CST Monday through Friday. Support is also available 24 hours a day 7 days a week on the following Electronic Bulletin Boards: ICD/OSS BBS 815/968-2229 300-9600 baud, CompuServe,GEnie, Delphi, and BIX. ICD's 24 hour FAX is connected to 815/968-6888. The San Jose, CA numbers for OSS will no longer be providing support. Orders for OSS products may be placed now. All products will be shipping in quantities soon. For more information call any of our product support lines or write to: ICD/OSS 1220 Rock Street Rockford, IL 61101 ______________________________________ XxBULLETIN FROM ZMAGAZINE HEADQUARTERS ______________________________________ January 26, 1988 Welcome to XBN BBS. There are TWO telephone numbers that both reach this ONE board. They are: 617-559-6844 617-770-0026 PC Pursuitable. (MABOS) Boston Metro call. Later in February, XBN will split into TWO boards. One will support OASIS SysOps and Christians/Religionists. The other will support ATARI 8-Bitters and be the Zmagazine Headquarters. Both boards will be PC Pursuitable and a Boston METRO free call. At that time this board that you are on now, will be the ZMAG and ATARI board, and the number will be 617-770-0197. Please make note of it. The SPLIT is planned for FEBRUARY 17th, 1988. At that time the telephone numbers will work in the following way: 617-559-6844> forwards to 617-770-0026 617-770-0026> OASIS - CHRISTIANITY 617-770-0197> ZMAG H.Q. - ATARI 8-bit if busy forwards to 617-770-0026. If you call the ZMAG/ATARI board, and the line is busy, your call will forward to the OASIS/CHRISTIAN board. There is no phone charges to you in this call transfer. You may wish to logon the OASIS board and leave a message to me if you have an urgent message, and you cannot get on the ZMAG board. This may seem complex at first, but whatever number you end up calling after February 17th, will reach an XBN BBS, and at that time you will be able to find out which number is best for you. There will be downloads for all support areas including ATARI 8-bit, ZMAGAZINES, OASIS support files, and Christian/Religious reading text files. Both systems will run on hard drives, to provide plenty of room for files, and fast transfers. ______________________________________ Xx -Permanent- RAM Operating System ______________________________________ by Russ Babylon The following article shows how to modify a 800XL computer to allow any RAM based operating system to remain resident under any situation short of turning off the power to the computer. Not only will the RAM operating remain active it will also be uncorruptible, that is it can not be changed once it is enabled. Sound interesting? As with any project involving internal modification to your computer do not attempt this unless you are familiar with electronic circuits and soldering. You will need one 74LS00 IC, a SPST subminature switch, a 5K resistor and a couple of feet of small guage hook up wire. At most a cost of two or three dollars. To start the project first disassemble your XL and remove the metal shields from the circuit board. Next locate the PIA chip, it is the 40 pin chip marked U23 in the lower right side of the circuit board when you hold the circuit board right side up, with the joystick ports to your right. If you are still unsure the PIA should be marked with 6520 somewhere in the jumble of numbers on the top. Now if you have socketed chips like I did carefully remove the PIA from its socket and locate pin 10. Pin 10 corresponds to bit 0 of memory location $D301. CAREFULLY bend pin 10 slightly to the side so that it will not be in the socket and then reinsert the PIA into the socket. If you have soldered chips then the easiest way to do the mod would be to carefully cut pin 10 from the circuit board with side cutters so no electrical connection existed between pin 10 of the PIA and the foil on the board. Make SURE you leave enough of pin 10 to solder to. I do not like the idea of cutting traces on the circuit board but if you do and can trace them carefully enough more power to you. Now solder about a twelve inch piece of hookup wire to pin 10 of the PIA again making sure that there is no electrical connection to the circuit board. If you have a wire wrapping tool it makes a quick way to make this connection and no soldering is required. Now flip the board over and find where pin 10 used to be connected and solder another twelve inch length of hookup wire to this point. Now for the next step; with the board right side up again look in the middle of the board and locate U28. This is a SN74LS375N chip and is used to latch the R/W signal from the 6502 CPU. You need to locate pin 14 of this chip and then flip the board over and solder about eight inches of wire to the back of the board where pin 14 connects. You will notice that pin 14 has no foil connections to it since it is unused in a standard XL but we are going to make good use of it. Onward and upward! Now you need to secure the 74LS00 chip to the circuit board. If you look up at the top of the board just to the left of the monitor output jack there is a large area of solid foil. I secured the chip UPSIDE DOWN in this area using a hot glue gun and adhesive but you can use whatever you have but make sure the chip is anchored before you continue and make sure you can get the metal shields back on the board with the chip installed! Now we need power for our newly installed chip and this can be obtained in many places on the board. I went right to the source for mine. Look in the upper left hand corner of the board right next to the power switch. You will see a capacitor on top, then a resistor, then a diode I believe and then a ferrite inductor. The right side of this inductor is the 5 volt power feed point for your computer and I just tacked a piece of wire to this. Connect the other end of this wire to pin 14 of the 74LS00. Remember the chip is upside down so be careful. Connect a wire from pin 7 of the chip to any convenient ground point, remember that the chip is sitting on a large piece of grounded foil which has several very small holes just perfect for passing a small wire through and soldering to the back. OK, you have power to the chip and now need to hook everything together. Take the wire you have connected to pin 10 of the PIA and solder it to pin 1 of the 74LS00 chip. Take the wire from the underside of the board that was connected to where pin 10 of the PIA used to be and connect it to pin 8 of the 74LS00 chip. Take the wire that you hooked to pin 14 of the SN74LS375N chip and connect it to pin 13 of the 74LS00 chip. On the 74LS00 chip itself connect pin 2 to pin 4, pin 4 to pin 5, pin 6 to pin 12, pin 3 to pin 9 and pin 10 to pin 11. You are almost home! Now take the 5K resistor and trim it down and connect one side to pin 2 of the 74LS00 chip and the other end to pin 14. Solder a small piece of wire to pin 4 or 5 of the 74LS00 (there hooked together so it doesn't matter which one). The other end of this wire is hooked to one side or the other of the SPST switch. On the other switch terminal connect a wire to any convenient ground point or pin 7 of the 74LS00 if none are to be found. That completes the electrical work! Now you have a switch hanging in mid air looking for a home. If you look at the lower cover of your computer (the part without the keyboard) you will notice a very nice area between the monitor output jack and the switch box output. I drilled a 1/4 inch hole in this area and mounted my switch in this area once the circuit board was installed in the bottom cover. Now all you have to do is put it all back together. The wires from the circuit board can be passed through any circuit board and metal shield openings being careful not to short or cut any wires or insulation. The moment of truth is at hand! With the SPST switch set so it is OPEN power up your computer. It should act perfectly normally in any mode or executing any program. If your computer will not power up try switching the SPST switch to the other position and power up again. Now for some fun load in a translator program and after it is in and running flip the SPST switch to close the contacts. The computer should not be visibly affected. Now push RESET and you will find that the translator is still there and operating. Go into BASIC with the translator or other RAM operating system and try pokeing different values into the RAM area where your operating system resides and you find that you can't once you have closed the SPST switch. This project has many possible uses. If you are proficient at machine language you can modify a RAM operating system to do all sort of nice things. It could make an Omni-mon look sick. You can make a copy of your ROM based operating system except change the RESET vector at $FFFC and $FFFD. Install this system in RAM put the switch back in its normal position and boot up some picky piece of software that checks for custom or RAM based operating systems and wait until it loads. Then close the switch and hit reset and you can go to and execute some utility program. I have used this technique to get memory dumps of loaded programs. The things you can do with this modification are only limited by your imagination. This mod gives you almost total control of your computer. Any questions, comments, or suggestions are gladly accepted. Call the Ratcom BBS at 437-9813 and leave a message for Big Russ or I can be reached on Compuserve from time to time as 72327,404 and my name is Russ Babylon ______________________________________ Xx ZMAG REPORTS ...A New column of Special Reports... ______________________________________ [Ed. With this article, We start a series of reviews on the ICD MIO. This is the first of many. Your thoughts, ideas, and commentary will appear here. So send them in!!] Current Topic> ICD's MIO < ========= This review by Thomas Warren ______________________________________ It's tough owning a computer system, there's always someone bringing out something trying to tempt you to part with your hard earned cash. The Multi- Input/Output Interface (MIO) from ICD is no exception. Just what can you get for $199.95? Unless you have been living under a rock for the past few months, and haven't read the articles in both Antic and Analog magazines praising the MIO, you'd know that it comes with 256K or 1 MEG of internal, refreshed, RAM, a parallel printer port, RS-232 port, video port, and a SASI/SCSI hard drive interface. What the magazines don't go into detail about is how you can use the MIO. Other than the obvious use of the hard drive interface, what good is the internal memory? The 6502 can't access more than 64K, so programs won't take advantage of it. And, 1 MEG! Can you imagine loading it everytime you want to use it? I have trouble loading my 256K upgraded ramdisk on my 130XE. But, the MIO isn't like a normal ramdisk. It's more like a -soft- hard drive. The memory is constantly refreshed from the external power supply, so whatever you put into it stays there unless you have a power failure. So, you can load up the MIO with your terminal software, utilities, word processors, spreadsheet, or whatever, and call it up instantly. Just think, no scrounging for your word processsor. Why, the 1 MEG version could do away with diskettes! All this sounds utopian, right? Well, there is another side. The MIO can't be accessed by any DOS except SpartaDOS 3.2. Oh, you can still use 2.0, 2.5, SmartDos, and TOP DOS 1.5+, as long as you keep your 1050 as drive 1. But SpartaDOS 2.3 won't work at all. And, if you configure the MIO to boot off itself, you'll lose access to the others. However, most programs work with SpartaDOS 3.2, so no problem. Now, another practical use. Being a sysop, I was interested in the possibility of running the system strictly off an MIO and a ramdisk. It can be done on the 256K version, although the 1 MEG would be the better choice. Right now, I have all my message bases, passwords, system help files, and some of the downloads in the MIO. Unless a black out occurs, they will stay there. Even a system lockup won't disturb them (I know, I've had several). For you sysops, or would be, the best program for the MIO is Keith Ledbetter's Express 1030/850 (I run the 850), since you can copy system individually. Remember to do a KEY OFF command before running your bbs. This is the best new product out. Now for 80 columns and 300/1200. MIO supplied by: Bookmans 1-602-325-5055 Tucson, AZ ______________________________________ Xx ZMAG BBS WATCH ______________________________________ This column returns and contains info of interest from BBS systems called during the previous week. | Msg # | 119 |Left at| 01/29/88 |Sent to| ALL |Sent by| MR.GOODPROBE |Subject| sad day... _____________________________________ Today is a sad day. Star Micronics of printer fame has cancelled their workhorse the NX-10, now you can only buy their replacement for this great printer, the NX-1000, ...another one bites the dust. Unbelevably, I also saw several new programs for the 8 bit Atari up at Waldenbooks at Chapel Hill, so they really are writing for that machine after all! Yeah! Holy chips! Its Mr. Goodprobe _____________________________________ |[N]ext [A]gain [R]eply [D]elete | |[E]dit [S]end ->(E-Mail) [Q]uit | | Msg # | 818 |Left at| 01/29/88 |Sent to| ALL |Sent by| ALICE AMORE |Subject| Ohio Software Exchge _____________________________________ Ohio Software Exchange ====================== For Atari ST and IBM PC public domain software/shareware, contact Ohio Software Exchange at: 334-4145 (local to Wadsworth) 836-0990 (out of calling area) 114 Megs of downloads, New downloads every day of the week $1.00 per hour, 2400/1200/300 baud MasterCard/Visa/Cash/Check/MO Subscribe now! Sign up online, or call OSE's support BBS: PIPELINE BBS: 336-3774 or write: Ohio Software Exchange P.O. Box 5001 Wadsworth, OH 44281 ______________________________________ Xx CO Transcripts 1/30/88 ______________________________________ (c)1988 CompuServe Atari8 SIG (18,Ron Kovacs) Jerry: Whats happen'n with CII? (18,Jerry@Carina) Ron: Just about ready to start on the manual. Workin' on text files now... it's...coming along real good. Here's some news that you might want to pass along... Carina II will be going up $10.00 starting 3/1/88. Carina 1 owners still get...$10.00 off, and another $10.00 off if they sen't in their registration card. (18,BOB ROSENDALE) Jerry: I had better drive on down. (18,Jerry@Carina) Bob: Why? (18,Ron Kovacs) Sounds good... Why the higher price?? (18,Wp 3.0) Jerry: Cii available NOW? (18,Jerry@Carina) WP: Available in April. (18,Jerry@Carina) Ron: Well, if you saw the program, I think you would see that it's probably a $150.00 program. It's pretty emense (19 modules). What it basically comes down to is... - The price was too low. (I have to eat). (18,Mike) Ron: Long time no talk -- how have you been? (18,Ron Kovacs) Mike: Very well, In anticipation of the baby...Due in about 3 days...?? (18,BOB ROSENDALE) (he has been typing his little Zmag fingers off)...grin (18,Mike) Really?! Congratulations Daddy-to-be! (18,BOB ROSENDALE) oh, IDEA...BABY ZMAG KOVACS (18,Ron Kovacs) This is number 2... Jerry: I am sure you will have no problem selling it! (18,Mike) Be sure to drop us an arrival notice when he/she finally comes! (18,Ron Kovacs) I sure will! (18,Mike) Ah, then make that daddy-to -be-a-second-time. (18,Mike) Lemme make a quick announcement in case any of you missed the Bulletin.... Lee Pappas and Clay Walnum of ANALOG will be in CO tomorrow night at 8:00 PM EST. Hope everyone here joins us! ______________________________________ Xx 1200 XL Modification ______________________________________ by Bob Wooley If I were allowed only one computer, I think that I would prefer a 1200XL. Only two features draw me toward the 800XL or the 130XE, the Parallel Buss and the quality of the video on my 1702 Commodore. The 130XE makes the 1200XL screen look like I'm using a television - through the tuner! Oddly enough, the 1200XL has almost a dozen transistors in it's video circuits, while the XE only has 3 or 4. Yet, the 130XE has a much, much better output. (same transistors, same signal source.... did the Warner engineers get paid by the component???) Nice for us, though. We can just duplicate the XE circuitry in the 1200XL - which is exactly what I will describe in this article. The result is a picture that is just as clear as the one from a 130XE and costs almost nothing. This is designed for a separate CHROMA system like the 1702. There is no provision for output to a television or a composite monitor. Installation will consist of removing certain components and either replacing them with another part, replacing them with a wire, or not replacing them at all. One component has to be added at a point in the circuitry where no component now exists. All others are mounted in existing locations. REMOVE REPLACE WITH ============================= R21 22K 1.5K L15 820uh wire C115 10uf wire C60 100pf ---- R187 1meg 2.2K CR20 1N4148 ---- R22 4.3K ---- R23 180 47 R24 180 100 R25 130 ---- R28 130 wire C62 10pf ---- R180 180 ---- R181 3.3K 6.8K C118 100pf wire R182 6.2K ---- R183 2.2K ---- R184 1K wire R185 1K 180 C119 3.9pf ---- CR19 1N4148 150ohm resistor C116 .001uf ---- Add a 47ohm resistor between the collector of Q11 and +5volts. You will have to cut the foil right next to the pad to isolate the collector. Solder a wire from the junction of CR19 (now a 150ohm resistor) and R180 (removed) to the unused pin on the monitor socket. This is the new CHROMA source. Pull out Q7, Q8, Q16, Q17, and Q18. Check all of your changes very carefully. Measure the resistance between +5volts and ground to make sure that you haven't got any power supply faults. (It should read over 100ohms) Power up in self-test mode and correct the color by adjusting R48. You are now only missing the Parallel Buss..... Bob Woolley 75126,3446 ______________________________________ Xx LEARNING TO PROGRAM IN ATARI BASIC ...Part 5 of a continuing series... ______________________________________ (C) COPYRIGHT 1986 by Jackson Beebe ------------------------------------ MATH RULES: ------------------------------------ Once we get numbers into a program with LET statements, we can do math on the numbers. Here's the Atari BASIC guide to math symbols: + = addition - = subtraction * = multiplication / = division ^ = raised to a power For example: 10 REM * MATH DEMO * 20 REM put numbers into variableS 30 A=2:B=5 40 REM print examples 50 ? A+B 60 ? A-B 70 ? A*B 80 ? A/B 90 ? A^B 100 END Type this program in and try it. This should print out answers. Note line 30's use of multiple statements on the same line, separated by colons. The question mark (?) is Atari shorthand for PRINT. This saves a lot of typing. These are examples of doing math in the PRINT statement. This is not only allowed, but is usually the preferred way of printing out math results, as opposed to using one statement to do the math, and another to print the result. You have to tell computers to PRINT in order to see anything. You could say: 10 A=1:B=3:C=4 20 ANS=A*B*C 30 END This WILL multiply 1 times 3 times 4, and will put the answer 12 in the variable ANS, but you won't see it, unless you ask to PRINT it. Adding: 25 ? ANS would print out 12. Math is performed in the order: 1st Anything in parenthesis. 2nd Exponentiation (# to a power) 3rd Division or Multiplication 4th Addition or subtraction Some examples: 3+(4+6)*2 = 23 2^3 = 8 3+4+6*2 = 19 3+2^3*2 = 19 (3+4+6)*2 = 26 3+6/2+4*2 = 14 When in doubt, use parenthesis. It never hurts to put them in there. Always count the left and right parens, to make sure you've used an equal number of each. ------------------------------------ INPUT STATEMENT: ------------------------------------ The INPUT statement is a second way to get data into a program (the LET statement is the first). The INPUT statement stops a program, prints a question mark on the screen as a prompt, and waits for you to input from the keyboard and press RETURN. For example: 10 PRINT -Please type in a number and press RETURN- 20 INPUT NUMBER 30 PRINT NUMBER 40 END Line 10 is a PROMPT to let the user know what to type in. Line 20 takes in a number and puts it into a numeric variable named NUMBER. Line 30 prints it's value on the screen. Try this. Type NEW then enter the program. RUN it a few times while trying different numbers for input. Try entering a letter instead of a number. The program crashes. To INPUT letters, you need to specify a string variable name in the INPUT statement. For example: 10 DIM NAME$(25) 20 PRINT -Enter your name and press RETURN- 30 INPUT NAME$ 40 PRINT NAME$ 50 END You can input ANYTHING into a string variable, but only numbers into numeric variables. When you press RETURN without pressing a letter, number or character first, that is called a null input, and can be tested for by checking for -- (nothing between the quotes.) You can take in multiple pieces of data in the same INPUT statement, by separating variable names with commas. 10 DIM NAME$(25) 20 PRINT -Type in name, age, weight- 30 INPUT NAME$,AGE,WEIGHT 40 PRINT NAME$ 50 PRINT AGE 60 PRINT WEIGHT 70 END Separate data items with commas, when typing them in. Type all three items, with commas before pressing RETURN. Even though this is POSSIBLE, I believe it is confusing to users, and believe it's much clearer programming to input one piece of data at a time. INPUT statements should be preceded by PRINT statements cueing the user for what's expected. These PRINT statements are called prompts. Some other BASIC's allow putting a prompt right in the INPUT statement, but... Atari BASIC does not. No real problem. BASIC running on microcomputers is a good environment for applications that are interactive with the user, and INPUT provides an easy way to accomplish that. INPUT statements are needed when your program performs a process on different data each time, like a program that converts Fahrenheit to Centigrade temperatures. While the program is running, it stops to ask for your input, then continues, using data you've furnished. When I want a user to read a screen of text, then press RETURN to continue with the program, I simply dimension a variable B$ early in the program as DIM B$(1), then follow the text with a line like: 350 PRINT - -;:INPUT B$:PRINT CHR$(125) This allows the user to read at his/her own pace, then press RETURN which clears the screen and continues the program. B$ is just a -dummy variable-, used to bring in a null input. Again, CHR$(125) clears the screen. Note the trailing semi-colon after the prompt, to keep the input question mark out on the end of the prompt line. ------------------------------------ READ AND DATA STATEMENTS: ------------------------------------ A third way to get data into a program is to put it in a DATA statement, and read it into the program with a READ statement. The format of the READ statement is READ followed by a variable name, or names separated by commas. The format of the DATA statement is DATA followed by numbers, or letters in quotes, with individual pieces of data separated by commas. For example: 10 READ A,B,C,D 20 PRINT A;- -;B;- -;C;- -;D 30 DATA 1,2,3,4 40 END This program would print 1 2 3 4. Here's mixed input: 10 DIM NAME$(20) 20 READ NAME$,AGE,WEIGHT 30 PRINT NAME$;- -;AGE;- -;WEIGHT 40 DATA John Brown,25,165 50 END Note that the program has to find string data when there's a string variable in the READ statement, and numeric to go with numeric variable, etc. or it crashes. No quotes are used in DATA strings. When the program first encounters a READ statement, is goes to the first DATA statement (you may have many) and READs the first piece of data in it. BASIC sets a pointer to this data, and increments it one piece of data each time a READ statement is executed. Every time another READ is encountered, either in the same or in a later READ statements, it reads the next piece of DATA it finds. If there are multiple pieces of data in the first DATA statement, it will read them in order. When it runs out of data in one statement, it continues with the next DATA statement it finds. For every READ command you issue, the program must find data, or it crashes. Also note that the command READ A,B,C needs to find all three pieces of data, or...it crashes. DATA statements may be placed anywhere in BASIC programs, but it is roughly a standard practice to place data at the end. If you follow this practice, a user can examine all the data easily, rather than having to scan the entire listing for scattered data. ------------------------------------ RESTORE statement: ------------------------------------ You may use data over again, by issuing the command RESTORE followed by the line number of a DATA statement. This resets the pointer to the first data item in that line. For example: 10 REM * RESTORE demo * 20 FOR X = 1 to 25 30 READ NUM 40 PRINT NUM;- -; 50 IF X = 15 THEN RESTORE 100 60 NEXT X 100 DATA 1,2,3,4,5 110 DATA 6,7,8,9,10 120 DATA 11,12,13,14,15 200 END This will produce output of: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 This program READs data into, and PRINTs out a variable named NUM, 25 times. It begins reading data at the beginning of line 100, and reads lines 110 and 120 until X = 15. Line 50 then RESTORE's the pointer to the beginning of line 100 and it READs the first 10 numbers over again. If desired, we could have RESTOREd to another DATA statement as line 120. More on FOR- NEXT and IF-THEN in later lessons. The ideal application of READ-DATA statements is the program that routinely does calculations with different data each time, as payroll programs, or student grade programs. For programs that use a large amount of data, it is easier to enter and verify the accuracy of DATA statements then to type in data one piece at a time with INPUT statements. In the OLD DAYS we read data in from punched cards 80 columns wide. The modern day equivalent of the punch card is the DATA statement that has taken it's place. For example: 10 REM * Student Grade Program * 20 DIM NAME$(20) 30 READ NAME$,GR1,GR2,GR3,GR4,GR5 40 AVEGR=(GR1+GR2+GR3+GR4+GR5)/5 50 PRINT NAME$;- -;-AVERAGE = -;- -;AVEGR 60 DATA SALLY SMART,95,91,89,98,97 70 END ------------------------------------ END STATEMENT; ------------------------------------ The END statement is required in some programs, and not in others. It is worth putting it at the end of all your programs, period. The END statement stops computation, shuts off any sound generators left on, and returns control to BASIC at the READY prompt. For now, put END on the last line of your program. Later we may tell the program to END if the Quit option is selected from a menu, etc. END is the preferred way for a program to end, as opposed to ending from an error statement. ------------------------------------ ------------------------------------ SAMPLE Programs: ------------------------------------ Okay, now let's try some programming exercises that use these principles. We know enough now, to solve more complex problems. PROBLEM 2 Write a program that adds, subtracts, multiplies, divides, and raises a number to a power, by putting two numbers in LET statements. Produce output EXACTLY like the following example. Don't use the numbers directly in the PRINT statements, but use variables. Be sure to allow room for minus signs. Example: The sum of 5 and 1 is 6. The difference between 5 and 1 is 4. The product of 5 and 1 is 5. The quotient of 5 divided by 1 is 5. 5 raised to the 1 power is 5. Run this program using the numbers -7 and 39. ------------------------------------ PROBLEM 2A Write a program that averages a student's grades, and prints out the name, and average. The formula for average is all grades added together, divided by the number of grades. Format output like: The average of the 7 grades for John Doe is XX.XX. Find the answer for the following data: (include this as a DATA statement in your program) DATA Jane Jones,79,88,99,90,89,93,83 ------------------------------------ PROBLEM 2B Write a program using INPUT statements that converts temperatures from Fahrenheit to Centigrade, as temperatures are input from the keyboard in Fahrenheit. The formula is C = (F-32)5/9 Format output as: 77 degrees F = 25 degrees C. 59 degrees F = 15 degrees C. Find the conversions for: a) 14 F b) 69.8 F c) 260.6 F d) 4262 F e) -29 F ------------------------------------ PROBLEM 2C Write a program that converts hours into minutes using INPUT statements. Format output as: 14.5 hours = 870 minutes Convert the following data: a) 3.75 hours b) 99 hours c) 266 hours d) 0.3 hours e) 24 hours ------------------------------------ PROBLEM 2D Write a program using INPUT statements, that prints a number, it's square, and it's cube, as follows: Number Square Cube 2 4 8 Run the program for the numbers: a) 14 b) -6 c) 0.033 d) 123 e) -0.88 ------------------------------------ This concludes Part 5 and lesson 2 of Learning to Program in Atari BASIC. Be sure to catch Part 6 next week and the start of Lesson 3. Contact me at: Jackson Beebe Prairie Data Fields 807 W. Hill Street Urbana, IL 61801 or CompuServe 72550,317 ______________________________________ Syndicate Zmagazine Issue #91 (c)1988 Syndicate Publishing Company ______________________________________