Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/* * AFunctions.s * * Please rename this file as Homework6_yourReadID.s and submit only this file */ .global isNumber .data // declare any global variables

image text in transcribed

/* * AFunctions.s * * Please rename this file as Homework6_yourReadID.s and submit only this file */ .global isNumber .data // declare any global variables here .text isNumber: mov r12,r13 // save stack pointer into register r12 sub sp,#32 // reserve 32 bytes of space for local variables push {lr} // push link register onto stack -- make sure you pop it out before you return // Your solution here pop {lr} // pop link register from stack mov sp,r12 // restore the stack pointer -- Please note stack pointer should be equal to the // value it had when you entered the function . mov pc,lr // return from the function by copying link register into program counter global compare .data // declare any global variables here .text compare: mov r12,r13 // save stack pointer into register r12 sub sp,#32 // reserve 32 bytes of space for local variables push {lr} // push link register onto stack -- make sure you pop it out before you return // Your solution here pop {lr} // pop link register from stack mov sp,r12 // restore the stack pointer -- Please note stack pointer should be equal to the // value it had when you entered the function . mov pc,lr // return from the function by copying link register into program counter global countOnes .data // declare any global variables here countOnes compare: mov r12,r13 // save stack pointer into register r12 sub sp,#32 // reserve 32 bytes of space for local variables push {lr} // push link register onto stack -- make sure you pop it out before you return // Your solution here pop {lr} // pop link register from stack mov sp,r12 // restore the stack pointer -- Please note stack pointer should be equal to the // value it had when you entered the function . mov pc,lr // return from the function by copying link register into program counter global returnHammingDistance .data // declare any global variables here returnHammingDistance compare: mov r12,r13 // save stack pointer into register r12 sub sp,#32 // reserve 32 bytes of space for local variables push {lr} // push link register onto stack -- make sure you pop it out before you return // Your solution here pop {lr} // pop link register from stack mov sp,r12 // restore the stack pointer -- Please note stack pointer should be equal to the // value it had when you entered the function . mov pc,lr // return from the function by copying link register into program counter 
COMPE 271 Homework 6 General Instructions: In the following pages you are requested to write 4 Assembly language functions. The skeleton code for the C version of these functions is given below Place all Assembly functions into a file named as "Homework6 _yourreadID.S" and submit this file on blackboard. Please note that you will write all functions in this homework in assembly. Function 1: int isNumber(char *c) Function should return 1 is the argument passed is a digit and zero otherwise. Please note the asci equivalents of numeric characters from an asci table. Function 2: Given the following C function prototype that accepts two integer arguments. Complete the function and return 1 if a >b, return -1 if a b, return -1 if a

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

More Books

Students also viewed these Databases questions