Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2.     str1: .asciiz "Lager"
  3.     str2: .asciiz "Regal"
  4.     str3: .space 10
  5.     .byte 0xff
  6.     .byte 0xff
  7. .text  
  8.     #convention s1 is for adresses
  9.     ori $s0, $zero, 0x5A #0x5A Z everything above is lowercase or
  10.     ori $s2, $zero, 0x40 #0x40 A everything below isnt a standard letter
  11.     #int mains
  12. main:
  13.     la $s1, str2
  14.     jal loadingbyte
  15.     j finalend
  16.    
  17. loadingbyte:
  18.     lbu $a0, ($s1) #loads byte
  19.     j strtolower #jumps to the fucntion
  20.    
  21. strtolower: #load data into
  22.     beqz $a0, funcstop #if byte is 00 stop programm
  23.     #if not ment to change jump back
  24.     blt $s0, $a0, funcend
  25.     blt $a0, $s2, funcend
  26.    
  27.     #if uppercase addi 32 to make it lowercase
  28.     addi $a0 ,$a0 ,32
  29.     sb $a0, ($s1) #store changed byte
  30. funcend:
  31.     addi $s1, $s1, 0x01 #increasing the position in data section by 1 byte
  32.     j loadingbyte
  33. funcstop:
  34.     jr $ra
  35. finalend:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement