CS计算机代考程序代写 assembler assembly Name: ________________________________________ Section: ____________ ECE 109 Exam #2

Name: ________________________________________ Section: ____________ ECE 109 Exam #2
April 19, 2021
 This exam is Open Note, Open Book, Open Calculator, Open Computer for notes.
 No correspondence is allowed with anyone other than the instructor/proctor.
 You absolutely may NOT access online resources (Google, Yahoo, Chegg, etc.) to obtain any problem solutions or previous class work from ANY organization! This applies before and during the exam.
 You may NOT have any materials printed/downloaded which were received from Anyone other than the instructor or TAs.
 Absolutely NO IMs, E-Mails, Verbal Messages, or other communications during the exam!
 If you do not have a printer available you may complete your exam on plain/lined paper and upload it at the end.
 You MUST have a camera turned on you during the entire exam. If your computer does not have a camera use a cell phone. Be sure to have your charger cable ready to cover the entire exam period.
 This is a 75 minute exam. Students who arrive late will NOT be given extra time on the exam. You are allotted 15 minutes to print the exam, 75 minutes to complete the exam, and then a final 15 minutes to scan and upload the exam. If you are still working on the exam past the 75 minute time, this will be considered cheating.
 You WILL be required to show your work for full credit! Partial Credit will be Generous!
 Please turn in your exam when asked! I consider it cheating to continue to work on an exam when told to stop and will count this as an Honor Offence!!
 Failure to abide by these rules and the NCSU Honor Policy will result in a zero on the exam and will be treated as a violation of the NCSU Code of Student Conduct.
 Read and sign the following statement. Failure to sign the statement will result in a zero on the exam.
I have neither given nor received unauthorized assistance on this test. I have notified the proctor of any violations of the above policies.
Signature: __________________________________________________

Name: __________________________
Question
Topic
Points
Score
1
I/O
15
2
Assemblers and Machine Code
30
3
Instruction Flowcharts
10
4
Von Neumann and Flowcharts
10
5
Assembly Programming
35
TOTAL
100
Except for name,
DO NOT WRITE ON THIS PAGE.
GRADER: _______________________________
ECE 109 Spring 2021 Exam #2 Page 2 of 11

Name: __________________________
[1] I/O [15 points]
Write a code segment to read the keyboard for two characters, echoing to the display each time. You must use the KBSR and KBDR registers for the reads, NOT GETC or IN. Leave the first character in R3 and the second character in R2. You do not have to convert them to a binary number. Drawing a flowchart is optional.
ECE 109 Spring 2021 Exam #2 Page 3 of 11

Name: __________________________ [2] [30 points] Assemblers and Machine Code
[a] [12 pts] Convert the following Assembly Instructions to Machine Code using the labels shown below. Assume all instructions are located at x3300.
ADD R6, R0, R3 AND R2, R5, x0C LD R2, JFK
ST R2, CLT
LDI R1, FLL
Labels: Address:
CLT x3206 RDU x3332 FLL x4430 JFK x33F5 ORD x3343
[b] [8 pts] Convert the following Machine Code instructions to Assembly Language using the same labels shown above. Assume all instructions are located at x3300.
1001 101 110 111111
0011 013 0 1111 0000
1011 001 0 0011 0001
ECE 109 Spring 2021 Exam #2 Page 4 of 11

[c] [10 points]
Name: __________________________
For the following assembly program generate the Symbol Table. There may be extra rows in the table that are not required.
.ORIG x3010
START LEA R0, VAC ; start here
PUTS
LDI R4, CLINIC
LEA R0, PACK
SPEAK PUTS
XX1 .FILL x35
.FILL x48
.FILL x53
.FILL x78
VAC .STRINGZ “\nGet Your Vaccine Today!\n”
OUCH ST R1, D1
ST R2, D2
ST R3, D3
ST R7, D7
ADD R1, R0, #0
SICK LD R3, D3
LDR R2, R1, #0
HALT
D1 .BLKW 6
D2 .FILL x0000
D3 .FILL x1234
D7 .BLKW 2
CLINIC .FILL x3057
PACK .STRINGZ “\n\n Keep our Pack Healthy!”
.END
ECE 109 Spring 2021 Exam #2 Page 5 of 11

Name: __________________________
[3] [10 points total] Instruction Flowchart
[a] [6 pts] Draw the instruction flow for the BRnzp command on the provided CPU block diagram. Number the steps.
[b] [4 pts] Describe in words each step in the instruction flowchart.
ECE 109 Spring 2021 Exam #2 Page 6 of 11

Name: __________________________ [4] [10 pts] Von Neumann and Flowcharting
[a] [4 pts] Name the registers (not acronyms) for transferring data into and out of memory
[b] [4 pts] Name the three steps to get an instruction from memory and execute it.
[d] [2 pts] What is the name of the process of starting with a high-level flowchart, and breaking it down into smaller and smaller pieces before converting to code?
ECE 109 Spring 2021 Exam #2 Page 7 of 11

Name: __________________________ [5] [35 points total] Assembly Language Coding
[a] [12pts] Write a code segment to decode the message in the string MYSTRING and display the new string using PUTS. The string is generated in memory for you by the command:
WOLF .STRINGZ “Pjju%Tzw%Ufhp%Mjfqym&~” (Sample String)
You must generate space for your new string, max length #50 characters plus null. The decode key is to subtract the value 5 from each character up to but not including the null (0) at the end of the string. You do not need to show the displayed characters.
ECE 109 Spring 2021 Exam #2 Page 8 of 11

Name: __________________________ [b] [ 4 pts] Write a code segment to subtract R2 = R6 – R5.
[c] [2 pts] Write a code segment to Clear register R2
[d] [5 pts] Write a code segment to Add x30BE to register R5
[e] [8 pts] Given a block of x20 locations of data in memory at location START1, copy every 2nd data value to a new memory block named HERE1. You must create the space for the new data block in memory.
ECE 109 Spring 2021 Exam #2 Page 9 of 11

Name: __________________________
[f][4 pts] OR the values from memory locations NUM1 and NUM2 and place the result in NUM3
ECE 109 Spring 2021 Exam #2 Page 10 of 11

Name: __________________________
ECE 109 Spring 2021 Exam #2 Page 11 of 11

Name: __________________________
n 2n 01 12 24 38
4 16 5 32 6 64 7 128 8 256 9 512
10 1024 (1K)
11 2048 (2K)
12 4096 (4K)
13 8192 (8K)
14 16,384 (16K)
15 32,768 (32K)
16 65,536 (64K)
TRAP TABLE
ECE 109
Spring 2021
Exam #2
Page 12 of 11