Jonathan A. Titus

Microcomputer Pioneer

Home Jon Titus Mark-8 Lessons Timeline Links Comm Board About









Lesson 8: Assembly Language

From "AMERICAN LABORATORY"
by David G. Larsen, Peter R. Rony, Jonathan A. Titus and Christopher A. Titus

Integer Addition and Subtraction
MOST 8-BIT microprocessors, such as the 8080A, Z-80, 6800, 6502, and F-8, can add and subtract only 8-bit numbers, which can represent only decimal quantities between 0 and 255. This is not enough resolution or dynamic range for many applications. Consequently, multiple-precision and jloating-point numbers are used.

The term multiple precision refers to the use of two or more computer words to represent a numeric quanti- ty.--l-H- the above-mentioned microprocessor chips, a computer word is called a byte, and is 8 bits long. A double-precision number, therefore, contains 2 bytes, or 16 bits, and can represent any unsigned integer number between 0 and 65,535. Similarly, a triple-precision number contains 3 bytes, or 24 bits, and can represent any unsigned integer number between 0 and 16,777,216. Despite this ability to represent very large numbers, multiple-precision numbers do have their limitations, especially when units such as picograms, liters per second, and kilograms all appear in a single equation.
Read More: Adobe Acrobat PDF FileInteger Addition and Subtraction.pdf [46.5KB]

Integer Multiplication and Division
IN THE March column, integer addition and subtraction subroutines were discussed. Since microprocessors like the 8080 and 6800 do not have multiplication and division instructions, subroutines that contain addition and subtraction instructions must be written to perform these operations. A typical paper- and-pencil decimal and binary multiplication for two different sets of numbers is shown in Figure 1.

As you can see, the mechanics of multiplication is very similar in these two examples. As the multiplicand is multiplied by larger and larger powers of ten or powers of two, the result of the multiplication has to be shifted to the left by one, to increase the significance of the result. For instance, when 1024 is multiplied by the 9 in 596, the result (9216) is shifted to the left by one place, because the multiplication is really 90 x 1024 and the result is really 92,160.
Read More: Adobe Acrobat PDF FileInteger Multiplication and Division.pdf [70.2KB]

Subroutines and Stacks
IN SOME of our previous columns, we have provided examples of short subprograms or subroutines that could be used by a main program. Subroutines are powerful software building blocks. They facilitate program development since they may be written and tested apart from the main body of software. In addition, they can be adapted for use with almost any type of program. In this month's column, we will focus upon their operation as well as on the use of stack instructions.

We have previously discussed the use of both unconditional and conditional jump instructions, which transfer computer control to another software task starting at the sixteenbit address specified within the jump instruction itself. The jump instruction is a one-way branch since it points to a single address, as illustrated in Figure 1. However, short subprograms that are used repeatedly exist in many software tasks. Examples of such tasks include mathematical computation, control, and teletypewriter input/output routines. It seems wasteful to duplicate these subprograms throughout the main program, so an attempt is made to separate them at the end of the main program and, in some manner, branch to them when they are needed.
Read More: Adobe Acrobat PDF FileSubroutines And Stacks.pdf [58.2KB]

Preparing Programs
ONE of the problems facing many microcomputer users is the preparation of software for particular applications. The software examples provided in past columns are short enough to have been put together or assembled by hand, i.e., each mnemonic was translated into its octal, hexadecimal or binary equivalent. Addresses for jumps, calls and input!output devices are easily added or changed since the computer programs are short and the addresses are probably listed in sequential order on the rought draft. Unfortunately, not all software preparation is this easy. Many application programs can be many thousands of steps long. This column will initiate a discussion of the aids available for microcomputer program development.

One of the biggest problems in software development is the clear, concise statement of the problem and its solution. All of the desired results, inputs, outputs and the complete program flow-including all decision making steps-must be considered before the programming is started. This can be in outline or block diagram form, but a flow chart will prove much easier to follow. A typical flow chart is shown in Figure 1.
Read More: Adobe Acrobat PDF FilePreparing Programs.pdf [40.6KB]

Assembly Language or BASIC: Which way to go?
A s THE APPLICATION of microcomputers continues to grow, more and more users are asking what the best language is for programming the microcomputer. There are currently only two languages that have widespread support, assembly language and the BASIC* language.

In choosing a language, there are a number of advantages and disadvantages associated with each that must be considered. The two languages should be compared on the basis of cost of programming, memory requirements, machine independence of programs, program relocatability, users' libraries, logicaloperations, use of nonstandard peripherals, and speed of execution. This listing is not in order of importance. In fact, there are probably items of interest that have been omitted. For each particular microcomputer application, the user may be interested in only one of the items, such as memory (storage) requirements, while others may feel that all of the items are important and must be considered.
Read More: Adobe Acrobat PDF FileAssembly Language.pdf [86.0KB]