Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

- Use the code provided in startercode.s and put your code in the spot that says Your code here. - DONOT use r0 and r1

- Use the code provided in startercode.s and put your code in the spot that says Your code here. - DONOT use r0 and r1 for your code because that part is used in starter code.

Q5. Load a value from a variable using .data directive into r2. [make sure not to use R0 and R1 to load and access the data]. Create the following mask into r3: - To write 1 into 8th bit

Q6. Load a value from a variable using .data directive into r3. [make sure not to use R0 and R1 to load and access the data]. Toggle the 8th bit of r3.

Q7. Load a value from a variable using .data directive into r3. [make sure not to use R0 and R1 to load and access the data]. Toggle 8th, 19th and 25th bit of r3.

Here is the code for startercode.s (in ARMv7)

// Constants

.equ UART_BASE, 0xff201000 // UART base address

.equ MASK, 0x0F

.equ DIGIT, 0x30

.equ LETTER, 0x37

.org 0x1000 // Start at memory location 1000

.text // Code Section

.global _start

_start:

/////////////////////////////////////// ///////////Your Code Here ///////////// ///////////////////////////////////////

// Print R3 to UART as ASCII

LDR R0, =UART_BASE

MOV R1,#8

// Print the register contents as ASCII characters

// Assumes value to print is in R3, UART address in R0

// Uses R1 for counter and R2 for temporary value

// R0 and R3 are preserved

TOP:

ROR R3,#28 // Rotate next four bits to LSB

MOV R2,R3 // Copy to R2 for masking

AND R2,R2,#MASK // Keep last 4 bits only

CMP R2,#9 // Compare last 4 bits to 9

ADDLE R2,R2,#DIGIT // add ASCII coding for 0 to 9

ADDGT R2,R2,#LETTER // add ASCII coding for A to F

STR R2,[R0] // Copy ASCII byte to UART

SUB R1,#1 // Move to next byte

CMP r1,#0 // Compare the countdown value to 0

BGT TOP // Branch to TOP if greater than 0

_stop:

B _stop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

11.1 Explore the role of labor unions.

Answered: 1 week ago