
    [32m   ***** Book Review - Abacus - Amiga Machine Language ******[0m

                          [32m      by S.W. Smith [0m


[32m   <> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <>
[0m

    [33m    Overview of the book

    This book is intended to give an introduction to the world of Assembler
    code to the uninitiated. Included are sections dedicated to using the
    different Assemblers which may be used in conjunction with the book,
    an in-depth usage guide to Intuition and details of several standard
    Amiga library files (exec.library etc.).

    [33m    Background

    As I have had very little exposure to the Assembler language other
    than trying to examine the contents of a C64's memory, I can give an
    assessment of an absolute beginner, as many of you would be.

    [33m    The Review

    [33m    Chapter 1 - Introduction (12 pages)
    This section goes into the advantages of machine language, (ASM,
    Assembler, machine code or whatever you wish to call it) memory types,
    the use of bits, bytes, words and longwords, the Amiga's component
    libraries, memory locations and other such jargon that is more than
    handy knowledge if embarking on the course laid out in this book.
    This is rather well set out with an introduction to the numbering
    systems (binary, decimal and hexadecimal) etc. explained in a simple
    format. Though I must admit that I am fully conversant with this part
    of Assembler already.

    [33m    Chapter 2 - The MC68000 processor (31 pages)
    This is where the 16/32 bit processor is explained, complete with
    registers, Stack pointer and Status Register, the point of which was
    totally beyond me even though it states that this plays an important
    role in Assembler programming.
    After this came the methods of addressing memory, which was a little
    confusing to begin with, but after a little re-reading and cross
    referencing from the next chapters became clear, as it needed too as
    this is probably the most common instruction in assembler being used
    to move and store data.
    The chapter continues with the operating modes - User and Supervisor,
    exceptions and interrupts ? I still don't know what the hell these do!
    There follows a very brief introduction to the 68000 instructions.
    This is not an in-depth exposure and the reader is given another book
    as a reference for further(!) reading on what I would have expected to
    be rather more fully documented in this book.
    A point to note here is that you have read 40+ pages of VERY dry
    reading and you have either not made any sense of this, or can't
    see any way to apply the knowledge you have gained. Do not worry
    about this, push on, things should make a little more sense when the
    coding sessions start in earnest. I had actually given up for a few
    months at this point as I had been totally lost. Persist and it does
    click after a while.

    [33m    Chapter 3 - Working with Assemblers (15 pages)
    This chapter is dedicated to explaining how to use the assembler
    packages -
    [32m       ASSEM
    [32m       AssemPro
    [32m       KUMA-SEKA
    none of which are supplied with the book.

    This, to me, was a total waste of the 15 pages dedicated to using
    Assemblers which should be supplied with documentation when they are
    purchased, and be of a much better standard than is supplied here!
    I can only assume that they have information that these packages have
    been heavily pirated!

    [33m    Chapter 4 - Our First Programs (20 pages)
    This is where the book gets DEADLY SERIOUS, with sample programs to
    add tables of figures, sort tables and convert from ASCII-decimal-hex.
    These are all on the simple side and easily mastered, nicely commented
    if a little light on content.
    It is assumed that you are using the AssemPro package, which caused me
    a few problems as I am using a copy of Devpac2 obtained from a magazine
    coverdisk (the most useful thing, by far, that I have from these).
    There are also hints supplied for using the other Assemblers mentioned
    above, but I found that some of the Assembler Instructions that are
    used, are not recognised by Devpac.
    The main culprit is the [32m blk.b [0m command used for reserving
    bytes for the program. However, after reading the Devpac guide in the
    magazine (written at 100mph by the authors of Populous), I noticed the
    command [32m ds.b [0m, which is the 'pseudo-op' (non-68000 code used
    by the assembler) which substituted quite nicely for the blk.b command.

    [33m    Chapter 5 - Hardware Registers (17 pages)
    This starts off poorly with instruction totally dedicated to using
    the preferred assemblers to display special keys. A small timing
    program is then supplied to use the hardware registers to obtain the
    time taken for a particular routine to complete. Other programs
    here are basically small modules which can be inserted into a program
    to - read a mouse or joystick, though the 6 pages used to show how to
    produce tones/noises was a little extravagant given the size of the
    sections for the rest of the programs in this section.
    The chapter finishes with a list of the hardware registers. To be fair
    to the author here, I should mention that these registers seem to
    dominated by the audio type of register, hence the 6 pages dedicated
    to these.
    And yes I am aware that many people do like to make pretty noises on
    the Amiga, but I would assume they would use a package dedicated to
    this purpose, rather than attempting the almost impossible task of
    making music from raw binary numbers.

    [33m    Chapter 6 - The Operating System (60 pages)
    This starts off with a very interesting review of some Commodore
    supplied load libraries, for instance did you know the difference in
    use of mathffp.library, mathieeedoubbas.library and mathstran.library?
    Well these are explained here, along with instructions of how to call
    functions from these libraries.
    For the uninitiated, this simply consists of finding the function that
    you wish to call up, move the library into a register and use an
    offset ('x' number of bytes from the start of the library) to allocate
    memory, open a window or any of several hundred functions laid out for
    easy use.
    This is a real eye opener as to the ease of use of the Amiga's
    operating system to code in assembler. The code to open a window, dump
    some text in and then close it are explained in simple terms, as this
    is the only way to describe them. It is so easy!
    Another word of caution is needed here, as the AssemPro assembler
    rears its ugly head again in the form of the instructions -
    [32m ILABEL Assempro:includes/Amiga.l
    [32m INIT_AMIGA
    [32m EXIT_AMIGA
    after much deliberation, I found that these instruction can be totally
    ignored. However, you must check each line of code with assembler as a
    mistake (which I had originally attributed to the lack of this dataset
    and/or macro) results in either nothing like you expect, or a trip to
    the GURU. This happens most often when incorrectly specifying a byte
    (move.b or dc.b) instead of a word or longword (move.w or move.l).
    After the initial visits to the GURU, this knowledge made finding the
    incorrect code much easier.
    Another instruction that does not work under Devpac is the [32m align
    instruction. This must be substituted with [32m even [0m command.
    The content of the remainder of this hefty section runs thru the code
    needed to use the keyboard for input, the screen for output, printer
    control, speech and disk operations and executing CLI commands.
    These I handled with few errors (OK, a lot), becoming more comfortable
    with how assembler is written the commands are easier to anticipate,
    which one tends to do when typing in code, be it BASIC or Assembler.

    One whinge here would be that the carriage return for several of the
    lines of code has been missed, making it harder to interpret when
    there is two lines of code on one line, leading to a few errors.
    Another is the fact that any tags/labels used are case-sensitive, so
    many of my first efforts at assembling these met with errors which
    were not easy to find. This is not documented in the book and the
    author has used mixed case, though this may be a limitation of the
    Devpac assembler, not a general consideration for the assemblers
    referenced in the book.

    [33m    Chapter 7 - Working with Intuition (67 pages)
    After this chapter, I had worked out that the author was more than
    impressed by the GUI/WIMP/Intuition side of the Amiga (and rightly so)
    but I did feel that he had lost the plot somewhat and had gone
    overboard in explaining every little facet of these operations, even
    to the extent of fully explaining two separate methods of using menus
    in a window.
    The contents of this chapter deal with creating screens, windows,
    menus, requestors, borders, images, gadgets etc. etc. etc.
    Another whinge here is that it is VERY hard to follow how to implement
    the code for the gadgets and images. There are no real instructions
    for where this code should live in the routine (this is progressively
    built upon by the different sections), should it be called in the main
    loop, or as a sub-section and if so when ? Fortunately there is a
    complete listing of all the code at the end of the section which is
    useful as a second source of code.
    However, try as I may, I could not get the code for the gadgets to
    work. I tried to follow the code and checked this word for word, but
    it was still a jumbled mess, though it did seem to perform its
    function, after I had worked out that it must be declared to the
    screen definitions (not mentioned in the book!).

    Another mystery was that the code at the end of the chapter contained
    some instructions that had not been discussed at all in the tutorial
    for the component parts. The meaning or function of the [32m roxl or
    [32mroxr[0m instructions that magically appear in the finished code.
    I have since checked the Mnemonics (the correct name for instructions)
    in Chapter 2 and have been thoroughly enlightened by the information
    that roxl is 'rotation left with transfer in X flag' and roxr is the
    equivalent for rotation right........RIGHT! Clear as mud...

    [33m    Chapter 8 - Advanced Programming (8 pages)
    Whooooooooooooooosh. What was that, it was this section going straight
    over my head. But seriously folks, this section explains how to swap
    between User State and Supervisor State, which coming from an MVS
    (IBM Mainframe Operating System) background I can understand, but I
    cannot fathom out why one would require this type of information.
    For those that wish, this explains that you can only access the
    Status registers in supervisor state or an Exception will take place,
    causing the system to crash.
    What is an Exception you say! Well they then proceed to explain the
    vectors needed to access the Exception routines.
    Sorry if this does not sound clear, but I am not one of the Nic
    Wilson's of this world (yes, I bow to this mans great contribution to
    the Australian Amiga scene) and I just cannot see what I would get out
    of this section.

    [33m    Appendix (11 pages)
    The first part of the Appendix is a complete listing of the offsets
    required to use the following load.libraries -

    [32m    clist.library
    [32m    console.library
    [32m    diskfont.library
    [32m    dos.library
    [32m    exec.library
    [32m    graphics.library
    [32m    icon.library
    [32m    intuition.library - covered comprehensively in the tutorials
    [32m    layers.library
    [32m    mathffp.library
    [32m    mathieeedoubbas.library
    [32m    mathtrans.library
    [32m    potgo.library
    [32m    timer.library
    [32m    translator.library

    The second part of the Appendix is an alphabetical listing of the
    68000's Mnemonics(instructions). Very useful, even if I did discover
    these after hunting thru Chapter 2 for the roxl/roxr mnemonics.

    [33m Overall impressions

    As a complete guide to learning to program in Assembler this book
    falls short of the mark. I feel that the author has explained what
    are his strengths, this being based around the use of Intuition.
    I would like to have seen more examples of using assembler to move
    text around a screen, define and move a sprite or manipulate the
    screen by changing the colors etc. as would be done is the simple
    blocky games of my youth.
    Having said this, I do believe that I can write simple programs in
    assembler and my next little task will be to use the offsets provided
    for diskfont.library to try and change the screen/window/requestor's
    yukky default font to the more normal WorkBench font. This I believe
    I can do with a little trial and error and surely this is the acid
    test of the worth of the book. I am now capable of approaching such
    a task, where before I was not.

    [33m  Summary

    Well worth the $44.95 spent.

    [33m  Miscellaneous notes. [0m

    A disk with all the programs on the book is available, I personally
    did not use this partly because of the additional $20ish and partly
    because I believe that one does not learn by copying files over.
    BUT a good companion disk to this is MISC_92 - An Amiga Coders Club
    Disk (ACC) which has many sample routines of medium-hard complexity
    AND some [32m very good [0m reference docs written by Mark Meany
    and Mike Cross. A VERY good buy for $2.50 from the MegaDisk library.

    [33m  Hints and Tips [0m

    When using the assemblers, it is a good idea not to try to write the
    code using their text editors. They tend to be clumsy or at the very
    least, not as flexible in their operation as some of the best text
    editors around. Once the code has been written via your own text
    editor, simply load the ASCII file into the assembler and away you go.

    For writing the source code for Windows, I found a 'Giftware' program
    called FastWINDOWS brilliant. This allows the budding programmer to
    format a window with a WYSIWYG (WhatYouSeeIsWhatYouGet) style.
    Once the program is loaded, just click on the gadgets representing the
    options you desire, select the SHOW option from the menu and see what
    you have created. If changes are desire, close the window and return
    to the program.
    Once the window has the correct look to it, use the SAVE option and
    an ASCII file is created for inclusion in your assembler program.
    I have not been able to find this in a Fish Disk, but I have supplied
    a copy of the program and documentation to Tim for possible inclusion
    on a Utilities Disk.

    All through the book offsets are gradually introduced which allow the
    user to use the different functions as you are introduced to them.
    I found that as I got more comfortable with using assembler, I was
    combining the sections and introducing my own code. This creates a
    problem as you must keep repeating the offsets, often making errors,
    not knowing what parameters are required. My solution to this was to
    write ALL of these into another file and use the [32m include [0m
    command to pull in this file. As well as being able to use this in
    all my source files, I had fully commented all the parameters to
    reduce the need to refer to the book.



 [32m  <> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <%> 34 <>
[0m


