-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathled running.as
471 lines (421 loc) · 10.4 KB
/
led running.as
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
opt subtitle "HI-TECH Software Omniscient Code Generator (Lite mode) build 6379"
opt pagewidth 120
opt lm
processor 16F877A
clrc macro
bcf 3,0
endm
clrz macro
bcf 3,2
endm
setc macro
bsf 3,0
endm
setz macro
bsf 3,2
endm
skipc macro
btfss 3,0
endm
skipz macro
btfss 3,2
endm
skipnc macro
btfsc 3,0
endm
skipnz macro
btfsc 3,2
endm
indf equ 0
indf0 equ 0
pc equ 2
pcl equ 2
status equ 3
fsr equ 4
fsr0 equ 4
c equ 1
z equ 0
pclath equ 10
# 2 "D:\TI\PIC course\led running\running.c"
psect config,class=CONFIG,delta=2 ;#
# 2 "D:\TI\PIC course\led running\running.c"
dw 0x3FFE&0x3F7F&0x3FFF&0x3FFB ;#
FNCALL _main,_delay
FNROOT _main
global _led
psect idataCOMMON,class=CODE,space=0,delta=2
global __pidataCOMMON
__pidataCOMMON:
file "D:\TI\PIC course\led running\running.c"
line 7
;initializer for _led
retlw 01h
retlw 02h
retlw 04h
retlw 08h
retlw 010h
retlw 020h
retlw 040h
retlw 080h
global _PORTB
_PORTB set 6
global _TRISB
_TRISB set 134
file "led running.as"
line #
psect cinit,class=CODE,delta=2
global start_initialization
start_initialization:
psect dataCOMMON,class=COMMON,space=1
global __pdataCOMMON
__pdataCOMMON:
file "D:\TI\PIC course\led running\running.c"
_led:
ds 8
global btemp
psect inittext,class=CODE,delta=2
global init_fetch,btemp
; Called with low address in FSR and high address in W
init_fetch:
movf btemp,w
movwf pclath
movf btemp+1,w
movwf pc
global init_ram
;Called with:
; high address of idata address in btemp
; low address of idata address in btemp+1
; low address of data in FSR
; high address + 1 of data in btemp-1
init_ram:
fcall init_fetch
movwf indf,f
incf fsr,f
movf fsr,w
xorwf btemp-1,w
btfsc status,2
retlw 0
incf btemp+1,f
btfsc status,2
incf btemp,f
goto init_ram
; Initialize objects allocated to COMMON
global __pidataCOMMON
psect cinit,class=CODE,delta=2
fcall __pidataCOMMON+0 ;fetch initializer
movwf __pdataCOMMON+0&07fh
fcall __pidataCOMMON+1 ;fetch initializer
movwf __pdataCOMMON+1&07fh
fcall __pidataCOMMON+2 ;fetch initializer
movwf __pdataCOMMON+2&07fh
fcall __pidataCOMMON+3 ;fetch initializer
movwf __pdataCOMMON+3&07fh
fcall __pidataCOMMON+4 ;fetch initializer
movwf __pdataCOMMON+4&07fh
fcall __pidataCOMMON+5 ;fetch initializer
movwf __pdataCOMMON+5&07fh
fcall __pidataCOMMON+6 ;fetch initializer
movwf __pdataCOMMON+6&07fh
fcall __pidataCOMMON+7 ;fetch initializer
movwf __pdataCOMMON+7&07fh
psect cinit,class=CODE,delta=2
global end_of_initialization
;End of C runtime variable initationation code
end_of_initialization:
clrf status
ljmp _main ;jump to C main() function
psect cstackCOMMON,class=COMMON,space=1
global __pcstackCOMMON
__pcstackCOMMON:
global ?_delay
?_delay: ; 0 bytes @ 0x0
global ?_main
?_main: ; 0 bytes @ 0x0
global delay@a
delay@a: ; 2 bytes @ 0x0
ds 2
global ??_delay
??_delay: ; 0 bytes @ 0x2
global ??_main
??_main: ; 0 bytes @ 0x2
global main@i
main@i: ; 2 bytes @ 0x2
ds 2
;;Data sizes: Strings 0, constant 0, data 8, bss 0, persistent 0 stack 0
;;Auto spaces: Size Autos Used
;; COMMON 14 4 12
;; BANK0 80 0 0
;; BANK1 80 0 0
;; BANK3 96 0 0
;; BANK2 96 0 0
;;
;; Pointer list with targets:
;; Critical Paths (_main)
;; COMMON: _main->_delay
;;
;;Main: autosize = 0, tempsize = 0, incstack = 0, save=0
;;
;;Call Graph Tables:
;; ---------------------------------------------------------------------------------
;; (Depth) Function Calls Base Space Used Autos Params Refs
;; ---------------------------------------------------------------------------------
;; (0) _main 2 2 0 60
;; 2 COMMON 2 2 0
;; _delay
;; ---------------------------------------------------------------------------------
;; (4294967295) _delay 2 0 2 15
;; 0 COMMON 2 0 2
;; ---------------------------------------------------------------------------------
;; Estimated maximum call depth -1
;; ---------------------------------------------------------------------------------
;; Call Graph Graphs:
;; _main (ROOT)
;; _delay
;;
;; Address spaces:
;;Name Size Autos Total Cost Usage
;;BANK3 60 0 0 8 0.0%
;;SFR3 0 0 0 4 0.0%
;;BITSFR3 0 0 0 4 0.0%
;;BITBANK3 60 0 0 11 0.0%
;;BITSFR2 0 0 0 5 0.0%
;;SFR2 0 0 0 5 0.0%
;;BITBANK2 60 0 0 12 0.0%
;;BANK2 60 0 0 9 0.0%
;;SFR1 0 0 0 2 0.0%
;;BITBANK1 50 0 0 6 0.0%
;;BANK1 50 0 0 7 0.0%
;;BITSFR1 0 0 0 2 0.0%
;;ABS 0 0 C 10 0.0%
;;DATA 0 0 D 5 0.0%
;;SFR0 0 0 0 1 0.0%
;;NULL 0 0 0 0 0.0%
;;CODE 0 0 0 0 0.0%
;;BITSFR0 0 0 0 1 0.0%
;;BITBANK0 50 0 0 3 0.0%
;;BANK0 50 0 0 4 0.0%
;;STACK 0 0 1 2 0.0%
;;BITCOMMON E 0 0 0 0.0%
;;COMMON E 4 C 1 85.7%
;;EEDATA 100 0 0 0 0.0%
global _main
psect maintext,global,class=CODE,delta=2
global __pmaintext
__pmaintext:
;; *************** function _main *****************
;; Defined at:
;; line 9 in file "D:\TI\PIC course\led running\running.c"
;; Parameters: Size Location Type
;; None
;; Auto vars: Size Location Type
;; i 2 2[COMMON] int
;; Return value: Size Location Type
;; None void
;; Registers used:
;; wreg, fsr0l, fsr0h, status,2, status,0, btemp+0, pclath, cstack
;; Tracked objects:
;; On entry : 17F/0
;; On exit : 0/0
;; Unchanged: 0/0
;; Data sizes: COMMON BANK0 BANK1 BANK3 BANK2
;; Params: 0 0 0 0 0
;; Locals: 2 0 0 0 0
;; Temps: 0 0 0 0 0
;; Totals: 2 0 0 0 0
;;Total ram usage: 2 bytes
;; Hardware stack levels required when called: 1
;; This function calls:
;; _delay
;; This function is called by:
;; Startup code after reset
;; This function uses a non-reentrant model
;;
psect maintext
file "D:\TI\PIC course\led running\running.c"
line 9
global __size_of_main
__size_of_main equ __end_of_main-_main
_main:
opt stack 1
; Regs used in _main: [wreg-fsr0h+status,2-btemp+0+pclath+cstack]
line 10
l1731:
;running.c: 10: TRISB=0x00;
bsf status, 5 ;RP0=1, select bank1
bcf status, 6 ;RP1=0, select bank1
clrf (134)^080h ;volatile
line 11
;running.c: 11: while(1)
l567:
line 13
l1733:
;running.c: 12: {
;running.c: 13: for(int i=0;i<8;i++)
movlw low(0)
movwf (main@i)
movlw high(0)
movwf ((main@i))+1
l1735:
movf (main@i+1),w
xorlw 80h
movwf btemp+0
movlw (high(08h))^80h
subwf btemp+0,w
skipz
goto u2155
movlw low(08h)
subwf (main@i),w
u2155:
skipc
goto u2151
goto u2150
u2151:
goto l568
u2150:
l1737:
goto l569
line 14
l568:
line 15
l1739:
;running.c: 14: {
;running.c: 15: PORTB=led[i];
movf (main@i),w
addlw _led&0ffh
movwf fsr0
movf indf,w
bcf status, 5 ;RP0=0, select bank0
bcf status, 6 ;RP1=0, select bank0
movwf (6) ;volatile
line 16
l1741:
;running.c: 16: delay(20000);
movlw low(04E20h)
movwf (?_delay)
movlw high(04E20h)
movwf ((?_delay))+1
fcall _delay
line 13
l1743:
movlw low(01h)
addwf (main@i),f
skipnc
incf (main@i+1),f
movlw high(01h)
addwf (main@i+1),f
l1745:
movf (main@i+1),w
xorlw 80h
movwf btemp+0
movlw (high(08h))^80h
subwf btemp+0,w
skipz
goto u2165
movlw low(08h)
subwf (main@i),w
u2165:
skipc
goto u2161
goto u2160
u2161:
goto l568
u2160:
l569:
line 19
l570:
line 11
goto l567
l571:
line 21
l572:
global start
ljmp start
opt stack 0
GLOBAL __end_of_main
__end_of_main:
;; =============== function _main ends ============
signat _main,88
global _delay
psect text56,local,class=CODE,delta=2
global __ptext56
__ptext56:
;; *************** function _delay *****************
;; Defined at:
;; line 4 in file "D:\TI\PIC course\led running\running.c"
;; Parameters: Size Location Type
;; a 2 0[COMMON] unsigned int
;; Auto vars: Size Location Type
;; None
;; Return value: Size Location Type
;; None void
;; Registers used:
;; wreg
;; Tracked objects:
;; On entry : 0/0
;; On exit : 0/0
;; Unchanged: 0/0
;; Data sizes: COMMON BANK0 BANK1 BANK3 BANK2
;; Params: 2 0 0 0 0
;; Locals: 0 0 0 0 0
;; Temps: 0 0 0 0 0
;; Totals: 2 0 0 0 0
;;Total ram usage: 2 bytes
;; Hardware stack levels used: 1
;; This function calls:
;; Nothing
;; This function is called by:
;; _main
;; This function uses a non-reentrant model
;;
psect text56
file "D:\TI\PIC course\led running\running.c"
line 4
global __size_of_delay
__size_of_delay equ __end_of_delay-_delay
_delay:
opt stack 0
; Regs used in _delay: [wreg]
line 5
l1499:
;running.c: 5: while(a--);
goto l561
l562:
l561:
l1501:
movlw low(01h)
subwf (delay@a),f
movlw high(01h)
skipc
decf (delay@a+1),f
subwf (delay@a+1),f
movlw high(0FFFFh)
xorwf ((delay@a+1)),w
skipz
goto u1535
movlw low(0FFFFh)
xorwf ((delay@a)),w
u1535:
skipz
goto u1531
goto u1530
u1531:
goto l562
u1530:
l563:
line 6
l564:
return
opt stack 0
GLOBAL __end_of_delay
__end_of_delay:
;; =============== function _delay ends ============
signat _delay,4216
psect text57,local,class=CODE,delta=2
global __ptext57
__ptext57:
global btemp
btemp set 07Eh
DABS 1,126,2 ;btemp
global wtemp0
wtemp0 set btemp
end