Question: Write an assembly language program that contains function SelectionSort ( float [ ] a , int len ) . This function must take an array
Write an assembly language program that contains function SelectionSortfloat a int len This function must take an array of single precision floating point values allocated in RAM and its length both passed in stack and sort the array in ascending order by using the selectionsort method. Make sure to allocate and initialize an array to sort in ROM and copy its values into RAM prior calling your sorting routine. Print the original unsorted array and the sorted one. You may use selectionsort project for sorting integers from Module and make necessary adjustments in it for fp processing.
Hint: use the following method to print floatingpoint numbers:
WriteFloat PROC push R LR vpush.f S vmov.f R S tst R #x beq wf movs R # bl WriteChar vneg.f S S wf vcvtuf S S ; S integer part vmov.f R S bl WriteInt vcvtfu S S vsub.f S S ; S fraction movw R # bl WriteChar vldrf S vmul.f S S vcvtuf S S vmov.f R S bl WriteInt vpop.f S pop R PC ENDP
WRITE IT IN THIS FORMAT
INCLUDE EFRBGinc ; CPU register definitions
INCLUDE terminal.inc ; terminal function definitions
EXPORT main
IMPORT LETIMERsetup ; import names from other code files
IMPORT GPIOsetup
; ; noninitialized DATA segment in RAM
AREA RAM, DATA, NOINIT, READWRITE, ALIGN
;myWord SPACE ; bit variable MUST BE ALIGHED!
;myHalf SPACE ; bit variable MUST BE ALIGHED!
;myByte SPACE ; bit variable NO alighment required
; ; CODE segment in flash ROM
AREA text CODE, READONLY
main PROC ; main user code
bl Terminalsetup ; setup TeraTerm communication
; bl GPIOsetup ; configure port pins
; bl LETIMERsetup ; start sec timer for periodic events
; your code starts here
loop ; periodic task starts here
b loop ; repeat periodic task
ENDP
;
;prompt DCB "Enter a number: ; allocate constant strings here
ALIGN
;constW DCD ; initialized bit constant
;constH DCW ; initialized bit constant
;constB DCB ; initialized bit constant
ALIGN
END
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
