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
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.
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.
It is a good idea to leave the notepad program running. If the assembler reports any errors, you can quickly make fixes.C:\ee332\Buffalo>as11 LEDblink.asm -L C:\ee332\Buffalo>as11 LEDblink.asm -L > LEDblink.LST
Below the title bar for Tera-Term, select:>LOAD T
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.File => Send File
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.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.
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.
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.
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.
$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.
$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
| |||||||||
$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.