Assignment Numerics Conditional Branching and the Stack TURN IN

Reviews
Shared by: Zach Morris
Stats
views:
1
rating:
not rated
reviews:
0
posted:
4/8/2009
language:
pages:
0
91.305 Assignment 4: Numerics, Conditional Branching, and the Stack TURN IN THESE SHEETS. NAME                                                                                             PROBLEM 1—NUMERIC CONVERSIONS. Convert between numeric representations of decimal unsigned, decimal signed, 1-byte hexadecimal, 2-byte hexadecimal, and 8-bit binary as requested. On each row, fill in any conversion marked with a “?”. Note: When dealing with signed representations, you must know whether you are working with 8bit or 16-bit numbers. Hence, for the conversions involving negative signed numbers, look at the Hex columns to see whether to work with an 8-bit or 16-bit number (one of them will be dashed out; use the other). The first few are done for you to give you the idea. Remember: If a line is dashed out, you don’t need to complete it. Unsigned Signed Decimal Decimal 1-Byte Hex 2-Byte Hex 8-Bit Binary ----------------------------------------------------------------------0 0 00 0000 00000000 18 255 64 30 250 ? ? ? ? ? ? ----1 64 30 ? -1 ? ? ? ? ? 12 ff ? ? ? -7f 80 ---0012 ---? ? ---ffff ------1000 7fff 8000 00010010 11111111 ? ? ? -------? ? ---------------------page 1 http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/assignment4.pdf 91.305 Assignment 4: Numerics, Conditional Branching, and the Stack PROBLEM 2—BRANCHING AND THE CONDITION CODE REGISTER. For each of the following code excerpts, determine whether or not the branch will be taken: • Determine the value in accumulator A. • Fill in the contents of the condition code register. Indicate 1, 0, or – (unknown) for each of the four CCR bits N, Z, V, and C (negative, zero, overflow, and carry) • Indicate whether the branch will be taken. Example: ldaa #0 inca bne target Accum A= 0x01 CCR bits NZVC= 0000 Branch Y/N? Y                                                                                                                                                                       Problem 2a ldaa #1 deca beq target Accum A= CCR bits NZVC= Branch Y/N?                                                                                                                                                                       Problem 2b clra deca beq target Accum A= CCR bits NZVC= Branch Y/N?                                                                                                                                                                       Problem 2c ldaa #0xff inca beq target Accum A= CCR bits NZVC= Branch Y/N?                                                                                                                                                                       http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/assignment4.pdf page 2 91.305 Assignment 4: Numerics, Conditional Branching, and the Stack Problem 2d ldaa #10 suba #10 bmi target Accum A= CCR bits NZVC= Branch Y/N?                                                                                                                                                                       Problem 2e ldaa #0x10 suba #10 bhs target Accum A= CCR bits NZVC= Branch Y/N?                                                                                                                                                                       Problem 2f ldaa #0x80 asla bcs target Accum A= CCR bits NZVC= Branch Y/N?                                                                                                                                                                       Problem 2g ldaa #10 cmpa #10 beq target Accum A= CCR bits NZVC= Branch Y/N?                                                                                                                                                                       Problem 2h ldaa #0xf0 anda #0x80 bmi target Accum A= CCR bits NZVC= Branch Y/N?                                                                                                                                                                       http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/assignment4.pdf page 3 91.305 Assignment 4: Numerics, Conditional Branching, and the Stack PROBLEM 3—OPERATION OF THE STACK. Consider the following HC11 program, which loaded into memory at location 0xb600. Your task is to specify (1) the contents of the stack and (2) the values in the SP (stack pointer) and X registers at three different points of the program execution. mem object location code bytes B600 8E 01 FF B603 CE 10 00 B606 3C B607 BD B6 0D B60A 38 B60B 20 FE B60D B610 B611 B613 CE 01 F4 09 26 FD 39 line # 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 start: instruction lds #0x1ff ldx #0x1000 pshx jsr delay pulx done: bra done comment ; set stack ptr ; initialize X ; put X on stack ; call subr ; restore X ; all done delay: ldx #500 delaylp: dex bne delaylp rts Use the diagrams below to fill in your answers. The first one is done for you. Please note: • Write all values in hex. Do not put the “0x” prefix in the boxes. • In each stack memory address, write two hex digits (for 1 byte). • In the SP and X register boxes, write four hex digits (for 2 bytes). • “After line 9” means: after the instruction at line 5 has executed, but before the very next instruction has been run. • If a value is unknown or indeterminate, mark it with a dash. • The first problem is done for you. after line 9: STACK m em addr contents 0x01FB 0x01FC 0x01FD 0x01FE 0x01FF SP reg X reg after line 10: STACK m em addr contents 0x01FB 0x01FC 0x01FD 0x01FE 0x01FF SP reg X reg after line 18: STACK m em addr contents 0x01FB 0x01FC 0x01FD 0x01FE 0x01FF SP reg X reg after line 14: STACK m em addr contents 0x01FB 0x01FC 0x01FD 0x01FE 0x01FF SP reg X reg http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/assignment4.pdf page 4

Related docs
Branching and Looping
Views: 80  |  Downloads: 2
Conditional Assignment
Views: 285  |  Downloads: 5
Templates, STL, some Conditional
Views: 4  |  Downloads: 0
Lesson 2.2 � Conditional Statements
Views: 42  |  Downloads: 1
Conditional Gifts
Views: 89  |  Downloads: 1
FNB_Conv_Stack
Views: 0  |  Downloads: 0
Outline Function calls Stack layout
Views: 28  |  Downloads: 0
Other docs by Zach Morris
How Great is our God
Views: 334  |  Downloads: 7
I Am a Sheep
Views: 259  |  Downloads: 2
dv145
Views: 132  |  Downloads: 0
I Am Mine No More
Views: 215  |  Downloads: 0
It is the Cry of My Heart
Views: 203  |  Downloads: 0
I Love You Lord
Views: 434  |  Downloads: 8
dv260
Views: 87  |  Downloads: 0
dv105c
Views: 143  |  Downloads: 0
For All That You ve Done00
Views: 246  |  Downloads: 0
Van Valkenburgh v Lutz
Views: 2752  |  Downloads: 27
World History Standards Test
Views: 385  |  Downloads: 3
I Cry Out
Views: 341  |  Downloads: 0
Order of Trial
Views: 266  |  Downloads: 1
Jesus Name Above All Names
Views: 1213  |  Downloads: 2