Assignment 11: If you require help with your Assembly language proect or need a Assembly language online tutor to help you complete your Assembly language proect then we can provide that for you.
Finding the smallest value in memory
- $500 contains an array of words, with the number of elements in D0. Write a routine that finds the smallest value and stores it the memory pointed to be A0.
- The program should start at $2000.
- Fix any syntax errors after you assemble.
- Start the simulator, and set registers and add edit the array.
- Run the program and check that result is the result intended.
- You need to reset PC if you want to rerun the program.
- Show the screenshots of the program in action, to show the workings.
Solution: You will find a sample Assembly language project, that indicates the quality of the work we can do for you.
ORG $2000SMALLEST: ; smallest subroutine; address of place to save the minimum is in A0; number of elements in the array is in D0MOVEM.L D0-D2/A0-A1,-(SP) ; save used registers in the stackMOVE.L #$500,A1 ; load A1 with the array address $500MOVE.W (A1)+,D1 ; load first value from the array into D1, which will hold the minimumSUBI.L #1,D0 ; we used the first number, decrement element countLOOP:CMP.L #0,D0 ; if the count is zeroBEQ DONE ; we are doneMOVE.W (A1)+,D2 ; load a number from the arrayCMP.W D1,D2 ; compare the current element with the minimumBGT NEXT ; if the element is bigger than the minimum, skipMOVE.W D2,D1 ; otherwise, set element as new minimumNEXT:SUBI.L #1,D0 ; decrement number of elements to compareBRA LOOP ; repeatDONE:MOVE.W D1,(A0) ; at the end D1 has the minimum, save it in the given addressMOVEM.L (SP)+,D0-D2/A0-A1 ; recover saved registers from the stackRTS ; return from subroutineEND SMALLEST
Instructions For running it I used the following starting values: D0 = 10 A0=$1000 Memory data in $500: 8, 4, 7, 3, 6, 2, 5, 9, 1, 2, all words (2 bytes each) The file "screenshot-start.png" shows the initial screen for the simulator. After running you can see in the "screenshot-end.png" that memory position $1000 has the value 1, which is the minimum, or smallest value in the array. The code is written as a subroutine as requested, it saves the registers it uses at the start of the subroutine and it restores their value at the end of it, the subroutine exits with the instruction RTS or return from subroutine. Below is a Assembly language project, but if you just require a Assembly language online tutor then we can do that for you as well.
Here is a sample Assembly language assignment, that demonstrates the style of Assembly language project help we can deliver.