-
Notifications
You must be signed in to change notification settings - Fork 0
/
Solution _code _1.txt
110 lines (87 loc) · 1.17 KB
/
Solution _code _1.txt
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
ORG 0000
MOVE #$00,A
MOVE A,all
input_1 MOVE #$00,A
MOVE #$00,B
check0 MOVE $E1,B
CMP #$00,B
BEQ check0
MOVE $E0,A
MOVE A,$E2
CMP #$31,A
BEQ add8
add8r JMP input_2
input_2 MOVE #$00,A
MOVE #$00,B
check1 MOVE $E1,B
CMP #$00,B
BEQ check1
MOVE $E0,A
MOVE A,$E2
CMP #$31,A
BEQ add4
add4r JMP input_3
input_3 MOVE #$00,A
MOVE #$00,B
check2 MOVE $E1,B
CMP #$00,B
BEQ check2
MOVE $E0,A
MOVE A,$E2
CMP #$31,A
BEQ add2
add2r JMP input_4
input_4 MOVE #$00,A
MOVE #$00,B
check3 MOVE $E1,B
CMP #$00,B
BEQ check3
MOVE $E0,A
MOVE A,$E2
CMP #$31,A
BEQ add1
add1r MOVE #$0A,A
ncheck MOVE $E3,B
CMP #$00,B
BEQ ncheck
MOVE A,$E2
JMP OUTPUT
add8 MOVE all,A
ADD #$08,A
MOVE A,all
JMP add8r
add4 MOVE all,A
ADD #$04,A
MOVE A,all
JMP add4r
add2 MOVE all,A
ADD #$02,A
MOVE A,all
JMP add2r
add1 MOVE all,A
ADD #$01,A
MOVE A,all
JMP add1r
OUTPUT MOVE all,A
CMP #$0A,A
BMI single
double MOVE #$31,A
check4 MOVE $E3,B
CMP #$00,B
BEQ check4
MOVE A,$E2
MOVE all,A
SUB #$0A,A
ADD #$30,A
check5 MOVE $E3,B
CMP #$00,B
BEQ check5
MOVE A,$E2
JMP end
single ADD #$30,A
check6 MOVE $E3,B
CMP #$00,B
BEQ check6
MOVE A,$E2
end HALT
all DC.W 0