-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask1.s43
56 lines (51 loc) · 1.57 KB
/
task1.s43
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
#include <msp430xG46x.h> ;define controlled include file
ORG 1100h
id_asaf DW 1,3,3,9,0,4,2,9
id_aviv DW 0,8,4,8,8,9,7,3
OnesAmount1 DS16 8
OnesAmount2 DS16 8
SIZE DW 9
LENGTH DW 5
RSEG CODE ; ORG 0x3100 - place program in 'CODE' segment in to Flash memory
Main MOV #id_asaf,R5
MOV #id_aviv,R6
MOV #OnesAmount1, R10
MOV #OnesAmount2, R11
MOV SIZE,R7
MOV #0,R14
Start_1 MOV @R5+,R12
MOV LENGTH,R8
Loop_1 DEC R8
JZ Next_num_1
RRC R12
JC Incre_1
JMP Loop_1
Incre_1 ADD #1, R14
JMP Loop_1
Next_num_1 DEC R7
MOV R14,R10
JZ Next_id
JMP Start_1
Next_id ADD SIZE,R8
Start_2 MOV @R6+,R13
ADD LENGTH,R7
Loop_2 DEC R7
JZ Next_num_2
RRC R13
JC Incre_2
JMP Loop_2
Incre_2 ADD #1, 0(R11)
JMP Loop_2
Next_num_2 DEC R8
JZ L
INCD R11
CLR R11
JMP Start_2
L JMP L ; infinite loop
NOP ; to remove warnings
;-------------------------------------------------------------------------------
COMMON INTVEC ; Interrupt Vectors
;-------------------------------------------------------------------------------
ORG RESET_VECTOR ; POR, ext. Reset
DW Main
END