Write a program which takes character input from user in a stack and print it in reverse order in MARs (Assembly Language)  ?  ANS:  ...

Write a program which takes character input from user in a stack and print it in reverse order in MARs (Assembly Language)  ? 

ANS: 

.data

a1: .asciiz "Enter values : \n"
a2: .asciiz " \n "
.text
main:

loop:
li $v0,4
la $a0,a1
syscall
li $v0,12
syscall
move $t0,$v0

beq $t0,'?',Reverse            #Condition if $t0 = '? '
addi $sp,$sp,-4
sw $t0,0($sp)
j loop 

Reverse: 
li $v0,4
la $a0,a2
syscall

li $v0,11
lw $a0 , 0($sp)
syscall
addi $sp,$sp,4
beq $a0,0,label
j Reverse 

label:

li $v0,10
syscall



Name

Books,1,Gallery,1,
ltr
item
MufasaGroup
MufasaGroup
https://mufasagroup.blogspot.com/2016/12/write-program-which-takes-character.html
https://mufasagroup.blogspot.com/
http://mufasagroup.blogspot.com/
http://mufasagroup.blogspot.com/2016/12/write-program-which-takes-character.html
true
3180243321548045405
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy