Feedback Search Top Backward Forward
EDM/2

The Codesmith's Library - Using Assembly Language

Written by Carsten Whimster

 

Introduction

In The Codesmith's Library, I focus on development books and materials. I write this column from the point of view of an intermediate programmer. Pick up whichever book strikes your fancy, and join the growing group of people following our programming columns.

Please send me your comments and thoughts so that I can make this column what you want it to be. I read and respond to all mail.

Using Assembly Language, 3rd Edition

I picked up Using Assembly Language in order to learn enough x86 assembly language to be able spruce up my C code, to get through a more advanced book I have on my shelf, and to further my understanding of the underlying machinery. This should help me become a better debugger . This book purports to teach assembly language from scratch, including information on incorporating assembler into C, C++, BASIC (sic), Pascal, DBase, and Clipper code. The chapters are as follows:


     Part I: The Fundamentals of
             Assembly Language
1.   Understanding the Programming Environment
2.   An Overview of Assembly Language
3.   Choosing and Using Your Assembler
4.   Choosing and Using Your Linker
5.   Using Microsoft's Assembly Language Products
6.   Using Borland's Assembly Language Products
7.   Debugging Assembly Language Subroutines
8.   Using Additional Tools
9.   Developing Libraries
     Part II: Mixed Language Programming with
              Assembly Language
10.  Interfacing Subroutines
11.  Interfacing with BASIC
12.  Interfacing with Pascal
13.  Interfacing with C and C++
14.  Interfacing with DBase III+ and FoxPro
15.  Interfacing with Clipper
     Part III: Applying Assembly
               Language Techniques
16.  Working with Different Processors
17.  Video Memory
18.  Accessing Hardware Ports
19.  Working with Disk Drives
     Part IV: Reference
20.  Accessing BIOS Services
21.  The DOS Services
22.  Processor Instruction Set
23.  Assembler Directives
Appendix A:  The ASCII Character Set
Appendix B:  Keyboard Interpretation Tables

This book is a touch older (1992) than other books I have reviewed, and this is partly my fault. The bookstore I frequent is generally quite good and keeps recent books mostly, but when I picked this one up, I flicked through and liked what I saw, without checking the publishing date. I presume that there is now a newer version out which may correct some of the faults of this book. Keep this in mind as you read this review.

After a brief introduction, we get launched into chapter one, which discusses the programming environment! With this, the author means the layout of memory (under DOS), segments, the stack, registers and flags in the 80x86 CPUs, BIOS, DOS, and device drivers. The next chapter reviews assembly language programming for the uninitiated, and also introduces the assembler directives. Loops and branches are briefly introduced, and then a skeleton for assembly language programs is given. The next few chapters discuss the relative virtues of the most prevalent assemblers and linkers, as well as the environments. Note that this discussion is limited to MASM 5.1/6.0 and TASM 2.0/3.0 due to the early publishing date of the book. Debuggers are also briefly discussed, including a discussion of DOS's debug! I didn't even know that DOS still came with this in 1992. It even comes with DOS 6.20, and I presume the newer versions. I can't imagine using debug as your main debugger. Finally, make and nmake are discussed, and the tools required to build libraries are discussed. So far, this has been a good, if brief, discussion of the tools you might use on the command-line.

Part II addresses the ways of interfacing assembly language with most of the popular DOS-based programming languages. Parameter passing, the stack, and registers are discussed. Following this, several languages deal with the individual languages to interface with. This concludes this short section.

Part III (finally) actually discusses assembly language programming. Still, it does not really go into any depth in general assembly language programming, but skips straight to several rather esoteric topics, albeit some are of common interest. A neat program is listed which shows how to detect which processor is running. It only covers up until the 486, but I am under the impression that the Pentium has a special instruction which deals with this, so it is probably an easy matter to extend this. It also shows how to detect an FPU. Unfortunately the program is only partially explained, and some details are a little unclear. The chapter on video memory only covers up to and including VGA, and only in text mode. If you are looking to do some graphics programming, look elsewhere. Accessing hardware ports with the IN and OUT instructions is covered next, followed by working with disk drives. This concludes the tutorial section on assembly language programming.

Part IV is pure reference, including nearly 600 pages worth of BIOS, DOS, instruction set and assembler directive reference. Each instruction has its own little half-page, divided into applicable processors, category, status affected, coding example, and description.

Summary

This book is a bit of a mixed bag. It is large, clear, and thorough in all areas except one: teaching assembly language. I have seen many books which covered programming for some specific application, completely neglecting the tools, the programming environment, and reference, but this is the first time I have seen the opposite. You have to study the few code snippets very carefully even to learn how to set up a loop correctly. I feel that this is a major shortcoming, but the rest of the book is quite good, so now what?

I give this book a C+, not because it is terrible, but because I feel that it does not fulfill its aim. In general, it is quite good, but there are some areas in which it is too brief. It is quite large, and a good reference, but is marketed more as a how-to book. There are some neat sample programs in the book, but by and large, if you don't know much about assembly language before you read it, you won't know a lot when you are done reading it. You will understand how to use the tools to write it, but you will not have any insight in how to program efficiently. You will have to invest time on your own, figuring out how to be a good assembly programmer. My feeling is that there must be a better book out there to teach assembly language, and act as a reference.

Using Assembly Language, 3rd Edition, Allen L. Wyatt, Sr.

  • QUE, ISBN 0-88022-884-9, $US29.95, $37.95CAN, UK27.45.
  • Intended audience: DOS Assembly Programmers
  • Mark: C+

Reviewed Books

Our Bookstore has reviews and links to Amazon for all books we have reviewed in the past, as well as several books waiting to be reviewed, and others which we recommend.