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

Display the result after substracting elements of a vector in TASM
printf float in nasm assembly 64-bit
About x87 FPU precision
Can not print integer to standard out (assembly)
Defining data in assembly
Assembly Programming beginner
Counting words in a string in NASM
How to read my USIM with my PC
Function memory address (ASM)
What is the meaning of the following assembler-code line?
scanf string in assembly
assembly get input and use it as a value
64 bit application: layout in memory
IDA pro script to extract all the instructions into a assemble file
How Come this MOVSB Assembly Language Code Works?
Cannot add two values in assembly

Categories

HOME
asp.net-web-api
fabricjs
linkedin
dns
datastore
r-googlesheets
telegram-bot
regular-language
zip
x264
frontend
qpython
ycsb
rtf
favicon
renjin
eip
linear-algebra
searchview
shortest-path
database-connection
ksh
question2answer
aggregation
monit
pic32
mat
custom-controls
autodesk-designautomation
complex-numbers
paragraph
sql-server-2000
fstream
clickjacking
hreflang
getpixel
sharding
browser-extension
raft
openproject
xdocreport
protein-database
urlsession
xv6
datacachefactory
branching-and-merging
softmax
logback-groovy
android-checkbox
berkeley-db-je
procfile
phpdbg
flask-restful
serde
wcftestclient
netbeans6.8
configurationmanager
tf
magic-draw
qtranslate
context-sensitive-grammar
css-transforms
monkey
visual-studio-2008-sp1
google-cloud-console
spring-cloud-feign
dotnetnuke-7
nikeplus-api
jodd
dimension
vorpal.js
simevents
udpclient
respondcms
swizzling
mediametadataretriever
spreadjs
design-principles
relativelayout
file-move
.bash-profile
eoferror
dronekit-android
procedural-programming
cosine-similarity
ssis-data-flow
sql-scripts
raygun
lnk
windows-embedded-standard
windows-phone-8-sdk
kaleidoscope
pclzip
actiondispatch
android-icons
cardreader
fitbounds
isa-swizzling
stress
jquery-address
flex-mobile
htdocs
fsevents
rmdir
umra
xui
unattended-processing
photolibrary
diagrams
facebook-iframe
jqueryform
wordprocessingml
interop-domino
escrow
information-management

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