Assn4 - li $v0,1 move $a0 $s0 syscall#Print counter1 li $v0,4 la $a0 count2 syscall#Print counter 2 phrase li $v0,1 move $a0 $s1 syscall#print

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
.data str: s Prompt: .asciiz " Please Input a string (15 characters long): \n " count1: .asciiz "\n Number of upper case letters is: " count2: .asciiz "\n Number of lower case letters is: " .globl main .text main: li $v0,4 la $a0, Prompt syscall li $v0, 8 la $a0, str li $a1, 16 syscall s la $t3, str lb $t0, 0($t3) $ addi $s0, $zero, 0 #initialize counter for upper case # addi $s1, $zero, 0 #initialize counter for lowwer case # loop: beq $t0, $zero, exit jal upper jal lower addi $t3, $t3, 1 #get address of new character # lb $t0, 0($t3) j loop l exit: li $v0,4 la $a0, count1 syscall #Print counter 1 phrase
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: li $v0,1 move $a0, $s0 syscall #Print counter1 # li $v0,4 la $a0, count2 syscall #Print counter 2 phrase li $v0,1 move $a0, $s1 syscall #print counter2 # end: j end e upper: li $t1, 65 #lower bound li $t2, 90 #upper bound bgt $t0, $t2, exitup blt $t0, $t1, exitup addi $s0, $s0, 1 #increment counter exitup: jr $ra $ lower: li $t1, 97 #lower bound li $t2, 122 #upper bound bgt $t0, $t2, exitdw blt $t0, $t1, exitdw addi $s1, $s1, 1 #increment counter exitdw: jr $ra...
View Full Document

This note was uploaded on 12/02/2009 for the course CDA 3101 taught by Professor Small during the Spring '08 term at University of Florida.

Page1 / 2

Assn4 - li $v0,1 move $a0 $s0 syscall#Print counter1 li $v0,4 la $a0 count2 syscall#Print counter 2 phrase li $v0,1 move $a0 $s1 syscall#print

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online