Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #load the ASCII needed
- li $t1, ' '
- li $t2, '0'
- li $t3, ':'
- li $t4, 'A'
- li $t5, '['
- li $t6, '`'
- li $t7, '{'
- li $t8, 'z'
- #load keystrokeCounter
- la $s5, keystrokeCounter
- #promt message for user input
- la $a0, userInput
- li $v0, 4
- syscall
- #take user input and store it in register t0
- li $v0, 8
- la $a0, userString
- li $a1, 400
- move $t0, $a0
- syscall
- #counter
- la $s0, initial
- #time to make this loop :(
- #exit at end of string
- beq $s0, 400, exit
- lb $t0,($s0)
- #check for null
- beq $t0,$zero,exit
- #branch if character is a space
- beq $t1, $t0 space
- #branch if less than 0 (special char)
- blt $t0, $t2, special
- #branch if less than : (digit)
- blt $t0, $t3, digit
- #branch if less than A (special)
- blt $t0, $t4, special
- #branch if less than [ (letter)
- blt $t0, $t5, letter
- #branch if less than ' (special)
- blt $t0, $t6, special
- #branch if less than { (letter)
- blt $t0, $t7, letter
- #branch if greater than z (special
- bgt $t0, $t8, special
- #end of label
- li $v0, 10
- syscall
- #return back to main while loop
- j while
- #end of label
- li $v0, 10
- syscall
- #return back to main while loop
- j while
- #end of label
- li $v0, 10
- syscall
- #return back to main while loop
- j while
- #end of label
- li $v0, 10
- syscall
- #return back to main while loop
- j while
- #end of label
- li $v0, 10
- syscall
- #print spaces
- li $v0, 4
- la $a0, spaceInfo
- syscall
- lbu $s5,($s1) #load desired index to print
- li $v0, 1 #tell mips to print int
- move $s5, $a0 #move print target to a0 (where it will be printed)
- syscall #print
- li $v0, 4
- la $a0, newLine
- syscall
- #print letters
- li $v0, 4
- la $a0, letterInfo
- syscall
- lbu $s5,($s2) #load desired index to print
- li $v0, 1 #tell mips to print int
- move $s5, $a0 #move print target to a0 (where it will be printed)
- syscall #print
- li $v0, 4
- la $a0, newLine
- syscall
- #print digits
- li $v0, 4
- la $a0, digitInfo
- syscall
- lbu $s5,($s3) #load desired index to print
- li $v0, 1 #tell mips to print int
- move $s5, $a0 #move print target to a0 (where it will be printed)
- syscall #print
- li $v0, 4
- la $a0, newLine
- syscall
- #print special chars
- li $v0, 4
- la $a0, specialInfo
- syscall
- lbu $s5,($s4) #load desired index to print
- li $v0, 1 #tell mips to print int
- move $s5, $a0 #move print target to a0 (where it will be printed)
- syscall #print
- #end of program
- li $v0, 10
- syscall
Add Comment
Please, Sign In to add comment