Assembly Languages

In computer programming, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence between the instructions in the language and the architecture's machine code instructions. Assembly language usually has one statement per machine instruction (1:1), but constants, comments, assembler directives, symbolic labels of, e.g., memory locations, registers, and macros are generally also supported.

Because assembly depends on the machine code instructions, each assembly language is specific to a particular computer architecture.

Sometimes there is more than one assembler for the same architecture, and sometimes an assembler is specific to an operating system or to particular operating systems. Most assembly languages do not provide specific syntax for operating system calls, and most assembly languages can be used universally with any operating system, as the language provides access to all the real capabilities of the processor, upon which all system call mechanisms ultimately rest. In contrast to assembly languages, most high-level programming languages are generally portable across multiple architectures but require interpreting or compiling, much more complicated tasks than assembling.

Today, it is typical to use small amounts of assembly language code within larger systems implemented in a higher-level language, for performance reasons or to interact directly with hardware in ways unsupported by the higher-level language. For instance, just under 2% of version 4.9 of the Linux kernel source code is written in assembly; more than 97% is written in C.

For me the first exposure to Assembler was the big boy IBM 360 Assembler in my first university computer 101 class, An Introduction to Computer Programming.  A summer course of 9 weeks.  Split up into 3 sections, IBM Assembler, Fortran and Basic.  The first two parts were done with Punched cards, a card reader and line printer connected to a remote IBM 360 system at another Research Center across the state.  The third section was BASIC-Plus on the Universities PDP-11/40 mentioned earlier.

I would later dig into DEC Macro-11 on the PDP, then when the Apple ][s came in 6502 assembler was a fun study.  I wrote an audio digitizer routine that used the Apple’s Joystick port to record about 10 seconds of audio into about 40K of RAM, and then play it back over the tiny speaker.  Needless to say is sounded terrible.

Professionally I first used assembly on a Kaypro 10.  This allowed me to write several file utilities for cleaning up “locked” RM-COBOL data files that were left locked by the applications when they crashed.  Which was often.  The company I worked for gave them to customers to help their productivity.  Later I would develop some home automation tools in 8085 Assembler and then I did some embedded systems development for a PIC micro-controller for refrigeration control.

Sample Code

The assembler hello world program is a simple single call to BDOS to print the message string:

C>type hello.asm
        ORG     100H

BDOS    EQU     0005H                   ; LOCATION OF BDOS ENTRY POINT
BOOT    EQU     0000H                   ; LOCATION OF BOOT REQUEST

START:
        MVI     C,9                     ; BDOS REQUEST 9 - PRINT STRING
        LXI     D,MESSAGE               ; OUR STRING TO PRING
        CALL    BDOS
        JMP     BOOT                    ; EXIT TO CP/M

MESSAGE:
        DB      13,10,'Hello World from CP/M!',13,10,'$'

        END     START

C>asm hello
CP/M ASSEMBLER - VER 2.0
0126
000H USE FACTOR
END OF ASSEMBLY

A>load hello

FIRST ADDRESS 0100
LAST  ADDRESS 0125
BYTES READ    0026
RECORDS WRITTEN 01


C>hello

Hello World from CP/M!

C>

References

This article uses material from the Wikipedia article Assembly Languages which is released under the Creative Commons Attribution-Share-Alike License 4.0.

Comments

Popular posts from this blog

Still Working on the New Home Page

A New Home Page is in the works!

Old Quizzes that have been taken down