tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoo...
Upcoming SlideShare
Loading in...5
×

IGNOU Assembly Language Programming

15,792

Published on

IGNOU MCSL 017 Assembly Language Programming

Published in: Education, Technology, Business
5 Comments
20 Likes
Statistics
Notes
No Downloads
Views
Total Views
15,792
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
5
Likes
20
Embeds 0
No embeds

No notes for slide

IGNOU Assembly Language Programming

  1. 1. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoyMCSL 017 Assembly Language Programming ManualSessions 3 and 4:1. Write a program to add two numbers present in two consecutive memory locations and store theresult in next memory location..model small.datan1 db 12hn2 db 13hres db ?.codemov ax, @datamov ds, axmov al, n1add al, n2mov res, almov ah, 4chint 21hend2. Develop program to read a character from console and echo it..model small.datamsg1 db Enter a Character : $msg2 db 10,13,Your Input is : $.codemov ax, @datamov ds, axmov ah, 9lea dx, msg1int 21hmov ah, 1int 21hmov bl, almov ah, 9lea dx, msg2int 21hmov dl, blmov ah, 2int 21hmov ah, 4chint 21hendMCSL 0171 Loganathan R
  2. 2. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy3. Develop and execute a program to read 10 chars from console..model small.datamsg1 db Enter 10 Characters : $msg2 db 10,13,Your Input is : $chars db 10 dup(?).codemov ax, @datamov ds, axmov ah, 9lea dx, msg1int 21hlea si, charsmov cl, 10mov ah, 1agn:int 21hmov [si], alinc sidec cljnz agnmov ah, 9lea dx, msg2int 21hlea si, charsmov cl, 10mov ah, 2nxt:mov dl, [si]int 21hinc sidec cljnz nxtmov ah, 4chint 21hendMCSL 0172 Loganathan R
  3. 3. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy4. Write a program to exchange two memory variables using MOV and XCHG instruction. Can you doit with just XCHG?.model small.datan1 db 12hn2 db 13h.codemov ax, @datamov ds, axmov al, n1xchg al, n2mov n1,almov ah, 4chint 21hendUsing XCHG only:.model small.datan1 db 12hn2 db 13h.codemov ax, @datamov ds, axxchg al, n1xchg al, n2xchg n1,almov ah, 4chint 21hendMCSL 0173 Loganathan R
  4. 4. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy5. Write a program to find the sum of two BCD numbers stored in memory..model small.datan1 db 12hn2 db 13hres db ?.codemov ax, @datamov ds, axmov al, n1add al, n2daamov res, almov ah, 4chint 21hendMCSL 0174 Loganathan R
  5. 5. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy6. Write a program, which will read two decimal numbers, then multiply them together, and finallyprint out the result (in decimal)..model small.datamsg1 db Enter First Decimal Digit : $msg2 db 10,13,Enter Second Decimal Digit : $msg3 db 10,13,Multiplied Result : $.codemov ax, @datamov ds, axmov ah, 9lea dx, msg1int 21hmov ah, 1int 21hsub al, 30hmov bl, almov ah, 9lea dx, msg2int 21hmov ah, 1int 21hsub al, 30hmul blaamadd ax, 3030hmov bx, axmov ah, 9lea dx, msg3int 21hmov dl, bhmov ah, 2int 21hmov dl, blmov ah, 2int 21hmov ah, 4chint 21hendMCSL 0175 Loganathan R
  6. 6. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy7. Write a program to convert the ASCII code to its BCD equivalent..model small.dataascii db 46H ;for Hex ditits 30h-39h,41h-46hbcd db ?.codemov ax, @datamov ds, axmov al, asciicmp al, 39hjbe sub30sub al, 7hsub30:sub al, 30hdaamov bcd, almov ah, 4chint 21hendMCSL 0176 Loganathan R
  7. 7. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy8. Write a program, which will read in two decimal inputs and print out their sum, in decimal..model small.datamsg1 db Enter First Decimal Digit : $msg2 db 10,13,Enter Second Decimal Digit : $msg3 db 10,13,Addition Result : $.codemov ax, @datamov ds, axmov ah, 9lea dx, msg1int 21hmov ah, 1int 21hsub al, 30hmov bl, almov ah, 9lea dx, msg2int 21hmov ah, 1int 21hsub al, 30hadd al, blaamadd ax, 3030hmov bx, axmov ah, 9lea dx, msg3int 21hmov dl, bhmov ah, 2int 21hmov dl, blmov ah, 2int 21hmov ah, 4chint 21hendMCSL 0177 Loganathan R
  8. 8. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy9. Write a program, which will read in two decimal inputs and print out the smaller of the two, indecimal..model small.datamsg1 db Enter First Decimal Digit : $msg2 db 10,13,Enter Second Decimal Digit : $msg3 db 10,13,Smallest : $.codemov ax, @datamov ds, axmov ah, 9lea dx, msg1int 21hmov ah, 1int 21hmov bl, almov ah, 9lea dx, msg2int 21hmov ah, 1int 21hmov bh, almov ah, 9lea dx, msg3int 21hcmp bl, bhjb lessblmov dl, bhjmp displessbl:mov dl, bldisp:mov ah, 2int 21hmov ah, 4chint 21hendMCSL 0178 Loganathan R
  9. 9. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy10. Write a program to calculate the average of three given numbers stored in memory..model small.datan1 db 2n2 db 3n3 db 3avg db ?.codemov ax, @datamov ds, axxor ah, ahmov al, n1add al, n2jnc adnxtinc ahadnxt:add al, n3jnc cntnuinc ahcntnu:mov bl, 3div blmov avg, almov ah, 4chint 21hendMCSL 0179 Loganathan R
  10. 10. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy11. Write a program in 8086 assembly language to find the volume of sphere using followingformula: V = 4/3π r3;find the volume of sphere using following formula: V = 4/3 pi r3.model small.datar db 3v db ?.codemov ax, @datamov ds, axmov al, rmul almul rmov bl ,almov al, 88mov cl, 21div clmul blmov v, al ; result in hexa decimalmov ah, 4chint 21hendMCSL 01710 Loganathan R
  11. 11. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy12. Write a program to evaluates 3 * (x^3) + 4x + 5 if flag = = 1 or evaluates 7x + 8 if flag = = 0.Assume x is a 16-bit unsigned integer.;evaluates 3 * (x^3) + 4x + 5 if flag = = 1;evaluates 7x + 8 if flag = = 0.model small.dataflag db 1x dw 2res dw ?.codemov ax, @datamov ds, axcmp flag, 1jne eq2mov ax, 3mul xmul xmul xmov cx, ax ; assume result doest not exceed 16 bitmov ax, 4mul xadd ax, 5add ax, cxjmp xiteq2:mov ax, 7mul xadd ax, 8xit:mov res, axmov ah, 4chint 21hendMCSL 01711 Loganathan R
  12. 12. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy13. Write a program to convert Centigrade (Celsius) to Fahrenheit temperature measuring scales.Using formula: Celsius = (Fahrenheit - 32) * 5 / 9;convert Centigrade (Celsius) to Fahrenheit temperature;formula: Celsius = (Fahrenheit - 32) * 5 / 9; i.e f = (c * 9 / 5) + 32.model small.datac db 40f db ?.codemov ax, @datamov ds, axmov cl, 32mov al, 9mov bl, 5mul cdiv bladd al, clmov f, al ; result in hexadecimalmov ah, 4chint 21hendMCSL 01712 Loganathan R
  13. 13. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy14. Write a Program which adds the sales tax in the Price list of items and replace the Price list with anew list.;adds the sales tax in the Price list of items;replace the Price list with a new list.model small.dataprice db 20h, 30h, 40h, 50h, 60h,70htax db 3, 4, 5, 6, 7, 8n db tax - price.codemov ax, @datamov ds, axmov es, ax ; since di usedmov cl, nlea si, pricelea di, taxnxt:mov al , [di]add [si], alinc siinc didec cxjnz nxtmov ah, 4chint 21hendMCSL 01713 Loganathan R
  14. 14. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoySessions 5, 6 and 7:1. Write a program to find the factorial of decimal number given by user.;factorial of decimal number given by user.model small.datan db 5f db ?.codemov ax, @datamov ds, axmov cl, nmov al, 1agn:cmp cl, 0jbe xitmul cldec cljmp agnxit:mov f, almov ah, 4chint 21hendMCSL 01714 Loganathan R
  15. 15. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy2. Write a program to find nCr for a given n and r..model small.datan db 5r db 2ncr db ?.codemov ax, @datamov ds, axxor ch, chmov cl, nmov al, 1forn:mul clloop fornmov bl, al ;n!mov cl, rmov al, 1forr:mul clloop forrmov bh, al ;r!mov al, 1mov cl, nsub cl, r ; cl <- n-rjcxz xitnrfornr:mul clloop fornrxitnr:mul bh ;(n-r)! * r!mov cl, almov al, bldiv cl ;n! / {(n-r)! * r!)daamov ncr, almov ah, 4chint 21hendMCSL 01715 Loganathan R
  16. 16. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy3. Write a program to arrange given N numbers in descending order.;Signed Descending order.model small.dataa db 34h,78h,56h,47h,0,90hlen dw len-a ;len=no of elements.codemov ax,@datamov ds,axmov bx,lendec bx ;bx=no of passes needed to complete sorting(n-1)outlup:mov cx,bx ;cx=no of comparisions to be performed in a passmov si,0inlup:mov al,a[si]inc sicmp al,a[si]ja go_onxchg al,a[si]mov a[si-1],algo_on:loop inlup ;dec cx,until cx=0dec bxjnz outlupmov ah, 4chint 21hendMCSL 01716 Loganathan R
  17. 17. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy4. Write a program, which will read in decimal inputs repeatedly until a zero value is read; at thispoint, it should print out the sum of the numbers read in so far..model small.datamsg1 db 10,13,Enter Decimal Digit (0 to Stop): $msg2 db 10,13,The sum : $.codemov ax, @datamov ds, axmov bl, 0nxt:mov ah, 9lea dx, msg1int 21hmov ah, 1int 21hcmp al, 0je xitsub al, 30hadd al, blmov bl, aljmp nxtxit:mov ah, 9lea dx, msg2int 21hmov al, blaamadd ax, 3030hmov bx, axmov dl, bhmov ah, 2int 21hmov dl, blmov ah, 2int 21hmov ah, 4chint 21hendMCSL 01717 Loganathan R
  18. 18. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy5. Develop and execute an assembly language program to find the LCM of two 16-bit unsignedintegers..model small.datan1 dw 8000n2 dw 9000lcml dw ?lcmh dw ?.codemov ax,@datamov ds,axmov dx,0mov ax,n1 ;dx_ax=25mov bx,n2 ;bx=15again:push axpush dxdiv bxcmp dx,0 ;remainder of the division is stored in dxje exitpop dxpop axadd ax,n1jnc noincdxinc dxnoincdx:jmp againexit:pop lcmhpop lcmlmov ah, 4chint 21hendMCSL 01718 Loganathan R
  19. 19. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy6. Develop and execute an assembly language program to find the HCF of two unsigned 16-bitnumbers..model small.dataval1 dw 30val2 dw 75gcd dw ?.codemov ax,@datamov ds, axmov ax, val1mov bx, val2again:cmp ax,bxje exitjb bigbxdivaxbx:mov dx,0div bxcmp dx,0je exitmov ax,dxjmp againbigbx:xchg ax,bxjmp divaxbxexit:mov gcd,bxmov ah, 4chint 21hendMCSL 01719 Loganathan R
  20. 20. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy7. Write a program for finding the largest number in an array of 10 elements.;Largest.model small.dataa db 34h,78h,56h,47h,0,90h, 22h,88h,12hlen dw $-a ;len=no of elementslrg db ?.codemov ax,@datamov ds,axlea si, amov al, [si]mov cx,lennxt:cmp al, [si]jae cntnumov al,[si]cntnu:inc siloop nxtmov lrg, almov ah, 4chint 21hendMCSL 01720 Loganathan R
  21. 21. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy8. Develop and execute a program to sort a given set of 8-bit unsigned integers into ascending order.;Unsigned Ascending order.model small.dataa db 34h,78h,56h,47h,0,90hlen dw $-a ;len=no of elements.codemov ax,@datamov ds,axmov bx,lendec bx ;bx=no of passes needed to complete sorting(n-1)outlup:mov cx,bx ;cx=no of comparisions to be performed in a passmov si,0inlup:mov al,a[si]inc sicmp al,a[si]jb go_onxchg al,a[si]mov a[si-1],algo_on:loop inlup ;dec cx,until cx=0dec bxjnz outlupmov ah, 4chint 21hendMCSL 01721 Loganathan R
  22. 22. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy9. Develop and execute an assembly language program to sort a given set of 16-bit unsigned integersinto descending order.;16 bit Unsigned Descending order.model small.dataa dw 5678h,1234h,3456h,2345h,4567h,6789hlen dw ($-a)/2 ;len=no of elements.codemov ax,@datamov ds,axmov bx,lendec bx ;bx=no of passes needed to complete sorting(n-1)outlup:mov cx,bx ;cx=no of comparisions to be performed in a passmov si,0inlup:mov ax,a[si]inc siinc sicmp ax,a[si]ja go_onxchg ax,a[si]mov a[si-2],axgo_on:loop inlup ;dec cx,until cx=0dec bxjnz outlupmov ah, 4chint 21hendMCSL 01722 Loganathan R
  23. 23. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy10. Write a Program which adds the sales tax in the Price list of items and replace the Price list withcalculated values.;adds the sales tax in the Price list of items;replace the Price list with a new list.model small.dataprice db 20, 30, 40, 50, 60,70tax db 5, 4, 5, 3, 2, 2n db tax - price.codemov ax, @datamov ds, axmov es, ax ; since di usedmov cl, nmov bl, 100lea si, pricelea di, taxnxt:mov al , [di]mul [si]div bladd [si], alinc siinc diloop nxtmov ah, 4chint 21hendMCSL 01723 Loganathan R
  24. 24. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy11. Write a program to Convert ASCII number into decimal digit.;ASCII to Decimal.model large.stack 100h.model small.dataasci db zbcd dw 0.codemov ax, @datamov ds,axmov bl, 10mov cl, 0mov al, ascinxt:mov ah, 0div blmov ch,alxchg al, ahcbwshl ax, clor bcd, axadd cl, 4mov al, chcmp al, 0jnz nxtmov ah,4chint 21hendMCSL 01724 Loganathan R
  25. 25. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy12. Write a Program for performing the following operation. Z=((A-B)/10*C) ** 2;z= ((a-b) /10 *c) **2.model small.dataa db 60b db 20c db 5Z dw ?.codemov ax, @datamov ds, axmov ah, 0mov bl, 10mov al, asub al, bdiv blmul cmul almov z, axmov ah, 4chint 21hendMCSL 01725 Loganathan R
  26. 26. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy13. Write a Program for adding an array of Binary Digits.;add array of binar digits.model small.databin db 1,0,1,1,1,1,1,1,1,0,1len dw len-binres db ?.codemov ax, @datamov ds, axlea si, binmov cx, lenmov al, 0nxt:test [si], 1jz cntnuinc alcntnu:inc siloop nxtmov res, almov ah, 4chint 21hendMCSL 01726 Loganathan R
  27. 27. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy14. Write a Program, which takes the input of 4-digit number, and display the sum of square of digitsas given below.Example: Input = 472142+72+22+12= 16+49+4+1Result = 70. (Display);Squarte & add digits.model small.datamsg1 db 10,13,Enter a 4 digit decimal number : $n dw 0msg2 db 10,13,Addition of Square of all digits : $dgts db 4 dup(?)res dw 0.codemov ax, @datamov ds, axlea si, dgtswrng:lea dx, msg1mov ah, 9int 21hmov cx, 4mov ah, 1nxt:int 21hcmp al, 0jb wrngcmp al, 9ja wrngsub al, 30hmov [si], alinc siloop nxtlea si, dgtsmov cx, 4nxtdgt:mov al, [si]mul aladd res, axinc siloop nxtdgtlea dx, msg2mov ah, 9int 21hMCSL 01727 Loganathan R
  28. 28. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoylea si, dgtsadd si, 3mov bl, 10mov cx, 4mov ax, resxtrct:div blmov [si],ahdec simov ah,0loop xtrctlea si, dgtsmov cx,4mov ah, 2disp:mov dl, [si]add dl, 30hint 21hinc siloop dispmov ah, 4chint 21hendMCSL 01728 Loganathan R
  29. 29. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy15. Using the method of "add-and-shift" loop, in which you use the binary digits of one number tocontrol additions of a shifted version of the other number into a running total; this is essentially thesame algorithm you use when multiplying numbers by hand in decimal.;Multiply using shift & add.model small.datamulpir db 21hmulcnd db 30hres dw 0.codemov ax, @datamov ds, axmov cx, 8mov al, mulcndcbwmov bl, mulpirnxt:shr bl, 1jnc cntnuadd res, axcntnu:shl ax, 1loop nxtmov ah, 4chint 21hendMCSL 01729 Loganathan R
  30. 30. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy16. Write a Program, which should add two 5-byte numbers (numbers are stored in array- NUM1 &NUM2), and stores the sum in another array named RESULT.;Adding 2 Five byte Numbers.model small.datanum1 db 11h,22h,33h,44h,0f5h,num2 db 55h,44h,33h,22h,0f1hres db 6 dup(0).codemov ax, @datamov ds, axmov es, axmov cx, 5lea bx, reslea si, num1lea di, num2nxt:mov al, [si]add al, [di]jnc cntnuinc [bx+1]cntnu:add [bx], alinc siinc diinc bxloop nxtmov ah, 4chint 21hendMCSL 01730 Loganathan R
  31. 31. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy17. Write a program which should convert 4 digits BCD number into its binary equivalent..model small.stack 64.databcd dw 9999hbin dw 0.codemov ax, @datamov ds, axmov bp, bcd ; y not dx?mov bx, 10mov cx, 4nxt:push cxmov cl, 4rol bp, clpop cxmov ax, binmul bxmov bin, axmov ax, 0fhand ax, bpadd bin, axloop nxtmov ah, 4chint 21hendMCSL 01731 Loganathan R
  32. 32. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy18. Write a program to conduct a binary search on a given sorted array of 16-bit, unsigned integers,and a given 16-bit unsigned key..model small.datanos dw 1111h,2222h,4444h,7777h,9999hlen dw (len - nos) / 2key dw 0A999hsmsg db Search Success$fmsg db Search Failure$.codemov ax, @datamov ds, axmov bx, 1mov dx, len ;dx=5mov cx, key ;cx=2345agn:cmp bx, dxja failmov ax, bxadd ax, dxshr ax, 1mov si, axdec siadd si, sicmp cx, nos[si]jae largdec axmov dx, axjmp agnlarg:je sucsinc axmov bx, axjmp agnsucs:lea dx, smsgjmp dispfail:lea dx, fmsgdisp:mov ah, 09hint 21hmov ah, 4chint 21hendMCSL 01732 Loganathan R
  33. 33. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy19. Write a program to convert a string in upper case to lower case or lower case to upper case..model small.datastr db UPPERCASE To lowercase$len dw len-strmsg1 db 10,13,Before Convertion : $msg2 db 10,13,After Convertion : $.codemov ax, @datamov ds, axmov es, axlea dx, msg1mov ah, 9int 21hlea dx, strint 21hlea dx, msg2int 21hmov cx, lenlea si, strmov di, sinxt:lodsbcmp al, Ajb nochgcmp al, Zja toupadd al, a - Ajmp nochgtoup:cmp al, ajb nochgcmp al, zja nochgsub al, a - Anochg:stosbloop nxtlea dx, strmov ah, 9int 21hmov ah, 4chint 21hendMCSL 01733 Loganathan R
  34. 34. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy20. Develop cryptographic algorithm where each letter is replaced by a different letter. Given themapping of characters to encoded characters, it is simple to translate from encoded to decoded data.Write a Program, which encodes the string into the ASCII value but not corresponding ASCII value;shift 5 place left in ASCII and write the encoding string.;Encryption.model small.datastr db This is a TEST data XyZ$len dw len-strmsg1 db 10,13,Before Encryption : $msg2 db 10,13,After Encryption : $.codemov ax, @datamov ds, axmov es, axlea dx, msg1mov ah, 9int 21hlea dx, strint 21hlea dx, msg2int 21hmov cx, lenlea si, strmov di, sinxt:lodsbcmp al, Ajb nochgcmp al, Zja tolowpush cxmov cx, 5nxtup:dec alcmp al, Ajae ucntnumov al, Zucntnu:loop nxtuppop cxjmp nochgMCSL 01734 Loganathan R
  35. 35. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoytolow:cmp al, ajb nochgcmp al, zja nochgpush cxmov cx, 5nxtlow:dec alcmp al, ajae lcntnumov al, zlcntnu:loop nxtlowpop cxnochg:stosbloop nxtlea dx, strmov ah, 9int 21hmov ah, 4chint 21hendMCSL 01735 Loganathan R
  36. 36. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy21. Similarly write another Program to Decoding with respect to above problem.;Decryption.model small.datastr db Ocdn dn v OZNO yvov StU$ulut db FGHIJKLMNOPQRSTUVWXYZABCDEllut db fghijklmnopqrstuvwxyzabcdelen dw len-strmsg1 db 10,13,Before Decryption : $msg2 db 10,13,After Decryption : $.codemov ax, @datamov ds, axmov es, axlea dx, msg1mov ah, 9int 21hlea dx, strint 21hlea dx, msg2int 21hmov cx, lenlea si, strmov di, sinxt:lodsbcmp al, Ajb nochgcmp al, Zja tolowlea bx, ulutsub al,Axlatjmp nochgtolow:cmp al, ajb nochgcmp al, zja nochglea bx, llutsub al,axlatMCSL 01736 Loganathan R
  37. 37. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoynochg:stosbloop nxtlea dx, strmov ah, 9int 21hmov ah, 4chint 21hendMCSL 01737 Loganathan R
  38. 38. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoySession 8:1. Write a program, which takes two inputs as strings and display the Concatenated string.;Concatenation of 2 Strings.model small ;1 ds & 1 CS.data ;Data Segmentstr1b db 53sl1 db ?str1 db 51 dup($)str2b db 53sl2 db ?str2 db 51 dup($)cstr db 100 dup($)msg1 db Enter String 1(Max length 50) :$msg2 db 10,13,Enter String 2(Max length 50) :$cmsg db 10,13,The Concatenated String : $.codemov ax, @datamov ds, ax ;initialize DS with Data Segment Basemov es, ax ;initialize ES with Data Segment Baselea dx, msg1mov ah, 9int 21hlea dx, str1bmov ah, 0ahint 21hlea dx, msg2mov ah, 9int 21hlea dx, str2bmov ah, 0ahint 21hlea si, str1lea di, cstrmov cl, sl1xor ch, chjcxz nxt1cpy1:lodsbstosbloop cpy1nxt1:lea si, str2mov cl, sl2jcxz nxt2MCSL 01738 Loganathan R
  39. 39. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoycpy2:lodsbstosbloop cpy2nxt2:mov ah, 9lea dx, cmsgint 21hlea dx, cstrint 21hmov ah, 4ch ;exit to operating system.int 21hendMCSL 01739 Loganathan R
  40. 40. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy2. Write a program, which converts string lower case characters to upper case characters and uppercase characters to lower case characters..model small ;1 ds & 1 CS.data ;Data Segmentstrb db 103sl db ?str db 101 dup($)msg db Enter String with Upper & Lower case :$cmsg db 10,13,The Coverted String : $.codemov ax, @datamov ds, ax ;initialize DS with Data Segment Basemov es, ax ;initialize ES with Data Segment Baselea dx, msgmov ah, 9int 21hlea dx, strbmov ah, 0ahint 21hlea dx, cmsgmov ah, 9int 21hmov cl, slxor ch, chjcxz xitlea si, strmov di, sinxt:lodsbcmp al, Ajb nochgcmp al, Zja toupadd al, a - Ajmp nochgtoup:cmp al, ajb nochgcmp al, zja nochgsub al, a - Anochg:MCSL 01740 Loganathan R
  41. 41. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoystosbloop nxtxit:lea dx, strmov ah, 9int 21hmov ah, 4ch ;exit to operating system.int 21hendMCSL 01741 Loganathan R
  42. 42. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy3. Write a program for reversing a given string..model small ;1 ds & 1 CS.data ;Data Segmentstrb db 103sl db ?mstr db 101 dup($)rstr db 100 dup($)msg db Enter a String : $cmsg db 10,13,The Reversed String : $.codemov ax, @datamov ds, ax ;initialize DS with Data Segment Basemov es, ax ;initialize ES with Data Segment Baselea dx, msgmov ah, 9int 21hlea dx, strbmov ah, 0ahint 21hlea dx, cmsgmov ah, 9int 21hmov cl, slxor ch, chjcxz xitlea si, mstrlea di, rstradd si, cxnxt:dec simov al, [si]stosbloop nxtxit:lea dx, rstrmov ah, 9int 21hmov ah, 4ch ;exit to operating system.int 21hendMCSL 01742 Loganathan R
  43. 43. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy4. Write a program, which converts string to its ASCII value and store in array..model small ;1 ds & 1 CS.data ;Data Segmentstrb db 103sl db ?str db 101 dup(0) ; ASCII equivalent of string charactersmsg db 10,13,Enter a String : $.codemov ax, @datamov ds, ax ;initialize DS with Data Segment Baselea dx, msgmov ah, 9int 21hlea dx, strbmov ah, 0ahint 21hmov ah, 4ch ;exit to operating system.int 21hendMCSL 01743 Loganathan R
  44. 44. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy5. Write a program to find if two strings are equal length: and if the strings are found to be ofequivalent length then are they the same, if not the same then which string is lexicographically greater.;Concatenation of 2 Strins.model small ;1 ds & 1 CS.data ;Data Segmentstr1b db 103sl1 db ?str1 db 101 dup($)str2b db 103sl2 db ?str2 db 101 dup($)msg1 db 10,13,Enter String 1(Max length 50) :$msg2 db 10,13,Enter String 2(Max length 50) :$emsg db 10,13,The Strings are Equal$nemsg db 10,13,The Strings are NOT Equal Length$gmsg db 10,13,String res db ?, is Greater$.codemov ax, @datamov ds, ax ;initialize DS with Data Segment Basemov es, ax ;initialize ES with Data Segment Baseagn:lea dx, msg1mov ah, 9int 21hlea dx, str1bmov ah, 0ahint 21hlea dx, msg2mov ah, 9int 21hlea dx, str2bmov ah, 0ahint 21hlea si, str1lea di, str2mov cl, sl1cmp cl, sl2jne diflenxor ch, chjcxz agnrepe cmpsbje eqlstrmov al, [si-1]cmp al, [di-1]ja gstr1MCSL 01744 Loganathan R
  45. 45. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoymov res, 2jmp dspgstrgstr1:mov res, 1dspgstr:lea dx, gmsgjmp disp:eqlstr:lea dx, emsgjmp dispdiflen:lea dx, nemsgdisp:mov ah, 9int 21hmov ah, 4ch ;exit to operating system.int 21hendMCSL 01745 Loganathan R
  46. 46. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy6. Write a program to determine a given string is a palindrome. If Yes output the message “Thegiven string is a palindrome”. If No output the message “No, it is not a palindrome”..model small ;1 ds & 1 CS.data ;Data Segmentstrb db 103sl db ?mstr db 101 dup($)rstr db 100 dup($)msg db 10,13,Enter a String : $pmsg db 10,13,Given String is a Polindrome$npmsg db 10,13,Given String is NOT a Polindrome$.codemov ax, @datamov ds, ax ;initialize DS with Data Segment Basemov es, ax ;initialize ES with Data Segment Baseagn:lea dx, msgmov ah, 9int 21hlea dx, strbmov ah, 0ahint 21hmov cl, slxor ch, chjcxz agnlea si, mstrlea di, rstradd si, cxnxt:dec simov al, [si]stosbloop nxtmov cl, sllea si, mstrlea di, rstrrepe cmpsbje equllea dx, npmsgjmp dispequl:lea dx, pmsgMCSL 01746 Loganathan R
  47. 47. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoydisp:mov ah, 9int 21hxit:mov ah, 4ch ;exit to operating system.int 21hendMCSL 01747 Loganathan R
  48. 48. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoy7. Write a program to search for a character in a given string and calculate the number ofoccurrences of the character in the given string.;Character Search.model small ;1 ds & 1 CS.data ;Data Segmentstrb db 103sl db ?str db 101 dup($)msg1 db 10,13,Enter a String : $msg2 db 10,13,Enter the charector to be searched : $msg3 db 10,13,Given Characterchr db ?, Present nos db 0,0, Times$.codemov ax, @datamov ds, ax ;initialize DS with Data Segment Basemov es, ax ;initialize ES with Data Segment Baseagn:lea dx, msg1mov ah, 9int 21hlea dx, strbmov ah, 0ahint 21hlea dx, msg2mov ah, 9int 21hmov ah, 1int 21hmov chr, almov cl, slxor ch, chjcxz agnlea di, strnxt:scasbjne cntnuinc noscntnu:loop nxtmov al, nosaamMCSL 01748 Loganathan R
  49. 49. tootDNtooototot Copypo NoDtoott CoytoypCyootopyt CyCyptpyptotpototoyyptyytoCopyptoppyyp pDo pCyot Cpy pyDtotptopyypttoCpoooooot otpCo poyptNtpyNtpNCNDoCDyCotoCypopttyyopyptoNpytopotootpp yoDNyoDoDtotp yyDotoopCyp otoytooyooypyypNNtoo ooytopyypDotto oooNo Nt CoyDoNoDto ooCyyooCpootpoypoyotyDypyoCDooDo NootyypDNoooppyypottootyNtoypt CpoDNootypyottoDDNtooopDo tCDppNoCpyypototoCoypo NyoypoytCopopCtopoy yotNoypyo Cootyypooytppyttoypypyp oyoto toDotootpyNypooDtooypyptoCCoytoooypypoototyooCotpNDoNttptpooyypNytottoopypyt CpypDootttoypypot CDtoyopDDotppo Noooo NyttoypooDNoyt Copp yot oypoppNottopyDooNDNt oCotoopytooppNCypootooDo NoDNooyyypoDo NtppypCpoyadd ax, 3030hmov nos, ahmov nos+1, allea dx, msg3mov ah, 9int 21hmov ah, 4ch ;exit to operating system.int 21hendMCSL 01749 Loganathan R

×