Fill in the table of registers and the blank boxes in the diagram of memory with numbers to show the state of the assemb

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Fill in the table of registers and the blank boxes in the diagram of memory with numbers to show the state of the assemb

Post by answerhappygod »

Fill In The Table Of Registers And The Blank Boxes In The Diagram Of Memory With Numbers To Show The State Of The Assemb 1
Fill In The Table Of Registers And The Blank Boxes In The Diagram Of Memory With Numbers To Show The State Of The Assemb 1 (158.46 KiB) Viewed 25 times
Fill in the table of registers and the blank boxes in the diagram of memory with numbers to show the state of the assembly-language program on the last time it gets to POINT ONE. GPR address value of GPR when main label starts up_c Ox0040_0060 $s0 12 up_s Ox0040_0078 $s1 34 main Ox0040_0008 $s2 56 dd Ox1001_0000 $sp Ox7fff_edco Ox1001_0007 $ra Ox0040_0050 Assume that memory is little-endian and write memory contents as values of bytes. Note that some of the memory bytes in the diagram might not be used by the program. Use base ten or hexadecimal format for numbers, whichever is more convenient for any particular number. Use "??" to indicate that there is no way to determine the value of a number. Here are some useful ASCII codes: 117-122 for 'u' through 'z'; 85-90 for 'U' through 'Z'; 51 for '3'. SS Memory, last time at POINT ONE STACK data saved before main was called GPR values, last time at POINT ONE register value $v0 $s0 $s1 $s2 $sp $ra higher addresses .data Ox1001_0004 Ox1001_0000 +3 +0 +2 +1 byte offset

int up_c(int c) { if ('a' <= c && c <= 'Z') C -= 32; return c; } up_c: .text globl up_c addiu $t0, $a0, -97 sltiu $t1,$t0, 26 beq $t1, $zero, L1 addiu $a0, $a0, -32 addu $v0, $a0, $zero L1: # POINT ONE jr $ra int up_s (char *d, const char *s) { int k; k = 0; while (* != '\0') { *d = up_c(*s); d++; s++; k++; } *d = '\0'; return k; } SW SW SW char dd[ ] = "uvwxyz"; char ss[ ] = "zY3x"; int main(void) { up_s(dd, ss); return 0: } .text .globl up_s up_s: addiu $sp,$sp, -16 $ra, 12($sp) $s2, 8($sp) $51, 4($sp) SW $50, 0($sp) addu $50, $a0, $zero addu $s1, $a1, $zero addiu $s2, $zero, o L2: lbu $al, ($s1) beq $a0, $zero, L3 jal up_c sb $v0, ($s0) addiu $50, $50, 1 addiu $s1, $s1, 1 addiu $s2, $s2, 1 j L2 L3: sb $zero, $s0) addu $v0, $s2, $zero lw $s0, 0($sp) lw $51, 4($sp) lw $s2, 8($sp) lw $ra, 12($sp) addiu $sp,$sp, 16 jr $ra om dd: .data globl dd asciiz "uvwxyz" globl ss .asciiz "zY3x" SS: main: SW text globl main addiu $sp,$sp, -4 $ra, 0($sp) la $a0, dd la $a1, ss jal up_s addiu $v0, $zero, O lw $ra, 0($sp) addiu $sp,$sp, 4 jr $ra
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply