+1 678 648 4277 
Table Of Contents
  • Finding the smallest value in memory
  • program.X68
  • screenshot-start.png
  • screenshot-end.png
  • Index:

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    $2000
SMALLEST:                  ; smallest subroutine
    ; address of place to save the minimum is in A0    
    ; number of elements in the array is in D0
    MOVEM.L D0-D2/A0-A1,-(SP)   ; save used registers in the stack

    MOVE.L #$500,A1     ; load A1 with the array address $500
    MOVE.W (A1)+,D1      ; load first value from the array into D1, which will hold the minimum
    SUBI.L #1,D0        ; we used the first number, decrement element count
    CMP.L #0,D0         ; if the count is zero
    BEQ DONE            ; we are done
    MOVE.W (A1)+,D2      ; load a number from the array
    CMP.W D1,D2         ; compare the current element with the minimum
    BGT NEXT            ; if the element is bigger than the minimum, skip
    MOVE.W D2,D1        ; otherwise, set element as new minimum
    SUBI.L #1,D0        ; decrement number of elements to compare
    BRA   LOOP          ; repeat 
    MOVE.W D1,(A0)      ; at the end D1 has the minimum, save it in the given address

    MOVEM.L (SP)+,D0-D2/A0-A1   ; recover saved registers from the stack
    RTS                 ; return from subroutine

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 homework, that demonstrates the style of Assembly language project help we can deliver.



I hope that after reading through these examples you decide to contact us to offer you help with Assembly language homework.