Question: Building SORT code section The program of this exercise deals with arrays of numbers and subroutines. At the beginning of your program you will allocate

Building SORT code section

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 .set 0x0200 ;Memory allocation ARY1

ARY1S .set 0x0210 ;Memory allocation ARYS

ARY2 .set 0x0220 ;Memory allocation ARY2

ARY2S .set 0x0230 ;Memory allocation AR2S

;------------------------------------ Main Block -----------------------------------

clr R4 ;clearing all register being use is a good

clr R5 ;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

ArraySetup1 mov.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

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 Databases Questions!