Pl INTRODUC.DOC

From Atari Wiki
Jump to navigation Jump to search
                         --------------------------
                          VOLUME I,   CHAPTER N°1

                                INTRODUCTION
                            
                         --------------------------

  HELLO!       To start, as the title of this first chapter
  indicates, here is an explanation of how to use this digital manual
  and also a general introduction to programming in 68000
  assembler on ATARI ST.

  
                    *** HOW TO USE THIS MANUAL? ***
                    --------------------------------

-   This is a digital manual, meaning it is composed of texts
    on a magnetic medium: a floppy disk

-   The advantage of this method? A significant saving for
    the buyer, programs, and especially already written listings (thus
    saving time and no more typing mistakes or other errors...)

-   You can load the various texts, grouped by files, and
    read them with a word processor (for example FIRST WORD) or (if
    you do not own one) with any other utility loading texts
    in ASCII format (meaning a file containing text and
    can be listed from the DESKTOP as such):

        This is possible with the text editors from METACOMCO (select
    the file to read by going through the NENU+.PRG utility with
    the option 'CHOOSE *.*' then the option 'EDIT')

    This method also applies to DEVPAC 68000. (Metacomco and DEVPAC
    are assemblers, see below for more details).

  You can also use the options of the DESKTOP: double-click
  on the chosen text file then select 'PRINT' or 'VIEW'.

  Of course, you can also freely print all the files
  with your word processor once they are loaded...


-   This manual is formed by a series of texts classified by chapters
    (like in a book) to give a structure to the whole.

-   At the end of each file, an indication will give you the exact name
  of the next text to read: You should not encounter any problems.



                         *** STRUCTURE OF THE BOOK ***
                         ----------------------------
-   As you can see, the titles are centered, framed
    with stars, underlined and spaced in a way to aerate the text.

    The text itself will be grouped into paragraphs for better
    clarity.

-   Later, important words to remember will be
    written in capital letters. (examples: BYTE, REGISTER, etc...)

-   I will also use certain abbreviations: "i.e." for "that is to
    say" or "ex." for "example", "prg" for "program"...

-   Example programs will be present on the floppy disk.
    (you will be able to load them directly with your assembler without
    having to retype them!)

    The same goes for the executable programs from these
    listings and for corrections of exercises.
    

                       *** A DIDACTIC METHOD ***
                       ------------------------
-   Assembler is known for its difficulty, and it is true that pro-
    gramming in assembler requires much more effort than programming
    in BASIC or even in the C language...

-   Do not worry...! To make a comparison, one could
    say that programming in assembler is as difficult as learning
    to read or write, yet who among you does not know how to read AND write?!

-   Just like for learning to read, this book will place
    practice in the forefront and will be very abundant in various
    examples which are all detailed and personal exercises (with
    complete answers).

-   You will have to get rid of all preconceptions about assembler:

    Someone who cannot read will be discouraged in front of a text, which
    to them is just a slab of letters without any apparently logical
    alignment.

    The same must be of you in front of an assembler listing,
    so be patient...


-   You will first have to learn the alphabet (i.e. the useful
    definitions) then study examples, the grammar rules (hence the relationships
    that give consistency to your program) but also the exceptions
    (i.e. the specific cases in assembler).

    At the end of this book you will all be capable of READING a pro-
    gram in 68000 assembler and UNDERSTANDING it.
    
    In short, you will have acquired the basics of programming in ASS. 68000
    and you will be able to write your first programs.

-   At that point, you can finally dive into various books
    on 68000 assembler programming, most of which are intended for an informed
    audience, and you will see for yourself that your progression will only accelerate...

-   The aim of this book is therefore very ambitious: Its goal is to teach you an
    unfamiliar computer language.

    Facing the difficulty, I have tried to make the problems
    posed by programming in assembler very clear:

  ----------------------------------------------------------------------
*  This book was not written to dazzle or impress its readers
   with incomprehensible technical vocabulary, it is, on the contrary, an
   example of clarity.

*  Each important concept is explained in depth and illustrated by
   diverse and detailed examples.

*  The vocabulary used will be defined and the linearity of the book will bring
   the reader to a progressive, fast, and unambiguous result.

  ----------------------------------------------------------------------

-  Never forget this golden rule:

                  "QUALITY IS BETHER THAN QUANTITY!"

    This is especially true for programming in assembler, I advise you not to read too quickly, you will not be able to progress if
    you do not regularly assimilate the notions from the various chapters:

    Programming in assembler follows very strict rules.

    Re-reading will be essential and frequent, this is normal.

    Stop if you did not understand something and reread
    very slowly.



                          *** NECESSARY MATERIAL ***
                          -------------------------
1) Software:
   --------
-    A complete ASSEMBLER: EDITOR, ASSEMBLER, LINKER (terms explained
   later) will be essential if you want to create your own
   68000 assembler programs.

     Several are available at any good retailer, here are the most
     common.

* METACOMCO MC 68000:    .A good assembler, the editor is managed by the
  ------------------      keyboard: so it is very convivial and fast.

                         .The assembler is customizable and allows defining
                          MACRO-INSTRUCTIONS (sorts of functions
                          created by the programmer and able to simulate
                          a new instruction later on, I will detail later...)

                         .The accesses to the floppy drive are, in my
                          opinion, too frequent, which results in a loss of
                          speed, it's a pity.

* PROFIMAT           :   .We will use this assembler in the
  --------                examples, but the listings remain valid for other assemblers.

                         .The editor is very complete (helps, management with
                          the mouse through dropdown menus...)

                         .The assembler is customizable and generates an optimized
                          OBJECT CODE.
                          (patience for explanations...)

                         .Also allows creating MACROS.

                         .The editor, assembler, linker are available
                          at the same time, the accesses to the floppy drive
                          are therefore limited, Very good!

also contains:            .A DEBUGGER (to find ERRORS in your
                          assembler programs (also allows to study the
                          content of the computer's memory)),
                          And a DISASSEMBLER that provides a text file
                          (listing) from a COMPILED program (or
                          executable program of type NAME .PRG)

                          These 2 terms will be explained in a separate
                          chapter.

                         .Very complete


* DEVPAC ST (1 or 2)     .Same characteristics as PROFIMAT but less
  ------------------      developed for DEVPAC I.

                         .Very efficient (especially DEVPAC II) and simple
                          to access.
     
                         .With DEVPAC II, you can directly launch the
                          created program, without having to leave the edi-
                          tor, and reprocess the listing in case of an error!
                         
                         .DEVPAC II comes with MONST2, the best
                          debugger and disassembler you can find...

                         .DEVPAC II admits very
                          powerful ASSEMBLY DIRECTIVES: INCBIN, REPT, ENDR, ELSEIF, RSSET...

                         .DEVPAC II is, in my opinion, THE best assembler
                          you can find: Do not hesitate!

     
* GFA ASSEMBLER         .I was only able to test a preversion of this
  --------------          assembler:

                         .It will be very useful to you because it corrects
                          incorrect syntaxes.

                         .The program can be directly executed,
                          under the editor. (Like with DEVPAC II)
                    
                         .Contains a very user-friendly debugger...
                         
                         .The EDITOR is superb! (It is faster than
                          the one from GFA BASIC).
   
                         (Ask your retailer for more details...)
 
* METACOMCO 12.0         .Contains a very good EDITOR.
  --------------         
                         .The ASSEMBLER, LINKER, and DEBUGGER provided
                          are very powerful.

                         .The provided manual is very well made...

  The prices of these different assemblers can vary, but they are generally
  quite high because these are already very complex utilities
  reserved for professionals, but they are very suitable for our
  needs and their use is not a problem if one knows
  assembler.

     You still have all the time to make your choice if it has not yet
  been made, be patient to be able to perfect your judgment
  because there is no rush ...


2) Additional manuals (optional)
   -----------------------------

-       Later on, when we study the functions of GEMDOS, XBIOS, and BIOS, it will be very
    useful for you to own "THE ST BIBLE" by MICRO APPLICATION, this book contains precisely all
    the names of the functions of the 'libraries' that are GEMDOS, XBIOS, and BIOS.

   The functions of GEMDOS, XBIOS, and BIOS can be called
   in assembler and allow the execution of basic functions such as
   printing characters, opening files on Floppy, or changing the color palette, etc...

      A chapter will explain in detail all these functions with
      examples, corrected exercises, and a meticulous description.


-  You can also buy "THE GEM BOOK" by MICRO APPLICATION, it
   contains VDI and AES functions:

    The VDI is a 'Library' of functions just like the BIOS or
    GEMDOS and XBIOS, but these functions are graphical and allow
    for example the drawing of circles, polygons, fillings...

    The AES manages the environment for applications, that is, it manages
    and allows the creation of windows, icons... through which the user
    communicates information to the computer, thanks to the mouse
    among other things.

-   We will be more interested in the VDI in a separate chapter because
    the use of the AES goes beyond the scope of our goal given the complexity
    of its implementation.

    

   .An entire chapter will be dedicated to GEMDOS, BIOS, XBIOS, and VDI functions (You will also study LineAs and interrupt programs...)



                    *** WHAT IS ASSEMBLER? ***
                    ------------------------------

-    ASSEMBLER has the sad reputation of being difficult to
     implement, which is why it is often preferred to a language like BASIC,
     PASCAL, C, etc...

     One of the major reasons that have contributed to this reputation is
     undoubtedly the lack of any complete and didactic initiation
     to this fantastic language that is ASSEMBLER.
     Often, works published on ASSEMBLER are completely devoid of any pedagogical ambition and are in fact nothing more
     than catalogs of incomprehensible technical terms.

     Thus, most amateur programmers know nothing about assembler even though it is the natural language of
     their computer!

     It is a pity, because the performance of assembler
     cannot even be compared to that of certain languages called 'evolved'. (especially in terms of graphics)

-       ASSEMBLER allows understanding the internal workings of the
     computer, in an ASSEMBLER program each component of the computer's structure appears clearly: MEMORY, REGISTERS,
     VARIABLES...

-    Each of these components can be modified in ASSEMBLER.

     ASSEMBLER is in direct contact with the computer and therefore uses
     no detours, it always achieves a precise result.

     A 3-line BASIC program once compiled will consist of a hundred
     ASSEMBLER instructions, while the same program, written
     directly in ASSEMBLER, would only take up a tenth of that...


-    Like every computer language, ASSEMBLER has various
     instructions, but it can also directly call functions (XBIOS, BIOS, GEMDOS, AES, VDI...) providing the
     necessary parameters.

-    The 68000 ASSEMBLER works in two different modes:

          The User mode: a reserved memory area is
                               available to the programmer.

          The Supervisor mode: The programmer has access to all
                               instructions and all memory.


-     ASSEMBLER is very specific: programming in Z80 Assembler
      on AMSTRAD CPC is not the same as on ATARI ST in 68000 Assembler.


   --------------------------------------------------------------------
        All these notions will be defined in-depth later:
                          Do not Panic!

   --------------------------------------------------------------------



               *** WHY PROGRAM IN ASSEMBLER? ***
               ----------------------------------

 -   Who among you does not dream of being able to match or surpass the
     programmers of your favorite games??

     Ex: OVERLANDER and PANDORA were programmed with DEVPAC II
          and 95% of the good games on ST are written in Assembler.
          
 -   In some cases, ASSEMBLER can be 100 times faster
     than GFA BASIC...

 -   If you program in BASIC, you will only have access to the
     instructions specific to the utility whereas in ASSEMBLER you have
     a hundred functions directly usable and an instruction set that will allow
     directing every operation with unparalleled precision and speed.

 -   ASSEMBLER is very specific because it varies according to the MICRO-
     PROCESSOR (the 'brain' of your computer).

     The ATARI ST is equipped with the MC 68000 Microprocessor (from Motorola)
     :So we program in 68000 Assembler on ST...

     An AMSTRAD CPC is equipped with a Z80 microprocessor, different from
     the MC 68000 in many ways. This explains the differences in
     performance, and in programming between these two computers.

-    But today, we find computers equipped with Microprocessors from the 68000 family: the 68008,68010,68012...
     An example: The AMIGA also has an MC 68000 microprocessor.

     It will, therefore, be quite easy for you to adapt to programming in
     assembler on these (new) computers.

     The microprocessors from the 68000 family, therefore, have a bright future ahead... (as opposed to the Z80 for example, which is
     totally outdated)


                                --------------

     That's it for the theoretical part, but now let's get down to business...



       Laurent PIECHOCKI
       8, impasse Bellevue                       continued in :  NR#2.DOC
       57980 TENTELING                                        --------


Back to ASM_Tutorial