Software Marketing - Technical/Detailed
Sample - Technical Article: Detailed Review of a Programmer's Library
Detailed Review of "Spontaneous Assembly", a programmer's library, written on speculation for the now-defunct Computer Language magazine
Spontaneous Assembly: a detailed product review
The death of assembly language has been heralded for decades. And, as always, the news has been premature. There has always been, and probably will always be, a real need for assembly language. Applications such as TSRs (terminate and stay resident programs), device drivers, and communications software all require the degree of control and speed that assembler provides. Also, an efficient assembler application can give an underpowered laptop or vintage PC the responsiveness of a ‘386.
This article provides some perspective on a new product that breathes fresh life into assembly language development for MS-DOS based computers. Spontaneous Assembly Version 2.0, by BaseTwo Development of Orem, Utah, provides important leverage for would-be assembler developers. This product is powerful and comprehensive enough, in fact, that it deserves careful consideration by confirmed “C heads” who had long ago written off assembler as the province of cave-dwellers.
What is Spontaneous Assembly?
Spontaneous Assembly is a comprehensive library of run-time support routines for MS-DOS assembly language development. The ‘Spontaneous’ in the product’s name refers to the fact that this product makes it possible to code assembler applications ‘spontaneously’, without research or hassle.
The problem with developing assembler applications has historically been one of bootstrapping, learning curve, and reinvention of the wheel. One has to perform considerable research in order to write even trivial assembler applications. In addition to mastering Intel 80x86 machine language, you must refer (constantly) to such weighty tomes as The Microsoft MS-DOS Programmer’s Reference if you want to do anything except access memory and registers. The MS-DOS programming environment is scattered into multiple sources of information, namely BIOS, DOS, and hardware specific details. Also, there is generally no “run time” support for assembly language. A typical assembler project will consist of re-inventing the wheel dozens of times until you accumulate a “critical mass” of often used support routines. The net result is that most part-time assembly language developers aren’t able to give their application code the attention that it deserves. This is because they must spend too much time trying to get “trivialities” such as file I/O or DOS memory allocation to work properly.
Spontaneous Assembly is a product that addresses all of these problems with a straightforward, powerful toolkit of functions.
Product Description
Spontaneous Assembly is a run-time library for assembler applications that provides the same functions for assembly language development that all commercial “C” compiler implementations provide. The product contains about 750 macros and functions.
Spontaneous Assembly is provided on four 5.25”, 360K disks. All files are packed into “LHArc” self extracting, executable archives. The source code for the libraries is provided, as are pre-built libraries in all supported memory models. Utility programs for source code extraction and building of the libraries, and sample programs, are also provided. The documentation is a paper-bound, 756 page user’s manual.
Overview of the Functions
If you already program in “C”, you probably know how many of the Spontaneous Assembly library functions work. The naming and the calling semantics of Spontaneous Assembly routines borrow heavily from generic C library style. The borrowing from “C” includes the support of a several kinds of memory heap, most of the standard “C” namesake functions such as “STRCMP” and “MALLOC”, and support for the standard memory models from tiny through large. There is much that you would expect in such a package, such as DOS console and file 10 functions. There is also much that you would not expect: structured arrays, strings, and full, automatic support of layered windows and video text modes.
Spontaneous Assembly is divided into 19 functional areas called “units”. Each unit provides support of a particular type of functionality, such as windowing or array management. The following descriptions each cover roughly one unit, and are a condensation of the “Library Overview" beginning on page 10 of the Spontaneous Assembly manual.
Full layered, text mode windowing is supported. The windowing functions allow you set up arbitrarily overlapping windows that may be updated even if they are covered by other windows. Definable shadows, borders, and a few dozen window options that govern the backdrop, the borders, etc. are supported. The hardware cursor can be automatically managed on a window by window basis.
Both console and screen I/O are supported. The “screen I/O” functions will be directed automatically to the “current” selected window in the windowing system, or will be directed to the screen if windowing is not in effect.
There are both near heap and far heap functions. The near heap manages available space in the default data segment, and the far heap lives in available DOS memory beyond the end of the program. There is also a capability for “relative” heaps. These are caller defined memory regions that the program wishes to declare as sources of allocable memory. Heaps can be re-initialized or destroyed at any time.
Array type data structures are supported. Functions are provided for array insertion, sorting, appending, stepping through the array, and random accesses.
Program spawning, command line parsing, and manipulation of the environment variables is provided. Critical error handling, DOS file I/O, DOS console I/O, and file and directory functions are included. The directory functions include the ability to merge and un-merge path, drive, and/or file specifications into full file names.
String to numeric and numeric to string conversions (integer) is provided for bytes through quad words. An integer math library that allows all four math operations on double and quad word arguments is included. There is a random number generator.
Date and time conversion functions are present. There is a facility for a “millisecond” event timer.
String and memory block operations allow copying, comparisons, searches, and token manipulation.
DOS file operations and miscellaneous functions are included, such as memory control blocks, sound generator, etc.
Memory Models
Spontaneous Assembly supports all standard memory models except “huge”. These memory models are named tiny, small, medium, compact, and large. The Spontaneous Assembly models support the same segment conventions as Microsoft and Borland languages (EG: compact implies “large” data pointers and “small” code.) Spontaneous Assembly also provides macros that replace the simplified segment directives of the Borland and the Microsoft assemblers. The segment directive replacement macros are more flexible and efficient of segment and memory usage than the simplified directives.
Calling Conventions
All of the functionality within Spontaneous Assembly is implemented either as assembler functions (subroutines) or as macros. Spontaneous Assembly is not, as the documentation notes, a pre-processor. Neither does it provide a “shell” that isolates you from assembler. You must still write all of your application in native assembler, but your code is supplemented by Spontaneous Assembly macros and routines. You are still free, of course, to write your own special-purpose routines if you feel that Spontaneous Assembly does not provide the functionality that you require.
All parameters are passed and returned in CPU registers. The stack is only used for local variables and for subroutines. The macros and functions make use of what the documentation calls a “minimum register profile”. This means that the macros and the functions make predictable use of the 80x86 register set. Registers that are not used for input or output are preserved, and input values are preserved.
The predictability and consistency of register usage avoids the “register pushing paranoia” to which most coders tend to succumb when they call assembler routines that they did not write within the last 5 minutes. (If you aren’t certain what registers are used by a subroutine, you will tend to push everything in sight.) A second aspect of Spontaneous Assembly’s register usage convention is that the functions within a unit tend to use the same register for a similar purpose across related functions. A “window handle” is always passed or returned in BX, for example. This often makes it possible to string together successive calls to Spontaneous Assembly functions without shuffling the contents of registers.
Spontaneous Assembly is also extremely consistent in the naming of the functions and macros. The Spontaneous Assembly function names fall into consistent, easily learned patterns.
The net effect of the consistency of style is that coding a large application with Spontaneous Assembly should involve considerably less “grunt work” than one would have ever expected with assembly language.
Using Spontaneous Assembly
I did not have the opportunity to exercise more than a tiny subset of the Spontaneous Assembly functions. I first built the sample program WIN.ASM which is provided as one of the example programs, using Borland TASM and TLINK. The resulting WIN.EXE displays a small pop-up window with a shadowed border, and then allows you to move the window around on the screen with the arrow keys. WIN.EXE assembled and linked with no problems, and worked as promised.
I then modified WIN.ASM to display two, much larger windows that overlapped each other. I did this in order to test three things: the ease of reworking Spontaneous Assembly application code, the speed of the windowing functions when updating a large window, and the ability to support overlapped moves. The modifications took about 15 minutes of total time. I was able to scoot the lower window around at will with no ill effect on the upper window. The windows snapped right up with impressive speed. Drawing lag was negligible even at a “Norton SI” computing speed index of 1.1. Even though I made a couple of errors and came up with a screen filled with colorful garbage characters a few times, the computer did not lock up; at least the Spontaneous Assembly windowing unit routines are “forgiving”. My modified WIN.ASM linked to an executable program of 8963 bytes.
What is Not Provided
The kinds of functions that Spontaneous Assembler does not provide is rather small, but should be noted. There are no explicit TSR control functions (except the interrupt vector manipulation functions.) There is no support for extended or expanded memory, nor is any mouse support provided. There are no B-Tree functions nor any other database type functions.
Documentation
The manual for Spontaneous Assembly is probably the best indicator of the product’s comprehensive nature. The single manual (which is essential, as there is no on-line help or “Norton Guide” file included) is hefty and is filled with useful details.
The manual is divided into six sections, as follows. Introduction; Programming with Spontaneous Assembly; Integration with C; Technical Notes, which provides an overview of the functions; the reference section, which provides the detailed function by function descriptions; the appendix; and an index.
The documentation explains the programming interface to every function and macro. Each routine and macro is clearly documented for register usage, effects upon external variables, the effect on the interrupt flag, any provisos or special conditions, and any error exceptions. The manual stops short of walking through the source code algorithms, however.
A surprising feat that Spontaneous Assembly pulled off with the version that I obtained was that all documentation is incorporated into the printed manual, as God intended. There is no clutter of last-minute README.TXT files that have to be cross-checked with the manual. Much of the value of this product is that the tedium of looking-up-stuff is eliminated and all documentation is in a single place. The lack of README files is welcomed.
Deficiencies
The greatest shortcoming to Spontaneous Assembly is its list price. I purchased the product under a mail order incentive, and I would personally balk at paying upwards of $300 (Spontaneous Assembly lists at $395.) Value is all in the eye of the perceiver, however. Most professional “C” compiler packages are in this ballpark, and Spontaneous Assembly allows you to compete, productivity-wise, with “C” coders.
A second quibble is the printed documentation that you get for the price. The single manual is rather bulky. A secondary reference card or a smaller, spiral bound reference booklet would make the product much more useable. At the price level of this product, Basetwo Development should definitely emulate Microsoft and Borland and other language—makers, and provide a similar documentation package in several parts.
A third issue is that of media. The unarchiving process for the files is well explained by inserts stuffed into the manual. However, Basetwo Development skimped on the media by requiring a second, lengthy extraction process in order to split the resulting .SRC files (one for each functional unit) into a plethora of individual .ASM files. Again, at the price level of this product, this is not reasonable.
A final, minor shortcoming is that, as mentioned earlier, there are no walk-through explanations of the library source code. However, the source code contains headers and comments. The omission of theory of operation is significant in the case of the windowing and the screen 10 unit, which involve rather complex operations. The lack of explanation is proportionately less of a problem with the simpler units. If you opt to use only the prepackaged libraries, you will be none the wiser.
Who Should Buy Spontaneous Assembly?
Spontaneous Assembly is probably of greatest interest to software companies and consultants who would like to develop assembly language applications but who have been put off by the labor intensive nature of doing so. The classes of applications that benefit from assembly language are large and varied: games, TSR5, utilities, communications and hardware control, and applications that are tar~geted for low-end PC5. Spontaneous Assembly allows you to develop large assembler applications without becoming a self contained MS-DOS research department and also without reinventing functions and features that you have come to take for granted in Pascal or “C”.
A second reason to look at Spontaneous Assembly is that it teaches excellent assembler coding practices. Spontaneous Assembly was obviously written to be aesthetically pleasing and sensible (as well as blindingly fast). Spontaneous Assembly would be an ideal way to learn 80x86 assembler coding techniques, and it might be useful to educators for this purpose.
Conclusion
Spontaneous Assembly is exactly what it is advertised to be, and it did not disappoint in the slightest. It is a thoughtfully crafted, well documented, thoroughly professional toolkit with great value for the money. Spontaneous Assembly currently has no competition, so it is your only choice if you do need such a product.
This product might even make you switch from “C” to assembler! That appears to be the hope of its developers, who claim that coding with Spontaneous Assembly is nearly as easy as coding in
Now, I think I’m finally gonna write that whiz-bang TSR utility...