I need help with MIPS Assembly Language. I\'m using the MARS program development
ID: 3793400 • Letter: I
Question
I need help with MIPS Assembly Language. I'm using the MARS program development environment.
Demonstrate how to implement loops in MIPS. The program should read from memory the contents of an array containing an arbitrary number of characters, followed by a period (‘.’). Your program should create a second character array which is identical to the first, except that the case of every alphabetical letter has been changed: for example, given the input string “Ab()Cd1234EfGh#.”, your program would create the string “aB()cD1234eFgH#.” and store it in a buffer. Test the program using input strings of different lengths. The program may assume that the input string will always contain a single period, which will always be the last character.
Explanation / Answer
.file 1 "" .section .mdebug.abi32 .previous .gnu_attribute 4, 1 .abicalls .section .rodata.str1.4,"aMS",@progbits,1 .align 2 $LC0: .ascii "Input a string " .text .align 2 .globl main $LFB0 = . .set nomips16 .ent main .type main, @function main: .frame $sp,1032,$31 # vars= 1000, regs= 2/0, args= 16, gp= 8 .mask 0x80010000,-4 .fmask 0x00000000,0 .set noreorder .cpload $25 .set nomacro addiu $sp,$sp,-1032 $LCFI0: sw $31,1028($sp) $LCFI1: sw $16,1024($sp) movz $31,$31,$0 $LCFI2: .cprestore 16 lw $4,%got($LC0)($28) lw $25,%call16(puts)($28) nop jalr $25 addiu $4,$4,%lo($LC0) lw $28,16($sp) addiu $16,$sp,24 lw $25,%call16(gets)($28) nop jalr $25 move $4,$16 lw $28,16($sp) b $L2 nop $L5: beq $6,$0,$L3 nop b $L4 sb $5,0($16) $L3: beq $4,$0,$L4 addiu $2,$2,-32 sb $2,0($16) $L4: addiu $16,$16,1 $L2: lb $3,0($16) nop andi $2,$3,0x00ff addiu $6,$2,-65 addiu $4,$2,-97 andi $6,$6,0x00ff andi $4,$4,0x00ff sltu $6,$6,26 addiu $5,$2,32 bne $3,$0,$L5 sltu $4,$4,26 lw $25,%call16(puts)($28) nop jalr $25 addiu $4,$sp,24 lw $31,1028($sp) move $2,$0 lw $16,1024($sp) j $31 addiu $sp,$sp,1032 .set macro .set reorder .end main $LFE0: .size main, .-main .section .eh_frame,"aw",@progbits $Lframe1: .4byte $LECIE1-$LSCIE1 $LSCIE1: .4byte 0x0 .byte 0x1 .globl __gxx_personality_v0 .ascii "zP " .uleb128 0x1 .sleb128 -4 .byte 0x1f .uleb128 0x5 .byte 0x0 .4byte __gxx_personality_v0 .byte 0xc .uleb128 0x1d .uleb128 0x0 .align 2 $LECIE1: $LSFDE1: .4byte $LEFDE1-$LASFDE1 $LASFDE1: .4byte $LASFDE1-$Lframe1 .4byte $LFB0 .4byte $LFE0-$LFB0 .uleb128 0x0 .byte 0x4 .4byte $LCFI0-$LFB0 .byte 0xe .uleb128 0x408 .byte 0x4 .4byte $LCFI2-$LCFI0 .byte 0x11 .uleb128 0x10 .sleb128 2 .byte 0x11 .uleb128 0x1f .sleb128 1 .align 2 $LEFDE1: .ident "GCC: (Debian 4.4.5-8) 4.4.5"
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.