PROGRAM 1.a:
ADDITION OF TWO 32 BIT NUMBERS.
area addition,code,readonly
entry
mov r0,#00000009
mov r1,#00000005
add r2,r1,r0
end
PROGRAM 1.b:
ADDITION OF TWO 64 BIT NUMBERS.
area addition,code,readonly
entry
ldr r0,=0x11111111
ldr r1,=0x22222222
ldr r2,=0x33333333
ldr r3,=0x44444444
adds r4,r0,r2
adcs r5,r1,r3
end
PROGRAM 1.c:
ADDITION OF 'N' 32 BIT NUMBERS.
area nadd,code,readonly
entry
ldr r0,=0x40000000
mov r2,#05 // number of 32 bit no. to be added
ldr r3,[r0],#04
back ldr r4,[r0],#04
add r3,r3,r4
subs r2,r2,#01
cmp r2,#00
bne back
stop b stop
end
PROGRAM 2.a:
DATA EXCHANGE
area data_exch,code,readonly
entry
ldr r0,=0x40000000
ldr r1,=0x40000044
mov r4,#09
loop ldr r2,[r0]
mov r5,r2
ldr r6,[r1]
str r6,[r0],#04
str r5,[r1],#04
subs r4,#01
cmp r4,#00
bne loop
stop b stop
end
PROGRAM 2.b:
BLOCK OF DATA TRANSFER
area data_trans,code,readonly
entry
ldr r0,=0x40000000
ldr r1,=0x40000044
mov r4,#09
loop ldr r2,[r0],#04
str r2,[r1],#04
subs r4,#01
cmp r4,#00
bne loop
stop b stop
end
PROGRAM 3.a:
COVERTING ASCII TO HEX
area ascii_hex,code,readonly
entry
mov r0,#&41
mov r1,#&46
mov r3,r0
bl next
mov r4,r3,lsl#04
mov r3,r1
bl next
add r5,r4,r3
b stop
next cmp r3,#&39
subls r3,r3,#&30
subgt r3,r3,#&37
mov pc,lr
stop b stop
end
PROGRAM 3.b:
CONVERTING HEX NUMBER TO ASCII NUMBER
area hex_ascii,code,readonly
entry
mov r0,#&af
mov r1,r0
and r2,r1,#&0f
bl next
mov r3,r2
and r2,r0,#&f0
mov r2,r2,lsr#04
bl next
b stop
next cmp r2,#09
addcs r2,r2,#&37
addcc r2,r2,#&30
mov pc,lr
stop b stop
end
PROGRAM 3.c:
CONVERTING BINARY TO GRAY
area binary_gray,code,readonly
entry
mov r0,#0x06
mov r1,#08
lsr r2,r2,#01
eor r2,r2,r1
stop b stop
end
PROGRAM 3.d:
CONVERTING GRAY TO BINARY
area gray_binary,code,readonly
entry
mov r0,#0x58
mov r1,r0
mov r2,#07
loop mov r1,r1,lsr#01
eor r0,r0,r1
subs r2,r2,#01
cmp r2,#00
bne loop
stop b stop
end
PROGRAM 4:
DIVISION OF TWO NUMBERS BY SUCCESSIVE SUBTRACTION
area division,code,readonly
entry
mov r0,#25
mov r1,#04
cmp r0,r1
movge r3,r0
movls r3,r1
movcs r4,r1
movcc r4,r0
loop subs r3,r3,r4
add r2,r2,#01 //divisible
cmp r3,r4
bge loop
mov r5,r3 //r3 holds quotient
stop b stop
end
PROGRAM 5:
FINDING FACTORIAL OF NUMBER WITHOUT LOOKUP TABLE
area fact_wout_lt,code,readonly
entry
mov r0,#10
mov r1,#01
back mul r2,r0,r1
mov r1,r2
subs r0,r0,#01
cmp r0,#00
bne back
stop b stop
end
ADDITION OF TWO 32 BIT NUMBERS.
area addition,code,readonly
entry
mov r0,#00000009
mov r1,#00000005
add r2,r1,r0
end
PROGRAM 1.b:
ADDITION OF TWO 64 BIT NUMBERS.
area addition,code,readonly
entry
ldr r0,=0x11111111
ldr r1,=0x22222222
ldr r2,=0x33333333
ldr r3,=0x44444444
adds r4,r0,r2
adcs r5,r1,r3
end
PROGRAM 1.c:
ADDITION OF 'N' 32 BIT NUMBERS.
area nadd,code,readonly
entry
ldr r0,=0x40000000
mov r2,#05 // number of 32 bit no. to be added
ldr r3,[r0],#04
back ldr r4,[r0],#04
add r3,r3,r4
subs r2,r2,#01
cmp r2,#00
bne back
stop b stop
end
PROGRAM 2.a:
DATA EXCHANGE
area data_exch,code,readonly
entry
ldr r0,=0x40000000
ldr r1,=0x40000044
mov r4,#09
loop ldr r2,[r0]
mov r5,r2
ldr r6,[r1]
str r6,[r0],#04
str r5,[r1],#04
subs r4,#01
cmp r4,#00
bne loop
stop b stop
end
PROGRAM 2.b:
BLOCK OF DATA TRANSFER
area data_trans,code,readonly
entry
ldr r0,=0x40000000
ldr r1,=0x40000044
mov r4,#09
loop ldr r2,[r0],#04
str r2,[r1],#04
subs r4,#01
cmp r4,#00
bne loop
stop b stop
end
PROGRAM 3.a:
COVERTING ASCII TO HEX
area ascii_hex,code,readonly
entry
mov r0,#&41
mov r1,#&46
mov r3,r0
bl next
mov r4,r3,lsl#04
mov r3,r1
bl next
add r5,r4,r3
b stop
next cmp r3,#&39
subls r3,r3,#&30
subgt r3,r3,#&37
mov pc,lr
stop b stop
end
PROGRAM 3.b:
CONVERTING HEX NUMBER TO ASCII NUMBER
area hex_ascii,code,readonly
entry
mov r0,#&af
mov r1,r0
and r2,r1,#&0f
bl next
mov r3,r2
and r2,r0,#&f0
mov r2,r2,lsr#04
bl next
b stop
next cmp r2,#09
addcs r2,r2,#&37
addcc r2,r2,#&30
mov pc,lr
stop b stop
end
PROGRAM 3.c:
area binary_gray,code,readonly
entry
mov r0,#0x06
mov r1,#08
lsr r2,r2,#01
eor r2,r2,r1
stop b stop
end
PROGRAM 3.d:
CONVERTING GRAY TO BINARY
area gray_binary,code,readonly
entry
mov r0,#0x58
mov r1,r0
mov r2,#07
loop mov r1,r1,lsr#01
eor r0,r0,r1
subs r2,r2,#01
cmp r2,#00
bne loop
stop b stop
end
PROGRAM 4:
DIVISION OF TWO NUMBERS BY SUCCESSIVE SUBTRACTION
area division,code,readonly
entry
mov r0,#25
mov r1,#04
cmp r0,r1
movge r3,r0
movls r3,r1
movcs r4,r1
movcc r4,r0
loop subs r3,r3,r4
add r2,r2,#01 //divisible
cmp r3,r4
bge loop
mov r5,r3 //r3 holds quotient
stop b stop
end
PROGRAM 5:
FINDING FACTORIAL OF NUMBER WITHOUT LOOKUP TABLE
area fact_wout_lt,code,readonly
entry
mov r0,#10
mov r1,#01
back mul r2,r0,r1
mov r1,r2
subs r0,r0,#01
cmp r0,#00
bne back
stop b stop
end
can i get more programs on assembly language
ReplyDeleteThank You and that i have a swell offer you: House Renovation exterior makeover house
ReplyDelete