SlideShare a Scribd company logo
1 of 7
Download to read offline
1) (a) Write a code fragment which adds the 32-bit contents of $8100 (LSB) - 8103 (MSB) to
$8104 - $8107 and stores it to $8100 - $8103. (b) Write a similar code fragment, which adds the
8-digit BCD contents of $8200 - $8203 to $8204 - $8207 and stores it to $8200 - $8203. Using
68HC11 Assembly Instruction Set.
Solution
Step I : Initialize the data segment.
Step II : Load the LSB of first number into AX register.
Step III : Load the MSB of first number into BX register.
Step IV : Load the LSB of the second number into CX register.
Step V : Load the MSB of the second number into DX register.
Step VI : Add the LSBs of two number.
Step VII : Add the MSBs of two numbers along with carry.
Step VIII : Display the result.
Step IX : Stop.
.model small
.data
op1 dd 12345678h
op2 dd 11111111h Corel - 10
ans dd ?
.code
mov ax, @data
mov ds, ax
mov ax, word ptr op1 ; lsb of number1 in ax
mov bx, word ptr op1+2 ; msb of number1 in bx
mov cx, word ptr op2 ; lsb of number2 in cx
mov dx, word ptr op2+2 ; msb of number1 in dx
add ax, cx ; add msb + msb + carry
mov word ptr ans, ax ; lsb answer
mov word ptr ans+2, bx ; msb answer
mov bx, word ptr ans+2 ; Result in reg bx
mov dh, 2
l1: mov ch, 04h ; Count of digits to be displayed
mov cl, 04h ; Count to roll by 4 bits
l2: rol bx, cl ; roll bl so that msb comes to lsb
mov dl, bl ; load dl with data to be displayed
and dl, 0fH ; get only lsb
cmp dl, 09 ; check if digit is 0-9 or letter A-F
jbe l4
add dl, 07 ; if letter add 37H else only add 30H
l4: add dl, 30H
mov ah, 02 ; INT 21H (Display character)
int 21H
dec ch ; Decrement Count
jnz l2
dec dh
cmp dh, 0
mov bx, word ptr ans ; display lsb of answer
jnz l1
mov ah, 4ch ; Terminate Program
int 21h
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.model small
.data
op1 dd 12345678h
op2 dd 11111111h Corel - 10
ans dd ?
.code
mov ax, @data
mov ds, ax
mov ax, word ptr op1 ; lsb of number1 in ax
mov bx, word ptr op1+2 ; msb of number1 in bx
mov cx, word ptr op2 ; lsb of number2 in cx
mov dx, word ptr op2+2 ; msb of number1 in dx
add ax, cx ; add msb + msb + carry
mov word ptr ans, ax ; lsb answer
mov word ptr ans+2, bx ; msb answer
mov bx, word ptr ans+2 ; Result in reg bx
mov dh, 2
l1: mov ch, 04h ; Count of digits to be displayed
mov cl, 04h ; Count to roll by 4 bits
l2: rol bx, cl ; roll bl so that msb comes to lsb
mov dl, bl ; load dl with data to be displayed
and dl, 0fH ; get only lsb
cmp dl, 09 ; check if digit is 0-9 or letter A-F
jbe l4
add dl, 07 ; if letter add 37H else only add 30H
l4: add dl, 30H
mov ah, 02 ; INT 21H (Display character)
int 21H
dec ch ; Decrement Count
jnz l2
dec dh
cmp dh, 0
mov bx, word ptr ans ; display lsb of answer
jnz l1
mov ah, 4ch ; Terminate Program
int 21h
---------------------------------------------------
Step 1 : Initialize the data segment.
Step 2 : Get the first number in AL register.
Step 3 : Get the second number in BL register.
Step 4 : Add the two numbers.
Step 5 : Display the result.
Step 6 : Stop
.model small
.data
a db 09H
b db 02H
.code
mov ax, @data ; Initialize data section
mov ds, ax
mov al, a ; Load number1 in al
mov bl, b ; Load number2 in bl
add al, bl ; add numbers and result in al
mov ch, 02h ; Count of digits to be displayed
mov cl, 04h ; Count to roll by 4 bits
mov bh, al ; Result in reg bh
l2: rol bh, cl ; roll bl so that msb comes to lsb
mov dl, bh ; load dl with data to be displayed
and dl, 0fH ; get only lsb
cmp dl, 09 ; check if digit is 0-9 or letter A-F
jbe l4
add dl, 07 ; if letter add 37H else only add 30H
l4: add dl, 30H
mov ah, 02 ; Function 2 under INT 21H (Display character)
int 21H
dec ch ; Decrement Count
jnz l2
mov ah, 4CH ; Terminate Program
int 21H
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.model small
.data
op1 dd 12345678h
op2 dd 11111111h Corel - 10
ans dd ?
.code
mov ax, @data
mov ds, ax
mov ax, word ptr op1 ; lsb of number1 in ax
mov bx, word ptr op1+2 ; msb of number1 in bx
mov cx, word ptr op2 ; lsb of number2 in cx
mov dx, word ptr op2+2 ; msb of number1 in dx
add ax, cx ; add msb + msb + carry
mov word ptr ans, ax ; lsb answer
mov word ptr ans+2, bx ; msb answer
mov bx, word ptr ans+2 ; Result in reg bx
mov dh, 2
l1: mov ch, 04h ; Count of digits to be displayed
mov cl, 04h ; Count to roll by 4 bits
l2: rol bx, cl ; roll bl so that msb comes to lsb
mov dl, bl ; load dl with data to be displayed
and dl, 0fH ; get only lsb
cmp dl, 09 ; check if digit is 0-9 or letter A-F
jbe l4
add dl, 07 ; if letter add 37H else only add 30H
l4: add dl, 30H
mov ah, 02 ; INT 21H (Display character)
int 21H
dec ch ; Decrement Count
jnz l2
dec dh
cmp dh, 0
mov bx, word ptr ans ; display lsb of answer
jnz l1
mov ah, 4ch ; Terminate Program
int 21h

More Related Content

Similar to 1) (a) Write a code fragment which adds the 32-bit contents of $8100.pdf

Instalación de emu8086
Instalación de emu8086Instalación de emu8086
Instalación de emu8086Alex Toapanta
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarragaFabricio Galárraga
 
Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Santy Bolo
 
Introduction to ibm pc assembly language
Introduction to ibm pc assembly languageIntroduction to ibm pc assembly language
Introduction to ibm pc assembly languagewarda aziz
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructionswarda aziz
 
Защищая С++. Павел Филонов ➠ CoreHard Autumn 2019
Защищая С++. Павел Филонов ➠ CoreHard Autumn 2019 Защищая С++. Павел Филонов ➠ CoreHard Autumn 2019
Защищая С++. Павел Филонов ➠ CoreHard Autumn 2019 corehard_by
 
Assembly Language Instructions & Programming.pptx
Assembly Language Instructions & Programming.pptxAssembly Language Instructions & Programming.pptx
Assembly Language Instructions & Programming.pptxVineetKukreti1
 
15CS44 MP &MC Module 3
15CS44 MP &MC Module 315CS44 MP &MC Module 3
15CS44 MP &MC Module 3RLJIT
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-pptjemimajerome
 
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and TasksSegmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and TasksDavid Evans
 
Emulador de ensamblador emu8086
Emulador de ensamblador emu8086Emulador de ensamblador emu8086
Emulador de ensamblador emu8086Marco Muñoz
 
Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.pptsteffydean
 

Similar to 1) (a) Write a code fragment which adds the 32-bit contents of $8100.pdf (20)

8086 microprocessor lab manual
8086 microprocessor lab manual8086 microprocessor lab manual
8086 microprocessor lab manual
 
8086 labmanual
8086 labmanual8086 labmanual
8086 labmanual
 
Instalación de emu8086
Instalación de emu8086Instalación de emu8086
Instalación de emu8086
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarraga
 
Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086Lenguaje ensamblador EMU8086
Lenguaje ensamblador EMU8086
 
6 arithmetic logic inst and prog
6 arithmetic logic inst and prog6 arithmetic logic inst and prog
6 arithmetic logic inst and prog
 
Introduction to ibm pc assembly language
Introduction to ibm pc assembly languageIntroduction to ibm pc assembly language
Introduction to ibm pc assembly language
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
 
Emulador emu8086
Emulador emu8086Emulador emu8086
Emulador emu8086
 
Protecting C++
Protecting C++Protecting C++
Protecting C++
 
Защищая С++. Павел Филонов ➠ CoreHard Autumn 2019
Защищая С++. Павел Филонов ➠ CoreHard Autumn 2019 Защищая С++. Павел Филонов ➠ CoreHard Autumn 2019
Защищая С++. Павел Филонов ➠ CoreHard Autumn 2019
 
Assembly Language Instructions & Programming.pptx
Assembly Language Instructions & Programming.pptxAssembly Language Instructions & Programming.pptx
Assembly Language Instructions & Programming.pptx
 
15CS44 MP &MC Module 3
15CS44 MP &MC Module 315CS44 MP &MC Module 3
15CS44 MP &MC Module 3
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and TasksSegmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
 
Emulador de ensamblador emu8086
Emulador de ensamblador emu8086Emulador de ensamblador emu8086
Emulador de ensamblador emu8086
 
Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.ppt
 
Mpmc lab
Mpmc labMpmc lab
Mpmc lab
 
Ch9b
Ch9bCh9b
Ch9b
 

More from aromanets

Multiple sclerosis (like many CNS disorders) is more descriptive.pdf
Multiple sclerosis (like many CNS disorders) is more descriptive.pdfMultiple sclerosis (like many CNS disorders) is more descriptive.pdf
Multiple sclerosis (like many CNS disorders) is more descriptive.pdfaromanets
 
In your own words, define the following terms. Concentrate on structu.pdf
In your own words, define the following terms. Concentrate on structu.pdfIn your own words, define the following terms. Concentrate on structu.pdf
In your own words, define the following terms. Concentrate on structu.pdfaromanets
 
Is R with the cofinite topo1o separable Prove your answer. Solut.pdf
Is R with the cofinite topo1o separable Prove your answer. Solut.pdfIs R with the cofinite topo1o separable Prove your answer. Solut.pdf
Is R with the cofinite topo1o separable Prove your answer. Solut.pdfaromanets
 
Identify the impacts of dementia.Is it preventable in our future a.pdf
Identify the impacts of dementia.Is it preventable in our future a.pdfIdentify the impacts of dementia.Is it preventable in our future a.pdf
Identify the impacts of dementia.Is it preventable in our future a.pdfaromanets
 
Heisenberg Uncertainty question...Why does my professor write delt.pdf
Heisenberg Uncertainty question...Why does my professor write delt.pdfHeisenberg Uncertainty question...Why does my professor write delt.pdf
Heisenberg Uncertainty question...Why does my professor write delt.pdfaromanets
 
How did the Spanish crown initially fulfill its need for African sla.pdf
How did the Spanish crown initially fulfill its need for African sla.pdfHow did the Spanish crown initially fulfill its need for African sla.pdf
How did the Spanish crown initially fulfill its need for African sla.pdfaromanets
 
Four different fluorescent dyes are used in automated DNA sequencing.pdf
Four different fluorescent dyes are used in automated DNA sequencing.pdfFour different fluorescent dyes are used in automated DNA sequencing.pdf
Four different fluorescent dyes are used in automated DNA sequencing.pdfaromanets
 
For the investment situation below. Identify the annual Interest rate.pdf
For the investment situation below. Identify the annual Interest rate.pdfFor the investment situation below. Identify the annual Interest rate.pdf
For the investment situation below. Identify the annual Interest rate.pdfaromanets
 
For a given class, the studen records are stored in a file. The reco.pdf
For a given class, the studen records are stored in a file. The reco.pdfFor a given class, the studen records are stored in a file. The reco.pdf
For a given class, the studen records are stored in a file. The reco.pdfaromanets
 
Elementary school children spent significantly more time reading i.pdf
Elementary school children spent significantly more time reading i.pdfElementary school children spent significantly more time reading i.pdf
Elementary school children spent significantly more time reading i.pdfaromanets
 
Describe the tools and technology used to support IT project managem.pdf
Describe the tools and technology used to support IT project managem.pdfDescribe the tools and technology used to support IT project managem.pdf
Describe the tools and technology used to support IT project managem.pdfaromanets
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
 
Compare the following bacterial species, bacterial strain, and bact.pdf
Compare the following bacterial species, bacterial strain, and bact.pdfCompare the following bacterial species, bacterial strain, and bact.pdf
Compare the following bacterial species, bacterial strain, and bact.pdfaromanets
 
Annual estimates of the population in a Hawaiian county from 1999 (t .pdf
Annual estimates of the population in a Hawaiian county from 1999 (t .pdfAnnual estimates of the population in a Hawaiian county from 1999 (t .pdf
Annual estimates of the population in a Hawaiian county from 1999 (t .pdfaromanets
 
Acid rain negatively affects plants byA. reducing the photosynthet.pdf
Acid rain negatively affects plants byA. reducing the photosynthet.pdfAcid rain negatively affects plants byA. reducing the photosynthet.pdf
Acid rain negatively affects plants byA. reducing the photosynthet.pdfaromanets
 
A random variable X is exponentially distributed with a mean of 0.14.pdf
A random variable X is exponentially distributed with a mean of 0.14.pdfA random variable X is exponentially distributed with a mean of 0.14.pdf
A random variable X is exponentially distributed with a mean of 0.14.pdfaromanets
 
A protein, called pRb (protein for retinoblastoma) is synthesized by.pdf
A protein, called pRb (protein for retinoblastoma) is synthesized by.pdfA protein, called pRb (protein for retinoblastoma) is synthesized by.pdf
A protein, called pRb (protein for retinoblastoma) is synthesized by.pdfaromanets
 
What kind of bond would form between NH_4 and Cl^- to make the salt a.pdf
What kind of bond would form between NH_4 and Cl^- to make the salt a.pdfWhat kind of bond would form between NH_4 and Cl^- to make the salt a.pdf
What kind of bond would form between NH_4 and Cl^- to make the salt a.pdfaromanets
 
Which muscle provides a guide to the position of the radial artery at.pdf
Which muscle provides a guide to the position of the radial artery at.pdfWhich muscle provides a guide to the position of the radial artery at.pdf
Which muscle provides a guide to the position of the radial artery at.pdfaromanets
 
Which of the following is a true statement regarding lysosomesWhi.pdf
Which of the following is a true statement regarding lysosomesWhi.pdfWhich of the following is a true statement regarding lysosomesWhi.pdf
Which of the following is a true statement regarding lysosomesWhi.pdfaromanets
 

More from aromanets (20)

Multiple sclerosis (like many CNS disorders) is more descriptive.pdf
Multiple sclerosis (like many CNS disorders) is more descriptive.pdfMultiple sclerosis (like many CNS disorders) is more descriptive.pdf
Multiple sclerosis (like many CNS disorders) is more descriptive.pdf
 
In your own words, define the following terms. Concentrate on structu.pdf
In your own words, define the following terms. Concentrate on structu.pdfIn your own words, define the following terms. Concentrate on structu.pdf
In your own words, define the following terms. Concentrate on structu.pdf
 
Is R with the cofinite topo1o separable Prove your answer. Solut.pdf
Is R with the cofinite topo1o separable Prove your answer. Solut.pdfIs R with the cofinite topo1o separable Prove your answer. Solut.pdf
Is R with the cofinite topo1o separable Prove your answer. Solut.pdf
 
Identify the impacts of dementia.Is it preventable in our future a.pdf
Identify the impacts of dementia.Is it preventable in our future a.pdfIdentify the impacts of dementia.Is it preventable in our future a.pdf
Identify the impacts of dementia.Is it preventable in our future a.pdf
 
Heisenberg Uncertainty question...Why does my professor write delt.pdf
Heisenberg Uncertainty question...Why does my professor write delt.pdfHeisenberg Uncertainty question...Why does my professor write delt.pdf
Heisenberg Uncertainty question...Why does my professor write delt.pdf
 
How did the Spanish crown initially fulfill its need for African sla.pdf
How did the Spanish crown initially fulfill its need for African sla.pdfHow did the Spanish crown initially fulfill its need for African sla.pdf
How did the Spanish crown initially fulfill its need for African sla.pdf
 
Four different fluorescent dyes are used in automated DNA sequencing.pdf
Four different fluorescent dyes are used in automated DNA sequencing.pdfFour different fluorescent dyes are used in automated DNA sequencing.pdf
Four different fluorescent dyes are used in automated DNA sequencing.pdf
 
For the investment situation below. Identify the annual Interest rate.pdf
For the investment situation below. Identify the annual Interest rate.pdfFor the investment situation below. Identify the annual Interest rate.pdf
For the investment situation below. Identify the annual Interest rate.pdf
 
For a given class, the studen records are stored in a file. The reco.pdf
For a given class, the studen records are stored in a file. The reco.pdfFor a given class, the studen records are stored in a file. The reco.pdf
For a given class, the studen records are stored in a file. The reco.pdf
 
Elementary school children spent significantly more time reading i.pdf
Elementary school children spent significantly more time reading i.pdfElementary school children spent significantly more time reading i.pdf
Elementary school children spent significantly more time reading i.pdf
 
Describe the tools and technology used to support IT project managem.pdf
Describe the tools and technology used to support IT project managem.pdfDescribe the tools and technology used to support IT project managem.pdf
Describe the tools and technology used to support IT project managem.pdf
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
 
Compare the following bacterial species, bacterial strain, and bact.pdf
Compare the following bacterial species, bacterial strain, and bact.pdfCompare the following bacterial species, bacterial strain, and bact.pdf
Compare the following bacterial species, bacterial strain, and bact.pdf
 
Annual estimates of the population in a Hawaiian county from 1999 (t .pdf
Annual estimates of the population in a Hawaiian county from 1999 (t .pdfAnnual estimates of the population in a Hawaiian county from 1999 (t .pdf
Annual estimates of the population in a Hawaiian county from 1999 (t .pdf
 
Acid rain negatively affects plants byA. reducing the photosynthet.pdf
Acid rain negatively affects plants byA. reducing the photosynthet.pdfAcid rain negatively affects plants byA. reducing the photosynthet.pdf
Acid rain negatively affects plants byA. reducing the photosynthet.pdf
 
A random variable X is exponentially distributed with a mean of 0.14.pdf
A random variable X is exponentially distributed with a mean of 0.14.pdfA random variable X is exponentially distributed with a mean of 0.14.pdf
A random variable X is exponentially distributed with a mean of 0.14.pdf
 
A protein, called pRb (protein for retinoblastoma) is synthesized by.pdf
A protein, called pRb (protein for retinoblastoma) is synthesized by.pdfA protein, called pRb (protein for retinoblastoma) is synthesized by.pdf
A protein, called pRb (protein for retinoblastoma) is synthesized by.pdf
 
What kind of bond would form between NH_4 and Cl^- to make the salt a.pdf
What kind of bond would form between NH_4 and Cl^- to make the salt a.pdfWhat kind of bond would form between NH_4 and Cl^- to make the salt a.pdf
What kind of bond would form between NH_4 and Cl^- to make the salt a.pdf
 
Which muscle provides a guide to the position of the radial artery at.pdf
Which muscle provides a guide to the position of the radial artery at.pdfWhich muscle provides a guide to the position of the radial artery at.pdf
Which muscle provides a guide to the position of the radial artery at.pdf
 
Which of the following is a true statement regarding lysosomesWhi.pdf
Which of the following is a true statement regarding lysosomesWhi.pdfWhich of the following is a true statement regarding lysosomesWhi.pdf
Which of the following is a true statement regarding lysosomesWhi.pdf
 

Recently uploaded

SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Recently uploaded (20)

SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

1) (a) Write a code fragment which adds the 32-bit contents of $8100.pdf

  • 1. 1) (a) Write a code fragment which adds the 32-bit contents of $8100 (LSB) - 8103 (MSB) to $8104 - $8107 and stores it to $8100 - $8103. (b) Write a similar code fragment, which adds the 8-digit BCD contents of $8200 - $8203 to $8204 - $8207 and stores it to $8200 - $8203. Using 68HC11 Assembly Instruction Set. Solution Step I : Initialize the data segment. Step II : Load the LSB of first number into AX register. Step III : Load the MSB of first number into BX register. Step IV : Load the LSB of the second number into CX register. Step V : Load the MSB of the second number into DX register. Step VI : Add the LSBs of two number. Step VII : Add the MSBs of two numbers along with carry. Step VIII : Display the result. Step IX : Stop. .model small .data op1 dd 12345678h op2 dd 11111111h Corel - 10 ans dd ? .code mov ax, @data mov ds, ax mov ax, word ptr op1 ; lsb of number1 in ax mov bx, word ptr op1+2 ; msb of number1 in bx mov cx, word ptr op2 ; lsb of number2 in cx mov dx, word ptr op2+2 ; msb of number1 in dx add ax, cx ; add msb + msb + carry mov word ptr ans, ax ; lsb answer mov word ptr ans+2, bx ; msb answer mov bx, word ptr ans+2 ; Result in reg bx mov dh, 2
  • 2. l1: mov ch, 04h ; Count of digits to be displayed mov cl, 04h ; Count to roll by 4 bits l2: rol bx, cl ; roll bl so that msb comes to lsb mov dl, bl ; load dl with data to be displayed and dl, 0fH ; get only lsb cmp dl, 09 ; check if digit is 0-9 or letter A-F jbe l4 add dl, 07 ; if letter add 37H else only add 30H l4: add dl, 30H mov ah, 02 ; INT 21H (Display character) int 21H dec ch ; Decrement Count jnz l2 dec dh cmp dh, 0 mov bx, word ptr ans ; display lsb of answer jnz l1 mov ah, 4ch ; Terminate Program int 21h end 1 2 3 4 5 6 7 8 9 10 11 12 13 14
  • 3. 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 .model small .data op1 dd 12345678h op2 dd 11111111h Corel - 10 ans dd ? .code mov ax, @data mov ds, ax mov ax, word ptr op1 ; lsb of number1 in ax mov bx, word ptr op1+2 ; msb of number1 in bx mov cx, word ptr op2 ; lsb of number2 in cx mov dx, word ptr op2+2 ; msb of number1 in dx
  • 4. add ax, cx ; add msb + msb + carry mov word ptr ans, ax ; lsb answer mov word ptr ans+2, bx ; msb answer mov bx, word ptr ans+2 ; Result in reg bx mov dh, 2 l1: mov ch, 04h ; Count of digits to be displayed mov cl, 04h ; Count to roll by 4 bits l2: rol bx, cl ; roll bl so that msb comes to lsb mov dl, bl ; load dl with data to be displayed and dl, 0fH ; get only lsb cmp dl, 09 ; check if digit is 0-9 or letter A-F jbe l4 add dl, 07 ; if letter add 37H else only add 30H l4: add dl, 30H mov ah, 02 ; INT 21H (Display character) int 21H dec ch ; Decrement Count jnz l2 dec dh cmp dh, 0 mov bx, word ptr ans ; display lsb of answer jnz l1 mov ah, 4ch ; Terminate Program int 21h --------------------------------------------------- Step 1 : Initialize the data segment. Step 2 : Get the first number in AL register. Step 3 : Get the second number in BL register. Step 4 : Add the two numbers. Step 5 : Display the result. Step 6 : Stop .model small .data a db 09H b db 02H .code
  • 5. mov ax, @data ; Initialize data section mov ds, ax mov al, a ; Load number1 in al mov bl, b ; Load number2 in bl add al, bl ; add numbers and result in al mov ch, 02h ; Count of digits to be displayed mov cl, 04h ; Count to roll by 4 bits mov bh, al ; Result in reg bh l2: rol bh, cl ; roll bl so that msb comes to lsb mov dl, bh ; load dl with data to be displayed and dl, 0fH ; get only lsb cmp dl, 09 ; check if digit is 0-9 or letter A-F jbe l4 add dl, 07 ; if letter add 37H else only add 30H l4: add dl, 30H mov ah, 02 ; Function 2 under INT 21H (Display character) int 21H dec ch ; Decrement Count jnz l2 mov ah, 4CH ; Terminate Program int 21H end 1 2 3 4 5 6 7 8 9 10 11 12 13 14
  • 6. 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 .model small .data op1 dd 12345678h op2 dd 11111111h Corel - 10 ans dd ? .code mov ax, @data mov ds, ax mov ax, word ptr op1 ; lsb of number1 in ax mov bx, word ptr op1+2 ; msb of number1 in bx mov cx, word ptr op2 ; lsb of number2 in cx mov dx, word ptr op2+2 ; msb of number1 in dx
  • 7. add ax, cx ; add msb + msb + carry mov word ptr ans, ax ; lsb answer mov word ptr ans+2, bx ; msb answer mov bx, word ptr ans+2 ; Result in reg bx mov dh, 2 l1: mov ch, 04h ; Count of digits to be displayed mov cl, 04h ; Count to roll by 4 bits l2: rol bx, cl ; roll bl so that msb comes to lsb mov dl, bl ; load dl with data to be displayed and dl, 0fH ; get only lsb cmp dl, 09 ; check if digit is 0-9 or letter A-F jbe l4 add dl, 07 ; if letter add 37H else only add 30H l4: add dl, 30H mov ah, 02 ; INT 21H (Display character) int 21H dec ch ; Decrement Count jnz l2 dec dh cmp dh, 0 mov bx, word ptr ans ; display lsb of answer jnz l1 mov ah, 4ch ; Terminate Program int 21h