This laboratory will give you more experience with the tools we will use this semester. Be sure to read through the entire lab and do the pre-lab for each section before coming to lab.
prog: equ $0800
CODE: section .text
org prog
ldaa #12
ldab #195
aba
std $900
swi
Do (a), (b) and (c) before coming to lab.
eval $time=0.
Trace through the program using ZAP. To find out how many cycles it
took to execute, go to the COMMAND window an give the instruction
eval $time.
Compare this to the answer of part (b).
; 68HC11 demo program
; Bill Rison
; 1/26/99
; 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 3 Demo Program"
prog: equ $0800 ;put program at address 0x0800
data: equ $0900 ;put data at address 0x0900
count: equ 10 ;number of entries in table
CODE: section .text
org prog ;set program counter to 0x0800
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
DATA: section .data
org data
;initialize table1 (COUNT bytes long)
table1: dc.b $07,$ae,$4a,$f3,$6c,$30,$7f,$12,$67,$cf
table2: ds.b count ;reserve count bytes for table2.
ldab #250
loop1: ldx #40000
loop2: dex
bne loop2
decb
bne loop1
swi