Introduction to Assembly Programming with MiniIDE (Lab 1) - Prof. Xubin He, Lab Reports of Microcomputers

Instructions for assembling and debugging assembly language programs using miniide, a windows-based development tool. Students will learn the layout and structure of assembly programs and how to load, run, and debug them using miniide. The lab covers creating a new project, writing and saving the source code, assembling the code, and running the program step-by-step using the d-bug12 monitor.

Typology: Lab Reports

Pre 2010

Uploaded on 07/30/2009

koofers-user-oyl
koofers-user-oyl 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE 3120
SPRING 2004
LAB 1 Assemble and Trace
ASSEMBLY PROGRAMMING WITH MINIIDE
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.
INTRODUCTION TO MiniIDE
MiniIDE (available on the Huang book CD) is a windows based program, which
allows assembly programmer to assemble, debug, and download a program onto the
68HC12 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.
PROCEDURE:
I) USING MINIIDE
After logon in the CadLab, click on the start menu as follows:
Start Æ Programs Æ Programming Æ MiniIDE Æ MiniIDE
1. Click on the File Æ New. This is where you will write your program.
2. Type the following program into the edit window:
2/6/04 Page 1 of 4
pf3
pf4

Partial preview of the text

Download Introduction to Assembly Programming with MiniIDE (Lab 1) - Prof. Xubin He and more Lab Reports Microcomputers in PDF only on Docsity!

S PRING 2004

L A B 1 – Assemble and Trace

A S S E M B L Y P R O G R A M M I N G W I T H M I N I I D E

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.

I N T R O D U C T I O N T O MiniIDE

MiniIDE (available on the Huang book CD) is a windows based program, which allows assembly programmer to assemble, debug, and download a program onto the 68HC12 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.

P R O C E D U R E :

I) U S I N G M I N I IDE

After logon in the CadLab, click on the start menu as follows: Start Æ Programs Æ Programming Æ MiniIDE Æ MiniIDE

  1. Click on the File Æ New. This is where you will write your program.
  2. Type the following program into the edit window:

S PRING 2004

;--------------------------------------- ;Lab# ;Assemble and Trace ;(Put your name and date here) ;--------------------------------------- org $900 ;Memory data starts at address hex 900 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 hex 900 num equ $72 ;Symbol num equals hex 72

org $800 ;Start at memory location hex 800 LDAA #num ;Load the value of label 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 num_ STAA num_1 ;Store the content of Accumulator A into mem num_ ABA ;Add the content of A & B and store result in A LDX #255 ;Load reg X with decimal value 255 (IMM addr) EXG D,X ;Exchange registers D and X SWI ;Software Interrupt Command. Makes ; Microcontroller Stop executing

  1. Save the program as Lab1.asm in your network directory.
  2. Make sure the options in MiniIDE are set properly. In the menu, select Build – Options and make sure only the following items are selected: Generate listing file, Used only, and Warning level 4.
  3. Click on the Build Current button on the task bar (or menu: Build – Build Current ). This will assemble your source code and allow you to check whether or not your program has any syntax errors.
  4. In the Output window at the bottom of the screen, you should get the assembler’s message. If it says 0 errors detected, your program has been assembled successfully. If not, go back and check where the problem is and fix it.

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 68HC12 board’s memory next. The listing file is a text file that is helpful in debugging the program.

_Approved: Lab TA _____________________ Date _____________

S PRING 2004

II) U S I N G T H E D-B U G 12 M O N I T O R C O M M A N D S

Perform Lab Exercises L3.1 through L3.4 in Huang and show to the Lab TA.

_Approved: Lab TA _____________________ Date _____________

Things to turn in as your Lab1 Report:

  1. A print out of both Lab1.asm and Lab1.lst. You’ll need to print the listing file in landscape mode to make it fit.
  2. Answers to the following questions:
    • What is shown in the listing file that was not in your source file? How might this information be useful for debugging?
    • What was the original content of memory locations num_1 and num_ after loading but before executing the program?
    • What is the final content of memory locations num_1 and num_2?
    • When you added Accumulator A and B, what were the operand values and what answer did you get?
    • List the command sequence that you entered for each of the lab exercises in Part III.