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

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

Mano basic computer assembly code examples.


Calculate Positive Numbers X * Y

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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

Calculate Positive Numbers X^Y

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
LDA X
STA TOTAL
LDA Y
CMA
INC
INC
STA Y
LOP,
LDA TOTAL
STA TEMP
CLA 
STA TOTAL
LDA TEMP
CMA
INC
STA TEMP
LDA TOTAL
LOP2,
ADD X
ISZ TEMP
BUN LOP2
STA TOTAL
ISZ Y
BUN LOP
STA TOTAL
HLT
X, DEC 10
Y, DEC 3
TOTAL, DEC 0
TEMP, DEC 0

X^Y Java code for better understanting algorithm.

1
2
3
4
5
6
7
8
9
10
11
12
int x = 4;
int y = 2;
int total = x;
for(byte i=0;i<y-1;i++){
		int temp = total;
		total = 0;
		for(byte j=0;j<temp;j++){
				total = total + x;
		}
}

System.out.println(total);

Similar Posts:
  1. Aritmatic, Logic, Circular Shift Examples
  2. Mano Basic Computer X*Y and X/Y Code Examples
  3. Mano Basic Computer Aritmatic, Logic, Circular Shift Codes

Tags: assembly, mano assembly, mano basic computer, mano codes, mano coding, mano computer, mano computer assembly examples