______________________________________ |////////////////////////////////////| |//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//| |//\SYNDICATE ZMAGAZINE ISSUE #95\//| |//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//| |////////////////////////////////////| |///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//| |//\|PUBLISHER/EDITOR: RON KOVACS|\//| |//\|ASST. PUBLISHER:KEN KIRCHNER|\//| |//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//| |////////////////////////////////////| |////////////////////////////////////| |____________________________________| |February 29, 1988 | |____________________________________| |This Issue Dedicated to my wife, | |daughter and new son! | |____________________________________| |Syndicate Publications | |Post Office Box 74 | |Middlesex, New Jersey 08846-0074 | |____________________________________| |BBS (201) 968-8148 300/1200 24 hrs | |____________________________________| |Contents | |____________________________________| |*|A New Arrival!! | |*|Systems Prgm'g on the Atari XL/XE | |*|What's New On CompuServe Atari | |*|Atari News Update | |*|Atari Basic Programming Part 8 | |*|Modem Noise Killer | |____________________________________| A New Arrival!! ______________________________________ Earlier today at 1:46pm Adam Michael Kovacs was born! Mother and baby are doing fine. Guess the child knew we has an issue to get out! We are now a thriving family of four and appreciate the well wishes sent in over the last few weeks. It has been a long 9 months, we are happy and hope you are too, in hearing the news!! ______________________________________ SYSTEMS PROGRAMMING ON THE ATARI XL/XE ______________________________________ PART 1 COPYRIGHT (C) 1988 BY TOM HUNT NOTICE: This article may be republished, in portions or in it's entirety, if credit to the author is given. There is no doubt in my mind that the subject of this article is very broad. But, we will try and focus in on the systems environment aspect of this topic. More precisely, we will be examining the steps and considerations I found necessary to produce a multitasking environment (called MTOS) for our beloved 8-bit Atari computers. This may help others in extending -the frontier- of what we can do with our machines. MTOS is licensed to: DATAQUE 3308 PARK AVE. W. P.O.BOX 134 ONTARIO, OH 44862 Let's start by looking at the very heart of the system, the central processing unit (CPU). The CPU in our computers is the 6502C. It is driven at a clock speed of 1.79 MHz. It has 8-bit registers, and a 16-bit address bus. While it is a very able CPU, it has some very limiting constrictions when compared to more capable microprocessors. The Motorola 68000 processor has around 70,000 transistors on the chip, an 8 bit CPU (like the Intel 8085) has around 5,000 transistors. The 16-bit and 32-bit CPU's are faster, have expanded address space, and sometimes have better instruction sets. This does not mean that we should stop exploring the limits of our Atari XL/XE computers. On the contrary. What we must first do is accurately evaluate what our true limitations are. Frequently we will find that it is not so much the CPU that is the limiting factor. It is our minds, and in our imaginations. It is in the way we perceive a problem, and how we go about solving it. (Truly, a Guru Meditation!) Whereas the newer CPU's have address space in the megabyte range, our machines are confined to 64k. The way to extend this range is through bank switching. Some 8-bit Atarians are using memory in the megabyte range through this method. If you own an XL computer with only 64k, then I suggest you upgrade your memory to at least 256k. There are kits available to do this yourself, or by a qualified technician. Also, there are user's groups across the country that are waiting to help, if you need it. The rest of this article assumes that we have at least 128k in which to use. After doing what we can to extend the memory capabilities of our machines, we consider the clock rate of our CPU. 1.79 MHz is pretty slow to start with. Some Atarians have experimented with installing faster clock crystals to speed up the CPU. But what they have found is that it throws the video off. It messes up the display. Perhaps with the advent of the 80 column box from Atari, the hardware hackers will have better luck with this endeavor since the box apparently bypasses the ANTIC chip. Since there is nothing we can do about the speed (for now), we will have to come up with optimizing techniques for time sensitive areas. This is where we must begin looking for new ways to do things. The limiting factor is on us. I personally do not feel that the instruction set of our CPU is a limiting factor. Many of the newest CPU's employ RISC architecture. RISC stands for reduced instruction set computer. It seems that there are only a few instructions that do 90% of the work. A couple of instructions we defiantly could use would be 16-bit multiply and divide. Perhaps these instructions are found in the new 65816 CPU. The people at Western Design Centers claim that it is pin-compatible with the 6502C. Rumors abound of people working on a XE/GS that employs this chip. But in the meantime, we have more than enough opcodes to do some serious work. The next part in this series will be USING THE INTERRUPT SYSTEM. The programming of interrupt handlers is a considerable part of practical systems programming. ______________________________________ Whats New On CompuServe ______________________________________ THE ATARI USERS NETWORK (SIG*ATARI) WHAT'S NEW IN SIG*ATARI (Feb. 16) NEW FORUM SOFTWARE A new version of the Forum Software was installed in all three Atari Forums. Most changes are internal, however, there are some changes to the USER OPTIONS area (OP) of the Forum. Please see FORUM.235 in DL 0 of the ATARI 8-Bit or 16-Bit Forum for details! ** The ATARI 16-Bit Forum ** (GO ATARI16) The newest edition of ST-REPORT #21 is now available in DL 8. If you haven't been reading the monthly editions of this EXCELLENT Atari-oriented newsletter, we urge you to take a look at the latest copies. Nice job, Ron Kovacs! ** ATARI Programmers & Developers ** (GO ATARIDEV) ATTENTION ALL DEVELOPERS! We will be assembling a list of developer names and User IDs of those parties who regularly frequent the ATARI Forums for an upcoming publication. If you do NOT wish your name and PPN to be included in this published list (or to make sure that you ARE included in this listing), please contact SYSOP*Ron Luks 76703,254 and express your desires. ______________________________________ Atari News Update ______________________________________ ATARI TO UNVEIL UNIX-LIKE SYSTEM Look for Atari Corp. to use the stage of next month's Hanover Computer Fair in West Germany for the coming-out party of its new low-cost Unix-like, 68030-based workstations. Computergram International newsletter reports that the workstation is based on Whitesmiths' Idris system which Atari licensed last year. In addition, the newsletter reports it hears that Atari also will introduce a desktop publishing system for under $5,000, -getting close to the price of a good laser printer alone.- The publication says the system will be composed of the Mega computer, the SLM804 laser printer and Atari Deskset software. -The software is claimed to put true WYSIWYG (what you see is what you get) on the screen,- CI says, -and page formatting will be handled inside the computer rather than on the printer, 1 meg of memory being dedicated to laser printer commands.- Computergram International is a regular feature of NewsNet. ______________________________________ Xx LEARNING TO PROGRAM IN ATARI BASIC ...Part 8 of a continuing series... ______________________________________ ------------------------------------ COUNTERS: ------------------------------------ Often, we wish to keep track of how many times we have gone through a loop. We may want to do something every other trip through, or count when to end, or keep track of how many times we've done a thing. This is done with COUNTERS, which are +1 or adding statements placed within the body of the loop. These let the computer do the counting, freeing us from this chore, which is the whole idea behind using and programming computers. These often look like: 10 X = X + 1 70 TOTAL = TOTAL - 5 25 COUNT = COUNT + 1 Note the way these are coded. Counters say, -a variable equals itself plus something-. The variable name appears on each side of the equal sign, with the -plus something- on the right. Remember a LET statement takes what's on the right of the equal sign, and assigns it to what's on the left of the equal sign. It's a little hard to think so elementary at first, X = X + 1, but becomes second nature soon. I'm serious, they're hard to catch on to coding. ------------------------------------ SUMMERS: ------------------------------------ SUMMER is not a proper programming term, but that's what I call these. Summer's are utilities much like counters, but rather than counting, they total or add together or accumulate a running sum total number. For example, a summer in a payroll program keeps track of how much we have earned to date in the year. These are coded much like counters, but often have a variable for a -plus something- on the right hand side. Some examples: 15 TOTHOURS = TOTHOURS + HOURS 10 YTDSAL = YTDSAL + WEEKSAL 55 SUM = SUM + (14.7*TAX-INTEREST) 10 TOTAL = TOTAL + ADDON If counters usually tell us -how many- a thing is now, then summers keep track of -how much- we have now. Trust me! This will make sense someday. Sometimes when a program you are writing is acting up, and you can't figure it out, you can install some counters and/or summers in the code, and RUN it. Break in with the BREAK key, and ask it to print the value of a counter or summer in immediate mode at the READY prompt, like -? SUMM- or -? TOTAL- or -? COUNT-. It may be helpful to see if it's looped more or less times than you had thought, or perhaps you find it got stuck after a set number of loops. When the program's debugged, take out the lines. ------------------------------------ Putting It All Together ------------------------------------ Let's write a program that puts this all together, that you can continue to work on and develop, and learn on. Let's imagine you are a teacher, who needs to average student grades for the entire semester, and assign a letter grade. If doing this by hand, we would add all of a student's grades, divide by the number of grades, and find a numerical average. This would then be compared to a range of numerical grades and letter grades. We must count the number of grades each student has, to find the correct number to divide by. This if often confusing when students have a different number of grades in a class, and could lead to an error. Let's write a program that calculates these grades on our Atari computer in BASIC. When calculating the average, it must keep track of how many grades we enter for each student, automatically choosing the correct divisor. The program should prompt you for correct input, and error check it for correctness. It should stop taking grades and display the average when we type in a grade of 999 to signal the end of input. We may add to this program at some point, so we'll start numbering it at 1000. Leaves lots of room -below.- 1000 REM ** EZ-GRADE ** 1010 REM JACKSON B 6/87 1020 REM 1030 REM CLEAR,INITIALIZE,PROMPT,IN 1040 ? CHR$(125):TOTAL = 0:COUNT = 0 1050 ? :? :? -Enter grade -; 1060 INPUT GRADE 1070 REM 1080 REM TEST,INCREMENT,SUM,LOOP 1090 IF GRADE = 999 THEN 1160 1100 IF GRADE <0 OR GRADE > 100 THEN GOTO 1050 1110 TOTAL = TOTAL + GRADE 1120 COUNT = COUNT + 1 1130 GOTO 1050 1140 REM 1150 REM AVERAGE AND OUTPUT 1160 AVG = TOTAL / COUNT 1170 ? :? -The AVERAGE for these -; COUNT;- grades is -;AVG 1180 ? :? -(Press 9 to enter more grades) -; 1190 INPUT M 1200 IF M = 9 THEN 1040 1210 END This program uses a counter (COUNT) to keep track of the number of grades entered, and a summer (TOTAL) to keep a running total. Entering a 9 after an average, will continue the program. Any other key will end the program. Note that the counter and summer are initialized (set to zero) OUTSIDE the main loop. ------------------------------------ Sample Problems: ------------------------------------ PROBLEM 4 Add lines to EZ-GRADE to determine a letter grade A, B, C, etc, in additional to a numerical average. (HINT - add a pile of IF-THEN's after line 1170 that test whether input is between 70 and 79, 80 and 89 etc, and assign a letter to a variable. Use a one character string variable to hold the letter grade, that is dimensioned outside the loop (line 1135.) ------------------------------------ PROBLEM 4A Modify EZ-GRADE so that instead of typing in 999 to signal the end of data, you simply press RETURN without having entered a grade (a NULL entry.) Have it prompt whether you really want to stop entering data before it calculates the average and letter grade. (HINT - you need a string variable to bring in a plain carriage return. The VAL function will translate your string input into a number.) The way you test for an empty carriage return (RETURN) is to test the input for equality with two sets of quotation marks back-to-back with nothing between them as: 195 IF NAME$ = -- THEN 255 This tests True for a null input, and goes to line 255. You MUST hit the RETURN key to pass an INPUT statement in BASIC. ------------------------------------ PROBLEM 4B Write a GUESS THE SECRET NUMBER program. Use the following line early in the program, which will generate a random number between 1 and 100, and assign it to the variable SNUM. Write your program to prompt the player for a number from 1 to 100, and give feedback if the guess is higher, lower, or equal to the secret number (a winner.) Write it to loop 10 times, then signal that the 10 guesses are up, and you lose! 35 SNUM = INT(RND(0)*100+1) ------------------------------------ PROBLEM 4C Write a program that asks you to guess the capitol of 5 states, and gives you a grade from 0 to 100 on your answers. ------------------------------------ This concludes Part 7 Lesson 4 of Learning to Program in Atari BASIC. Let's back up for one moment, and recall a rap we had in Lesson 1, in which I identified 3 tasks beginners face in learning to program. 1. Learning to operate the hardware. 2. Learning to program. 3. Learning the BASIC language. Once you learn most of the basic programming concepts and structures, you will never need to learn them over again, if you pursue other languages. For instance, you will not relearn the concepts of testing, branching and counters. You will simply ask -What's the syntax to...test, loop, branch, etc.- It is natural to be very confused right now. Do not quit because you are confused. That simply means your brain is making the correct thinking adjustments. It is natural to dream about programs and problems when working on new projects. Relax, it's not permanent, and some of your best ideas just pop into your head after days of muddled thoughts. ------------------------------------ Contact me at: Jackson Beebe Prairie Data Fields 807 W. Hill Street Urbana, IL 61801 ______________________________________ Modem Noise Killer ______________________________________ With this circuit diagram, some basic tools including a soldering iron, and four or five components from Radio Shack, you should be able to cut the noise/garbage that appears on your computer's screen. I started this project out of frustration at using a US Robotics 2400 baud modem and getting a fare amount of junk when connecting at that speed. Knowing that capacitors make good noise filters, I threw this together. This is very easy to build, however conditions may be different due to modem type, amount of line noise, old or new switching equipment (Bell's equipment), and on and on. So it may not work as well for you in every case. If it does work, or if you've managed to tweek it to your computer/ modem setup I'd like to hear from you. I'd also appreciate any of you electronic wizzards out there wanting to offer any improvements. Let's make this work for everyone! Please read this entire message and see if you understand it before you begin. OK, what you'll need from Radio Shack: 1 #279-374 Modular line cord if you don't already have one. You won't need one if your phone has a modular plug in its base $4.95 1 #279-420 Modular surface mount jack (4 or 6 conductor) $4.49 1 #271-1720 Potentiometer. This is a 5k audio taper variable resistor. $1.09 1 #272-1055 Capacitor. Any non- polarized 1.0 to 1.5 uf cap should do. Paper, Mylar, or metal film caps should be used, although #272-996 may work as well. (272-996 is a non-polarized electrolytic cap) $.79 1 100 ohm resistor - quarter or half watt. $.19 1 #279-357 Y-type or duplex modular connector. Don't buy this until you've read the section on connecting the Noise Killer below. (A, B,or C) $4.95 First off, open the modular block. You normally just pry them open with a screwdriver. Inside you'll find up to 6 wires. Very carefully cut out all but the green and red wires. The ones you'll be removing should be black, yellow, white, and blue. These wires won't be needed and may be in the way. So cut them as close to where they enter the plug as possible. The other end of these wires have a spade lug connector that is screwed into the plastic. Unscrew and remove that end of the wires as well. Now, you should have two wires left. Green and red. Solder one end of the capacitor to the green wire. Solder the other end of the capacitor to the center lug of the potentiometer (there are three lugs on this critter). Solder one end of the resistor to the red wire. You may want to shorten the leads of the resistor first. Solder the other end of the resistor to either one of the remaining outside lugs of the potentiometer. Doesn't matter which. Now to wrap it up, make a hole in the lid of the mod block to stick the shaft of the potentiometer through. Don't make this hole dead center as the other parts may not fit into the body of the mod block if you do. See how things will fit in order to find where the hole will go. Well, now that you've got it built you'll need to test it. First twist the shaft on the potentiometer until it stops. You won't know which way to turn it until later. It doesn't matter which way now. You also need to determine where to plug the Noise Killer onto the telephone line. It can be done by one of several ways: A. If your modem has two modular plugs in back, connect the Noise Killer into one of them using a line cord. (a line cord is a straight cord that connects a phone to the wall outlet. Usually silver in color) B. If your phone is modular, you can unplug the cord from the back of it after you're on-line and plug the cord into the Noise Killer. C. You may have to buy a Y-type modular adaptor. Plug the adaptor into a wall outlet, plug the modem into one side and the Noise Killer into the other. Call a BBS that has known noise problems. After you've connected and garbage begins to appear, plug the Noise Killer into the phone line as described above. If you have turned the shaft on the potentiometer the wrong way you'll find out now. You may get a lot of garbage or even disconnected. If this happens, turn the shaft the other way until it stops and try again. If you don't notice much difference when you plug the Noise Killer in, that may be a good sign. Type in a few commands and look for garbage characters on the screen. If there still is, turn the shaft slowly until most of it is gone. If nothing seems to happen at all, turn the shaft slowly from one side to the other. You should get plenty of garbage or disconnected at some point. If you don't, reread this message to make sure you've connected it right. ______________________________________ Final Word ______________________________________ This issue was intended to be a bit longer than it is, But due to the rush of current events, I removed a few scheduled items till next week. We are also in a development stage with a few projects. If you want to get involved with them and are a ZMag BBS carrier, give us a call on the BBS and join the discussion! Happy Leap Year! ______________________________________ Syndicate ZMagazine February 29, 1988 Issue #95. (c)1988 SPC/Ron Kovacs ______________________________________