[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The Second Book Of Machine Language on the Web



Kevin Savetz wrote:

>The team at AtariArchives.org is pleased to announce that the full text of
>the 
>best-selling book _The Second Book Of Machine Language_ by Richard Mansfield 
>is now online at
>
>    http://www.atariarchives.org/2bml/
>
>Published in 1984 by Compute! Books, this classic book is the sequel to 
>_Machine Language For Beginners_, another of Mansfield�s best-selling titles 
>which is also available on the Web site. The Second Book Of Machine Language 
>walks readers through the creation of LADS (Label Assembler Development 
>System,) a sophisticated assembler written in machine language. It includes 
>examples and program code for Atari, Apple 2, PET/CBM, VIC-20, and Commodore 
>64 computers.
>
>This is the 17th classic computing book to be made available at 
>AtariArchives.org. Like all books at the site, it is available with the 
>gracious permission of the author. 

I think that this project to make useful books available on the web
is a valuable one, and I commend those responsible.

However, with regard to this particular book, I have my doubts.
As nostalgia, it is a great contribution for all those who once
read it and find it familar--but it can hardly be considered
the work of a good assembly language coder.

I have often said that the best way to learn to write code in a
language is to read great code written by great coders.  This
book does not present great code.  It might be defended as
an introduction to coding, but it is then a _second_ introduction
by the same author.

The LADS assembler which is the focus of the exposition is
hardly an "advanced" assembler (which would have macros
and, at least, the ability to handle address expressions
more complex than "label+constant").

Not only are the assembler's specifications elementary, its
construction and algorithms are elementary.  For example,
using sequential search for the mnemonic table is a poor
choice, given the relative ease of, say, binary searching
in an ordered table.

The choice of a sequential table of labels is, perhaps,
intuitive to an inexperienced coder, but experience soon
leads to the realization that a partially-ordered tree structured
table is _much_ more efficient.  Add to this the fact that
the author chooses to insert all labels into the table without
searching first, so duplicates can only be detected by doing
a _full_ search of the sequential table on _each use_, and
you see a totally naive design realized totally naively.

And the way of thinking about performance issues presented
is also backwards, choosing to focus on coding details before
reconsidering algorithms.  And then choosing code optimizations
without any consideration of measurement to locate the "hot"
regions of code.  (For example, sampling the PC on timer
interrupts will _instantly_ reveal the location of any region
of code which is consuming a disproportionate amount of
execution time.)

All things considered, this book could be useful to a relatively
inexperienced machine language coder who wanted a better
familiarity with what an assmbler does and how it does it.
But this familiarity would be obtained along with some
fundamental misunderstandings about how to design a
a good program and implement it both wisely and cleverly.

A minor but annoying factor throughout the text is the use
of decimal representations of bytes, where hexadecimal
would be more familiar (to anyone looking at memory)
and clearer, since the patterns of binary values are
manifest in hex representation.

Many years ago, an instructor mentioned in passing that "the
problem with most assemblers is that they were written by
someone who is writing their first assembler."  This observation
is confirmed by this book (as well as by much experience).

(BTW, the irony of reviewing a book almost two decades
after its publication is not lost on me.  Such a thing would
never had occurred to me if not for its "republication".  ;-)
-michael

Check out amazing quality 8-bit Apple sound on my
Home page:  http://members.aol.com/MJMahon/