assembly


MIPS Assemply Language Convert using radix


I have this code, but I have to make some changes to it.
The following MIPS code converts an unsigned integer stored in register $a0 into a string stored in the data segment in memory. The string is initialized with 10 space characters. The string has 10 characters only because a 32-bit unsigned integer can have at most 10 digits.
.data
str: .asciiz " " # str = 10 space characters
.text
.globl main
main:
li $a0, 5128 # $a0 = unsigned integer to convert
la $v0, str # load address of str into $v0
addiu $v0, $v0, 11 # $v0 = pointer at end of str
li $a1, 10 # Initialize $a1 = 10
int2str:
divu $a0, $a1 # divide $a0 by 10
mflo $a0 # $a0 = quotient
mfhi $t0 # $t0 = remainder (0 to 9)
addiu $t0, $t0, 48 # convert digit into a character
addiu $v0, $v0, -1 # point to previous space character
sb $t0, ( $v0) # store byte: Memory($v0) = $t0
bnez $a0, int2str # loop back if quotient is not zero
done:
. . . # $v0 = pointer to string in memory
The integer-to-string program presented above converts an unsigned integer to string format using successive division by 10 and storing the remainder digit characters in a string. It is also possible to convert the unsigned integer to any radix using successive divisions by the radix value. Rewrite the integer-to-string program asking the user to input an unsigned integer and a radix value between 2 and 10. Do the radix conversion and then print the string. Make sure that the string has sufficient space characters, especially when converting to radix

Related Links

How to change the comment sign for m4's --synclines option?
Define “getting a value from the chip” vs. using a provided constant - assembly
I want to copy bytes from file to string
Assembly language simple program
repeating mov instruction x86
How to display value having RIP relative address in gdb?
GNU 8085 Simulator(How to change the initial starting address)
NASM - Get number of items in stack
Assembly, easy code, Segmentation fault why
How to write a procedure to print a string and a newline character in x86 assembly?
Profiling compiled code without source code?
Where is -32768 coming from?
Printing decimal number in assembly language?
How to take digits as input in Assembly Language then print them as a number?
Indirection on a DEC PDP 8
OP code for shifting operations (Intel, ARM)

Categories

HOME
django
delphi-7
eslint
ng-idle
wakanda
object
zend-framework
battery
pdfbox
static-site
big-o
spring-session
jtextpane
google-schemas
jsonpath
altera
azure-powershell
dimensional-modeling
cfml
sencha-touch
topology
guzzle
ksh
dpdk
custom-post-type
motion-detection
recurring-events
zend-debugger
mustache
jmockit
papaparse
navigator
python-pptx
tex
nohup
sim-card
recurrent-neural-network
verifiable-c
plaintext
subclipse
outputcache
reportservice2010
geotiff
rserve
remedy
cpu-cache
vcloud-director-rest-api
builtins
reporting-services-2012
envi
file-uri
signalr.client
eigenvector
database-relations
jparsec
qbxml
piracy-prevention
concept-insights
directdraw
concurrentmodification
lazybones
text-search
canalyzer
airbrake
ansi
google-refine
typeconverter
grouping-sets
exceldatareader
ssis-data-flow
crowd
post-commit-hook
sql-scripts
template-deduction
verold
c++builder-xe5
neos-server
traceability
alice
asplinkbutton
bjyauthorize
sentestingkit
multiplexing
infobright
jquery-address
convention
workflow-services
android-holo-everywhere
webdev.webserver
xui
msr
qglwidget
dot-emacs
opml
scrollbars
interop-domino
complex-event-processing
localizable.strings
ifilter
wcf-proxy

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App