Sunday, March 30, 2014

The AS Macro Assembler

I was recently writing some Intel 8080 assembly language code for the Briel Altair 8800 computer. Assembling programs by hand and toggling in the binary codes using the front panel gets tedious very quickly. I could write it under CP/M and use the CP/M assembler, but text editing is a little clumsy under CP/M, the assembler is slow, and I want to run the programs standalone on the Altair 8800 without using CP/M.

A search for a cross-assembler that would run on Linux and support the Intel 8080 identified the AS macro assembler. This is a full-featured, free (GPL licensed) cross-assembler that runs on Linux and other desktop operating systems. It actually supports about 75 different microprocessors -- quite an amazing accomplishment!

I built it from source on Linux without any problems and was soon assembling 8080 assembly language code. The documentation that comes with it is very extensive and complete and the assembler listings are easy to read (some representative listing code is shown below).

727/     39F :                     ; GetAddress
728/     39F :                     ; Gets a four character hex number from the keyboard.
729/     39F :                     ; Ignores invalid characters. cancels and sets carry bit.
730/     39F :                     ; Returns binary word in HL.
731/     39F :                     ; Registers affected: A,B,H,L
732/     39F :                     
733/     39F :                     GetAddress:
734/     39F : CD 90 03                    call    GetByte         ; Get MSB
735/     3A2 : D8                          rc                      ; Exit if pressed
736/     3A3 : 67                          mov     h,a             ; Save MSB in H
737/     3A4 : CD 90 03                    call    GetByte         ; Get LSB
738/     3A7 : D8                          rc                      ; Exit if pressed
739/     3A8 : 6F                          mov     l,a             ; Save LSB in L
740/     3A9 : C9                          ret

It can produce Intel Hex format files which can be transferred to CP/M, converted to .COM files using the CP/M LOAD program, and then executed.

I am using it to generate a binary file which can be copied to an SD card and then directly loaded and executed by the firmware on the Briel Altair 8800.

It is very fast to assemble programs under Linux, and seems to have all the features and more than I could want. If you are looking for a good cross-assembler for the 8080 or just about any processor, it may be just what you need.

2 comments:

Kevin Cole said...

I'm coming to this post six years late... How did the project go? I'm just starting to learn Altair assembly language and went searching for a Linux-based assembler. This popped up. BTW I converted the Operator's Manual to HTML. https://pages.codeberg.org/ubuntourist/Altair-8800/ Still one diagram missing, and a serious proofreading needed. Plus more hyper-linkery. But I only started the conversion two weeks ago.

Kevin Cole said...

Specfically "I am using it to generate a binary file which can be copied to an SD card and then directly loaded and executed by the firmware on the Briel Altair 8800."

This is approximately where I intend to be headed, helping a teacher who's planning to purchase from AltairClone.com.