;Write assembly and embedded C code to find the maximum, and minimum ;from 32 bit data stored from memory location 0x1FFFF104, No. of data ;elements is stored on memory location 0x1FFFF100.
Steps to find the maximum from given set of 32 bit data
Step 1:
- Initialize register with the memory location 0x1FFFF100 i.e. R7 for holding base address.
- Initialize 0x00000000 to any of the register for holding Shift value i.e. R6. We need to add 0x04
In case, of
Word we need to ADD 0x04
half word ADD 0x02 and
byte ADD 0x01.
- Initialize 0x00000000 to any of the register for holding maximum value i.e. R3.
Step 2:
- Fetch 32 bit data from next memory location and initialize to any of register for the looping i.e. R1.
- Add 0x04 into base address(0x1FFFF100) to now start fetching from 0x1FFFF104.
Step 3:
- Fetch next data (32bit) and store to any register i.e. in R2.
- Fix any of the register to store maximum number from list i.e. in R3
Step 5:
Compare content of both registers mentioned above.
Step 6:
if the content of Data register (R2) is higher than content of maximum no register(R3) than transfer the content of data register(R2) into max register(R3).
Step 7:
- Repeat steps 3 and 6 also decrease the looping register(R1)
- Continue up to the value stored in Step 2 i.e. register R1 goes to zero.
Repeat above Steps to find the minimum from given set of 32 bit data.
Note:
if you are facing any doubt, please ask the query in comment section