DOC PREVIEW
NMT EE 308 - EE 308 – Homework 4

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

EE 308 Spring 2005EE 308 – Homework 4Due Feb. 14, 20051. Find the values of the N, Z, C, and V bits of the CCR register after execution of each of thefollowing instructions, given that (A) = $5A and the condition flags are N=1, C=0, Z=0, andV=1. (Assume these are the values before each instruction starts – e.g., do not use the flagstate resulting from the instruction in part (a) as the initial state for part (b).)(a) ADDA #$5C(b) ADDA #$27(c) LSRA(d) CMPA #$60(e) SUBA #$40(f) ASLA2. Suppose you started with the following register contents:P-C007 Y-7892 X-FF00 A-44 B-70 SP-C04AWht address is in the stack pointer and exactly what is in the stack after the followinginstructions sequence is executed:PSHAPSHBPSHY3. Write a subroutine to copy data one byte at a time from memory location $2000 to memorylocation $3000 until a byte with $FF is detected.4. Below are some data in the HC12 memory:0 1 2 3 4 5 6 7 8 9 A B C D E F0900 D6 05 35 CF E0 00 FE 08 20 A6 00 47 6A 05 08 530910 26 F7 34 C6 C8 CD 9C 40 03 26 FD 53 26 F7 3D 3F0920 07 C2 3A 68 F3 09 C2 67 9A 0F AA 55 08 40 CD CFIndicate the values in the registers after the HC12 executes the following instructions. Alsowrite down the number of cycles needed to execute each instruction. Show what will be in theregisters (in hex) after each of the instructions. If the instruction does not change a register,you may leave that entry blank. Note that the first instruction is located at address 0x0800.DInstruction A B X Y SP N Z V C Addr EffectiveMode AddressAA 25 0910 0900 0A00 1 0 1 0lds #$0920anda 2,x-tappulystaa $01bita $09131EE 308 Spring 20055. Below is the listing from the Cosmic Asse mbler after assembling a s imple program. Bec auseof a bad printer, a few of the entries are blank. There is s ufficient information in the listingto determine what the missing information is. Fill in the blanks with the correct values.12 00001000 prog: equ _____3 00002000 data: equ $20004 ________ stack: equ $3c005 00000000 PORTA: equ $006 00000002 DDRA: equ ___78 CODE: section .text9 1000 org prog10 1000 ______ lds #stack11 1003 180bff0002 movb #$ff,DDRA12 ____ ce2000 loop1: ldx #table13 100b 180d300000 loop2: ____ 1,x+,PORTA14 1010 ______ jsr delay15 1013 8e2008 cpx #table_end16 1016 23f3 bls _____17 1018 20ee bra _____1819 101a 36 delay: psha20 101b __ pshx21 101c 86fa ldaa _____22 101e ce0c80 l1: ldx #320023 1021 0435fd l2: dbne x,l224 1024 0430f7 ____ a,l125 1027 30 pulx26 1028 32 pula27 1029 3d rts2829 DATA: section .data30 2000 org data31 2000 ________ table: dc.b $00,$80,$C0,$E032 ____ f0f8fcfe dc.b $F0,$F8,$FC,$FE33 2008 ff table_end: dc.b $FF2EE 308 Spring 20056. Write a program fragment which will make Bits 6, 4, 2, and 1 of Port A output, and the otherbits of Port A


View Full Document

NMT EE 308 - EE 308 – Homework 4

Documents in this Course
Load more
Download EE 308 – Homework 4
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view EE 308 – Homework 4 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view EE 308 – Homework 4 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?