-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMAINPROGREM.asm
198 lines (125 loc) · 2.23 KB
/
MAINPROGREM.asm
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
; PIC16F877 Configuration Bit Settings
; Assembly source line config statements
#include "p16F877.inc"
; CONFIG
; __config 0xFFFB
__CONFIG _FOSC_EXTRC & _WDTE_OFF & _PWRTE_OFF & _CP_OFF & _BOREN_ON & _LVP_ON & _CPD_OFF & _WRT_ON
org 0x00
status=003h
Reset:
addlw 0x00
movwf 0x40
clrw
addlw 0x20
movwf 0x41
goto Start
Start:
clrf STATUS
bsf 003h,0x04
bsf 003h,0x03
main:
;goto Hisor
;goto Kafal
;goto boothKafal
goto Hiluk
Hisor:
movf 0x36,0x00
subwf 0x35,0x00
btfss 003h,0
call Abs
movwf 0x37
goto exit
boothKafal:
PreCheckK:
clrw
clrf 0x43
clrf 0x42
bcf 003h,2
iorwf 0x41,1
iorwf 0x40,1
btfsc 003h,2
goto zerokapalexit
BuilderK:
clrw
bcf 003h,2
bcf 003h,0
addlw 0x08
movwf 0x38
clrf 0x39
btfsc 0x40,0
bsf 0x39,1
bcf 0x39,1
movf 0x40,0
movwf 0x42
comf 0x41,0
movwf 0x40
incf 0x40
LoopBooth:
btfsc 0x42,0
goto nextIfZero
btfsc 003h,0
goto MplusA
goto MtoBtoLast
nextIfZero:
btfsc 003h,1
goto MtoBtoLast
goto MpahutA
MplusA:
movfw 0x41
addwf 0x43,1
bcf 003h,0
goto MtoBtoLast
MpahutA:
movfw 0x40
addwf 0x43,1
bsf 003h,0
MtoBtoLast:
rrf 0x43,1
rrf 0x42,1
decfsz 0x38,1
goto LoopBooth
goto exit
Hiluk:
PreCheckH:
clrw
bcf 003h,2
iorwf 0x41,1
btfsc 003h,2
goto zerokapalexit
iorwf 0x40,1
btfsc 003h,2
goto CantDivByZero
BuilderH:
clrf 0x43
bcf 003h,2
movfw 0x41
movwf 0x42
clrw
addlw 0x08
movwf 0x41
LoopHiluk:
bcf 003h,0
rlf 0x42,1
rlf 0x43,1
movfw 0x40
subwf 0x43,0
btfss 003h,0
goto MbigerBNo
goto MbigerBYes
MbigerBYes:
movwf 0x43
bsf 0x42,0
MbigerBNo:
decfsz 0x41,1
goto LoopHiluk
goto exit
Abs:
comf 0x37,1
incf 0x37,0
return
zerokapalexit:
clrf 0x43
clrf 0x42
CantDivByZero:
exit:
END