Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,48 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue