Sunteți pe pagina 1din 6

# 32 bit addition *****Name : Abhinit Sinha*****Roll No.

: 23*****DESD Sept-2011***** *****Write an assembly language program to add 2 32-bit nos r0, r1 and store in r2***** .org 0 .code 32 .text .global _start _start: mov r0,#10 mov r1,#20 add r2,r0,r1

...

halt: b halt See More LikeUnlike Follow PostUnfollow Post November 8 at 9:42pm * * * * * Write a comment... # Abhinit Sinha created a doc. 64 bit addition *****Name : Abhinit Sinha*****Roll No. : 23*****DESD Sept-2011***** *****Write an assembly language program to add 2 64-bit nos r0, r1 and store in r2***** .org 0 .code 32 .text .global _start _start: ldr r0,=0xffffffff mov r1,#1 mov r2,#1 mov r3,#1 adds r4,r0,r2 adc r5,r1,r3

...

halt: b halt See More LikeUnlike Follow PostUnfollow Post November 8 at 9:42pm * * * * * Write a comment... # Abhinit Sinha created a doc. character search *****Name : Abhinit Sinha*****Roll No. : 23*****DESD Sept-2011*****

*****Write an assembly prog to check whether a character is present in string or not***** .org 0 .code 32 .section .text .align .global _start _start: ldr r0,=label ldr r2,=label1 ldrsb r3,[r2] ldr r4,=7 loop: sub r4,r4,#1 cmp r4,#0 beq hlt ldrsb r1,[r0],#1 cmp r3,r1 bne loop beq hlt label: .asciz "HICDAC" label1: .ascii "D" hlt: b hlt See More LikeUnlike Follow PostUnfollow Post November 8 at 9:41pm * * * * * Write a comment... # Abhinit Sinha created a doc. memory addition *****Name : Abhinit Sinha*****Roll No. : 23*****DESD Sept-2011***** *****Write an assembly language program to add 2 nos in memory and store back to memory*****

...

...

.org 0 .code 32 .text .global _start _start: mov r0,#10 mov r1,#20 ldr r3,=8240 str r0,[r3] str r1,[r3,#4] ldr r3,=8240 ldr r4,[r3] ldr r5,[r3,#4]

add r2,r4,r5 ldr r7,=8248 str r2,[r7] halt: b halt See More LikeUnlike Follow PostUnfollow Post November 8 at 9:40pm * * * * * Write a comment... # Abhinit Sinha created a doc. greatest in array *****Name : Abhinit Sinha*****Roll No. : 23*****DESD Sept-2011***** *****Write an assembly language program to find the greatest no. in an array.*** ** .org 0 .code 32 .text .global _start _start: mov r1,#13 mov r2,#29 mov r3,#7 mov r4,#31 mov r5,#17 ldr r0,=8240 str r1,[r0],#4 str r2,[r0],#4 str r3,[r0],#4 str r4,[r0],#4 str r5,[r0] ldr r0,=8240 ldr r6,[r0],#4 cont: ldr r7,[r0],#4 cmp r6,r7 bls set ret: add r8,r8,#1 cmp r8,#4 bne cont halt: b halt set: mov r6,r7 b ret

...

See More LikeUnlike Follow PostUnfollow Post November 8 at 9:40pm * * * * * Write a comment...

# Abhinit Sinha created a doc. GCD *****Name : Abhinit Sinha*****Roll No. : 23*****DESD Sept-2011***** *****Write an assembly language program to find Greatest Common Divisor of two n os.***** .org 0 .code 32 .text .global _start _start: mov r1,#60 mov r2,#40 gcd: cmp r1,r2 beq halt blt less sub r1,r1,r2 b gcd less: sub r2,r2,r1 b gcd halt: b halt See More LikeUnlike Follow PostUnfollow Post November 8 at 9:39pm * * * * * Write a comment... # Abhinit Sinha created a doc. sorting *****Name : Abhinit Sinha*****Roll No. : 23*****DESD Sept-2011***** *****Write an assembly language program to sort an array in ascending order***** .org 0 .code 32 .text .global _start _start: mov r1,#13 mov r2,#29 mov r3,#7 mov r4,#31 mov r5,#17 mov r12,#255 ldr r0,=8240 ldr r9,=8260 mov r10,#5 str r1,[r0],#4 str r2,[r0],#4 str r3,[r0],#4 str r4,[r0],#4 str r5,[r0] loop: mov r8,#4

...

...

ldr r0,=8240 ldr r6,[r0],#4 cont: ldr r7,[r0],#4 cmp r6,r7 bhi set ret: sub r8,r8,#1 cmp r8,#0 bne cont ldr r0,=8240 loop1: ldr r11,[r0],#4 cmp r6,r11 bne loop1 str r12,[r0,#-4] str r6,[r9],#4 sub r10,r10,#1 cmp r10,#0 bne loop ldr r9,=8260 ldr r1,[r9],#4 ldr r2,[r9],#4 ldr r3,[r9],#4 ldr r4,[r9],#4 ldr r5,[r9] halt: b halt set: mov r6,r7 b ret

See More LikeUnlike Follow PostUnfollow Post November 8 at 9:39pm * * * * * Write a comment... # Abhinit Sinha created a doc. array addition *****Name : Abhinit Sinha*****Roll No. : 23*****DESD Sept-2011***** *****Write an assembly language program to add the contents of an array. Assume that***** *****the array contains constant word stored in memory. Also find average.****** ********* ... .org 0 .code 32 .text .global _start _start:mov r1,#10 mov r2,#20 mov r3,#30 ldr r0,=8040 str r1,[r0],#4 str r2,[r0],#4 str r3,[r0] ldr r0,=8040 bck: ldr r4,[r0],#4

add r5,r5,r4 add r6,r6,#1 cmp r6,#3 bne bck div: subs r5,r5,#3 bmi halt add r7,r7,#1 b div halt: b halt

2.Write an assembly program to add contents of an array and find d average? ANS. .org 0 ... .code 32 .text .global _start _start:mov r1,#10 mov r2,#20 mov r3,#30 ldr r0,=8040 str r1,[r0],#4 str r2,[r0],#4 str r3,[r0] ldr r0,=8040 bck: ldr r4,[r0],#4 add r5,r5,r4 add r6,r6,#1 cmp r6,#3 bne bck div: subs r5,r5,#3 bmi halt add r7,r7,#1 b div halt: b halt

S-ar putea să vă placă și