Question: Provide me the code correctly so that I can get the correct output from the input You are to write simple MSP 4 3 0

Provide me the code correctly so that I can get the correct output from the input
You are to write simple MSP430 assembly functions for a program that will take a decimal number and a base as input and output the value in that specified base. For example:
>2367098
116245
>132
1101
>297082
111010000001100
>581523
2221202210
>484354
23310303
>345676
424011
>510066
1032050
>515669
77655
>3760820
4E08
>5915630
25LQ
>244037
1SZ
>244137
1Sa
>244237
1T0
>2837464
6xM
>40080256
156.144
>45600256
178.32
>2903865
0
>1231
0
>678902
100100110010
func/base_256.S
.file "func/base_256.S"
.text
.global base_256
; this function uses both approaches
; (possibly calling other_base)
;
; the value to convert is in r15,
; the base is specified in r14 and
; the current index is given in r13
base_256:
ret
func/convert.S
.file "func/convert.S"
.text
.global convert
; this function has to figure
; out which conversion function
; to call
;
; it receives the decimal value
; in r15 and the base to convert
; to in r14
convert:
mov #40, r13
call #other_base
mov #40, r15
ret
func/log_2.S
.file "func/log_2.S"
.text
.global log_2
; this function calculates
; log base 2 of a value
;
; the value should be in r15
log_2:
ret
func/other_base.S
.file "func/other_base.S"
.text
.global other_base
; this function uses modulo and
; divide to convert the decimal
; value to the specified base
;
; the value to convert is in r15,
; the base is specified in r14 and
; the current index is given in r13
other_base:
mov #buf, r14 ; buf
add r13, r14 ; buf[index]
mov.b #'0',0(r14) ; buf[index]='0'
ret
func/power2_base.S
.file "func/power2_base.S"
.text
.global power2_base
; this function uses mask and
; shift to convert the decimal
; value to the specified base
;
; the value to convert is in r15,
; the base is specified in r14 and
; the current index is given in r13
power2_base:
ret
func/rshift.S
.file "func/rshift.S"
.text
.global rshift
; this function should shift the
; a value a specified number of times
;
; the value to shift is in r15 and
; the number of times to right shift
; is specified in r14
rshift:
ret

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!