Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #mirroring_char
- .data
- buffer: .space 100
- .text
- main:
- #---Input------
- li $v0, 8
- la $a0,buffer
- li $a1,100
- syscall
- #inicialization
- move $s0,$a0 # s0 - buffer base adress
- move $s1,$a1 # s1 - buffer size
- #t0 = 0 # t0 - iterator
- #t1 # t1 - current symbol
- move $t2,$s0 # t2 - current adress
- #t3 # t3 - mirrored symbol
- li $t4, 219 # t4 - mirror center
- #li $t5, '\n' # t5 - \n symbol
- li $t6, 96 # t6 - mirror center
- #--------------
- loop:
- lb $t1,0($t2)
- sle $t5, $t1, $t6 #if loaded symbol != alpha
- bne $t5, $zero, endloop
- sub $t3, $t4, $t1
- sb $t3,0($t2)
- beq $t0,$s1,endloop #if t0 == s1
- addi $t0,$t0,1
- addi $t2,$t2,1
- j loop
- endloop:
- li $v0, 4
- move $a0, $s0
- # output
- syscall
- li $v0, 10
- # terminate program
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement