Using an external assembler

It should not be too hard to convince you of the usefulness of using a separate assembler other than the runimentary Buffalo assembler.  Here we outline three methods that Windows users can use to produce an executable file for the following program.

* LEDblink.asm - Jonathan Hill
* Blink an LED once for about 1 second

PORTA:	EQU	$1000
EXIT:   EQU	$E0B2
N1:	EQU	$64
N2:	EQU	$09C4
	ORG	$0100

* Turn the LED on
	LDAA	#$10
	STAA	PORTA

* Repeat the outer loop N1 times
	LDAA    #N1    ; 2 cycles

* Inner delay loop - ten milliseconds
L1:	LDX     #N2    ; 3 cycles
L2:	NOP            ; 2 cycles
	DEX            ; 3 cycles
	BNE     L2     ; 3 cycles

* Rest of the outer loop
	DECA           ; 2 cycles
	BNE     L1     ; 3 cycles

* Turn the LED off and exit
	LDAA  	#$00
	STAA	PORTA
	JMP   	EXIT

* End of LEDblink.asm

Using THRSim11

The THRSim11 program is an integrated development environment (IDE) that provides a text editor, assembler, and simulator.  While the simulator is limited, the assembler is not so limited.  What many students do not know is that the THSim11 assembler produces two files that are of particular importance.

The list file summarizes the actual correspondence of your assmebly language program with the final program image.  The image uses the Motorola S19 format to describe your program as it will appear in memory.  You will use the S19 file to program the microprocessor.

Open THRSim11 and create a file named LEDblink.asm and use the THRSim11 assembler to assemble the file.  Look in the same folder where you created the .asm file, there should be a matching .LST file and a .S19 file as well.

The as11 command line assembler

To use a command line assembler like as11 you must first use a text editor to create a so called source file for your program.  Create a directory that you can find and open the notepad text editor. 
Start => Programs => Accessories => Notepad

Enter the following program and save it in a file named LEDblink.asm.  Be very careful that before you save the file, set the "Save as filetype" to All Files, as otherwise a .txt extension will be appended to the filename. 

The Motorola free-ware assembler as11 is available from the Motorola's FTP site ( ftp://www.motorola.com/pub/SPS/MCU/ibm/) but is also installed with the Axiom development software, which we discuss in a moment. 

Open a DOS window and use the cd command to change to the directory you set up.  I am using a subdirectory named Buffalo.

C:\>cd ee332\Buffalo

C:\ee332\Buffalo>as11 LEDblink.asm
Freeware assember ASxx.EXE Ver 1.03.


Number of errors 0

C:\ee332\Buffalo>

By default the as11 program only produces a S19 file.  To produce list file output, follow the file name with -L, in the following the first line produces a listing which appears in the console output.  The second saves the list file output in an actual file.

C:\ee332\Buffalo>as11 LEDblink.asm -L

C:\ee332\Buffalo>as11 LEDblink.asm -L > LEDblink.LST
It is a good idea to leave the notepad program running.  If the assembler reports any errors, you can quickly make fixes. 

Down-load Your Code

The as11 and THRSim11 programs produces a file named LEDBLINK.S19 or LEDblink.S11 that you will down-load to the Axiom board.  With Buffalo running with an ASCII text terminal, enter the following command:
>LOAD T
Below the title bar for Tera-Term, select:
File => Send File
In the pop-up window browse to find the file LEDBLINK, select it and click OPEN.  In a brief moment, the Buffalo prompt returns.  Congratulations, you just down-loaded your first program.

The Axiom Development Tool

Now that you have the basic idea of how a program is assembled and down-loaded using Buffalo, the Axiom development tool provides a fancy terminal program that isn't necessary but convenient.  To start up the Axiom development tool, select the following with your mouse:

Start => Programs => AxIDE2 => AxIDE

You will still use a text editor like note pad to enter the program.  The Axiom tool itself executes as11 for you and is used in place of an ASCII terminal such as TeraTerm.  Axiom software is available from the Axiom website (http://www.axman.com/).  Some very old Axiom CDs include a broken version of as11.  If you have a CD and are not certain how it is, be sure to download a new copy of the tools from Axiom manufacturing or get a recent copy of as11 from Motorola and replace the installed copy.

The first time that you start the development tool, the AxTerm port window may appear, asking you to select a port.  Make your selection and click OK. 


AxTerm port selection

If you have trouble communicating with Buffalo or otherwise need to change the configuration once the development tool appears, you can make necessary changes by selecting File => Options.

Press the reset button on the development board, you should now see the familiar Buffalo greeting.  Press the Enter key on your keyboard as you did before so that Buffalo returns its familiar prompt. 


Buffalo's familiar greeting

In the AxIDE window, use your mouse to click the Build button.  In the pop-up window give the path and name of the program you want assembled.  Also turn on the first two options.


Axiom build options

Click the OK button to assemble your program.  If your program has any errors, they will appear in the list file that appears.  Incidentally, the Axiom development tools cause both LEDblink.lst and LEDblink.S19 to be produced. 

To send an S19 file to Buffalo you basically follow a similar procedure as you did before.  At the Buffalo command prompt enter the following:

> load t

This time click the Upload button in the AxIDE window and in the pop-up window enter the path and filename of the S19 file and then click OK to send the file.


The Axiom upload window

From here on out you use Buffalo just as you did before.  The first part of the tutorial introduces Buffalo commands that are useful in developing your code. 

System Memory Map

As mentioned elsewhere, this tutorial was written assuming that your system has a processor like the 68HC11E9 and has at least has 512 bytes of RAM starting at address $0000.  As written, the tutorial may be performed with your system either in single-chip mode or expanded mode. 

Single Chip System Memory Map (68HC11E98CFN2)
$0000-$0041 : Internal RAM Buffalo user stack
$0042-$00FF : Internal RAM reserved by Buffalo
$0100-$01FF : Internal RAM
$1000-$103F : Internal registers
$B600-$B7FF : Internal EEPROM
$D000-$FFFF : Internal EPROM (Buffalo) if ROMON enabled

The following table summarizes the memory map of the CME11E9-EVBU development board produced by Axiom Manufacturing for the cases of expanded mode.  The expanded mode fills in many of the empty spaces with more memory.

Axiom CME11E9-EVBU System Memory Map
$0000-$00FF : Internal RAM reserved by Buffalo
$0100-$01FF : Internal RAM
$0200-$0FFF : Expanded mode RAM (U5)
$1000-$103F : Internal registers
$1040-$7FFF : Expanded mode RAM (U5)
$8000-$B57F : Optional memory - not installed (U6)
$B580-$B5FF : Peripheral area for CS0 - CS7 and LCD
$B580-$B58F = CS0 $B590-$B59F = CS1 $B5A0-$B5AF = CS2
$B5B0-$B5BF = CS3 $B5C0-$B5CF = CS4 $B5D0-$B5DF = CS5
$B5E0-$B5EF = CS6 $B5F0-$B5F1 = LCD $B5F2-$B5FF = CS7
$B600-$B7FF : Internal EEPROM
$B800-$CFFF : Optional memory - not installed (U6)
$D000-$DFFF : Internal EPROM (Buffalo) if ROMON enabled
$E000-$FFFF : Internal EPROM (Buffalo) if ROMON enabled
: Otherwise external EPROM (U7) if ROMON disabled

Buffalo occupies significant resources in the development board, in particular Buffalo reserves the entire memory zero page and the top 12Kbytes of memory.  For small programs, the 512 byte internal EEPROM is particularly convenient to use. 

Copyright Notice

This tutorial page was written for EE332, the Introduction to Microprocessors course offered by the Electrical Engineering Department in the College of Engineering at the University of Hartford.  Copyright is dated October 18, 2001 and is reserved by the author, Jonathan Hill.  Permission is granted to make copies of this document for educational use as-is, provided that this statement remains attached.  Please forward corrections for my review along with suggestions.  Credits will be added as improvements are made to this document.
Original Author: Jonathan Hill (jmhill@mail.hartford.edu)
Last Modified: Tue Sep 9 00:24:16 EDT 2003