SlideShare a Scribd company logo
1 of 5
DO NOT ANSWER IF NOT EXPERT ON ASSEMBLY LABGUAGE PROGRAMMING X86
DOSBox-X
This is assembly language code, it has no warning or errors but doesn't run as expected. This
program asks the user for 2 numbers that are only from 0 to 9. Then should print all the results
from the operations which are add, subtract, divide and multiply these 2 numbers. Please fix.
Here is the code:
.model small
.stack 100h
.data
prompt1 db 10,13,'Enter first digit: $'
prompt2 db 10,13,'Enter second digit: $'
result dw ?
error_message db 'Invalid input, enter a digit between 0 and 9: $'
divide_by_zero_message db 'Cannot divide by 0, enter a non-zero second digit: $'
.code
main proc
mov ax, @data
mov ds, ax
call GET_FIRST_DIGIT
call GET_SECOND_DIGIT
; Check if the second digit is 0
cmp dx, 0
je DIVIDE_BY_ZERO
; Automatically perform all four arithmetic operations
mov bx, ax
mov cx, dx
; Addition
add ax, cx
mov result, ax
call SHOW_RESULT
; Subtraction
mov ax, bx
sub ax, cx
mov result, ax
call SHOW_RESULT
; Multiplication
mov ax, bx
mul cx
mov result, ax
call SHOW_RESULT
; Division
mov ax, bx
div cx
mov result, ax
call SHOW_RESULT
jmp END_PROGRAM
DIVIDE_BY_ZERO:
; Display an error message
lea dx, divide_by_zero_message
call DISPLAY_PROMPT
END_PROGRAM:
ret
main endp
; get the first digit
GET_FIRST_DIGIT proc
; display the prompt
lea dx, prompt1
call DISPLAY_PROMPT
; get the digit
call GET_DIGIT
ret
GET_FIRST_DIGIT endp
; get the second digit
GET_SECOND_DIGIT proc
; display the prompt
lea dx, prompt2
call DISPLAY_PROMPT
; get the digit
call GET_DIGIT
ret
GET_SECOND_DIGIT endp
; display the result
SHOW_RESULT proc
; display the result
mov dx, result
mov ax, result
call DISPLAY_NUMBER
ret
SHOW_RESULT endp
; display a prompt
DISPLAY_PROMPT proc
; display the prompt
mov ah, 9
int 21h
ret
DISPLAY_PROMPT endp
; get a digit
GET_DIGIT proc
; get the digit
call GET_CHAR
sub al, 48
cmp al, 0
jge VALID_DIGIT
cmp al, 9
jl VALID_DIGIT
; display an error message
ERROR:
lea dx, error_message
call DISPLAY_PROMPT
jmp GET_DIGIT
VALID_DIGIT:
mov ah, 0
ret
GET_DIGIT endp
GET_CHAR proc
; get the character
mov ah, 1
int 21h
cmp al, 13
je EXIT_GET_CHAR
cmp al, 10
je EXIT_GET_CHAR
jmp GET_CHAR
EXIT_GET_CHAR:
ret
GET_CHAR endp
DISPLAY_DIGIT PROC
mov ah, 2
int 21h
ret
DISPLAY_DIGIT ENDP
; display a number
DISPLAY_NUMBER proc
; get the number of digits in the result
mov cx, result
cmp cx, 0
je DISPLAY_ZERO
mov bx, 10
xor dx, dx
mov bp, 0
div bx
inc bp
cmp dx, 0
jne @F
@B:
; get the current digit
mov dx, cx
mov ax, 10
mul bp
div ax
add dl, 48
; display the digit
call DISPLAY_DIGIT
; prepare for next digit
dec bp
mov cx, ax
cmp ax, 0
jne @B
jmp @E
@F:
inc bp
jmp @B
@E:
ret
DISPLAY_ZERO:
mov dl, 48
call DISPLAY_DIGIT
ret
DISPLAY_NUMBER endp
END main
This is the output of the program:
C:>cd final
C:FINAL>final.exe
Enter first digit: 2
Enter second digit: 3
00

More Related Content

Similar to DO NOT ANSWER IF NOT EXPERT ON ASSEMBLY LABGUAGE PROGRAMMING X86 DOSBo.docx

C++ programming Quiz t or f.pptx
C++ programming Quiz t or f.pptxC++ programming Quiz t or f.pptx
C++ programming Quiz t or f.pptxAdrianVANTOPINA
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarragaFabricio Galárraga
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksJinTaek Seo
 
1 ECE 175 Computer Programming for Engineering Applica.docx
1  ECE 175 Computer Programming for Engineering Applica.docx1  ECE 175 Computer Programming for Engineering Applica.docx
1 ECE 175 Computer Programming for Engineering Applica.docxoswald1horne84988
 
I need help getting my mips program completed this are the full inst.pdf
I need help getting my mips program completed this are the full inst.pdfI need help getting my mips program completed this are the full inst.pdf
I need help getting my mips program completed this are the full inst.pdfallurafashions98
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solutionKuntal Bhowmick
 
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdfKrishnaKumar2309
 
Programada chapter 4
Programada chapter 4Programada chapter 4
Programada chapter 4abdallaisse
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1manhduc1811
 
Sample Program file class 11.pdf
Sample Program file class 11.pdfSample Program file class 11.pdf
Sample Program file class 11.pdfYashMirge2
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans incnayakq
 
I need help coming up with a MIPS program for this.1.3. Overvi.pdf
I need help coming up with a MIPS program for this.1.3. Overvi.pdfI need help coming up with a MIPS program for this.1.3. Overvi.pdf
I need help coming up with a MIPS program for this.1.3. Overvi.pdfpratyushraj61
 
Question Hello, I need some assistance in writing a java pr...Hel.pdf
Question Hello, I need some assistance in writing a java pr...Hel.pdfQuestion Hello, I need some assistance in writing a java pr...Hel.pdf
Question Hello, I need some assistance in writing a java pr...Hel.pdfhainesburchett26321
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersSheila Sinclair
 

Similar to DO NOT ANSWER IF NOT EXPERT ON ASSEMBLY LABGUAGE PROGRAMMING X86 DOSBo.docx (20)

Lab report assembly
Lab report assemblyLab report assembly
Lab report assembly
 
C++ programming Quiz t or f.pptx
C++ programming Quiz t or f.pptxC++ programming Quiz t or f.pptx
C++ programming Quiz t or f.pptx
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarraga
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
 
1 ECE 175 Computer Programming for Engineering Applica.docx
1  ECE 175 Computer Programming for Engineering Applica.docx1  ECE 175 Computer Programming for Engineering Applica.docx
1 ECE 175 Computer Programming for Engineering Applica.docx
 
I need help getting my mips program completed this are the full inst.pdf
I need help getting my mips program completed this are the full inst.pdfI need help getting my mips program completed this are the full inst.pdf
I need help getting my mips program completed this are the full inst.pdf
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
 
C++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdfC++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdf
 
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
 
Emulador emu8086
Emulador emu8086Emulador emu8086
Emulador emu8086
 
PLSQL.docx
PLSQL.docxPLSQL.docx
PLSQL.docx
 
Plsql programs
Plsql programsPlsql programs
Plsql programs
 
Programada chapter 4
Programada chapter 4Programada chapter 4
Programada chapter 4
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1
 
Sample Program file class 11.pdf
Sample Program file class 11.pdfSample Program file class 11.pdf
Sample Program file class 11.pdf
 
17 Jo P May 08
17 Jo P May 0817 Jo P May 08
17 Jo P May 08
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
I need help coming up with a MIPS program for this.1.3. Overvi.pdf
I need help coming up with a MIPS program for this.1.3. Overvi.pdfI need help coming up with a MIPS program for this.1.3. Overvi.pdf
I need help coming up with a MIPS program for this.1.3. Overvi.pdf
 
Question Hello, I need some assistance in writing a java pr...Hel.pdf
Question Hello, I need some assistance in writing a java pr...Hel.pdfQuestion Hello, I need some assistance in writing a java pr...Hel.pdf
Question Hello, I need some assistance in writing a java pr...Hel.pdf
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
 

More from cmichael14

Describe the movement of ions during an action potential and the re-es.docx
Describe the movement of ions during an action potential and the re-es.docxDescribe the movement of ions during an action potential and the re-es.docx
Describe the movement of ions during an action potential and the re-es.docxcmichael14
 
depertments a shawn below ruand al dolie ensures to the he ent whoir d.docx
depertments a shawn below ruand al dolie ensures to the he ent whoir d.docxdepertments a shawn below ruand al dolie ensures to the he ent whoir d.docx
depertments a shawn below ruand al dolie ensures to the he ent whoir d.docxcmichael14
 
Describe each of the following types of skin markings- Hemangiomas- Fr.docx
Describe each of the following types of skin markings- Hemangiomas- Fr.docxDescribe each of the following types of skin markings- Hemangiomas- Fr.docx
Describe each of the following types of skin markings- Hemangiomas- Fr.docxcmichael14
 
Denali National Park has no trees on the big mountain because of very.docx
Denali National Park has no trees on the big mountain because of very.docxDenali National Park has no trees on the big mountain because of very.docx
Denali National Park has no trees on the big mountain because of very.docxcmichael14
 
Dave Fletcher was able to determine the activity times for constructin.docx
Dave Fletcher was able to determine the activity times for constructin.docxDave Fletcher was able to determine the activity times for constructin.docx
Dave Fletcher was able to determine the activity times for constructin.docxcmichael14
 
Davis- an officer for a $501(c)(3) organization- recelves benefits in.docx
Davis- an officer for a $501(c)(3) organization- recelves benefits in.docxDavis- an officer for a $501(c)(3) organization- recelves benefits in.docx
Davis- an officer for a $501(c)(3) organization- recelves benefits in.docxcmichael14
 
Darent acquired Subsidiary on January 1- 2019- The $440-000 excess of.docx
Darent acquired Subsidiary on January 1- 2019- The $440-000 excess of.docxDarent acquired Subsidiary on January 1- 2019- The $440-000 excess of.docx
Darent acquired Subsidiary on January 1- 2019- The $440-000 excess of.docxcmichael14
 
Daring its fint year of operations- Wintae Retreat inc- had sabes of 5.docx
Daring its fint year of operations- Wintae Retreat inc- had sabes of 5.docxDaring its fint year of operations- Wintae Retreat inc- had sabes of 5.docx
Daring its fint year of operations- Wintae Retreat inc- had sabes of 5.docxcmichael14
 
Define Asynchronous and Synchronous connection at data link layer and.docx
Define Asynchronous and Synchronous connection at data link layer and.docxDefine Asynchronous and Synchronous connection at data link layer and.docx
Define Asynchronous and Synchronous connection at data link layer and.docxcmichael14
 
Decreasing the driving forces and increasing the restraining forces- M.docx
Decreasing the driving forces and increasing the restraining forces- M.docxDecreasing the driving forces and increasing the restraining forces- M.docx
Decreasing the driving forces and increasing the restraining forces- M.docxcmichael14
 
Do the antigen protein vaccines contain all the proteins in the virus.docx
Do the antigen protein vaccines contain all the proteins in the virus.docxDo the antigen protein vaccines contain all the proteins in the virus.docx
Do the antigen protein vaccines contain all the proteins in the virus.docxcmichael14
 
During human development- which statement is correct regarding primary.docx
During human development- which statement is correct regarding primary.docxDuring human development- which statement is correct regarding primary.docx
During human development- which statement is correct regarding primary.docxcmichael14
 
During a restructuring- what could happen to the balance sheet of a co.docx
During a restructuring- what could happen to the balance sheet of a co.docxDuring a restructuring- what could happen to the balance sheet of a co.docx
During a restructuring- what could happen to the balance sheet of a co.docxcmichael14
 
Debbie makes porcelain plates in her home and sells them to the Opus g.docx
Debbie makes porcelain plates in her home and sells them to the Opus g.docxDebbie makes porcelain plates in her home and sells them to the Opus g.docx
Debbie makes porcelain plates in her home and sells them to the Opus g.docxcmichael14
 
Due Feb 6 by 11-59pm Submitting a fle upload Illustrate the concept of.docx
Due Feb 6 by 11-59pm Submitting a fle upload Illustrate the concept of.docxDue Feb 6 by 11-59pm Submitting a fle upload Illustrate the concept of.docx
Due Feb 6 by 11-59pm Submitting a fle upload Illustrate the concept of.docxcmichael14
 
Draw a graph showing an action potential in a ventricular myocyte cell.docx
Draw a graph showing an action potential in a ventricular myocyte cell.docxDraw a graph showing an action potential in a ventricular myocyte cell.docx
Draw a graph showing an action potential in a ventricular myocyte cell.docxcmichael14
 
Drag and drop the DNS lookup commands from the left onto the functions.docx
Drag and drop the DNS lookup commands from the left onto the functions.docxDrag and drop the DNS lookup commands from the left onto the functions.docx
Drag and drop the DNS lookup commands from the left onto the functions.docxcmichael14
 
Draw a 5 point star- tougher than you think--- (Hint- circle - polar c.docx
Draw a 5 point star- tougher than you think--- (Hint- circle - polar c.docxDraw a 5 point star- tougher than you think--- (Hint- circle - polar c.docx
Draw a 5 point star- tougher than you think--- (Hint- circle - polar c.docxcmichael14
 
Dr- Kelly wins a trip to the a beach destination (insert your dream be.docx
Dr- Kelly wins a trip to the a beach destination (insert your dream be.docxDr- Kelly wins a trip to the a beach destination (insert your dream be.docx
Dr- Kelly wins a trip to the a beach destination (insert your dream be.docxcmichael14
 
Dr- Triboli sampled n-47 people and asked them how many siblings they.docx
Dr- Triboli sampled n-47 people and asked them how many siblings they.docxDr- Triboli sampled n-47 people and asked them how many siblings they.docx
Dr- Triboli sampled n-47 people and asked them how many siblings they.docxcmichael14
 

More from cmichael14 (20)

Describe the movement of ions during an action potential and the re-es.docx
Describe the movement of ions during an action potential and the re-es.docxDescribe the movement of ions during an action potential and the re-es.docx
Describe the movement of ions during an action potential and the re-es.docx
 
depertments a shawn below ruand al dolie ensures to the he ent whoir d.docx
depertments a shawn below ruand al dolie ensures to the he ent whoir d.docxdepertments a shawn below ruand al dolie ensures to the he ent whoir d.docx
depertments a shawn below ruand al dolie ensures to the he ent whoir d.docx
 
Describe each of the following types of skin markings- Hemangiomas- Fr.docx
Describe each of the following types of skin markings- Hemangiomas- Fr.docxDescribe each of the following types of skin markings- Hemangiomas- Fr.docx
Describe each of the following types of skin markings- Hemangiomas- Fr.docx
 
Denali National Park has no trees on the big mountain because of very.docx
Denali National Park has no trees on the big mountain because of very.docxDenali National Park has no trees on the big mountain because of very.docx
Denali National Park has no trees on the big mountain because of very.docx
 
Dave Fletcher was able to determine the activity times for constructin.docx
Dave Fletcher was able to determine the activity times for constructin.docxDave Fletcher was able to determine the activity times for constructin.docx
Dave Fletcher was able to determine the activity times for constructin.docx
 
Davis- an officer for a $501(c)(3) organization- recelves benefits in.docx
Davis- an officer for a $501(c)(3) organization- recelves benefits in.docxDavis- an officer for a $501(c)(3) organization- recelves benefits in.docx
Davis- an officer for a $501(c)(3) organization- recelves benefits in.docx
 
Darent acquired Subsidiary on January 1- 2019- The $440-000 excess of.docx
Darent acquired Subsidiary on January 1- 2019- The $440-000 excess of.docxDarent acquired Subsidiary on January 1- 2019- The $440-000 excess of.docx
Darent acquired Subsidiary on January 1- 2019- The $440-000 excess of.docx
 
Daring its fint year of operations- Wintae Retreat inc- had sabes of 5.docx
Daring its fint year of operations- Wintae Retreat inc- had sabes of 5.docxDaring its fint year of operations- Wintae Retreat inc- had sabes of 5.docx
Daring its fint year of operations- Wintae Retreat inc- had sabes of 5.docx
 
Define Asynchronous and Synchronous connection at data link layer and.docx
Define Asynchronous and Synchronous connection at data link layer and.docxDefine Asynchronous and Synchronous connection at data link layer and.docx
Define Asynchronous and Synchronous connection at data link layer and.docx
 
Decreasing the driving forces and increasing the restraining forces- M.docx
Decreasing the driving forces and increasing the restraining forces- M.docxDecreasing the driving forces and increasing the restraining forces- M.docx
Decreasing the driving forces and increasing the restraining forces- M.docx
 
Do the antigen protein vaccines contain all the proteins in the virus.docx
Do the antigen protein vaccines contain all the proteins in the virus.docxDo the antigen protein vaccines contain all the proteins in the virus.docx
Do the antigen protein vaccines contain all the proteins in the virus.docx
 
During human development- which statement is correct regarding primary.docx
During human development- which statement is correct regarding primary.docxDuring human development- which statement is correct regarding primary.docx
During human development- which statement is correct regarding primary.docx
 
During a restructuring- what could happen to the balance sheet of a co.docx
During a restructuring- what could happen to the balance sheet of a co.docxDuring a restructuring- what could happen to the balance sheet of a co.docx
During a restructuring- what could happen to the balance sheet of a co.docx
 
Debbie makes porcelain plates in her home and sells them to the Opus g.docx
Debbie makes porcelain plates in her home and sells them to the Opus g.docxDebbie makes porcelain plates in her home and sells them to the Opus g.docx
Debbie makes porcelain plates in her home and sells them to the Opus g.docx
 
Due Feb 6 by 11-59pm Submitting a fle upload Illustrate the concept of.docx
Due Feb 6 by 11-59pm Submitting a fle upload Illustrate the concept of.docxDue Feb 6 by 11-59pm Submitting a fle upload Illustrate the concept of.docx
Due Feb 6 by 11-59pm Submitting a fle upload Illustrate the concept of.docx
 
Draw a graph showing an action potential in a ventricular myocyte cell.docx
Draw a graph showing an action potential in a ventricular myocyte cell.docxDraw a graph showing an action potential in a ventricular myocyte cell.docx
Draw a graph showing an action potential in a ventricular myocyte cell.docx
 
Drag and drop the DNS lookup commands from the left onto the functions.docx
Drag and drop the DNS lookup commands from the left onto the functions.docxDrag and drop the DNS lookup commands from the left onto the functions.docx
Drag and drop the DNS lookup commands from the left onto the functions.docx
 
Draw a 5 point star- tougher than you think--- (Hint- circle - polar c.docx
Draw a 5 point star- tougher than you think--- (Hint- circle - polar c.docxDraw a 5 point star- tougher than you think--- (Hint- circle - polar c.docx
Draw a 5 point star- tougher than you think--- (Hint- circle - polar c.docx
 
Dr- Kelly wins a trip to the a beach destination (insert your dream be.docx
Dr- Kelly wins a trip to the a beach destination (insert your dream be.docxDr- Kelly wins a trip to the a beach destination (insert your dream be.docx
Dr- Kelly wins a trip to the a beach destination (insert your dream be.docx
 
Dr- Triboli sampled n-47 people and asked them how many siblings they.docx
Dr- Triboli sampled n-47 people and asked them how many siblings they.docxDr- Triboli sampled n-47 people and asked them how many siblings they.docx
Dr- Triboli sampled n-47 people and asked them how many siblings they.docx
 

Recently uploaded

Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

DO NOT ANSWER IF NOT EXPERT ON ASSEMBLY LABGUAGE PROGRAMMING X86 DOSBo.docx

  • 1. DO NOT ANSWER IF NOT EXPERT ON ASSEMBLY LABGUAGE PROGRAMMING X86 DOSBox-X This is assembly language code, it has no warning or errors but doesn't run as expected. This program asks the user for 2 numbers that are only from 0 to 9. Then should print all the results from the operations which are add, subtract, divide and multiply these 2 numbers. Please fix. Here is the code: .model small .stack 100h .data prompt1 db 10,13,'Enter first digit: $' prompt2 db 10,13,'Enter second digit: $' result dw ? error_message db 'Invalid input, enter a digit between 0 and 9: $' divide_by_zero_message db 'Cannot divide by 0, enter a non-zero second digit: $' .code main proc mov ax, @data mov ds, ax call GET_FIRST_DIGIT call GET_SECOND_DIGIT ; Check if the second digit is 0 cmp dx, 0 je DIVIDE_BY_ZERO ; Automatically perform all four arithmetic operations mov bx, ax mov cx, dx ; Addition add ax, cx mov result, ax call SHOW_RESULT ; Subtraction mov ax, bx sub ax, cx mov result, ax call SHOW_RESULT
  • 2. ; Multiplication mov ax, bx mul cx mov result, ax call SHOW_RESULT ; Division mov ax, bx div cx mov result, ax call SHOW_RESULT jmp END_PROGRAM DIVIDE_BY_ZERO: ; Display an error message lea dx, divide_by_zero_message call DISPLAY_PROMPT END_PROGRAM: ret main endp ; get the first digit GET_FIRST_DIGIT proc ; display the prompt lea dx, prompt1 call DISPLAY_PROMPT ; get the digit call GET_DIGIT ret GET_FIRST_DIGIT endp ; get the second digit GET_SECOND_DIGIT proc ; display the prompt lea dx, prompt2 call DISPLAY_PROMPT ; get the digit call GET_DIGIT ret GET_SECOND_DIGIT endp
  • 3. ; display the result SHOW_RESULT proc ; display the result mov dx, result mov ax, result call DISPLAY_NUMBER ret SHOW_RESULT endp ; display a prompt DISPLAY_PROMPT proc ; display the prompt mov ah, 9 int 21h ret DISPLAY_PROMPT endp ; get a digit GET_DIGIT proc ; get the digit call GET_CHAR sub al, 48 cmp al, 0 jge VALID_DIGIT cmp al, 9 jl VALID_DIGIT ; display an error message ERROR: lea dx, error_message call DISPLAY_PROMPT jmp GET_DIGIT VALID_DIGIT: mov ah, 0 ret GET_DIGIT endp GET_CHAR proc ; get the character mov ah, 1 int 21h cmp al, 13 je EXIT_GET_CHAR cmp al, 10
  • 4. je EXIT_GET_CHAR jmp GET_CHAR EXIT_GET_CHAR: ret GET_CHAR endp DISPLAY_DIGIT PROC mov ah, 2 int 21h ret DISPLAY_DIGIT ENDP ; display a number DISPLAY_NUMBER proc ; get the number of digits in the result mov cx, result cmp cx, 0 je DISPLAY_ZERO mov bx, 10 xor dx, dx mov bp, 0 div bx inc bp cmp dx, 0 jne @F @B: ; get the current digit mov dx, cx mov ax, 10 mul bp div ax add dl, 48 ; display the digit call DISPLAY_DIGIT ; prepare for next digit dec bp mov cx, ax cmp ax, 0 jne @B jmp @E
  • 5. @F: inc bp jmp @B @E: ret DISPLAY_ZERO: mov dl, 48 call DISPLAY_DIGIT ret DISPLAY_NUMBER endp END main This is the output of the program: C:>cd final C:FINAL>final.exe Enter first digit: 2 Enter second digit: 3 00