



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




The purpose of this lab is to introduce you to the layout and structure of assembly language programs and their format, as well as to the use of the MiniIDE development tool. You will write your own programs later on in the semester with similar structure.
In the following example source code, from left to right, you will notice four columns. The first column contains label names. The second column contains instruction/assembler keywords. The third column contains data or operands. The fourth column is used for comments. Your programs should always be in this format.
MiniIDE (a free program available on the Internet) is a windows based program, which allows assembly programmer to assemble, debug, and download a program onto the Dragon12 68HCS12 board. This lab familiarizes the student with all the steps involved in loading, running, and debugging assembly language programs using MiniIDE. The student will be required to understand and remember all the steps to download and debug programs in future labs.
After logon in the CadLab, click on the start menu as follows: Start Æ AllPrograms Æ Engineering Æ ECE CadLab Æ MGTEK MiniIDE
;--------------------------------------- ;Lab# ;Assemble and Trace ;(Put your name and date here) ;--------------------------------------- org $1000 ;Memory data starts at address hex 1000 num_1 dc.b $6C ;Define Constant Byte with value hex 6C stored ; in memory at label num_ num_2 ds.b 1 ;Define Storage Byte to reserve ONE Memory Byte ; at label num_
data1 equ num_1 ;Symbol data1 equals num_1 (hex 6C) num equ $72 ;Symbol num equals value hex 72
org $1100 ;Start program at memory location hex 1100 LDAA #num ;Load the value of symbol NUM into Accumulator A LDX #data1 ;Load register X with the value of symbol data LDAB $0,X ;Load Accumulator B with content of memory ; location pointed to by register X plus 0 STAB num_2 ;Store the content of Accumulator B into mem ; location num_ STAA num_1 ;Store the content of Accumulator A into mem ; location num_ ABA ;Add the content of A & B and store result in A LDX #255 ;Load reg X with decimal value 255 EXG D,X ;Exchange registers D and X SWI ;Software Interrupt Command. Makes the ; microcontroller Stop executing this program
Now you have assembled the program and created a lab1.s19 file (machine or object code) and a lab1.lst file (source/object listing). These files are located in the same directory as your Lab1.asm file. The object code is what you will download onto the Dragon12 board’s memory next. The listing file is a text file that is helpful in debugging the program.
_Approved: Lab TA _____________________ Date _____________
Table 1
_Approved: Lab TA _____________________ Date _____________
This section will provide a walk-through of important and useful D-BUG commands. When finished executing this section, copy the terminal window output and paste it into a Word document as shown by the TA for inclusion in the report.
Note: Everything entered and displayed in D-Bug12 Monitor is in HEX, whether or not you enter the $. Each memory display line holds the 16 byte block associated with the beginning address. For example the $2200 block displays locations $2200 - $220F on one line. Using the command md $220A will display the entire 16 byte block associated with it; therefore it will display $2200 - $220F.
Type mm 2110 then press Enter.
Make the following addresses hold these values by typing in the value corresponding to the memory location and pressing Enter at the end of each line (note that the 21xx will be displayed as a prompt):
Then press Enter. You will see the results of changing $2113 to $12.
Press Enter, type 55 ^ Press Enter, type 44. Press Enter Finally, display the memory contents of $2110 using md 2110 and press Enter. Record the final values below (assume these are hex values):
2110 _____________ 2111 _____________ 2112 _____________ 2113 _____________
A 99 B EB X 569A
_Approved: Lab TA _____________________ Date _____________