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
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

Step by step
Solved in 2 steps









