Adsense

Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts

solution of assembly code to find the maximum and minimum from block of 32 bit data stored from memory location 0x1FFFF104, No. of data elements is stored on memory location 0x1FFFF100.

Solution1:

;jigar visani perform the code successfully roll no d19ec120 

              TTL transfer
        AREA Myprog, CODE, READONLY
ENTRY
        EXPORT main
main
        LDR R7,=0X1FFFF100 ; initialize the register R7 with starting address
        LDR R1,[R7,R1]     ; fetch the first value to R1 for counting  
        LSLS R1,R1,#0x02   ; left shift the R1 by 2 position to multiply with 4
        ADDS R7,R7,#0X04   ; add R7= R7+4 to start fetch the data from 0x1FFFF104
        LDR R3,=0X00000000 ; store maximum value
        LDR R4,=0XFFFFFFFF ; store the minimum value
       
COMPARE LDR R5,[R7,R6]    ; fetch first data into R5
        ADDS R6,R6,#0X04  ; Shift R6 to fetch the next word
        CMP R6,R1         ; compare R6 with R1 to continue loop
        BEQ done          ; if R6=R1 than end loop otherwise continue
        CMP R5,R3         ; compare the R5 with R3 to find greater
        BHI GREATER       ; number are unsigned so if R5>R3 than jump to label
back    CMP R5,R4         ; compare R5 with R4 to find minimum number
        BLO LESS          ; if R5<R3 jump to desired location
        B COMPARE         ; unconditional jump to comapre
      
GREATER MOVS R3,R5        ; transfer if R5 is higher than R3
        B back            ; jump to label
       
LESS    MOVS R4,R5        ; transfer if R5 smaller than R4
        B COMPARE         ; jump to label
 
done
        SWI &11
        END

Solutions .........

Please students try different logic. So, i can put some more stuff here.

Write a ARM cortex M0+ assembly language code based on arithmatc and logical instructions.

 Problem 1: Implement following code conversions to convert binary no 0x89ABCDEF(32-bits) into a) BCD (64-bits)   b) Gray (32-bits) Problem...