The program of this exercise deals with arrays of numbers and subroutines. At the beginning of your program you will allocate empty storage for two
The program of this exercise deals with arrays of numbers and subroutines. At the beginning of your program you will allocate empty storage for two original arrays and their sorted versions. For the overall program layout, use the program skeleton file (lab2-v32-inA-skl).
;Memory allocation of Arrays must be done before the RESET and StopWDT
ARY1.set0x0200 ;Memory allocation ARY1
ARY1S.set0x0210 ;Memory allocation ARYS
ARY2.set0x0220 ;Memory allocation ARY2
ARY2S.set0x0230 ;Memory allocation AR2S
;------------------------------------ Main Block -----------------------------------
clrR4 ;clearing all register being use is a good
clrR5 ;programming practice
SORT1 mov.w #ARY1, R5 ;initialize R5 as a pointer to array1
mov.w #ARY1S, R6 ;initialize R6 as a pointer to array1 sorted
call #ArraySetup1;then call subroutine ArraySetup1
Call SORT ;then call subroutine SORT
SORT2 ......
......
SORT ...... ;subroutine SORT sorts array from ...... ;lowest to highest value
Mainloop jmp Mainloop ;Infinite Loop
ArraySetup1mov.b#10, 0(R5) ;Memory allocation Subroutine
mov.b#1, 1(R5) ;First start with the number of elements
mov.b#2, 2(R5) ;and then fill in the element.
......
ret
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started