0% found this document useful (0 votes)
3 views7 pages

Applab 4

The document contains multiple assembly language programs demonstrating various operations such as loading and storing data, indexing modes, block transfers, and addition of numbers in arrays. Each program is structured with defined areas for code and data, and includes comments on their functionality. The experiments cover both 32-bit and 16-bit addition techniques, showcasing different memory manipulation methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

Applab 4

The document contains multiple assembly language programs demonstrating various operations such as loading and storing data, indexing modes, block transfers, and addition of numbers in arrays. Each program is structured with defined areas for code and data, and includes comments on their functionality. The experiments cover both 32-bit and 16-bit addition techniques, showcasing different memory manipulation methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

-AREA prg1,CODE,READONLY

EXPORT __main

ENTRY

__main

LDR R5,=0x10000004

LDR R6,=0x02

mov r3,#0x3211

mov r2,#0x00

mov r5,#0x02

add r0,r3,#0x0202

MOV R4,R0

MVN R4,R2

mvn r0, #0x00

LDR R1,=0x11223344

end
Program 2:

AREA prg1,CODE,READONLY

EXPORT __main

ENTRY

__main

LDR r3,=array ;loads the address of array into R3

LDR R4,[R3]

LDR r6,=array1 ;loads the address of array into R3

LDR R7,[R6]

LDR R5,=num1

STR R4,[R5]

array DCB ‘A’

array1 DCD 0x12345678

AREA DATA1,DATA,READWRITE

num1 DCD 5

end
Experiment Title: Indexing Modes

Program:

AREA prg1, CODE, READONLY

EXPORT __main

ENTRY

__main

LDR r1,= array

LDR r3, [r1,#4] ;pre-indexing

LDR r2,= array1

LDR r4, [r2,#4]! ;auto-indexing

LDR r5,=array2

LDR r6,[r5],#4 ;post-indexing

array DCB ‘A’

array1 DCB ‘B’

array2 DCB ‘C’

END
AREA program,CODE,READONLY
ENTRY
LDR R0,=0x40000000 ; Source memory base address
LDR R1,=0x50001000 ; Destination memory base address
MOV R2,#0x0A ; Counter register with value equal

to number of elements in source memory


label LDR R3,[R0],#4 ; Loading value to temporary register
STR R3,[R0],#4 ; Storing the value at destination memory
SUB R2,R2,#1
CMP R2.#00
BNE loop
END
Experiment Title: Block Transfer of elements from one array to another array

Program:

AREA prg1,CODE,READONLY

EXPORT __main

ENTRY

__main

LDR R4,=array

LDMIA R4!,{R1,R2,R3}

LDR R7,=array1

STMIA R7!,{R1,R2,R3}

array DCD 0x12345678, 0x21334567, 0x12345678

AREA DATA1, DATA, READWRITE

array1 DCD 0

end
Experiment Title: Addition of Numbers in an Array
Programe 1: 32bit addition
AREA prg1, CODE, READONLY
EXPORT __main
ENTRY
__main
mov r3,#0x09
ldr r0,=array
ldr r1, [r0], #4
loop ldr r2, [r0], #4
adds r1, r2, r1
subs r3,r3,#0x01
bne loop
ldr r4,=array1
str r1, [r4]
array DCD 0x00000001,0x00000002,0x00000001,0x00000001,0x00000001,0x00000001,
0x00000001,0x00000001,0x00000001,0x00000001
AREA data1, DATA, READWRITE
array1 DCD 0
end
Experiment Title: 16bit addition

AREA prg1, CODE, READONLY


EXPORT __main
ENTRY
__main
MOV R3,#0X09
LDR R0,=array
LDRH R1, [R0], #4
LOOP LDRH R2, [R0], #4
ADDS R1, R2, R1
SUBS R3, R3, #0X01
BNE LOOP
LDR R4,=array1
STRH R1, [R4]
array DCD 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001,
0x00000001, 0x00000001, 0x00000001, 0x00000001
AREA data1, DATA, READWRITE
array1 DCD 0
end

You might also like