Page 1 of 1

Each procedure will be worth 25pts, for a total of 100pts. Complete the assembly language program with the following pro

Posted: Sun May 15, 2022 8:39 am
by answerhappygod
Each Procedure Will Be Worth 25pts For A Total Of 100pts Complete The Assembly Language Program With The Following Pro 1
Each Procedure Will Be Worth 25pts For A Total Of 100pts Complete The Assembly Language Program With The Following Pro 1 (73.63 KiB) Viewed 39 times
Each Procedure Will Be Worth 25pts For A Total Of 100pts Complete The Assembly Language Program With The Following Pro 2
Each Procedure Will Be Worth 25pts For A Total Of 100pts Complete The Assembly Language Program With The Following Pro 2 (100.99 KiB) Viewed 39 times
This needs to be programmed in y86, this is all the
information
Each procedure will be worth 25pts, for a total of 100pts. Complete the assembly language program with the following procedures: 1. strlen(string length): calculate the length of a zero-terminated string. Input: String address in %rdi Output: Length in %rax 2. strcmp (string compare): compare two strings, returning 0 if they are identical Inputs: String addresses in %rdi, %rsi • Output: 0 in %rax if strings are identical; otherwise %rax contains one more than the index of the character mismatch 3. strrev (string reverse): reverses (in place) the characters in a string 4. is-palindrome (test for palindrome): compute if a valid palindrome or not • Input: String address in %rdi • Output: 0 in %rax if the string is a palindrome; 1 if not Hints: You may find it useful to use the strlen procedure you wrote as part of other procedures. What area in memory do we use when we have run out of input registers? How can this be used in these procedures? You have been provided some solutions to the test values as part of the boilerplate code. • Make use of your knowledge of function calls, for every push make sure to pop, handle input and return registers, etc.

-pos o main: irmovq 0x29, %r11 irmovq Oxo, %r12 irmovq Ox14, %13 irmovq Oxo, %r14 irmovq Oxo, %r8 irmovq Ox1, %r9 irmovq stack, %rsp # Set the stack pointer # Start Testing Procedures # String Length Test irmoq str_1, %rdi call strlen rrmovq krax, %:11 # String Comp Test irmoq str_1, %rsi call strcmp rrmova Krax, %r12 # String Comp Test irmovq str 2, %rsi call strcmp rrmovq krax, %r13 # String Rev Test irmovq str_3, %rdi call strrev irmovq ans_3, %rsi call strcmp rrmova Krax, %r14 # Palindrome Test irmovq str_5, %rdi call is_palindrome rrmovq rax, %r8 irmovq str_3, %rdi call is-palindrome rrmovq krax, %r9 halt .align 8 str_1: .quad Ox7420746e61772049 .quad 0x7420646e6966206 .quad 0x74676e656c206568 .quad 0x6968742066682068 .quad 0x676e697274732073 .quad 0x2e6e69727473002e str 2: 2