How would I make it so my code outputs a zero if it recieves a negative number or zero?   org 100 / prompt the user to enter the values of A,B,C and store them Input        Store A   Output    Input        Store B Output      Input    Output     Store C      Load B      / load B into accumulator Store Count1 / store B in Count variable Loop1,Load A  / load A into accumulator Add Sum1    / add value of accumulator to Sum1 Store Sum1  / store updated value of Sum1  Load Count1  / load value of Count1  Subt Decrement   / Decrement Count1 Store Count1 / store the updated value of Count1 in memory Skipcond 800/ skip if accumulator is negative or zero Jump Count2 / jump to Count2 if Count1 is greater than 0 Jump Loop1  / jump back to the start of Loop1 Count2,Load C / load C into accumulator Store Count1 / store C in Count1 variable Loop2,Load Sum1  / load value of Sum1  Add Sum2    / add value of accumulator to Sum2 Store Sum2  / store the updated value of Sum2  Load Count1  / load value of Count1  Subt Decrement  / Decrement Count1 Store Count1 / store updated value of Count1 Skipcond 800/ skip if accumulator is negative or zero Jump End    / End if Count is equal or less than 0 Jump Loop2  / jump back to the start of Loop2 End,Load Sum2   / load value of Z  Output      / display the sum Z Halt        /default values of A,B,C,Sum1,Sum2 and Count1 A, Dec 0 B, Dec 0 C, Dec 0 Sum1, Dec 0 Sum2, Dec 0 Count1, Dec 0 Decrement, Dec 1   / used to decrement Count1 variable

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

How would I make it so my code outputs a zero if it recieves a negative number or zero?

 

org 100

/ prompt the user to enter the values of A,B,C and store them
Input       
Store A  
Output   
Input       
Store B
Output     
Input   
Output    
Store C     


Load B      / load B into accumulator
Store Count1 / store B in Count variable

Loop1,Load A  / load A into accumulator
Add Sum1    / add value of accumulator to Sum1
Store Sum1  / store updated value of Sum1 

Load Count1  / load value of Count1 
Subt Decrement   / Decrement Count1
Store Count1 / store the updated value of Count1 in memory
Skipcond 800/ skip if accumulator is negative or zero
Jump Count2 / jump to Count2 if Count1 is greater than 0
Jump Loop1  / jump back to the start of Loop1

Count2,Load C / load C into accumulator
Store Count1 / store C in Count1 variable

Loop2,Load Sum1  / load value of Sum1 
Add Sum2    / add value of accumulator to Sum2
Store Sum2  / store the updated value of Sum2 


Load Count1  / load value of Count1 
Subt Decrement  / Decrement Count1
Store Count1 / store updated value of Count1
Skipcond 800/ skip if accumulator is negative or zero
Jump End    / End if Count is equal or less than 0
Jump Loop2  / jump back to the start of Loop2

End,Load Sum2   / load value of Z 
Output      / display the sum Z
Halt       

/default values of A,B,C,Sum1,Sum2 and Count1
A, Dec 0
B, Dec 0
C, Dec 0
Sum1, Dec 0
Sum2, Dec 0
Count1, Dec 0
Decrement, Dec 1   / used to decrement Count1 variable

 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education