EE 308 -- LAB 2
Further Use of SIM11 and the EVBU
This laboratory will give you more experience with the tools we will use in
- Consider the following program for the 68HC11:
.area CODE (ABS)
Do (a), (b) and (c) before coming to lab.
- Hand-assemble this program. I.e., determine the op-codes the HC11 will
use to execute this program.
- How many instruction cycles will it take the HC11 to execute this
program? How long will this take on the HC11? (Do not consider the swi
- What will be in address 0x0010 after the program executes?
- Assemble the program using as6811 and aslink. Look at the
S19 file. You should be able to relate the op-codes from part (a) to
the data in the S19 file. Appendix A of the M68HC11EVBU User's
Manual describes the format of the S19 file.
- Trace through the program using SIM11. The RUN window in
SIM11 shows how many cycles it takes to execute the instructions.
Compare this to the answer of part (b).
- Look at the contents of address 0x0010. Does the value agree with
your answer of part (c)?
- You could change this program to subtract rather than add by changing
the aba instruction to a sba instruction. Rather than going back
to the text editor, modifying the program, assembling it and loading the new
program into the simulator, you can easily change the one instruction of the
- Find the address of the aba instruction. Do this by looking at
the program code in the ASSEMBLE window of the simulator.
- Change the instruction by first typing ASM addr where
addr is the address of the aba instruction. Then enter the new
instruction (sba). Do this in the DEBUG window.
- Run the program again, and verify that the program now subtracts rather
- Repeat (e) through (g) on your EVBU. For part (g), use the ASM
command of BUFFALO to look at and change the program code on the EVBU.
- Consider the program in Figure 1, which is just the
program from Lab 1, modified to divide a table of ten values.
; 68HC11 demo program
; Bill Rison
; This is a program to take a table of data, and create a new table
; which is the original table divided by 2
.title LAB 1 Demo Program
EVBRAM = 0x0000 ;0x0000 is start of user ram on 68HC11EVBU
DATARAM = EVBRAM
PROG = EVBRAM+0x100 ;start program above BUFFALO
COUNT = 10 ;number of entries in table
.area CODE (ABS)
.org PROG ;set program counter to 0x0100
ldab #COUNT ;ACC B holds number of entries left to process
ldx #table1 ;Reg X points to entry to process
repeat: ldaa 0,x ;Get table1 entry into ACC A
asra ;Divide by 2
staa COUNT,x ;Save in table2
inx ;REG X points to next entry in table1
decb ;Decrement number left to process
bne repeat ;If not done, process next table1 entry
swi ;Done -- Exit
.area DATA (ABS)
;initialize table1 (COUNT bytes long)
table1: .db 0x07,0xae,0x4a,0xf3,0x6c,0x30,0x7f,0x12,0x67,0xcf
table2: .ds COUNT ;reserve COUNT bytes for table2.
Figure 1: Demo program for Part 2 of Lab 2
- Use a text editor to enter this program, or download it from
program into an S19 file.
- Load the program into the simulator. Run the program. How many
cycles does it take to execute the entire program? How long would this
take on the EVBU?
- Use the BF instruction of the simulator to change the values
in addresses 0x0000 through 0x0020 to 0xFF. Reload the
- Set a break point at repeat.
- Execute the program again. The program should stop the first time
it reaches the repeat label, with 0x0A in ACC B, and
0x0000 in X.
- Continue running the program. It should stop each time it gets to the
repeat label -- B should be decremented by one, X should be
incremented by one, and there should be a new entry in table2.
- Repeat the above using the EVBU.
- Consider the code of Figure 2. Do parts (a) and (b) below
before coming to lab.
loop1: ldx #33333
Figure 2: Demo program for Part 3 of Lab 2
- How many cycles will it take to execute this program? How long will
this take on the EVBU?
- Use a text editor to enter the code into a program -- you will have to
add .org statements and other assembler directives to make the program
- Assemble the program and run it on the simulator. Determine the number
of cycles it takes. This should match your answer to part (a).
- Run the program on the EVBU. How long does it take to run? This time
should match your answer to part (a).
Fri Jan 24 1997
© 1997, New Mexico Tech