Showing posts with label Assembly Language Programs. Show all posts
Showing posts with label Assembly Language Programs. Show all posts

Wednesday, 25 October 2017

ARM Architecture

ARM Architecture

Micro-Controller & Embedded Systems

 

Class materials at http://www.OpenSecurityTraining.info/... 

Follow us on Twitter for class news @OpenSecTraining. 

The playlist for this class is here: http://bit.ly/103IkTj

 

Part 1: Introduction to ARM

Part 2: Introduction to ARM

Part 3: Introduction to ARM

Part 4: Introduction to ARM

Part 5: Introduction to ARM

Part 6: Introduction to ARM

Part 7: Introduction to ARM

Part 8: Introduction to ARM

Part 9: Introduction to ARM

Part 10: Introduction to ARM

Saturday, 14 October 2017

ARM Assembly Language Programming

Micro-Controller & Embedded Systems

ARM Assembly Language Programming

Go through this video and complete the programes given.







Thursday, 5 October 2017

Experiment List

Experiment List

Micro-Controller & Embedded Systems




Exp. No
Experiment Name
0
Numbering System and Logic Gates
1
Loading data in A and transferring to R0, R1 of bank 1
2
Addition of first 10 natural numbers
3
Addition of two 16 bit numbers
4
Subtraction of two 16 bit numbers
5
Multiplication of two 8 bit numbers
6
Division of two 8 bit numbers
7
Finding Smallest/Largest Number in the Array
8
Conversion of Hexadecimal number to Decimal Number
9
Performing logical operations, AND, OR, XOR, NOT
10
Generation of Square wave using timer
11
To transfer message serially to P1.5
12
Write a ARM assembly language program to display “Hello TEIT” "you name"
13
Write a ARM assembly language program to transfer block of data from one address to other address
Write a ARM assembly language program to add two 64 bit numbers.
14
Write a ARM assembly language program to convert hexadecimal to ASCII conversion
Write a ARM assembly language program to solve the equation 4x2 +3x... ... if x is stored in r1. Store the result in r0.
15
Write a ARM assembly language program to divide a 32-bit number by an 8 bit number

Saturday, 28 November 2015

ARM Assembly Language Programs

Microcontroller & Embedded Systems

1. Write ARM assembly language program to find largest/smallest value from given two numbers.
    
        AREA    bigger, CODE, READONLY
ENTRY
MAIN
        LDR    R1, Value1        ;load first value to be compared
        LDR    R2, Value2        ;load second value to be compared
       
        CMP    R1, R2             ;compare them
        BHI    DONE               ;if R1 contains the highest
       
        MOV R1, R2                ;otherwise overwrite R1
       
DONE
        STR    R1, Result            ;store the result
        SWI    &11
       
Value1    DCD    &12345678        ;value to be compared
Value2    DCD    &87654321        ;value to be compared
Result    DCD    0                          ;space to store result
        END


2. Write ARM assembly language program to find average of two numbers.

             AREA    Average, CODE, READONLY                    ; name code block
             ENTRY                                             ; marker of first executable instruction
start             
             ADR    r1, FIRSTNUM                                ; load first address into r1
             ADR    r2, SECONDNUM                                ; load second address into r2
             ADR    r3, AVGRESULT                                ; load result address into r3
             LDR    r4, [r1]                                    ; load first number into r4
             LDR    r5, [r2]                                    ; load second number into r5
             ADD    r0, r4, r5                                    ; add numbers together
             MOV    r0, r0, ASR#1                                ; divide by two using arithmetic shift
             STR    r0, [r3]                                    ; store result to address pointed to by r3
                      
             SWI    0x11                                        ; terminate the program
            
FIRSTNUM    DCD    &20
SECONDNUM    DCD    &50
AVGRESULT    DCD    &0           
            END                                                 ; marks the end of the file

ARM Assembly Language Programs

Microcontroller & Embedded Systems

1. Write ARM assembly language program to display "Hello World"

        AREA      HelloW, CODE, READONLY
SWI_WriteC        EQU  &0   
SWI_Exit         EQU  &11   
        ENTRY   
 

START     ADR        R1, TEXT   
LOOP     LDRB    R0, [R1], #1
       

        CMP      R0, #0
        SWINE    SWI_WriteC   
        BNE        LOOP
        SWI        SWI_Exit    
       
TEXT    =        "HELLO WORLD", &0a, &0d, 0
        END


2. Write ARM assembly language program to find the one's complement (inverse) of a number.

        AREA    Program, CODE, READONLY
        ENTRY

Main
        LDR     R1, Value                        ; Load the number to be complemented
        MVN     R1, R1                          ; take 1's complement of R1
        STR     R1, Result                        ; Store the result
        SWI     &11

Value   DCD     &FF                            ; Value to be complemented
Result  DCD     &ABCD1234              ; Storage for result

        END



3. Write an assembly language program to compute 4x2 +3x... ... if x is stored in r1. Store the result in r0.

                AREA    equation, CODE, READONLY
                ENTRY

start
                MUL r0, r1, r1                     ; result <-- x * x
                LDR r2, =4                         ; tmp <-- 4
                MUL r0, r2, r0                     ; result <-- 4 * x * x
                LDR r2, =3                         ; tmp <-- 3
                MUL r2, r1, r2                     ; tmp <-- x * tmp
                ADD r0, r0, r2                     ; result <-- result + tmp
stop          B     stop
                end   

ARM Assembly Language Program to add / sub / mul two 32 / 64 bit numbers.

Microcontroller & Embedded Systems

1. Write ARM assembly language program to add two 32 bit numbers.


        AREA    add32, CODE, READONLY
ENTRY
MAIN
        LDR    R0, =Value1
        LDR    R1, [R0]
           
        ADD    R0, R0, #0*4
           
        LDR    R2, [R0]
           
        ADD R1, R1, R2
           
        LDR    R0, =Result
           
        STR    R1, [R0]
           
        SWI    &11
           
Value1    DCD    &37E3C123
Value2    DCD    &367402AA
           
Result    DCD    0


2. Write ARM assembly language program to add two 64 bit numbers.
     
        AREA    add64, CODE, READONLY
ENTRY
MAIN
        LDR    R0, =Value1        ;pointer to first value
        LDR    R1, [R0]            ;load first part of value1
        LDR    R2, [R0, #4]        ; load lower part of value1
        LDR    R0, =Value2        ;pointer to second  value
        LDR    R3, [R0]            ;load upper part of value2
        LDR    R4, [R0, #4]        ; load lower part of value2
      
        ADDS    R6, R2, R4        ;add lower 4 bytes  and set carry flag
        ADC    R5, R1, R3        ;add upper 4 bytes  including carry
      
        LDR    R0, =Result        ;pointer to result
      
        STR    R5, [R0]            ;store upper part of result
        STR    R6, [R0, #4]        ;store lower part of result
      
        SWI    &11
      
Value1    DCD    &12A2E640, &F2100123
Value2    DCD    &001019BF, &40023F51
Result    DCD    0
      
        END