Machine Language Entry Program For Atari And Commodore 64
Charles Brannon Program Editor
Even the best typists have problems entering machine languare programs as BASIC loaders. Here's the solution.
Have you ever typed in a long machine language program? Chances are you typed in hundreds of DATA statements, numbers, and commas. You're never sure if you've typed them in right. So you go back, proofread, try to run the program, crash, go back and proofread again, correct a few typing errors, run again, crash, recheck your typing — frustrating, isn't it?
Until now, though, that has been the best way to enter machine language into your computer. Unless you happen to own an assembler and are willing to wrangle with machine language on the assembly level, it is much easier to enter a BASIC program that reads the DATA statements and POKEs the numbers into memory.
Some of these BASIC loaders, as they are known, use a checksum to see if you've typed the numbers correctly. The simplest checksum is just the sum of all the numbers in the DATA statements. If you make an error, your checksum will not match up. Some programmers make the task easier by calculating checksums every ten lines or so, and you can thereby locate your errors more easily.
"MLX" lets you type in long machine language (ML) listings with almost foolproof results. Using MLX, you enter the numbers from a special list that looks similar to BASIC DATA statements.
MLX checks your typing on a line-by-line basis. It won't let you enter illegal characters when you should be typing numbers, such as a lowercase L for a 1 or an O for a 0. It won't let you enter numbers greater than 255, which are not permitted in ML DATA statements. It will prevent you from entering the wrong numbers on the wrong line. In short, MLX should make proofreading obsolete!
In addition, MLX will generate a ready-to-use tape or disk file. For the 64, you can then use the LOAD command to read the program into the computer, just as you would with any program. Specifically, you enter:
LOAD "program" ,l,l (for tape) or LOAD "program",8,l (for disk)
To start the program you need to enter a SYS command that transfers control from BASIC to machine language. The starting SYS will always be given in the article accompanying the machine language program.
For the Atari, MLX will generate a ready-to-use boot tape or boot disk. It also has an option to create binary files for DOS users. A boot disk is like the disks sold with professional games on them. You just insert the disk, remove any cartridges, and turn on your computer. The game will then automatically load.
Using a boot tape is almost as simple. Just insert it into your player, rewind, press PLAY. Hold down the START key while turning on your computer until you hear a beep (like the one you hear with CLOAD). Then press a key on the keyboard and the program will automatically load and run.
Incidentally, the binary file is more useful for utilities than games. Binary files are loaded from the DOS menu (selection L) or automatically if the file is named "AUTORUN.SYS". If you can't stand the thought of putting only one game on each disk (as with boot disks), you can place several binary file machine language games on one disk.
To get started, type in and save MLX (you'll need it for future ML programs published in COMPUTE!). When you're ready to type in the ML program, the program will ask you for several numbers: the starting address and the ending address. In addition, the Atari MLX will request a "Run/Init Address". These vital numbers can be found in the appropriate article accompanying the ML program.
The Atari version will then ask you to press either T for a boot tape, or D for disk. If you press D, you'll be asked if you want to generate a boot disk (press D) or a binary file (press F).
Next you'll see a prompt. The prompt is the current line you are entering from the listing. Each line is six numbers plus a checksum. If you enter any of the six numbers wrong, or enter the checksum wrong, MLX will ring a buzzer and prompt you to reenter the line. If you enter it correctly, a pleasant bell tone will sound and you proceed to the next line.
A Special Editor
You are not using the normal Atari or Commodore 64 screen editor with MLX. For example, it will accept only numbers as input. If you need to make a correction, press <DEL/BACKS> (Atari) or <INST/DEL> (64). The entire number is deleted. You can press it as many times as necessary back to the start of the line. If you enter three-digit numbers as listed, the computer will automatically print the comma and prepare to accept the next number. If you enter less than three digits (by omitting leading zeros), you can press either the comma, space bar, or RETURN key to advance to the next number. When you get to the checksum value, the Atari MLX will emit a low drone to remind you to be careful. The checksum will automatically appear in inverse video; don't worry, it's highlighted for emphasis.
When testing MLX, we've found that it makes entering long listings extremely easy. With the audio cues provided, you don't even have to look at the screen if you're a touch-typist. We have tested MLX with people lacking any computer background whatsoever. No one has ever managed to enter a listing wrong with it.
Done At Last!
When you finish typing (assuming you type the entire listing in one session) you can then save the completed program on tape or disk. Follow the screen instructions. With a boot disk, the Atari version will offer to format the disk. If you press Y (yes), be sure you have a blank disk in drive one — not your program disk! If you get any errors while saving, you probably have a bad disk, or the disk is full, or you made a typo when entering the actual MLX program. (Remember, it can't check itself!)
What if you don't want to enter the whole program in one sitting? MLX lets you enter as much as you want, save that portion, and then reload the file from tape or disk when you want to continue. MLX recognizes these few commands:
S: SAVE L: LOAD N: New Address D: Display
For the Atari, hold down the CTRL key while you type the appropriate key. Hold down SHIFT on the 64 to enter a command key. You will jump out of the line you've been typing, so it's best to perform these commands at a new prompt. Use the SAVE command to save what you've been working on. It will write the tape or disk file as if you've finished, but the tape or disk won't work, of course, until you finish the typing. Remember what address you stop on. The next time you run MLX, answer all the prompts as you did before, then insert the disk or tape. When you get to the entry prompt, press CTRL-L (Atari) or SHIFT-L (64) to reload the file into memory. You'll then use the New Address command to resume typing.
New Address And Display
Here's how the New Address command, works. After you press SHIFT-N or CTRL-N, enter the address where you previously stopped. The prompt will change, and you can then continue typing. Always enter a New Address that matches up with one of the line numbers in the special listing, or else the checksum won't match up.
You can use the Display command to display a section of your typing. After you press CTRL-D or SHIFT-D, enter two addresses within the line number range of the listing. You can abort the listing by pressing any key.
The special commands may seem a little confusing at first, but as you work with MLX, they will become easy and valuable. What if you forgot where you stopped typing, for instance? Use the Display command to scan memory from the beginning to the end of the program. When you see a bunch of 170s (64) or zeros (Atari), stop the listing by pressing a key and continue typing where the 170s (or zeros) start. Some programs contain many sections of these zeros or 170s. To avoid typing them, you can use the New Address command to skip over these blocks. Be careful, though; you don't want to skip over anything you should type.
You can use the MLX SAVE and LOAD commands to make copies of the completed ML program. Use LOAD to reload the tape or disk, then insert a new tape or disk and use the SAVE command to make a new copy.
One quirk about tapes made with the 64 MLX SAVE command: When you load them, the message "FOUND program" may appear twice. The tape will load just fine, however.
We hope you will find MLX to be a true labor-saving utility. Since it has been thoroughly tested by entering actual programs, you can count on it as an aid for generating bug-free machine language. And be sure to save MLX; it will be used for future all-machine-language programs in COMPUTE!, COMPUTE!'s Gazette, and COMPUTE! Books.