MATH WIZARD
SYNOPSIS
This program presents a basic arithmetic drill in a colorful, arcade-style format. It requires 16k RAM (24k for disk), BASIC, and a joystick, and runs on all Atari computers.
Math Wizard allows you or your children to practice addition, subtraction, and multiplication problems at different skill levels.
HOW TO ENTER THE PROGRAM
Lines 20 through 80 contain two machine-language routines in the form of strings. Refer to the Listing Conventions table in this issue (see the Table of Contents) to help you type in this section. The seventeenth character in line 40 (which is also present in line 60) is an inverse-underline character. To produce it, press the inverse-video key, hold down [SHIFT], and press the minus [-] key. Check your typing with TYPO, and don't run the program until it checks out, or it may lock up the computer.
HOW TO USE MATH WIZARD
RUN the program. Math Wizard's first display consists of a menu of game options. Plug a joystick into Port 1. Move the stick up and down to position the flashing cursor and select different options. Pushing the stick to the left or right changes the value of the selected option. If you hold the joystick steadily in either of these positions, the change of values will gradually accelerate to make a wide range of values easily accessible. Options include:
¥ Minimum starting number -- The smallest value (MIN) to be used in the math problems.
¥ Maximum starting number -- The largest value (MAX) to be used in the problems. This value must exceed the minimum starting number by at least five.
¥ % Correct to Advance -- Each round consists of six problems. To proceed to the next round, in which both MIN and MAX increase, your score must match or beat this value.
¥ Difficulty Increment -- The number by which MAX will increase after each round.
¥ Rounds per Game.
¥ Problem Type.
The high score, most recent score, and problem type for the high-score game are displayed near the top ofthe menu screen.
HOW TO PLAY
Press the fire button to begin the game. The number of the current round, the problem number, and your percentage of correct answers appear at the far right. At the top of the screen the current problem type appears; below that is an answer box. As the round begins, six problems scroll toward the bottom of the screen, where you're stationed with a number blaster (the flashing cursor). Position the cursor under the problem whose answer corresponds to the one displayed in the answer box above. Press the fire button to select the problem. If more than one problem has the indicated solution, choose the one that is nearest to the cursor. This will save time, and earn you more bonus points at the end of the round.
If you're correct, you'll blast the problem back to the top of the screen and the correct answer will appear underneath it. Then the next answer will be displayed and the scrolling will continue. If you're wrong, the scrolling continues, but nothing else happens.
Should any of the round's problems reach the bottom of the screen unanswered, each will scroll back up to the top, and its correct answer will be displayed. If your percentage of correct answers is below the minimum, you have to play another round with the same values of MIN and MAX. If your percentage is high enough, you receive a bonus score based on your speed. Your score is based on your number of correct answers, plus bonuses. Any incorrect answer's value is deducted from your final score.
MACHINE-LANGUAGE ROUTINES
Math Wizard uses two machine-language routines, which are found in the strings GTX$ and CX$ in lines 20 through 80. GTX$, called GRAFTEXT, lets you add text to a graphics screen. CX$ is a MODE 8 multicolor routine. It fills a Graphics 8 screen very rapidly with a specific byte or with random values.
Line 90 contains an example of a calling format for GRAFTEXT. If you add the statement GX=ADR(GTX$), you can us GX as the first parameter: A=USR(GX,ADR(B$),LEN(B$),X,Y). This puts string B$ on the screen at coordinates X,Y in Graphics Modes 4,6, and 8. If you use the form A=USR(GX,ADR(B$),LEN(B$),X),it puts B$ on the screen at X; the Y position is taken from the cursor's current position (set by the most recent PLOT, DRAWTO, or LOCATE command). The form A=USR(GX,ADR("TEXT"),4)displays 'TEXT' at the current cursor location. The callA=USR(GX,ADR("X")) displays 'X' at the current position. If you o,it the length parameter, the default value is one.
An example of an invalid call to GRAFTEXT is A=USR(GX). This would cause the buzzer to sound, and return control to BASIC. IF a USR call contains too many parameters, GRAFTEXT uses what it needs, cleans up the stack and provides a safe return to BASIC.
For the best results with the Mode 8 multicolor routine, first call Graphics 8 and set the background to black as follows: GRAPHICS 8+16:POKE 710,0. The statement A=USR(ADR(CX$),165) fills the screen memory with the byte value165. Permissible values range from zero to 255. Different values cause varying degrees of artifacting, which result in a number of multicolor combinations. To fill the screen with random values, omit the second parameter:A=USR(ADR(CX$)). This creates an interesting display, but is of limited usefulness. This routine can also be used in GTIA Modes 9,10, and 11. It modifies 7680 bytes of memory, so it shouldn't be used with graphics modes that require less RAM.
Mathew Ratcliff is an electrical engineer and microcomputer enthusiast. He owns a customized Atari 400 with 48K, and has been programming in BASIC for six years.
Listing: MATHWIZ.BAS Download