hw5_solution - and the 6 th bits of the value at $C100 and...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE331 SS-08 HOMEWORK #5 Solution Problems from the textbook Chapter 2: Fundamental: 8. The effective address is calculated as the contents of X+20. The contents of this effective address are loaded into accumulator A. 10. Program: ORG 0000 FCB $12 FCB $10 12. (a) The directive initialized two memory locations designated by label DATA with $C2, $00. (b) The FCB directive initializes the next memory location with $F0. (c) The FDB directive initializes the next two 8-bit memory locations with $11 and $00. 13. FCB allows you to initialize the reserved location. RMB does not. Advanced: 9. We must first calculate the number of bytes for each instruction so we can determine the offset. DECA Æ 1 byte TSTA Æ 1 byte BNE Æ 2 bytes Thus we need to jump back 4 bytes. -4 = $FC. Therefore, the relative address should be $FC. Challenging: 3. There are many ways to do this. Here is one possible solution: 5. The first three instructions store $F0 and $0D to memory locations $C100 and $C101, respectively. The BSET instruction sets the 2 nd
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and the 6 th bits of the value at $C100, and the BCLR instruction clears the 0 th and the 4 th bits of the value at $C101. The resulting values, therefore, are $F4 and $0C in $C100 and $C101 respectively. 6. Many ways to do this. Most common is to set up a mask to check the bits. Problems from the textbook Chapter 3: Fundamental: 2. Each 68HC12 assembler creates two files during an assembly process: “filename.s19” and “filename.lst”. The “s19” file is the machine language file which is loaded onto a 68HC12 controller for execution. The “lst” file contains the hexadecimal machine language code, the original assembly language code, and the memory locations where the machine code is stored. The “lst” file is a valuable tool for debugging purposes. In addition, some assemblers create other files such as a backup file and a simulation file for 68HC12 simulators. Challenging: 2. Hand assembled program is as follows: Note that RESULT is allocated memory at address $C20D, at the end of the program....
View Full Document

This note was uploaded on 03/24/2008 for the course EGR 331 taught by Professor Jayanthirao during the Spring '08 term at Michigan State University.

Page1 / 2

hw5_solution - and the 6 th bits of the value at $C100 and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online