A PROGRAMMERS AID FOR ATARI 800 COMPUTERS
ATARI is a trademark of ATARI, INC.
© Copyright 1981 Eastern House Software
3239 Linda Drive, Winston-Salem, N.C. 27106 USA
It is important to note that the Monkey Wrench is a program development aid. It is intended to be used with ATARI BASIC. It contains very complex software. For this reason, it should be removed from the computer when running programs or games. Running a program with it installed could cause the computer to function improperly. (This is mainly true when the BASIC program does certain POKEs into memory.) Thus, do so at your own risk.
In ATARI BASIC, it is possible for a line to be longer than three physical lines after it has been entered. This is a poor programming practice which will cause problems at some future time. Due to the nature of the Monkey Wrench, it will truncate all BASIC lines longer than 120 characters in length (approximately three physical lines). Thus always ensure all BASIC lines are less than 120 characters.
>A (line number) (increment value)The >A command provides automatic line numbering for entering your BASIC program. The first parameter entered is the starting line number. The second parameter is the increment value used to determine the value of the next line number. If the increment value is not entered, the increment value defaults to 10. Now whenever you enter your BASIC line statements and depress RETURN, the next line number will automatically be displayed on the next line of the screen. This feature allows for full screen editing and still maintains the auto numbering mode.
>A 10 10 * Start automatic 10 REM The old dog has flees!! * line numbering 20 REM But he doesn't care!! * at line 10 and 30 * increment by 10 >A 5000 1 * Start automatic 5000 GOTO 1000 * line numbering 5001 IF A=l23 THEN B=321 * at line 5000 and 5002 LET C=0 * increment by 1 5003
>EWhen the Monkey Wrench is initialized at power--up, the cursor keys (up, down, left and right) are setup to allow their usage without holding down the CTRL key. This feature makes it much more easier to use the screen editing capabilities of the ATARI. To use the +, -, = and * characters, hold down the CTRL key. If you don't wish to use this feature, type in the >E command to exchange the characters to the normal mode. If at a later time you wish this feature restored, type >E again to exchange the keys.
>D (starting line number) (ending line number)The >D command deletes a range of BASIC line numbers. The first parameter specifies the starting line number to be deleted. The second parameter specifies the last line number to be deleted.
>D 0 50 * Delete lines 0 to 50 >D 100 200 * Delete lines 100 200 >D 32000 32500 * Delete lines 32000 to 32500
Due to a problem in ATARI BASIC, deleting lines may cause the computer to lockup. This problem can happen whether or not the Monkey Wrench is installed. Although it is not a serious problem and doesn't happen very often, it can happen. Therefore, be aware of this problem and always keep a current backup copy of the program.
>UTurn the upper case feature on or off. How many times have you went to depress the RETURN key only to depress the CAPS LOWR key instead. ATARI BASIC does not like lower case; therefore, this is a very annoying occurrence. The upper case feature will keep the computer in the upper case character set and disable the lower case character set.
># (decimal number)Convert a decimal number to hexadecimal number. When the RETURN key is depressed, the hexadecimal number will be displayed on the next line. The maximum decimal number is 65535.
># 255 00FF ># 10 000A ># 65535 FFFF
>$ (hexadecimal number)Convert a hexadecimal number to a decimal number. When the RETURN key is depressed, the decimal number will be displayed on the next line. The maximum hexadecimal number is FFFF.
>$ FF 255 >$ A 10 >$ FFFF 65535
>T (start hex address) (end hex address)One of the most handiest programs you can have for your computer is a MEMORY TEST program. It allows you to be sure that your RAM memory is functioning properly. This is particularly useful when you purchase additional memory modules. You only have a limited time period on your guarantee. How do you know that it is okay ? You really don't unless you test it. Also when one of your programs isn't working properly, is it because the problem is in the program or in RAM memory? With the memory test, you can find out.
>T 0700 7C20 * Test memory from hex 700 to hex 7C20. * For 32K, 40K, or 48K of memory. >T 0700 5C20 * Test memory from hex 700 to hex 5C20. * For 24K of memory. >T 0700 3C20 * Test memory from hex 700 to hex 3C20 * For 16K of memory. >T 0700 1C20 * Test memory from hex 700 to hex 1C20 * For 8K of memory.When the RETURN key is depressed, the screen will display TESTING. If any errors are found, they will be outputted as shown on the next page. At the end of the memory test, the screen will display TEST FINISHED and sound the buzzer. The memory test performs a lengthy but exhaustive test of RAM memory. Therefore, if you're testing a lot of memory, be prepared to wait!!! If you wish to terminate the test early, depress the SYSTEM RESET key.
ADDRESS DATA PATTERN DATA READ OF ERROR STORED BY TEST BY TEST ---------------------------------------------- xxxx yy zzExample Printout of Memory Errors
3D90 Fl F0 3D90 F3 F2 3D90 F5 F4 3D90 Fl F6To the beginning computerist, the printout of memory errors won't mean much. But it does indicate a problem in one of the memory modules. Remove one of the memory modules and test the RAM that is left. If the errors occur again, continue to swap memory modules until the errors no longer occur. At that time, the memory module not installed will be the bad one.
>T 7E00 8000 * For 32K, 40K, or 48K of memory >T 5E00 6000 * For 24K of memory >T 3E00 4000 * For 16K of memory >T 1E00 2000 * For 8K of memory
>R (start line number) (increment value)The >R command will renumber all BASIC lines in a BASIC program. It will renumber not only the line numbers but also all references to the line number by the following BASIC commands: COTO, GOSUB, IF THEN, ON GOTO, ON GOSUB, RESTORE, and TRAP.
>R 10 * Renumber program with the first new * lime number being 10. An increment * value of 10 will be assumed. The new * line numbers will look like 10, 20, * 30, 40, 50, etc. >R 1 1 * Renumber program with the first new * line number being 1 and an increment * value of 1. The new line numbers will * look like 1, 2, 3, 4, 5, 6, 7, etc. >R 32000 50 * Renumber program with the first new * line number being 32000 and an increment * value of 50. The new line numbers will * look like 32000, 32050, 32100, etc.Additional Facts About Using Renumber !!!
10 LET CAT=50 20 GOTO CAT* Be careful of the following BASIC format:
10 IF A=1 THEN 100 + AThe above format is OK. The 100 will be renumbered.
10 IF A=1 THEN A + 100In this format, the 100 will not be renumbered.
>F d string d (start line) (end line)The >F command will search through BASIC lines and find all occurrences of a string and print to screen. The d in the command format is a delimiter character. It is used to indicate the start and end of the string to be searched for in the program. The delimiter character can be any character entered on the keyboard. The same delimiter character used to indicate the start of the string MUST also be used to indicate the end of the string.
>F /ABCD/ 50 275 Find all occurrences of the string ABCD in lines 50 through 275. >F /TRAP 2000/ Find all occurrences of the string TRAP 2000 in all BASIC lines. >F /GO%%/ Find all occurrences of the string GO followed by two do not care' characters. Note that in this case, the find command will display all lines which contain GOTO commands as well as GOSUB commands and anything else that matches. >F ?TOTAL/NUM? Find all occurrences of the string TOTAL/NUN. Notice in previous examples a slash (/) was used as the delimiter. In this case however, It was necessary to use the slash character in the string to indicate a divide operation. Thus it was necessary to use a different delimiter. In this case, a question mark was used (however any other character could have been used as long as it doesn't appear as part of the string.Notes:
>X d search string d replace string d (start line) (end line)The >X command will search through BASIC lines and find all occurrences of a string and replace with another string. The xchange command works like the find command but in addition to finding the string it also replaces the string it found with a new string (replace string) as shown in the command format. All lines where a string is found and replaced will be displayed on the screen.
>X /START/FINISH/ 1000 2500 Search through BASIC lines 1000 to 2500 for all occurrences of the string START and replace it with the string FINISH. >X /GOTO 100/GOTO 500/ Search through all BASIC lines for all occurrences of the string GOTO 100 and replace it with the string GOTO 500. >X /SUM=%%/SUM=0/ Search through all BASIC lines for all occurrences of the string SUM= followed by two "do not care" characters and replace it with SUM=0. >X /GOSUB 5000// Search through all BASIC lines for all occurrences of the string COSUB 5000 and replace it with a null string. In this example the last two delimiters are next to each other indicating that there is no replace string. This feature in effect allows the user to delete any string from the BASIC line. >X /%// Try this example. It finds any character and deletes it. If this command is allowed to finish, it will delete every line from the computer.Notes:
>M (left margin) (right margin)The >M command makes it possible to easily change the screen margins, The first number in the parameter specifies the left margin; the second number in the parameter specifies the right margin, If the second parameter is not given, only the left margin will be changed.
>M 5 35 * Set margins to 5 and 35 >M 039 * Set margins to 0 and 39 >M 2 * Set left margin to 2The lowest left margin number is 0 and the highest right margin number is 39. Don't specify a left margin number greater than the right margin. If you do, use the SYSTEM RESET key to reset the margins.
>SEThe scroll enable command allows the user to scroll (list) BASIC lines to the screen by using the START and SELECT keys. The START key will scroll down BASIC lines; that is, to higher BASIC line numbers. The next higher BASIC line number will be displayed at the bottom of the screen with all other lines being moved up the screen. The SELECT key will scroll up BASIC lines; that is, to lower line numbers. The next lower line number will br displayed at the top of the screen.
>L (start line) (end line) >LP (start lime) (end line)The formatted list command list BASIC lines to the screen (and/or printer using >LP command). This command does the same thing as the normal list command. However, the >L command formats the line when multiple BASIC commands are in the same line. That is, whenever a BASIC line contains more then one command, the commands will be left justified on the screen or printer. In addition, the command also prints page numbers at the top of each page. This is very useful when sending listing to the printer via the >LP command. The following is an example of the printout.
110 GOSUB 2500 :GOSUB 3000 120 IF A=B THEN 10 :IF A<B THEN 20 :IF A>B THEN 30 130 X=100 :Y=2l0This formatted list allows easier viewing of a BASIC program when multiple commands per line are used. The Range of lines to be listed may be specified by entering the start and end line numbers. If no line numbers are entered, all lines will be listed. The >L and >LP commands can be aborted by depressing the space bar.
>V >VPThe >V command will display all BASIC variables and their current value. The >VP command will also send the variables to the printer. This includes variables used as constant8 and strings. In the case of arrays, only the array name will be displayed (the content of the array will not be displayed). Anytime a string or array name is displayed, the current DIM value(s) will also be displayed. If the string or array has not been dimensioned, a "U" will be displayed to indicate it is "un-dimensioned".
>V SUM =1234 A$ [16 ] =ABCDEF X$ [U ] XYZ( [18,20] *4In the above example, the the variable NUN and its current value is shown. The second line contains a string A$, the dimension  and the current contents of the string ABCDEF. String variables are always followed by a dollar sign $. The third line in the example is also a string variable. However, the string has not been dimensioned which is shown by the [U]. The forth line contains an array variable. As shown, the array variable name ends with a ( and the current dimensions follow. The last line contains an asterisk and the number of variables in the program.
>>xThe >>x command will display the drive where x is the disk drive number. disk directory of the disk
>>2 -- Display directory on disk drive number 2 >>4 -- Display directory on disk drive number 4 >> -- Display directory on disk drive number 1.As shown in this example, no drive number was entered. In this case, the drive number defaults to 1.
>CO (start line) (end line) (destination line)The >CO command copies BASIC lines from one area of the program to another. The range of lines to be copied is specified by the start line and end line parameters as shown in the command format. The destination line parameter specifies the first line number where the new lines will be stored. The destination line number will be incremented by 1 for each line copied. For example, if lines 10 thru 100 are to be copied to line 32000, the command would look like >CO 10 100 32000. After the return key is depressed, the lines being copied will be displayed on the screen. To abort the copy command before it has completed, depress the space bar. When the last line has been copied, the buzzer will sound.
>MO (start line) (end line) (destination line)The >MO command moves BASIC lines from one area of the program to another. The original lines are deleted. The range of lines to be moved is specified by the start line and end line parameters as shown in the command format. The destination line parameter specifies the first line number where the new lines will be stored. The destination line number will be incremented by 1 for each line moved. For example, if lines 10 thru 100 are to be moved to line 32000, the command would look like >M0 10 100 32000. After the return key is depressed, the lines being moved will be displayed on the screen. The original lines specified by start and end are deleted. To abort. the move command before it has completed, depress the space bar. When the last line has been moved, the buzzer will sound.
>*Enter the machine language monitor. The >* command exits the ATARI BASIC program and turns control of the 6502 microprocessor over to the monitor. See machine language monitor commands.
|.||COMMAND PROMPT||A period is used to indicate the MLM is ready for a command.|
|M XXXX YYYY||DISPLAY MEMORY||Display memory starting at hex address XXXX and ending at YYYY.|
M 6531 653F :6531 01 02 03 04 05 06 07 08 :6539 09 0A OB OC OD 0E OF 10Note -- If only start address is entered, 24 memory locations will be displayed.
Note -- For long memory displays, the control--i key can be use to stop and start the listing.
Note -- To abort a long listing, press the space bar.
|I XXXX YYYY||INTERROGATE MEMORY||Interrogate memory starting at hex address XXXX and ending at YYYY. The interrogate command works just like the .M command except it also displays the ATASCII equivalent of the memory contents. All cursor control codes are displayed with a question mark (?).|
|R||DISPLAY REGISTERS||Display 6502 registers.|
Example Printout --
* PC AR XR YR PR SP ; 7013 41 11 PA 03 FA PC = program counter; AR = accumulator; XR = X register; YR = Y register; PR = status register; SP = stack pointer
|:||ALTER MEMORY||Indicates that the following hex address and line of hex data will be used to alter memory. Cursur up and over to location and change bytes -- press RETURN.|
|;||ALTER 6502 REGISTERS||Used to modify 6502 registers. Cursor up and over to register and change bytes (S) -- press RETURN|
|G XXXX||GOTO||GOTO address specified by XXXX and execute program Program must contain a BRK instruction to return to MLM. If XXXX is not given, the GOTO address defaults to the program counter.|
|X||EXIT||Exit the monitor and return to BASIC.|
|S XXXX YYYY||SAVE MEMORY TO CASSETTE||Save memory starting at hex address XXXX to ending address YYYY.|
Note -- The end address must be.the actual address+1
|L XXXX||LOAD MEMORY FROM CASSETTE||Load memory from cassette and store starting at hex address XXXX. At the end of the load, the screen will display END ADDRESS -- followed by the hex address of the end of the program. Binary data saved using the S XXXX YYYY command can be loaded into memory at any location (as defined by L XXXX).|
|?||ERROR||A question mark will be printed if a bad command or bad hex data is entered. It will also be given if any command tries to alter a ROM or non-existent memory location.|
|H XXXX YYYY 'ZZZZZ||HUNT FOR ASCII STRING||Hunt memory from XXXX to YYYY for the ASCII string ZZZZZ.|
Note -- The ASCII string can be up to 20 characters long.
Note -- If a match of the ASCII string is found, the hex address will be listed to the screen. If no match is found, only the command prompt (.) will be displayed.
|H XXXX YYYY ZZ ZZ ZZ ZZ||HUNT FOR HEX CHARACTERS|| Hunt memory from XXXX to YYYY for the hex characters ZZ ZZ ZZ ZZ.|
Note -- The hex characters can be up to 20 hex bytes long.
Note -- If a match of the hex characters is found, the hex address will be listed to the screen. If no match is found, only the command prompt (.) will be displayed.
|B XXXX YYYY||CALCULATE BRANCH|| Calculate the branch value from address XXXX to YYYY.
Example -- |
|A||ATARI DOS||Exit the monitor and go directly to the DOS menu. If DOS isn't loaded, it will enter the MEMO PAD mode.|
|D XXXX||DISASSEMBLE MEMORY|| Disassemble memory starting at hex address XXXX.|
,A000 A5 CA -LDA $CA ,A002 D0 04 -BNE $A008 ,A004 A5 08 -LDA $08 ,A006 D0 45 -BNE $A04D etcNote -- When an unimplemented opcode is encountered, the mnemonic field will display 7??.
|,||ALTER DISASSEMBLE LISTING||A comma command is used to alter the hex code printed out by the disassemble command. After the listing has been stopped with space bar, simply cursor up and over and change hex code (up to 3 memory locations can be modified). When the RETURN key is pressed, the disassembly process will begin again.|
|The printer set command allows machine language monitor information set to the screen to be also sent to the printer. The printer set command remains activated until a printer clear command is given.|
>* * PC AR XR YR PR SP ; 8B29 27 PP 03 31 PP .L 0700 END ADDRESS = 1AF6 .S 0700 1AF6 .Note - Some commercial type software use special recording formats to prevent backups. Therefore, these types of programs cannot be backed-up with the above steps.