Mano Basic Computer X*Y and X/Y Code Examples

Calculate Positive Numbers X * Y

LDA Y
CMA
INC
STA Y
LDA TOTAL
LOP , 
ADD X
ISZ Y
BUN LOP
STA TOTAL
HLT
X, DEC 10
TOTAL, DEC 0
Y, DEC 10

Calculate Positive Numbers X/Y

LDA Y
CMA
STA Y
LOP , LDA TOTAL
INC
STA TOTAL 
LDA X
ADD Y
STA X
SNA
BUN LOP
HLT
X, DEC 15
Y, DEC 5
TOTAL, DEC 0

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *