Review Test Submission: Lab 02: Memory access instructions &....pdf

This preview shows page 7 - 8 out of 8 pages.

.section .text .globl lab02b lab02b: ADRP X0, msg1 ADD X0,X0, :lo12:msg1 LDURB W1, [X0,3] //load the character into W1 ADD W1, W1, -0x20 //encap the letter STURB W1, [X0,3] //store the new letter nomodify: BR X30 .section .data msg1: .asciz "This is the test sentence" Save the file. Modify the lab02 "main.c" and "Makefile" files such that your new function, lab02b is called by main() after test and such that the new file is compiled during the normal build process. (If you are unfamiliar with makefiles you may want to look at some howto's on the web about them. This is a reasonable one: ). Build and run your lab and demo it for your TA In the space below, describe what this function does.
…_3003573_1&outcome_id=_27111066_1&outcome_definition_id=_1010181_1 Response Feedback: [None Given] Question 8 In this problem you will create another assembly file, run it and determine what it does. Using a similar procedure as in the last problem create a new assembly file, "lab02c.S" with the following code in it: .section .text .globl lab02c lab02c: ADRP X3, hextable ADD X3,X3, :lo12:hextable ADRP X5, result ADD X5,X5, :lo12:result LSR X1, X0, 4 //get upper 4 bits ADD X2, X1, X3 //get address in hextable LDURB W4, [X2,0] //get character STURB W4, [X5,0] // first digit of the result AND X1, X0, 0xf //get lower 4 bits ADD X2, X3, X1//get address in hextable LDURB W4, [X2,0] //get character 10 out of 10 points
6/28/17, 9*50 AM Review Test Submission: Lab 02: Memory access instructions &... Page 8 of 8 …_3003573_1&outcome_id=_27111066_1&outcome_definition_id=_1010181_1 Wednesday, June 28, 2017 9:49:56 AM CDT STURB W4, [X5,1] // first digit of the result BR X30 .section .data hextable: .asciz "0123456789abcdef" msg1: .asciz "Your number in Hex is: " result: .byte 2

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture