
Basic Data Operation

This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:


Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |
Comparison |
Matching
Memory Operations
Pointers & references |
Addresses


Task

Get two integers from the user,   and then (for those two integers), display their:

   sum 
   difference 
   product 
   integer quotient
   remainder 
   exponentiation   (if the operator exists) 


Don't include error handling.

For quotient, indicate how it rounds   (e.g. towards zero, towards negative infinity, etc.).

For remainder, indicate whether its sign matches the sign of the first operand or of the second operand, if they are different.




Arithmetic:	PHA			;push accumulator and X register onto stack
		TXA
		PHA
		JSR GetUserInput	;routine not implemented
		;two integers now in memory locations A and B
		;addition
		LDA A
		CLC
		ADC B
		JSR DisplayAddition	;routine not implemented
 
		;subtraction
		LDA A
		SEC
		SBC B
		JSR DisplaySubtraction	;routine not implemented
 
		;multiplication - overflow not handled
		LDA A
		LDX B
Multiply:	CLC
		ADC A
		DEX
		BNE Multiply
		JSR DisplayMultiply	;routine not implemented
 
		;division	- rounds up
		LDA A
		LDX #0
		SEC
Divide:		INX
		SBC B
		BCS Divide
		TXA			;get result into accumulator
		JSR DisplayDivide	;routine not implemented
 
		;modulus
		LDA A
		SEC
Modulus:	SBC B
		BCS Modulus
		ADC B
		JSR DisplayModulus	;routine not implemented
 
		PLA			;restore accumulator and X register from stack
		TAX
		PLA
		RTS			;return from subroutine