Final version for 2001
Further Use of ZAP and the EVBU
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 2 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
                        ldx     #table1  ;Reg X points to entry to process in table 1
                        ldy     #table2  ;Reg Y points to entry to write to table 2
                        ldab    #count   ;ACC B holds number of entries left to process
               repeat:  ldaa    1,x+     ;Get table1 entry into ACC A; inc X to next entry
                        asra             ;Divide by 2
                        staa    1,y+     ;Save in table2; inc Y to next entry in table2
                        dbne    b,repeat ;Decrement number left to process;
                                         ;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