|
Before you begin, remember that we have all the documentation for the Dunfield software available as hard copies in the lab. Just ask for it!
Begin by installing the Dunfield HC11 tools. These are available from Tom and the TAs. You probably want to install these tools on your group's shared drive, so they are accessible from any ECES computer.
I'll assume that your EPROM or Flash is in your HC11 memory map from 0x8000 to 0xFFFF. If this is not the case, then you will need to modify the 'org $8000' and 'dw $8000' lines to reflect the start of your EPROM/Flash in memory.
Next, you need to create a file containing the assembly code you want to compile. In this case, your program will be something like this:
prog.asm
org $FFFE *set up your reset vector
dw $8000 *(your CPU will fetch from 0x8000 on reset)
org $8000 *start your code at address 0x8000
main
nop *some nops
nop
nop
jmp main *jump back to the top of the loop
Note that 'main' is a label (an address) and it is aligned to the left margin. There should be no comments or white space after the word 'main'. Everything else (instructions, directives) must be indented from the margin by some whitespace. Otherwise, you will get goofy compiler errors.
Once you've created this file (I'll assume you've named it "prog.asm"), you need to run it through the assembler. Open up a command prompt, navigate to the directory where your asm file is located, and type the following:
asm11 prog.asm -f
You may need to give the full path to the asm11 executible, which would look something like this:
y:\mc\asm11 prog.asm -f
Now, you'll see two more files: prog.lst and prog.hex. First, let's look at prog.lst:
prog.lst
FFFE 1 org $FFFE *set up your reset vector
FFFE 80 00 2 dw $8000 *(your CPU will fetch from 0x8000 on reset)
0000 3
0000 4
8000 5 org $8000 *start your code at address 0x8000
8000 6 main
8000 01 7 nop *some nops
8001 01 8 nop
8002 01 9 nop
8003 7E 80 00 10 jmp main *jump back to the top of the loop
The left-hand column is the address. The next items over are the data stored at that address. On the right, you see all ten lines of your assembly program, with comments. This file allows you to see how each assembly instruction is translated into machine code. (For example, notice that the opcode for nop is 0x01.) The "-f" option that you used when calling the assembler is what produces this full listing file. Otherwise, the .lst file will be empty unless errors occured in the assembler.
The other file, prog.hex, is what you need to burn an EPROM or Flash chip. This tutorial will not cover how to read the file. The file is given here:
prog.hex
S105FFFE80007D
S10980000101017E800075
S9030000FC
Put this file on a floppy and bring it over to one of the chip programmers. Load it into the programmer software, and make sure you tell it to burn your Flash/EPROM with a buffer offset of 0x8000. In other words, the data that the listing file claims is at 0x8000 will be burned to the first address (0x0000) in the Flash/EPROM.
|