May June 1980 - Commodore Computers
May June 1980 - Commodore Computers
May June 1980 - Commodore Computers
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
MAY/JUNE. <strong>1980</strong>. 198O. ISSUE 4. 4 COMPUTE. 57<br />
Machine Language<br />
Tools<br />
TOOlS Jim m Butterfield<br />
The newcomer to machine language programming<br />
will need to LO provide himself with certain toolss before<br />
he gets started.<br />
It's important to ro have the right computer. The<br />
original ROM which came with early PETs can be<br />
used with machine e language, but it's clumsy for this<br />
kind of use. If you haven't done so already, make the<br />
switch to upgrade ROM: you'll u ' get a built-in<br />
Machine Language MoniLOr Monitor and the capability to dig<br />
your way out of a program crash.<br />
Get the official reference: 6502 Programming<br />
Manual. It may be obtained from <strong>Commodore</strong><br />
(MOS Technology), Synertek or Rockwell, who are<br />
the three manufacturers urers of 6502 microprocessors. It's<br />
not a teaching leaching book, but a reference - although<br />
many of the earlyy chapters are sett out in tutorial<br />
style.<br />
If you see other books that seem to suit your<br />
needs, you may buy them, of course. Avoid books that<br />
deal with "somebody else's" machine - you won't<br />
learn much about the PET from books on KIM, , SYM, ,<br />
Apple, OSI, AIM or Atari. At a later stage, you<br />
might like to buy y such books in order to try your<br />
hand att converting the programs LO to PET - or just<br />
to get an idea as to what's in other machines.<br />
General books on the 6502 arc are good. Remember<br />
that you'll have to fit what these books say intoo<br />
the framework of thee PET architecture. Leventhal's<br />
6502 Assembly Language Programming (Osbornel<br />
(Osborne/<br />
McGraw Hill, , Inc.) is full of programming examples;<br />
but they will all need to be trimmed up LO to fit the<br />
PET. Don't let that worry youu - it's not hard, , and<br />
it's good practice.<br />
You have very little need for hardware unless<br />
you have a special project in mind. If your machine<br />
has upgrade ROM, , try building or buying g an uncrashing<br />
connector (see COMPUTE, P issue 1, page 89).<br />
Your early y programs will certainly "crash" and<br />
you'll save a lot of reloading or retyping if you<br />
un-<br />
can re-awaken your machine. Most non-PET<br />
machines have a Reset button butron that will do the same<br />
job, which is very convenient except when you hit<br />
it accidentally.<br />
The Machine Language Monitor is very vcry useful.<br />
It's built into upgrade ROMs. Original ROM<br />
machines cann load a MLM [\1 from tape, but t thiss is<br />
much less convenient especially y since it uses up<br />
memory space that you u might want for your own<br />
purposes. You may enhance the e usefulness of your<br />
MLM by obtainingg more elaborate versions. Many<br />
of these are availablee from the PET Programs Onn<br />
Tape Exchange (P.O. Box 516, , Montgomeryv Montgomcryville, PA<br />
18936). (Edilor (Editor's Note: Nole: Sec See Table of COl/leI/Is. Contents. RCL) R If you're stayingg with original ROM, , you<br />
might like Bill Seiler's Seller's NEWMON which has many<br />
extra functions including a tinyy assembler. Another<br />
useful package is Jim Russo's high monitor with<br />
machine language single-step; this is sometimes<br />
called MT6671 and sometimes DISS/STEP. STEP.<br />
The upgrade ROM monitor is built in, , but<br />
there are a couple of enhancement packages that add<br />
extra functions: SUPERMON and EXTRAMON.<br />
Both of these contain powerful l extras: disassembler,<br />
tiny y assembler, memory hunt, , and single-stepping.<br />
If you get deeply into machine language programming,<br />
you'll ' want to obtain a full assembler. These<br />
are available able from commercial sources. Don't get<br />
an assembler right away, especially if you're<br />
thinking of adding memory or a disk system. . Your<br />
beginning programs will be quite small, , and easy to<br />
hand assemble; what's more, you'll get a better<br />
feel for how the machine works by doing it all<br />
yourself. Later, as your programs stan start to exceed<br />
thirty lines of code or so, you'll find that an<br />
assembler will be a big help. . This is especially<br />
true when youu want to make changes to [Q a previously<br />
written program. Since few of us write<br />
perfect programs every time, the capability of oi making<br />
changes easilyy is a major advantage that assemblers<br />
give you.<br />
.<br />
The most important tool you need for machine-<br />
language programming ming is one you've already got: your<br />
brain. Remember that each machine language instruction<br />
is simple and logical; a program gets complex<br />
onlyy when youu put many instructions together. Be<br />
prepared to change your style when you go to<br />
machinee language; a lot t off thinking and planning<br />
should take place before you write your first line of<br />
code.<br />
If bits and logical operations are not familiar to<br />
you. u, you'll need to do some advance brushing g up.<br />
Learn why you u can n store values lucs only y from 0 to 255<br />
in a memory location; how w a negative number is<br />
represented reprcsen in binary; how to relate binary, hexadecilTla<br />
mall and decimal numbers; and how the logical functions<br />
(AND,, OR, R , and EOR) work. There are rc plenty y of<br />
introductory texts ts around to help. 0©