Subversion Repositories svnkaklik

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
CCS PCM C Compiler, Version 3.221, 27853               12-III-06 16:36
2
 
3
               Filename: D:\KAKLIK\programy\PIC_C\hack\hack.LST
4
 
5
               ROM used: 1587 words (41%)
6
                         Largest free fragment is 1792
7
               RAM used: 41 (11%) at main() level
8
                         51 (14%) worst case
9
               Stack:    3 worst case (2 in main + 1 for interrupts)
10
 
11
*
12
0000:  NOP
13
0001:  MOVLW  00
14
0002:  MOVWF  0A
15
0003:  GOTO   342
16
0004:  MOVWF  7F
17
0005:  SWAPF  03,W
18
0006:  CLRF   03
19
0007:  MOVWF  21
20
0008:  MOVF   7F,W
21
0009:  MOVWF  20
22
000A:  MOVF   0A,W
23
000B:  MOVWF  28
24
000C:  CLRF   0A
25
000D:  SWAPF  20,F
26
000E:  MOVF   04,W
27
000F:  MOVWF  22
28
0010:  MOVF   77,W
29
0011:  MOVWF  23
30
0012:  MOVF   78,W
31
0013:  MOVWF  24
32
0014:  MOVF   79,W
33
0015:  MOVWF  25
34
0016:  MOVF   7A,W
35
0017:  MOVWF  26
36
0018:  MOVF   7B,W
37
0019:  MOVWF  27
38
001A:  BCF    03.7
39
001B:  BCF    03.5
40
001C:  MOVLW  8C
41
001D:  MOVWF  04
42
001E:  BTFSS  00.0
43
001F:  GOTO   022
44
0020:  BTFSC  0C.0
45
0021:  GOTO   03B
46
0022:  MOVLW  8C
47
0023:  MOVWF  04
48
0024:  BTFSS  00.1
49
0025:  GOTO   028
50
0026:  BTFSC  0C.1
51
0027:  GOTO   03D
52
0028:  MOVF   22,W
53
0029:  MOVWF  04
54
002A:  MOVF   23,W
55
002B:  MOVWF  77
56
002C:  MOVF   24,W
57
002D:  MOVWF  78
58
002E:  MOVF   25,W
59
002F:  MOVWF  79
60
0030:  MOVF   26,W
61
0031:  MOVWF  7A
62
0032:  MOVF   27,W
63
0033:  MOVWF  7B
64
0034:  MOVF   28,W
65
0035:  MOVWF  0A
66
0036:  SWAPF  21,W
67
0037:  MOVWF  03
68
0038:  SWAPF  7F,F
69
0039:  SWAPF  7F,W
70
003A:  RETFIE
71
003B:  BCF    0A.3
72
003C:  GOTO   0E0
73
003D:  BCF    0A.3
74
003E:  GOTO   0E3
75
....................  #include ".\hack.h" 
76
....................  #include <16F88.h> 
77
....................  //////// Standard Header file for the PIC16F88 device ////////////////  
78
.................... #device PIC16F88  
79
.................... #list  
80
....................  
81
.................... #device *=16  
82
.................... #device ICD=TRUE  
83
.................... #device adc=8  
84
.................... #fuses NOWDT,INTRC , NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO  
85
.................... //#fuses NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO  
86
.................... #use delay(clock=4000000,RESTART_WDT)  
87
*
88
00E6:  MOVLW  42
89
00E7:  MOVWF  04
90
00E8:  BCF    03.7
91
00E9:  MOVF   00,W
92
00EA:  BTFSC  03.2
93
00EB:  GOTO   0FD
94
00EC:  MOVLW  01
95
00ED:  MOVWF  78
96
00EE:  MOVLW  BF
97
00EF:  MOVWF  77
98
00F0:  CLRWDT
99
00F1:  DECFSZ 77,F
100
00F2:  GOTO   0F0
101
00F3:  DECFSZ 78,F
102
00F4:  GOTO   0EE
103
00F5:  MOVLW  4A
104
00F6:  MOVWF  77
105
00F7:  DECFSZ 77,F
106
00F8:  GOTO   0F7
107
00F9:  NOP
108
00FA:  CLRWDT
109
00FB:  DECFSZ 00,F
110
00FC:  GOTO   0EC
111
00FD:  RETLW  00
112
.................... //#use rs232(baud=2400,xmit=PIN_B3)  
113
.................... //#use rs232(DEBUGGER)  
114
.................... #use rs232(baud=1200,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8)  
115
00FE:  BSF    03.5
116
00FF:  BCF    06.3
117
0100:  BCF    03.5
118
0101:  BCF    06.3
119
0102:  MOVLW  08
120
0103:  MOVWF  78
121
0104:  NOP
122
0105:  NOP
123
0106:  NOP
124
0107:  BSF    78.7
125
0108:  GOTO   118
126
0109:  BCF    78.7
127
010A:  RRF    4C,F
128
010B:  BTFSC  03.0
129
010C:  BSF    06.3
130
010D:  BTFSS  03.0
131
010E:  BCF    06.3
132
010F:  BSF    78.6
133
0110:  GOTO   118
134
0111:  BCF    78.6
135
0112:  DECFSZ 78,F
136
0113:  GOTO   10A
137
0114:  NOP
138
0115:  NOP
139
0116:  NOP
140
0117:  BSF    06.3
141
0118:  MOVLW  01
142
0119:  MOVWF  77
143
011A:  CLRF   04
144
011B:  DECFSZ 04,F
145
011C:  GOTO   11B
146
011D:  DECFSZ 77,F
147
011E:  GOTO   11A
148
011F:  MOVLW  0D
149
0120:  MOVWF  04
150
0121:  DECFSZ 04,F
151
0122:  GOTO   121
152
0123:  NOP
153
0124:  NOP
154
0125:  BTFSC  78.7
155
0126:  GOTO   109
156
0127:  BTFSC  78.6
157
0128:  GOTO   111
158
0129:  RETLW  00
159
012A:  MOVF   04,W
160
012B:  MOVWF  78
161
012C:  MOVLW  08
162
012D:  MOVWF  77
163
012E:  BSF    03.5
164
012F:  BSF    06.2
165
0130:  BCF    03.5
166
0131:  BTFSS  06.2
167
0132:  GOTO   135
168
0133:  BSF    03.5
169
0134:  GOTO   130
170
0135:  CLRF   41
171
0136:  BSF    77.7
172
0137:  GOTO   148
173
0138:  BCF    77.7
174
0139:  GOTO   148
175
013A:  BCF    03.0
176
013B:  BTFSC  06.2
177
013C:  BSF    03.0
178
013D:  RRF    41,F
179
013E:  BSF    77.6
180
013F:  GOTO   148
181
0140:  BCF    77.6
182
0141:  DECFSZ 77,F
183
0142:  GOTO   13A
184
0143:  MOVF   78,W
185
0144:  MOVWF  04
186
0145:  MOVF   41,W
187
0146:  MOVWF  78
188
0147:  GOTO   15D
189
0148:  MOVLW  01
190
0149:  MOVWF  04
191
014A:  MOVLW  00
192
014B:  BTFSC  77.7
193
014C:  MOVLW  55
194
014D:  MOVWF  78
195
014E:  DECFSZ 78,F
196
014F:  GOTO   14E
197
0150:  DECFSZ 04,F
198
0151:  GOTO   14A
199
0152:  MOVLW  0D
200
0153:  BTFSC  77.7
201
0154:  MOVLW  03
202
0155:  MOVWF  78
203
0156:  DECFSZ 78,F
204
0157:  GOTO   156
205
0158:  BTFSC  77.7
206
0159:  GOTO   138
207
015A:  BTFSC  77.6
208
015B:  GOTO   140
209
015C:  GOTO   13A
210
015D:  BCF    0A.3
211
015E:  GOTO   3C1 (RETURN)
212
....................   
213
....................  
214
.................... #include <stdlib.h> 
215
....................  ///////////////////////////////////////////////////////////////////////////  
216
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
217
.................... //// This source code may only be used by licensed users of the CCS C  ////  
218
.................... //// compiler.  This source code may only be distributed to other      ////  
219
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
220
.................... //// or distribution is permitted without written permission.          ////  
221
.................... //// Derivative programs created using this software in object code    ////  
222
.................... //// form are not restricted in any way.                               ////  
223
.................... ///////////////////////////////////////////////////////////////////////////  
224
....................   
225
.................... #ifndef _STDLIB  
226
.................... #define _STDLIB  
227
....................   
228
.................... //---------------------------------------------------------------------------  
229
.................... // Definitions and types  
230
.................... //---------------------------------------------------------------------------  
231
....................   
232
.................... #ifndef RAND_MAX  
233
.................... #define RAND_MAX  32767    // The value of which is the maximum value  
234
....................                            // ... returned by the rand function  
235
.................... #endif  
236
....................   
237
.................... typedef struct {  
238
....................    signed int quot;  
239
....................    signed int rem;  
240
.................... } div_t;  
241
....................   
242
.................... typedef struct {  
243
....................    signed long quot;  
244
....................    signed long rem;  
245
.................... } ldiv_t;  
246
....................   
247
.................... #include <stddef.h> 
248
....................  ///////////////////////////////////////////////////////////////////////////  
249
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
250
.................... //// This source code may only be used by licensed users of the CCS C  ////  
251
.................... //// compiler.  This source code may only be distributed to other      ////  
252
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
253
.................... //// or distribution is permitted without written permission.          ////  
254
.................... //// Derivative programs created using this software in object code    ////  
255
.................... //// form are not restricted in any way.                               ////  
256
.................... ///////////////////////////////////////////////////////////////////////////  
257
....................   
258
.................... #ifndef _STDDEF  
259
....................   
260
.................... #define _STDDEF  
261
....................   
262
.................... #if sizeof(int *)==1  
263
.................... #define ptrdiff_t int  
264
.................... #else  
265
.................... #define ptrdiff_t long  
266
.................... #endif  
267
....................   
268
.................... #define size_t int  
269
.................... #define wchar_t char  
270
.................... #define NULL 0  
271
....................   
272
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)  
273
....................   
274
.................... #endif  
275
....................  
276
....................   
277
.................... //---------------------------------------------------------------------------  
278
.................... // String conversion functions  
279
.................... //---------------------------------------------------------------------------  
280
....................   
281
.................... /* Standard template: float atof(char * s)  
282
....................  * converts the initial portion of the string s to a float.  
283
....................  * returns the converted value if any, 0 otherwise  
284
....................  */  
285
.................... float atof(char * s);  
286
....................   
287
.................... /* Standard template: signed int  atoi(char * s)  
288
....................  * converts the initial portion of the string s to a signed int  
289
....................  * returns the converted value if any, 0 otherwise  
290
....................  */  
291
.................... signed int atoi(char *s);  
292
....................   
293
.................... /* Syntax: signed int32  atoi32(char * s)  
294
....................    converts the initial portion of the string s to a signed int32  
295
....................    returns the converted value if any, 0 otherwise*/  
296
.................... signed int32 atoi32(char *s);  
297
....................   
298
.................... /* Standard template: signed long  atol(char * s)  
299
....................  * converts the initial portion of the string s to a signed long  
300
....................  * returns the converted value if any, 0 otherwise  
301
....................  */  
302
.................... signed long atol(char *s);  
303
....................   
304
.................... /* Standard template: float strtol(char * s,char *endptr)  
305
....................  * converts the initial portion of the string s to a float  
306
....................  * returns the converted value if any, 0 otherwise  
307
....................  * the final string is returned in the endptr, if endptr is not null  
308
....................  */  
309
.................... float strtod(char *s,char *endptr);  
310
....................   
311
.................... /* Standard template: long strtoul(char * s,char *endptr,signed int base)  
312
....................  * converts the initial portion of the string s, represented as an  
313
....................  * integral value of radix base  to a signed long.  
314
....................  * Returns the converted value if any, 0 otherwise  
315
....................  * the final string is returned in the endptr, if endptr is not null  
316
....................  */  
317
.................... signed long strtol(char *s,char *endptr,signed int base);  
318
....................   
319
.................... /* Standard template: long strtoul(char * s,char *endptr,signed int base)  
320
....................  * converts the initial portion of the string s, represented as an  
321
....................  * integral value of radix base to a unsigned long.  
322
....................  * returns the converted value if any, 0 otherwise  
323
....................  * the final string is returned in the endptr, if endptr is not null  
324
....................  */  
325
.................... long strtoul(char *s,char *endptr,signed int base);  
326
....................   
327
.................... //---------------------------------------------------------------------------  
328
.................... // Pseudo-random sequence generation functions  
329
.................... //---------------------------------------------------------------------------  
330
....................   
331
.................... /* The rand function computes a sequence of pseudo-random integers in  
332
....................  * the range 0 to RAND_MAX  
333
....................  *  
334
....................  * Parameters:  
335
....................  *       (none)  
336
....................  *  
337
....................  * Returns:  
338
....................  *       The pseudo-random integer  
339
....................  */  
340
.................... long rand(void);  
341
....................   
342
.................... /* The srand function uses the argument as a seed for a new sequence of  
343
....................  * pseudo-random numbers to be returned by subsequent calls to rand.  
344
....................  *  
345
....................  * Parameters:  
346
....................  *       [in] seed: The seed value to start from. You might need to pass  
347
....................  *  
348
....................  * Returns:  
349
....................  *       (none)  
350
....................  *  
351
....................  * Remarks  
352
....................  *          The srand function sets the starting point for generating  
353
....................  *       a series of pseudorandom integers. To reinitialize the  
354
....................  *       generator, use 1 as the seed argument. Any other value for  
355
....................  *       seed sets the generator to a random starting point. rand  
356
....................  *       retrieves the pseudorandom numbers that are generated.  
357
....................  *       Calling rand before any call to srand generates the same  
358
....................  *       sequence as calling srand with seed passed as 1.  
359
....................  *          Usually, you need to pass a time here from outer source  
360
....................  *       so that the numbers will be different every time you run.  
361
....................  */  
362
.................... void srand(unsigned int32 seed);  
363
....................   
364
.................... //---------------------------------------------------------------------------  
365
.................... // Memory management functions  
366
.................... //---------------------------------------------------------------------------  
367
....................   
368
.................... // Comming soon  
369
....................   
370
.................... //---------------------------------------------------------------------------  
371
.................... // Communication with the environment  
372
.................... //---------------------------------------------------------------------------  
373
....................   
374
.................... /* The function returns 0 always  
375
....................  */  
376
.................... signed int system(char *string);  
377
....................   
378
.................... //---------------------------------------------------------------------------  
379
.................... // Searching and sorting utilities  
380
.................... //---------------------------------------------------------------------------  
381
....................   
382
.................... /* Performs a binary search of a sorted array..  
383
....................  *  
384
....................  * Parameters:  
385
....................  *       [in] key: Object to search for  
386
....................  *       [in] base: Pointer to base of search data  
387
....................  *       [in] num: Number of elements  
388
....................  *       [in] width: Width of elements  
389
....................  *       [in] compare: Function that compares two elements  
390
....................  *  
391
....................  * Returns:  
392
....................  *       bsearch returns a pointer to an occurrence of key in the array pointed  
393
....................  *       to by base. If key is not found, the function returns NULL. If the  
394
....................  *       array is not in order or contains duplicate records with identical keys,  
395
....................  *       the result is unpredictable.  
396
....................  */  
397
.................... //void *bsearch(const void *key, const void *base, size_t num, size_t width,  
398
.................... //              int (*compare)(const void *, const void *));  
399
....................   
400
.................... /* Performs the shell-metzner sort (not the quick sort algorithm). The contents  
401
....................  * of the array are sorted into ascending order according to a comparison  
402
....................  * function pointed to by compar.  
403
....................  *  
404
....................  * Parameters:  
405
....................  *       [in] base: Pointer to base of search data  
406
....................  *       [in] num: Number of elements  
407
....................  *       [in] width: Width of elements  
408
....................  *       [in] compare: Function that compares two elements  
409
....................  *  
410
....................  * Returns:  
411
....................  *       (none)  
412
....................  */  
413
.................... //void *qsort(const void *base, size_t num, size_t width,  
414
.................... //              int (*compare)(const void *, const void *));  
415
....................   
416
.................... //---------------------------------------------------------------------------  
417
.................... // Integer arithmetic functions  
418
.................... //---------------------------------------------------------------------------  
419
....................   
420
.................... #define labs abs  
421
....................   
422
.................... div_t div(signed int numer,signed int denom);  
423
.................... ldiv_t ldiv(signed long numer,signed long denom);  
424
....................   
425
.................... //---------------------------------------------------------------------------  
426
.................... // Multibyte character functions  
427
.................... //---------------------------------------------------------------------------  
428
....................   
429
.................... // Not supported  
430
....................   
431
.................... //---------------------------------------------------------------------------  
432
.................... // Multibyte string functions  
433
.................... //---------------------------------------------------------------------------  
434
....................   
435
.................... // Not supported  
436
....................   
437
....................   
438
.................... //---------------------------------------------------------------------------  
439
.................... // Internal implementation  
440
.................... //---------------------------------------------------------------------------  
441
....................   
442
.................... #include <stddef.h> 
443
....................  ///////////////////////////////////////////////////////////////////////////  
444
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
445
.................... //// This source code may only be used by licensed users of the CCS C  ////  
446
.................... //// compiler.  This source code may only be distributed to other      ////  
447
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
448
.................... //// or distribution is permitted without written permission.          ////  
449
.................... //// Derivative programs created using this software in object code    ////  
450
.................... //// form are not restricted in any way.                               ////  
451
.................... ///////////////////////////////////////////////////////////////////////////  
452
....................   
453
.................... #ifndef _STDDEF  
454
....................   
455
.................... #define _STDDEF  
456
....................   
457
.................... #if sizeof(int *)==1  
458
.................... #define ptrdiff_t int  
459
.................... #else  
460
.................... #define ptrdiff_t long  
461
.................... #endif  
462
....................   
463
.................... #define size_t int  
464
.................... #define wchar_t char  
465
.................... #define NULL 0  
466
....................   
467
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)  
468
....................   
469
.................... #endif  
470
....................  
471
.................... #include <string.h> 
472
....................  ////////////////////////////////////////////////////////////////////////////  
473
.................... ////        (C) Copyright 1996,2003 Custom Computer Services            ////  
474
.................... //// This source code may only be used by licensed users of the CCS C   ////  
475
.................... //// compiler.  This source code may only be distributed to other       ////  
476
.................... //// licensed users of the CCS C compiler.  No other use, reproduction  ////  
477
.................... //// or distribution is permitted without written permission.           ////  
478
.................... //// Derivative programs created using this software in object code     ////  
479
.................... //// form are not restricted in any way.                                ////  
480
.................... ////////////////////////////////////////////////////////////////////////////  
481
....................   
482
.................... #ifndef _STRING  
483
.................... #define _STRING  
484
.................... #include <stddef.h> 
485
....................  ///////////////////////////////////////////////////////////////////////////  
486
.................... ////        (C) Copyright 1996,2003 Custom Computer Services           ////  
487
.................... //// This source code may only be used by licensed users of the CCS C  ////  
488
.................... //// compiler.  This source code may only be distributed to other      ////  
489
.................... //// licensed users of the CCS C compiler.  No other use, reproduction ////  
490
.................... //// or distribution is permitted without written permission.          ////  
491
.................... //// Derivative programs created using this software in object code    ////  
492
.................... //// form are not restricted in any way.                               ////  
493
.................... ///////////////////////////////////////////////////////////////////////////  
494
....................   
495
.................... #ifndef _STDDEF  
496
....................   
497
.................... #define _STDDEF  
498
....................   
499
.................... #if sizeof(int *)==1  
500
.................... #define ptrdiff_t int  
501
.................... #else  
502
.................... #define ptrdiff_t long  
503
.................... #endif  
504
....................   
505
.................... #define size_t int  
506
.................... #define wchar_t char  
507
.................... #define NULL 0  
508
....................   
509
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)  
510
....................   
511
.................... #endif  
512
....................  
513
.................... #include <ctype.h> 
514
....................  ////////////////////////////////////////////////////////////////////////////  
515
.................... ////        (C) Copyright 1996,2003 Custom Computer Services            ////  
516
.................... //// This source code may only be used by licensed users of the CCS C   ////  
517
.................... //// compiler.  This source code may only be distributed to other       ////  
518
.................... //// licensed users of the CCS C compiler.  No other use, reproduction  ////  
519
.................... //// or distribution is permitted without written permission.           ////  
520
.................... //// Derivative programs created using this software in object code     ////  
521
.................... //// form are not restricted in any way.                                ////  
522
.................... ////////////////////////////////////////////////////////////////////////////  
523
....................   
524
.................... #ifndef _CTYPE  
525
.................... #define _CTYPE  
526
....................   
527
.................... #define islower(x)  isamong(x,"abcdefghijklmnopqrstuvwxyz")  
528
.................... #define isupper(x)  isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")  
529
.................... #define isalnum(x)  isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")  
530
.................... #define isalpha(x)  isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")  
531
.................... #define isdigit(x)  isamong(x,"0123456789")  
532
.................... #define isspace(x)  (x==' ')  
533
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")  
534
.................... #define iscntrl(x)  (x<' ')  
535
.................... #define isprint(x)  (x>=' ')  
536
.................... #define isgraph(x)  (x>' ')  
537
.................... #define ispunct(x)  ((x>' ')&&!isalnum(x))  
538
....................   
539
.................... #endif  
540
....................   
541
....................  
542
....................   
543
....................   
544
....................   
545
.................... //////////////////////////////////////////////  
546
.................... //// Uncomment the following define to    ////  
547
.................... //// allow some functions to use a        ////  
548
.................... //// quicker algorithm, but use more ROM  ////  
549
.................... ////                                      ////  
550
.................... //// #define FASTER_BUT_MORE_ROM          ////  
551
.................... //////////////////////////////////////////////  
552
....................   
553
....................   
554
....................   
555
.................... /*Copying functions*/  
556
.................... /* standard template:  
557
....................    void *memmove(void *s1, void *s2, size_t n).  
558
....................    Copies max of n characters safely (not following ending '\0')  
559
....................    from s2 in s1; if s2 has less than n characters, appends 0 */  
560
....................   
561
.................... char *memmove(void *s1,char *s2,size_t n)  
562
.................... {  
563
....................    char *sc1;  
564
....................    char *sc2;  
565
....................    sc1=s1;  
566
....................    sc2=s2;  
567
....................    if(sc2<sc1 && sc1 <sc2 +n)  
568
....................       for(sc1+=n,sc2+=n;0<n;--n)  
569
....................          *--sc1=*--sc2;  
570
....................    else  
571
....................       for(;0<n;--n)  
572
....................          *sc1++=*sc2++;  
573
....................   return s1;  
574
....................   }  
575
....................   
576
.................... /* compiler ignored the name 'strcpy()'; perhaps, it's reserved? 
577
....................    Standard template: char *strcpy(char *s1, const char *s2)  
578
....................    copies the string s2 including the null character to s1*/  
579
....................   
580
.................... char *strcopy(char *s1, char *s2)  
581
.................... {  
582
....................   char *s;  
583
....................   
584
....................   for (s = s1; *s2 != 0; s++, s2++) {  
585
.................... 	  *s = *s2;  
586
....................   }  
587
....................   *s = *s2;  
588
....................   return(s1);  
589
.................... }  
590
....................   
591
.................... /* standard template:  
592
....................    char *strncpy(char *s1, const char *s2, size_t n).  
593
....................    Copies max of n characters (not following ending '\0')  
594
....................    from s2 in s1; if s2 has less than n characters, appends 0 */  
595
....................   
596
.................... char *strncpy(char *s1, char *s2, size_t n)  
597
.................... {  
598
....................   char *s;  
599
....................   
600
....................   for (s = s1; n > 0 && *s2 != '\0'; n--)  
601
....................      *s++ = *s2++;  
602
....................   for (; n > 0; n--)  
603
....................      *s++ = '\0';  
604
....................   
605
....................   return(s1);  
606
.................... }  
607
.................... /***********************************************************/  
608
....................   
609
.................... /*concatenation functions*/  
610
.................... /* standard template: char *strcat(char *s1, const char *s2)  
611
.................... appends s2 to s1*/  
612
....................   
613
.................... char *strcat(char *s1, char *s2)  
614
.................... {  
615
....................    char *s;  
616
....................   
617
....................    for (s = s1; *s != '\0'; ++s);  
618
....................    while(*s2 != '\0')  
619
....................    {  
620
....................       *s = *s2;  
621
....................       ++s;  
622
....................       ++s2;  
623
....................    }  
624
....................   
625
....................    *s = '\0';  
626
....................    return(s1);  
627
.................... }  
628
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n)  
629
.................... appends not more than n characters from s2 to s1*/  
630
....................   
631
.................... char *strncat(char *s1, char *s2, size_t n)  
632
.................... {  
633
....................    char *s;  
634
....................   
635
....................    for (s = s1; *s != '\0'; ++s);  
636
....................    while(*s2 != '\0' && 0<n)  
637
....................    {  
638
....................       *s = *s2;  
639
....................       ++s;  
640
....................       ++s2;  
641
....................       --n;  
642
....................    }  
643
....................   
644
....................    *s = '\0';  
645
....................    return(s1);  
646
.................... }  
647
....................   
648
.................... /***********************************************************/  
649
....................   
650
....................   
651
.................... /*comparison functions*/  
652
.................... /* standard template: signed int memcmp(void *s1, void *s2).  
653
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
654
....................   
655
.................... signed int memcmp(void * s1,char *s2,size_t n)  
656
.................... {  
657
.................... char *su1, *su2;  
658
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)  
659
.................... {  
660
....................    if(*su1!=*su2)  
661
....................       return ((*su1<*su2)?1:+1);  
662
.................... }  
663
.................... return 0;  
664
.................... }  
665
....................   
666
.................... /* standard template: int strcmp(const char *s1, const char *s2).  
667
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
668
....................   
669
.................... signed int strcmp(char *s1, char *s2)  
670
.................... {  
671
....................    for (; *s1 == *s2; s1++, s2++)  
672
....................       if (*s1 == '\0')  
673
....................          return(0);  
674
....................    return((*s1 < *s2) ?-1: 1);  
675
.................... }  
676
.................... /* standard template: int strcoll(const char *s1, const char *s2).  
677
....................    Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */  
678
....................   
679
.................... signed int strcoll(char *s1, char *s2)  
680
.................... {  
681
....................    for (; *s1 == *s2; s1++, s2++)  
682
....................       if (*s1 == '\0')  
683
....................          return(0);  
684
....................    return((*s1 < *s2) ?-1: 1);  
685
.................... }  
686
....................   
687
.................... /* standard template:  
688
....................    int strncmp(const char *s1, const char *s2, size_t n).  
689
....................    Compares max of n characters (not following 0) from s1 to s2;  
690
....................    returns same as strcmp */  
691
....................   
692
.................... signed int strncmp(char *s1, char *s2, size_t n)  
693
.................... {  
694
....................    for (; n > 0; s1++, s2++, n--)  
695
....................       if (*s1 != *s2)  
696
....................          return((*s1 <*s2) ?-1: 1);  
697
....................       else if (*s1 == '\0')  
698
....................          return(0);  
699
....................    return(0);  
700
.................... }  
701
.................... /* standard template:  
702
....................    int strxfrm(const char *s1, const char *s2, size_t n).  
703
....................    transforms maximum of n characters from s2 and places them into s1*/  
704
.................... size_t strxfrm(char *s1, char *s2, size_t n)  
705
.................... {  
706
....................   char *s;  
707
....................   int n1;  
708
....................   n1=n;  
709
....................   for (s = s1; n > 0 && *s2 != '\0'; n--)  
710
....................      *s++ = *s2++;  
711
....................   for (; n > 0; n--)  
712
....................      *s++ = '\0';  
713
....................   
714
....................   return(n1);  
715
.................... }  
716
....................   
717
....................   
718
....................   
719
....................   
720
....................   
721
.................... /***********************************************************/  
722
.................... /*Search functions*/  
723
.................... /* standard template: void *memchr(const char *s, int c).  
724
....................    Finds first occurrence of c in n characters of s */  
725
....................   
726
.................... char *memchr(void *s,int c,size_t n)  
727
.................... {  
728
....................    char uc;  
729
....................    char *su;  
730
....................    uc=c;  
731
....................    for(su=s;0<n;++su,--n)  
732
....................       if(*su==uc)  
733
....................       return su;  
734
....................    return NULL;  
735
.................... }  
736
....................   
737
.................... /* standard template: char *strchr(const char *s, int c).  
738
....................    Finds first occurrence of c in s */  
739
....................   
740
.................... char *strchr(char *s, int c)  
741
.................... {  
742
....................    for (; *s != c; s++)  
743
....................       if (*s == '\0')  
744
....................          return(0);  
745
....................    return(s);  
746
.................... }  
747
.................... /* standard template:  
748
....................    size_t strcspn(const char *s1, const char *s2).  
749
....................    Computes length of max initial segment of s1 that  
750
....................    consists entirely of characters NOT from s2*/  
751
....................   
752
.................... int *strcspn(char *s1, char *s2)  
753
.................... {  
754
....................    char *sc1, *sc2;  
755
....................   
756
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
757
....................       for (sc2 = s2; *sc2 != 0; sc2++)  
758
....................          if (*sc1 == *sc2)  
759
....................             return(sc1 - s1);  
760
....................    return(sc1 - s1);  
761
.................... }  
762
.................... /* standard template:  
763
....................    char *strpbrk(const char *s1, const char *s2).  
764
....................    Locates first occurence of any character from s2 in s1;  
765
....................    returns s1 if s2 is empty string */  
766
....................   
767
.................... char *strpbrk(char *s1, char *s2)  
768
.................... {  
769
....................    char *sc1, *sc2;  
770
....................   
771
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
772
....................       for (sc2 = s2; *sc2 != 0; sc2++)  
773
....................          if (*sc1 == *sc2)  
774
....................             return(sc1);  
775
....................    return(0);  
776
.................... }  
777
....................   
778
....................   
779
.................... /* standard template: char *strrchr(const char *s, int c).  
780
....................    Finds last occurrence of c in s */  
781
....................   
782
.................... char *strrchr(char *s, int c)  
783
.................... {  
784
....................    char *p;  
785
....................   
786
....................    for (p = 0; ; s++)  
787
....................    {  
788
....................       if (*s == c)  
789
....................          p = s;  
790
....................       if (*s == '\0')  
791
....................          return(p);  
792
....................    }  
793
.................... }  
794
.................... /* computes length of max initial segment of s1 consisting  
795
....................    entirely of characters from s2 */  
796
....................   
797
.................... int *strspn(char *s1, char *s2)  
798
.................... {  
799
....................    char *sc1, *sc2;  
800
....................   
801
....................    for (sc1 = s1; *sc1 != 0; sc1++)  
802
....................       for (sc2 = s2; ; sc2++)  
803
.................... 	 if (*sc2 == '\0')  
804
.................... 	    return(sc1 - s1);  
805
....................          else if (*sc1 == *sc2)  
806
....................             break;  
807
....................    return(sc1 - s1);  
808
.................... }  
809
.................... /* standard template:  
810
....................    char *strstr(const char *s1, const char *s2);  
811
....................    Locates first occurence of character sequence s2 in s1;  
812
....................    returns 0 if s2 is empty string  
813
....................   
814
....................    Uncomment #define FASTER_BUT_MORE_ROM at the top of the  
815
....................    file to use the faster algorithm */  
816
.................... char *strstr(char *s1, char *s2)  
817
.................... {  
818
.................... 	char *s, *t;  
819
....................   
820
....................    #ifdef FASTER_BUT_MORE_ROM  
821
....................    if (*s2 == '\0')  
822
....................          return(s1);  
823
....................    #endif  
824
....................   
825
.................... 	while (*s1)  
826
....................    {  
827
....................       for(s = s1, t = s2; *t && *s == *t; ++s, ++t);  
828
....................   
829
.................... 		if (*t == '\0')  
830
.................... 			return s1;  
831
....................       ++s1;  
832
....................       #ifdef FASTER_BUT_MORE_ROM  
833
....................          while(*s1 != '\0' && *s1 != *s2)  
834
....................             ++s1;  
835
....................       #endif  
836
.................... 	}  
837
.................... 	return 0;  
838
.................... }  
839
....................   
840
.................... /* standard template: char *strtok(char *s1, const char *s2).  
841
....................   
842
....................    Finds next token in s1 delimited by a character from separator  
843
....................    string s2 (which can be different from call to call).  First call  
844
....................    starts at beginning of s1 searching for first character NOT  
845
....................    contained in s2; returns 0 if none is found.  
846
....................    If one is found, it is the start of first token (return value).  
847
....................    Function then searches from there for a character contained in s2.  
848
....................    If none is found, current token extends to end of s1, and subsequent  
849
....................    searches for a token will return 0.  If one is found, it is  
850
....................    overwritten by '\0', which terminates current token.  Function saves  
851
....................    pointer to following character from which next search will start.  
852
....................    Each subsequent call, with 0 as first argument, starts searching  
853
....................    from saved pointer */  
854
....................   
855
.................... char *strtok(char *s1, char *s2)  
856
.................... {  
857
....................    char *beg, *end;  
858
....................    static char *save;  
859
*
860
0359:  CLRF   29
861
035A:  CLRF   2A
862
....................   
863
....................    beg = (s1)?s1: save;  
864
....................    beg += strspn(beg, s2);  
865
....................    if (*beg == '\0')  
866
....................    {  
867
....................       *save = ' ';  
868
....................       return(0);  
869
....................    }  
870
....................    end = strpbrk(beg, s2);  
871
....................    if (*end != '\0')  
872
....................    {  
873
....................       *end = '\0';  
874
....................       end++;  
875
....................    }  
876
....................    save = end;  
877
....................    return(beg);  
878
.................... }  
879
....................   
880
.................... /*****************************************************************/  
881
.................... /*Miscellaneous functions*/  
882
.................... /* standard template  
883
.................... maps error number in errnum to an error message string  
884
.................... Returns: Pointer to string  
885
.................... */  
886
.................... #ifdef _ERRNO  
887
.................... char * strerror(int errnum)  
888
.................... {  
889
.................... char s[15];  
890
.................... switch( errnum)  
891
.................... {  
892
.................... case 0:  
893
....................    strcpy(s,"no errors");  
894
....................    return s;  
895
.................... case EDOM :  
896
....................    strcpy(s,"domain error");  
897
....................    return s;  
898
.................... case ERANGE:  
899
....................    strcpy(s,"range error");  
900
....................    return s;  
901
.................... }  
902
.................... }  
903
.................... #ENDIF  
904
.................... /* standard template: size_t strlen(const char *s).  
905
....................    Computes length of s1 (preceding terminating 0) */  
906
....................   
907
.................... int *strlen(char *s)  
908
.................... {  
909
....................    char *sc;  
910
....................   
911
....................    for (sc = s; *sc != 0; sc++);  
912
....................    return(sc - s);  
913
.................... }  
914
....................   
915
.................... /* standard template: size_t stricmp(const char *s1, const char *s2).  
916
....................    Compares s1 to s2 ignoring case (upper vs. lower) */  
917
....................   
918
.................... signed int stricmp(char *s1, char *s2)  
919
.................... {  
920
....................  for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));  
921
....................     s1++, s2++)  
922
....................     if (*s1 == '\0')  
923
....................        return(0);  
924
....................  return((*s1 < *s2) ?-1: 1);  
925
.................... }  
926
....................   
927
....................   
928
.................... /* standard template: char *strlwr(char *s).  
929
....................    Replaces uppercase letters by lowercase;  
930
....................    returns pointer to new string s */  
931
....................   
932
.................... char *strlwr(char *s)  
933
.................... {  
934
....................    char *p;  
935
....................   
936
....................    for (p = s; *p != '\0'; p++)  
937
....................       if (*p >= 'A' && *p <='Z')  
938
....................          *p += 'a' - 'A';  
939
....................    return(s);  
940
.................... }  
941
....................   
942
....................   
943
.................... /************************************************************/  
944
....................   
945
....................   
946
.................... #endif  
947
....................  
948
....................   
949
.................... div_t div(signed int numer,signed int denom)  
950
.................... {  
951
....................    div_t val;  
952
....................    val.quot = numer / denom;  
953
....................    val.rem = numer - (denom * val.quot);  
954
....................    return (val);  
955
.................... }  
956
....................   
957
.................... ldiv_t ldiv(signed long numer,signed long denom)  
958
.................... {  
959
....................    ldiv_t val;  
960
....................    val.quot = numer / denom;  
961
....................    val.rem = numer - (denom * val.quot);  
962
....................    return (val);  
963
.................... }  
964
....................   
965
.................... float atof(char * s)  
966
.................... {  
967
....................    float pow10 = 1.0;  
968
....................    float result = 0.0;  
969
....................    int sign = 0;  
970
....................    char c;  
971
....................    int ptr = 0;  
972
....................   
973
....................    c = s[ptr++];  
974
....................   
975
....................    if ((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {  
976
....................       if(c == '-') {  
977
....................          sign = 1;  
978
....................          c = s[ptr++];  
979
....................       }  
980
....................       if(c == '+')  
981
....................          c = s[ptr++];  
982
....................   
983
....................       while((c >= '0' && c <= '9')) {  
984
....................          result = 10*result + c - '0';  
985
....................          c = s[ptr++];  
986
....................       }  
987
....................   
988
....................       if (c == '.') {  
989
....................          c = s[ptr++];  
990
....................          while((c >= '0' && c <= '9')) {  
991
....................              pow10 = pow10*10;  
992
....................              result += (c - '0')/pow10;  
993
....................              c = s[ptr++];  
994
....................          }  
995
....................       }  
996
....................   
997
....................    }  
998
....................   
999
....................    if (sign == 1)  
1000
....................       result = -1*result;  
1001
....................    return(result);  
1002
.................... }  
1003
....................   
1004
.................... signed int atoi(char *s)  
1005
.................... {  
1006
....................    signed int result;  
1007
....................    int sign, base, index;  
1008
....................    char c;  
1009
....................   
1010
....................    index = 0;  
1011
....................    sign = 0;  
1012
....................    base = 10;  
1013
....................    result = 0;  
1014
....................   
1015
....................    if (!s)   
1016
....................       return 0;  
1017
....................    // Omit all preceeding alpha characters  
1018
....................    c = s[index++];  
1019
....................   
1020
....................    // increase index if either positive or negative sign is detected  
1021
....................    if (c == '-')  
1022
....................    {  
1023
....................       sign = 1;         // Set the sign to negative  
1024
....................       c = s[index++];  
1025
....................    }  
1026
....................    else if (c == '+')  
1027
....................    {  
1028
....................       c = s[index++];  
1029
....................    }  
1030
....................   
1031
....................    if (c >= '0' && c <= '9')  
1032
....................    {  
1033
....................   
1034
....................       // Check for hexa number  
1035
....................       if (c == '0' && (s[index] == 'x' || s[index] == 'X'))  
1036
....................       {  
1037
....................          base = 16;  
1038
....................          index++;  
1039
....................          c = s[index++];  
1040
....................       }  
1041
....................   
1042
....................       // The number is a decimal number  
1043
....................       if (base == 10)  
1044
....................       {  
1045
....................          while (c >= '0' && c <= '9')  
1046
....................          {  
1047
....................             result = 10*result + (c - '0');  
1048
....................             c = s[index++];  
1049
....................          }  
1050
....................       }  
1051
....................       else if (base == 16)    // The number is a hexa number  
1052
....................       {  
1053
....................          c = toupper(c);  
1054
....................          while ( (c >= '0' && c <= '9') || (c >= 'A' && c<='F'))  
1055
....................          {  
1056
....................             if (c >= '0' && c <= '9')  
1057
....................                result = (result << 4) + (c - '0');  
1058
....................             else  
1059
....................                result = (result << 4) + (c - 'A' + 10);  
1060
....................   
1061
....................             c = s[index++];  
1062
....................             c = toupper(c);  
1063
....................          }  
1064
....................       }  
1065
....................    }  
1066
....................   
1067
....................    if (sign == 1 && base == 10)  
1068
....................        result = -result;  
1069
....................   
1070
....................    return(result);  
1071
.................... }  
1072
....................   
1073
.................... signed long atol(char *s)  
1074
.................... {  
1075
....................    signed long result;  
1076
....................    int sign, base, index;  
1077
....................    char c;  
1078
....................   
1079
....................    index = 0;  
1080
*
1081
0242:  CLRF   47
1082
....................    sign = 0;  
1083
0243:  CLRF   45
1084
....................    base = 10;  
1085
0244:  MOVLW  0A
1086
0245:  MOVWF  46
1087
....................    result = 0;  
1088
0246:  CLRF   44
1089
0247:  CLRF   43
1090
....................   
1091
....................    if (!s)   
1092
0248:  MOVF   41,W
1093
0249:  IORWF  42,W
1094
024A:  BTFSS  03.2
1095
024B:  GOTO   250
1096
....................       return 0;  
1097
024C:  MOVLW  00
1098
024D:  MOVWF  78
1099
024E:  MOVWF  79
1100
024F:  GOTO   341
1101
....................    c = s[index++];  
1102
0250:  MOVF   47,W
1103
0251:  INCF   47,F
1104
0252:  ADDWF  41,W
1105
0253:  MOVWF  04
1106
0254:  BCF    03.7
1107
0255:  BTFSC  42.0
1108
0256:  BSF    03.7
1109
0257:  MOVF   00,W
1110
0258:  MOVWF  48
1111
....................   
1112
....................    // increase index if either positive or negative sign is detected  
1113
....................    if (c == '-')  
1114
0259:  MOVF   48,W
1115
025A:  SUBLW  2D
1116
025B:  BTFSS  03.2
1117
025C:  GOTO   269
1118
....................    {  
1119
....................       sign = 1;         // Set the sign to negative  
1120
025D:  MOVLW  01
1121
025E:  MOVWF  45
1122
....................       c = s[index++];  
1123
025F:  MOVF   47,W
1124
0260:  INCF   47,F
1125
0261:  ADDWF  41,W
1126
0262:  MOVWF  04
1127
0263:  BCF    03.7
1128
0264:  BTFSC  42.0
1129
0265:  BSF    03.7
1130
0266:  MOVF   00,W
1131
0267:  MOVWF  48
1132
....................    }  
1133
....................    else if (c == '+')  
1134
0268:  GOTO   276
1135
0269:  MOVF   48,W
1136
026A:  SUBLW  2B
1137
026B:  BTFSS  03.2
1138
026C:  GOTO   276
1139
....................    {  
1140
....................       c = s[index++];  
1141
026D:  MOVF   47,W
1142
026E:  INCF   47,F
1143
026F:  ADDWF  41,W
1144
0270:  MOVWF  04
1145
0271:  BCF    03.7
1146
0272:  BTFSC  42.0
1147
0273:  BSF    03.7
1148
0274:  MOVF   00,W
1149
0275:  MOVWF  48
1150
....................    }  
1151
....................   
1152
....................    if (c >= '0' && c <= '9')  
1153
0276:  MOVF   48,W
1154
0277:  SUBLW  2F
1155
0278:  BTFSC  03.0
1156
0279:  GOTO   332
1157
027A:  MOVF   48,W
1158
027B:  SUBLW  39
1159
027C:  BTFSS  03.0
1160
027D:  GOTO   332
1161
....................    {  
1162
....................       if (c == '0' && (s[index] == 'x' || s[index] == 'X'))  
1163
027E:  MOVF   48,W
1164
027F:  SUBLW  30
1165
0280:  BTFSS  03.2
1166
0281:  GOTO   2A2
1167
0282:  MOVF   47,W
1168
0283:  ADDWF  41,W
1169
0284:  MOVWF  04
1170
0285:  BCF    03.7
1171
0286:  BTFSC  42.0
1172
0287:  BSF    03.7
1173
0288:  MOVF   00,W
1174
0289:  SUBLW  78
1175
028A:  BTFSC  03.2
1176
028B:  GOTO   296
1177
028C:  MOVF   47,W
1178
028D:  ADDWF  41,W
1179
028E:  MOVWF  04
1180
028F:  BCF    03.7
1181
0290:  BTFSC  42.0
1182
0291:  BSF    03.7
1183
0292:  MOVF   00,W
1184
0293:  SUBLW  58
1185
0294:  BTFSS  03.2
1186
0295:  GOTO   2A2
1187
....................       {  
1188
....................          base = 16;  
1189
0296:  MOVLW  10
1190
0297:  MOVWF  46
1191
....................          index++;  
1192
0298:  INCF   47,F
1193
....................          c = s[index++];  
1194
0299:  MOVF   47,W
1195
029A:  INCF   47,F
1196
029B:  ADDWF  41,W
1197
029C:  MOVWF  04
1198
029D:  BCF    03.7
1199
029E:  BTFSC  42.0
1200
029F:  BSF    03.7
1201
02A0:  MOVF   00,W
1202
02A1:  MOVWF  48
1203
....................       }  
1204
....................   
1205
....................       // The number is a decimal number  
1206
....................       if (base == 10)  
1207
02A2:  MOVF   46,W
1208
02A3:  SUBLW  0A
1209
02A4:  BTFSS  03.2
1210
02A5:  GOTO   2C9
1211
....................       {  
1212
....................          while (c >= '0' && c <= '9')  
1213
....................          {  
1214
02A6:  MOVF   48,W
1215
02A7:  SUBLW  2F
1216
02A8:  BTFSC  03.0
1217
02A9:  GOTO   2C8
1218
02AA:  MOVF   48,W
1219
02AB:  SUBLW  39
1220
02AC:  BTFSS  03.0
1221
02AD:  GOTO   2C8
1222
....................             result = 10*result + (c - '0');  
1223
02AE:  CLRF   4A
1224
02AF:  MOVLW  0A
1225
02B0:  MOVWF  49
1226
02B1:  MOVF   44,W
1227
02B2:  MOVWF  4C
1228
02B3:  MOVF   43,W
1229
02B4:  MOVWF  4B
1230
02B5:  GOTO   22C
1231
02B6:  MOVLW  30
1232
02B7:  SUBWF  48,W
1233
02B8:  ADDWF  78,W
1234
02B9:  MOVWF  43
1235
02BA:  MOVF   79,W
1236
02BB:  MOVWF  44
1237
02BC:  BTFSC  03.0
1238
02BD:  INCF   44,F
1239
....................             c = s[index++];  
1240
02BE:  MOVF   47,W
1241
02BF:  INCF   47,F
1242
02C0:  ADDWF  41,W
1243
02C1:  MOVWF  04
1244
02C2:  BCF    03.7
1245
02C3:  BTFSC  42.0
1246
02C4:  BSF    03.7
1247
02C5:  MOVF   00,W
1248
02C6:  MOVWF  48
1249
....................          }  
1250
02C7:  GOTO   2A6
1251
....................       }  
1252
....................       else if (base == 16)    // The number is a hexa number  
1253
02C8:  GOTO   332
1254
02C9:  MOVF   46,W
1255
02CA:  SUBLW  10
1256
02CB:  BTFSS  03.2
1257
02CC:  GOTO   332
1258
....................       {  
1259
....................          c = toupper(c);  
1260
02CD:  MOVF   48,W
1261
02CE:  SUBLW  60
1262
02CF:  BTFSC  03.0
1263
02D0:  GOTO   2D8
1264
02D1:  MOVF   48,W
1265
02D2:  SUBLW  7A
1266
02D3:  BTFSS  03.0
1267
02D4:  GOTO   2D8
1268
02D5:  MOVF   48,W
1269
02D6:  ANDLW  DF
1270
02D7:  GOTO   2D9
1271
02D8:  MOVF   48,W
1272
02D9:  MOVWF  48
1273
....................          while ( (c >= '0' && c <= '9') || (c >= 'A' && c <='F'))  
1274
....................          {  
1275
02DA:  MOVF   48,W
1276
02DB:  SUBLW  2F
1277
02DC:  BTFSC  03.0
1278
02DD:  GOTO   2E2
1279
02DE:  MOVF   48,W
1280
02DF:  SUBLW  39
1281
02E0:  BTFSC  03.0
1282
02E1:  GOTO   2EA
1283
02E2:  MOVF   48,W
1284
02E3:  SUBLW  40
1285
02E4:  BTFSC  03.0
1286
02E5:  GOTO   332
1287
02E6:  MOVF   48,W
1288
02E7:  SUBLW  46
1289
02E8:  BTFSS  03.0
1290
02E9:  GOTO   332
1291
....................             if (c >= '0' && c <= '9')  
1292
02EA:  MOVF   48,W
1293
02EB:  SUBLW  2F
1294
02EC:  BTFSC  03.0
1295
02ED:  GOTO   307
1296
02EE:  MOVF   48,W
1297
02EF:  SUBLW  39
1298
02F0:  BTFSS  03.0
1299
02F1:  GOTO   307
1300
....................                result = (result << 4) + (c - '0');  
1301
02F2:  RLF    43,W
1302
02F3:  MOVWF  49
1303
02F4:  RLF    44,W
1304
02F5:  MOVWF  4A
1305
02F6:  RLF    49,F
1306
02F7:  RLF    4A,F
1307
02F8:  RLF    49,F
1308
02F9:  RLF    4A,F
1309
02FA:  RLF    49,F
1310
02FB:  RLF    4A,F
1311
02FC:  MOVLW  F0
1312
02FD:  ANDWF  49,F
1313
02FE:  MOVLW  30
1314
02FF:  SUBWF  48,W
1315
0300:  ADDWF  49,W
1316
0301:  MOVWF  43
1317
0302:  MOVF   4A,W
1318
0303:  MOVWF  44
1319
0304:  BTFSC  03.0
1320
0305:  INCF   44,F
1321
....................             else  
1322
0306:  GOTO   31C
1323
....................                result = (result << 4) + (c - 'A' + 10);  
1324
0307:  RLF    43,W
1325
0308:  MOVWF  49
1326
0309:  RLF    44,W
1327
030A:  MOVWF  4A
1328
030B:  RLF    49,F
1329
030C:  RLF    4A,F
1330
030D:  RLF    49,F
1331
030E:  RLF    4A,F
1332
030F:  RLF    49,F
1333
0310:  RLF    4A,F
1334
0311:  MOVLW  F0
1335
0312:  ANDWF  49,F
1336
0313:  MOVLW  41
1337
0314:  SUBWF  48,W
1338
0315:  ADDLW  0A
1339
0316:  ADDWF  49,W
1340
0317:  MOVWF  43
1341
0318:  MOVF   4A,W
1342
0319:  MOVWF  44
1343
031A:  BTFSC  03.0
1344
031B:  INCF   44,F
1345
....................   
1346
....................             c = s[index++];c = toupper(c);  
1347
031C:  MOVF   47,W
1348
031D:  INCF   47,F
1349
031E:  ADDWF  41,W
1350
031F:  MOVWF  04
1351
0320:  BCF    03.7
1352
0321:  BTFSC  42.0
1353
0322:  BSF    03.7
1354
0323:  MOVF   00,W
1355
0324:  MOVWF  48
1356
0325:  SUBLW  60
1357
0326:  BTFSC  03.0
1358
0327:  GOTO   32F
1359
0328:  MOVF   48,W
1360
0329:  SUBLW  7A
1361
032A:  BTFSS  03.0
1362
032B:  GOTO   32F
1363
032C:  MOVF   48,W
1364
032D:  ANDLW  DF
1365
032E:  GOTO   330
1366
032F:  MOVF   48,W
1367
0330:  MOVWF  48
1368
....................          }  
1369
0331:  GOTO   2DA
1370
....................       }  
1371
....................    }  
1372
....................   
1373
....................    if (base == 10 && sign == 1)  
1374
0332:  MOVF   46,W
1375
0333:  SUBLW  0A
1376
0334:  BTFSS  03.2
1377
0335:  GOTO   33D
1378
0336:  DECFSZ 45,W
1379
0337:  GOTO   33D
1380
....................       result = -result;  
1381
0338:  COMF   43,F
1382
0339:  COMF   44,F
1383
033A:  INCF   43,F
1384
033B:  BTFSC  03.2
1385
033C:  INCF   44,F
1386
....................   
1387
....................    return(result);  
1388
033D:  MOVF   43,W
1389
033E:  MOVWF  78
1390
033F:  MOVF   44,W
1391
0340:  MOVWF  79
1392
.................... }  
1393
0341:  RETLW  00
1394
....................   
1395
.................... /* A fast routine to multiply by 10  
1396
....................  */  
1397
.................... signed int32 mult_with10(int32 num)  
1398
.................... {  
1399
....................    return ( (num << 1) + (num << 3) );  
1400
.................... }  
1401
....................   
1402
.................... signed int32 atoi32(char *s)  
1403
.................... {  
1404
....................    signed int32 result;  
1405
....................    int sign, base, index;  
1406
....................    char c;  
1407
....................   
1408
....................    index = 0;  
1409
....................    sign = 0;  
1410
....................    base = 10;  
1411
....................    result = 0;  
1412
....................   
1413
....................    if (!s)   
1414
....................       return 0;  
1415
....................    c = s[index++];  
1416
....................   
1417
....................    // increase index if either positive or negative sign is detected  
1418
....................    if (c == '-')  
1419
....................    {  
1420
....................       sign = 1;         // Set the sign to negative  
1421
....................       c = s[index++];  
1422
....................    }  
1423
....................    else if (c == '+')  
1424
....................    {  
1425
....................       c = s[index++];  
1426
....................    }  
1427
....................   
1428
....................    if (c >= '0' && c <= '9')  
1429
....................    {  
1430
....................       if (c == '0' && (s[index] == 'x' || s[index] == 'X'))  
1431
....................       {  
1432
....................          base = 16;  
1433
....................          index++;  
1434
....................          c = s[index++];  
1435
....................       }  
1436
....................   
1437
....................       // The number is a decimal number  
1438
....................       if (base == 10)  
1439
....................       {  
1440
....................          while (c >= '0' && c <= '9') {  
1441
....................             result = (result << 1) + (result << 3);  // result *= 10;  
1442
....................             result += (c - '0');  
1443
....................             c = s[index++];  
1444
....................          }  
1445
....................       }  
1446
....................       else if (base == 16)    // The number is a hexa number  
1447
....................       {  
1448
....................          c = toupper(c);  
1449
....................          while ((c >= '0' && c <= '9') || (c >= 'A' && c <='F'))  
1450
....................          {  
1451
....................             if (c >= '0' && c <= '9')  
1452
....................                result = (result << 4) + (c - '0');  
1453
....................             else  
1454
....................                result = (result << 4) + (c - 'A' + 10);  
1455
....................   
1456
....................             c = s[index++];c = toupper(c);  
1457
....................          }  
1458
....................       }  
1459
....................    }  
1460
....................   
1461
....................    if (base == 10 && sign == 1)  
1462
....................       result = -result;  
1463
....................   
1464
....................    return(result);  
1465
.................... }  
1466
....................   
1467
.................... float strtod(char *s,char *endptr) {  
1468
....................    float pow10 = 1.0;  
1469
....................    float result = 0.0;  
1470
....................    int sign = 0, point = 0;  
1471
....................    char c;  
1472
....................    int ptr = 0;  
1473
....................   
1474
....................    if (!s)   
1475
....................       return 0;  
1476
....................    c=s[ptr++];  
1477
....................      
1478
....................   
1479
....................    while((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {  
1480
....................       if(c == '-') {  
1481
....................          sign = 1;  
1482
....................          c = s[ptr++];  
1483
....................       }  
1484
....................   
1485
....................       while((c >= '0' && c <= '9') && point == 0) {  
1486
....................          result = 10*result + c - '0';  
1487
....................          c = s[ptr++];  
1488
....................       }  
1489
....................   
1490
....................       if (c == '.') {  
1491
....................          point = 1;  
1492
....................          c = s[ptr++];  
1493
....................       }  
1494
....................   
1495
....................       while((c >= '0' && c <= '9') && point == 1) {  
1496
....................          pow10 = pow10*10;  
1497
....................          result += (c - '0')/pow10;  
1498
....................          c = s[ptr++];  
1499
....................       }  
1500
....................   
1501
....................       if (c == '+') {  
1502
....................          c = s[ptr++];  
1503
....................       }  
1504
....................    }  
1505
....................   
1506
....................    if (sign == 1)  
1507
....................       result = -1*result;  
1508
....................    if(endptr)  
1509
....................    {  
1510
....................       if (ptr) {  
1511
....................          ptr--;  
1512
....................          *((char *)endptr)=s+ptr;  
1513
....................       }  
1514
....................       else  
1515
....................          *((char *)endptr)=s;  
1516
....................    }  
1517
....................   
1518
....................    return(result);  
1519
.................... }  
1520
....................   
1521
.................... long strtoul(char *s,char *endptr,signed int base)  
1522
.................... {  
1523
....................    char *sc,*s1,*sd;  
1524
....................    unsigned long x=0;  
1525
....................    char sign;  
1526
....................    char digits[]="0123456789abcdefghijklmnopqstuvwxyz";  
1527
....................    for(sc=s;isspace(*sc);++sc);  
1528
....................    sign=*sc=='-'||*sc=='+'?sc++:'+';  
1529
....................    if(sign=='-')  
1530
....................    {  
1531
....................       if (endptr)  
1532
....................       {  
1533
....................         *((char *)endptr)=s;  
1534
....................       }  
1535
....................       return 0;  
1536
....................    }  
1537
....................   
1538
....................    if (base <0 || base ==1|| base >36) // invalid base  
1539
....................    {  
1540
....................       if (endptr)  
1541
....................       {  
1542
....................         *((char *)endptr)=s;  
1543
....................       }  
1544
....................       return 0;  
1545
....................    }  
1546
....................    else if (base)  
1547
....................    {  
1548
....................       if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X'))  
1549
....................          sc+=2;  
1550
....................       if(base==8 && *sc =='0')  
1551
....................          sc+=1;  
1552
....................       if(base==2 && *sc =='0'&&sc[1]=='b')  
1553
....................          sc+=2;  
1554
....................   
1555
....................    }  
1556
....................    else if(*sc!='0') // base is 0, find base  
1557
....................       base=10;  
1558
....................    else if (sc[1]=='x' || sc[1]=='X')  
1559
....................       base =16,sc+=2;  
1560
....................    else if(sc[1]=='b')  
1561
....................       base=2,sc+=2;  
1562
....................    else  
1563
....................       base=8;  
1564
....................    for (s1=sc;*sc=='0';++sc);// skip leading zeroes  
1565
....................    sd=memchr(digits,tolower(*sc),base);  
1566
....................    for(; sd!=0; )  
1567
....................    {  
1568
....................       x=x*base+(int16)(sd-digits);  
1569
....................       ++sc;  
1570
....................       sd=memchr(digits,tolower(*sc),base);  
1571
....................    }  
1572
....................    if(s1==sc)  
1573
....................    {  
1574
....................       if (endptr)  
1575
....................       {  
1576
....................         *((char *)endptr)=s;  
1577
....................       }  
1578
....................    return 0;  
1579
....................    }  
1580
....................    if (endptr)  
1581
....................         *((char *)endptr)=sc;  
1582
....................    return x;  
1583
.................... }  
1584
....................   
1585
....................   
1586
.................... signed long strtol(char *s,char *endptr,signed int base)  
1587
.................... {  
1588
....................    char *sc,*s1,*sd;  
1589
....................    signed long x=0;  
1590
....................    char sign;  
1591
....................    char digits[]="0123456789abcdefghijklmnopqstuvwxyz";  
1592
....................    for(sc=s;isspace(*sc);++sc);  
1593
....................    sign=*sc=='-'||*sc=='+'?sc++:'+';  
1594
....................    if (base <0 || base ==1|| base >36) // invalid base  
1595
....................    {  
1596
....................       if (endptr)  
1597
....................       {  
1598
....................         *((char *)endptr)=s;  
1599
....................       }  
1600
....................       return 0;  
1601
....................    }  
1602
....................    else if (base)  
1603
....................    {  
1604
....................       if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X'))  
1605
....................          sc+=2;  
1606
....................       if(base==8 && *sc =='0')  
1607
....................          sc+=1;  
1608
....................       if(base==2 && *sc =='0'&&sc[1]=='b')  
1609
....................          sc+=2;  
1610
....................   
1611
....................    }  
1612
....................    else if(*sc!='0') // base is 0, find base  
1613
....................       base=10;  
1614
....................    else if (sc[1]=='x' || sc[1]=='X')  
1615
....................       base =16,sc+=2;  
1616
....................    else if(sc[1]=='b')  
1617
....................       base=2,sc+=2;  
1618
....................    else  
1619
....................       base=8;  
1620
....................    for (s1=sc;*sc=='0';++sc);// skip leading zeroes  
1621
....................   
1622
....................    sd=memchr(digits,tolower(*sc),base);  
1623
....................    for(;sd!=0;)  
1624
....................    {  
1625
....................       x=x*base+(int16)(sd-digits);  
1626
....................       ++sc;  
1627
....................       sd=memchr(digits,tolower(*sc),base);  
1628
....................    }  
1629
....................    if(s1==sc)  
1630
....................    {  
1631
....................       if (endptr)  
1632
....................       {  
1633
....................         *((char *)endptr)=s;  
1634
....................       }  
1635
....................    return 0;  
1636
....................    }  
1637
....................    if(sign=='-')  
1638
....................       x  =-x;  
1639
....................    if (endptr)  
1640
....................         *((char *)endptr)=sc;  
1641
....................    return x;  
1642
.................... }  
1643
....................   
1644
.................... signed int system(char *string)  
1645
.................... {  
1646
....................    return 0;  
1647
.................... }  
1648
....................   
1649
.................... int mblen(char *s,size_t n)  
1650
.................... {  
1651
....................    return strlen(s);  
1652
.................... }  
1653
....................   
1654
.................... int mbtowc(wchar_t *pwc,char *s,size_t n)  
1655
.................... {  
1656
....................    *pwc=*s;  
1657
....................    return 1;  
1658
.................... }  
1659
....................   
1660
.................... int wctomb(char *s,wchar_t wchar)  
1661
.................... {  
1662
....................    *s=wchar;  
1663
....................    return 1;  
1664
.................... }  
1665
....................   
1666
.................... size_t mbstowcs(wchar_t *pwcs,char *s,size_t n)  
1667
.................... {  
1668
....................    strncpy(pwcs,s,n);  
1669
....................    return strlen(pwcs);  
1670
.................... }  
1671
....................   
1672
.................... size_t wcstombs(char *s,wchar_t *pwcs,size_t n)  
1673
.................... {  
1674
....................    strncpy(s,pwcs,n);  
1675
....................    return strlen(s);  
1676
.................... }  
1677
....................   
1678
.................... //---------------------------------------------------------------------------  
1679
.................... // The random number implementation  
1680
.................... //---------------------------------------------------------------------------  
1681
....................   
1682
.................... unsigned int32 _Randseed = 1;  
1683
*
1684
035B:  MOVLW  01
1685
035C:  MOVWF  2B
1686
035D:  CLRF   2C
1687
035E:  CLRF   2D
1688
035F:  CLRF   2E
1689
....................   
1690
.................... long rand(void)  
1691
.................... {  
1692
....................    _Randseed = _Randseed * 1103515245 + 12345;  
1693
....................    return ((unsigned long)(_Randseed >> 16) % RAND_MAX);  
1694
.................... }  
1695
....................   
1696
.................... void srand(unsigned int32 seed)  
1697
.................... {  
1698
....................    _Randseed = seed;  
1699
.................... }  
1700
....................   
1701
.................... //---------------------------------------------------------------------------  
1702
.................... // Searching and sorting utilities implementation  
1703
.................... //---------------------------------------------------------------------------  
1704
....................   
1705
.................... typedef signed int (*_Cmpfun)(char * p1,char * p2);  
1706
....................   
1707
.................... void qsort(char * qdata, int qitems, int qsize, _Cmpfun cmp) {  
1708
....................    int m,j,i,l;  
1709
....................    short done;  
1710
....................    BYTE t[16];  
1711
....................   
1712
....................    m = qitems/2;  
1713
....................    while( m > 0 ) {  
1714
....................      for(j=0; j<(qitems-m); ++j) {  
1715
....................         i = j;  
1716
....................         do  
1717
....................         {  
1718
....................            done=TRUE;  
1719
....................            l = i+m;  
1720
....................            if( (*cmp)(qdata+i*qsize, qdata+l*qsize) > 0 ) {  
1721
....................               memcpy(t, qdata+i*qsize, qsize);  
1722
....................               memcpy(qdata+i*qsize, qdata+l*qsize, qsize);  
1723
....................               memcpy(qdata+l*qsize, t, qsize);  
1724
....................               if(m <= i)  
1725
....................                 i -= m;  
1726
....................                 done = FALSE;  
1727
....................            }  
1728
....................         } while(!done);  
1729
....................      }  
1730
....................      m = m/2;  
1731
....................    }  
1732
.................... }  
1733
....................   
1734
....................   
1735
.................... char *bsearch(char *key, char *base, size_t num, size_t width,_Cmpfun cmp)  
1736
.................... {  
1737
....................    char *p, *q;  
1738
....................    size_t n;  
1739
....................    size_t pivot;  
1740
....................    signed int val;  
1741
....................   
1742
....................    p = base;  
1743
....................    n = num;  
1744
....................   
1745
....................    while (n > 0)  
1746
....................    {  
1747
....................       pivot = n >> 1;  
1748
....................       q = p + width * pivot;  
1749
....................   
1750
....................       val = (*cmp)(key, q);  
1751
....................   
1752
....................       if (val < 0)  
1753
....................          n = pivot;  
1754
....................       else if (val == 0)  
1755
....................          return ((char *)q);  
1756
....................       else {  
1757
....................          p = q + width;  
1758
....................          n -= pivot + 1;  
1759
....................       }  
1760
....................    }  
1761
....................   
1762
....................    return NULL;      // There's no match  
1763
.................... }  
1764
....................   
1765
....................   
1766
.................... #endif  
1767
....................  
1768
....................   
1769
.................... #define SYNC   PIN_B4      // Spousteni oscyloskopu  
1770
.................... #define HACK   PIN_B5      // Zkratovani napajeni SmartCard  
1771
.................... #define CLOCK  PIN_B6      // Hodiny ze SmartCard  
1772
....................   
1773
.................... #int_TIMER1  
1774
.................... TIMER1_isr()  
1775
.................... {  
1776
....................   
1777
.................... }  
1778
....................   
1779
*
1780
00E0:  BCF    0C.0
1781
00E1:  BCF    0A.3
1782
00E2:  GOTO   028
1783
.................... #int_TIMER2  
1784
.................... TIMER2_isr()  
1785
.................... {  
1786
....................   
1787
.................... }  
1788
....................   
1789
00E3:  BCF    0C.1
1790
00E4:  BCF    0A.3
1791
00E5:  GOTO   028
1792
.................... void main()  
1793
.................... {  
1794
*
1795
0342:  CLRF   04
1796
0343:  BCF    03.7
1797
0344:  MOVLW  1F
1798
0345:  ANDWF  03,F
1799
0346:  BSF    03.5
1800
0347:  BCF    1F.4
1801
0348:  BCF    1F.5
1802
0349:  MOVF   1B,W
1803
034A:  ANDLW  80
1804
034B:  MOVWF  1B
1805
034C:  MOVLW  07
1806
034D:  MOVWF  1C
1807
034E:  MOVF   05,W
1808
034F:  CLRWDT
1809
0350:  MOVF   1C,W
1810
0351:  BCF    03.5
1811
0352:  BCF    0D.6
1812
0353:  MOVLW  60
1813
0354:  BSF    03.5
1814
0355:  MOVWF  0F
1815
0356:  BCF    06.3
1816
0357:  BCF    03.5
1817
0358:  BSF    06.3
1818
....................    unsigned int16 i;  
1819
....................    char ch;  
1820
....................    char string[10];  
1821
....................    const char ver[]={"HACK v1.0\0"};  
1822
....................    unsigned int16 prescale;  
1823
....................    unsigned int16 ticks;  
1824
....................    int n;  
1825
....................   
1826
....................    setup_adc_ports(NO_ANALOGS|VSS_VDD);  
1827
*
1828
0360:  BSF    03.5
1829
0361:  BCF    1F.4
1830
0362:  BCF    1F.5
1831
0363:  MOVF   1B,W
1832
0364:  ANDLW  80
1833
0365:  MOVWF  1B
1834
....................    setup_adc(ADC_OFF);  
1835
0366:  BCF    03.5
1836
0367:  BCF    1F.0
1837
....................    setup_spi(FALSE);  
1838
0368:  BCF    14.5
1839
0369:  BSF    03.5
1840
036A:  BCF    06.2
1841
036B:  BSF    06.1
1842
036C:  BCF    06.4
1843
036D:  MOVLW  00
1844
036E:  BCF    03.5
1845
036F:  MOVWF  14
1846
0370:  BSF    03.5
1847
0371:  MOVWF  14
1848
....................    setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);  
1849
0372:  MOVF   01,W
1850
0373:  ANDLW  C7
1851
0374:  IORLW  28
1852
0375:  MOVWF  01
1853
....................    setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);  
1854
0376:  MOVLW  87
1855
0377:  BCF    03.5
1856
0378:  MOVWF  10
1857
.................... //   setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);  
1858
....................    setup_timer_2(T2_DISABLED,0,1);  
1859
0379:  MOVLW  00
1860
037A:  MOVWF  78
1861
037B:  MOVWF  12
1862
037C:  MOVLW  00
1863
037D:  BSF    03.5
1864
037E:  MOVWF  12
1865
....................    setup_comparator(NC_NC_NC_NC);  
1866
037F:  MOVLW  07
1867
0380:  MOVWF  1C
1868
0381:  MOVF   05,W
1869
0382:  CLRWDT
1870
0383:  MOVLW  02
1871
0384:  MOVWF  77
1872
0385:  DECFSZ 77,F
1873
0386:  GOTO   385
1874
0387:  NOP
1875
0388:  NOP
1876
0389:  MOVF   1C,W
1877
038A:  BCF    03.5
1878
038B:  BCF    0D.6
1879
....................    setup_vref(FALSE);  
1880
038C:  BSF    03.5
1881
038D:  CLRF   1D
1882
.................... //   enable_interrupts(INT_TIMER1);  
1883
.................... //   enable_interrupts(INT_TIMER2);  
1884
.................... //   enable_interrupts(GLOBAL);  
1885
....................   
1886
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC);     // 4 MHz interni RC oscilator  
1887
038E:  MOVLW  62
1888
038F:  MOVWF  0F
1889
....................   
1890
....................    delay_ms(100);  
1891
0390:  MOVLW  64
1892
0391:  BCF    03.5
1893
0392:  MOVWF  42
1894
0393:  CALL   0E6
1895
....................    printf("\n\r\n\r%s", ver);  
1896
0394:  CLRF   41
1897
0395:  MOVF   41,W
1898
0396:  CALL   04E
1899
0397:  INCF   41,F
1900
0398:  MOVWF  77
1901
0399:  MOVWF  4C
1902
039A:  CALL   0FE
1903
039B:  MOVLW  04
1904
039C:  SUBWF  41,W
1905
039D:  BTFSS  03.2
1906
039E:  GOTO   395
1907
039F:  CLRF   42
1908
03A0:  MOVF   42,W
1909
03A1:  CALL   03F
1910
03A2:  IORLW  00
1911
03A3:  BTFSC  03.2
1912
03A4:  GOTO   3A9
1913
03A5:  INCF   42,F
1914
03A6:  MOVWF  4C
1915
03A7:  CALL   0FE
1916
03A8:  GOTO   3A0
1917
....................    output_low(SYNC);  
1918
03A9:  BSF    03.5
1919
03AA:  BCF    06.4
1920
03AB:  BCF    03.5
1921
03AC:  BCF    06.4
1922
....................    output_low(HACK);  
1923
03AD:  BSF    03.5
1924
03AE:  BCF    06.5
1925
03AF:  BCF    03.5
1926
03B0:  BCF    06.5
1927
....................    ticks=1;  
1928
03B1:  CLRF   3F
1929
03B2:  MOVLW  01
1930
03B3:  MOVWF  3E
1931
....................    prescale=0;  
1932
03B4:  CLRF   3D
1933
03B5:  CLRF   3C
1934
....................   
1935
....................    while(true)  
1936
....................    {  
1937
....................       printf("\n\r>");  
1938
03B6:  MOVLW  0A
1939
03B7:  MOVWF  4C
1940
03B8:  CALL   0FE
1941
03B9:  MOVLW  0D
1942
03BA:  MOVWF  4C
1943
03BB:  CALL   0FE
1944
03BC:  MOVLW  3E
1945
03BD:  MOVWF  4C
1946
03BE:  CALL   0FE
1947
....................       n=0;  
1948
03BF:  CLRF   40
1949
....................       do  
1950
....................       {  
1951
....................          ch=getchar();  
1952
03C0:  GOTO   12A
1953
03C1:  MOVF   78,W
1954
03C2:  MOVWF  31
1955
....................          printf("%c",ch);  
1956
03C3:  MOVF   31,W
1957
03C4:  MOVWF  4C
1958
03C5:  CALL   0FE
1959
....................          string[n++]=ch;  
1960
03C6:  MOVF   40,W
1961
03C7:  INCF   40,F
1962
03C8:  ADDLW  32
1963
03C9:  MOVWF  04
1964
03CA:  BCF    03.7
1965
03CB:  MOVF   31,W
1966
03CC:  MOVWF  00
1967
....................       } while((13 != ch) && (n < 10));  
1968
03CD:  MOVF   31,W
1969
03CE:  SUBLW  0D
1970
03CF:  BTFSC  03.2
1971
03D0:  GOTO   3D5
1972
03D1:  MOVF   40,W
1973
03D2:  SUBLW  09
1974
03D3:  BTFSC  03.0
1975
03D4:  GOTO   3C0
1976
....................       string[n]=0;  
1977
03D5:  MOVLW  32
1978
03D6:  ADDWF  40,W
1979
03D7:  MOVWF  04
1980
03D8:  BCF    03.7
1981
03D9:  CLRF   00
1982
....................       printf("\n\r");  
1983
03DA:  MOVLW  0A
1984
03DB:  MOVWF  4C
1985
03DC:  CALL   0FE
1986
03DD:  MOVLW  0D
1987
03DE:  MOVWF  4C
1988
03DF:  CALL   0FE
1989
....................       switch(string[0])  
1990
....................       {  
1991
03E0:  MOVF   32,W
1992
03E1:  XORLW  67
1993
03E2:  BTFSC  03.2
1994
03E3:  GOTO   3F1
1995
03E4:  XORLW  15
1996
03E5:  BTFSC  03.2
1997
03E6:  GOTO   460
1998
03E7:  XORLW  1A
1999
03E8:  BTFSC  03.2
2000
03E9:  GOTO   4E9
2001
03EA:  XORLW  01
2002
03EB:  BTFSC  03.2
2003
03EC:  GOTO   571
2004
03ED:  XORLW  19
2005
03EE:  BTFSC  03.2
2006
03EF:  GOTO   5A8
2007
03F0:  GOTO   5EB
2008
....................          case 'g':   // GO  
2009
....................                printf("%Lue4 + %Lu GO", prescale, ticks);  
2010
03F1:  MOVLW  10
2011
03F2:  MOVWF  04
2012
03F3:  MOVF   3D,W
2013
03F4:  MOVWF  44
2014
03F5:  MOVF   3C,W
2015
03F6:  MOVWF  43
2016
03F7:  CALL   15F
2017
03F8:  MOVLW  03
2018
03F9:  MOVWF  41
2019
03FA:  MOVF   41,W
2020
03FB:  CALL   059
2021
03FC:  INCF   41,F
2022
03FD:  MOVWF  77
2023
03FE:  MOVWF  4C
2024
03FF:  CALL   0FE
2025
0400:  MOVLW  08
2026
0401:  SUBWF  41,W
2027
0402:  BTFSS  03.2
2028
0403:  GOTO   3FA
2029
0404:  MOVLW  10
2030
0405:  MOVWF  04
2031
0406:  MOVF   3F,W
2032
0407:  MOVWF  44
2033
0408:  MOVF   3E,W
2034
0409:  MOVWF  43
2035
040A:  CALL   15F
2036
040B:  MOVLW  20
2037
040C:  MOVWF  4C
2038
040D:  CALL   0FE
2039
040E:  MOVLW  47
2040
040F:  MOVWF  4C
2041
0410:  CALL   0FE
2042
0411:  MOVLW  4F
2043
0412:  MOVWF  4C
2044
0413:  CALL   0FE
2045
....................                for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };  
2046
0414:  CLRF   30
2047
0415:  CLRF   2F
2048
0416:  MOVF   30,W
2049
0417:  SUBWF  3D,W
2050
0418:  BTFSS  03.0
2051
0419:  GOTO   43C
2052
041A:  BTFSS  03.2
2053
041B:  GOTO   420
2054
041C:  MOVF   3C,W
2055
041D:  SUBWF  2F,W
2056
041E:  BTFSC  03.0
2057
041F:  GOTO   43C
2058
0420:  CLRF   0F
2059
0421:  CLRF   0E
2060
0422:  MOVF   0F,W
2061
0423:  MOVWF  7A
2062
0424:  MOVF   0E,W
2063
0425:  MOVWF  77
2064
0426:  MOVF   0F,W
2065
0427:  SUBWF  7A,W
2066
0428:  BTFSS  03.2
2067
0429:  GOTO   422
2068
042A:  MOVF   77,W
2069
042B:  MOVWF  41
2070
042C:  MOVF   7A,W
2071
042D:  MOVWF  42
2072
042E:  MOVF   42,W
2073
042F:  SUBLW  27
2074
0430:  BTFSS  03.0
2075
0431:  GOTO   438
2076
0432:  BTFSS  03.2
2077
0433:  GOTO   422
2078
0434:  MOVF   41,W
2079
0435:  SUBLW  0F
2080
0436:  BTFSC  03.0
2081
0437:  GOTO   422
2082
0438:  INCF   2F,F
2083
0439:  BTFSC  03.2
2084
043A:  INCF   30,F
2085
043B:  GOTO   416
2086
....................                set_timer1(0); while ( get_timer1() < ticks ) ;  
2087
043C:  CLRF   0F
2088
043D:  CLRF   0E
2089
043E:  MOVF   0F,W
2090
043F:  MOVWF  7A
2091
0440:  MOVF   0E,W
2092
0441:  MOVWF  77
2093
0442:  MOVF   0F,W
2094
0443:  SUBWF  7A,W
2095
0444:  BTFSS  03.2
2096
0445:  GOTO   43E
2097
0446:  MOVF   77,W
2098
0447:  MOVWF  41
2099
0448:  MOVF   7A,W
2100
0449:  MOVWF  42
2101
044A:  MOVF   42,W
2102
044B:  SUBWF  3F,W
2103
044C:  BTFSS  03.0
2104
044D:  GOTO   454
2105
044E:  BTFSS  03.2
2106
044F:  GOTO   43E
2107
0450:  MOVF   3E,W
2108
0451:  SUBWF  41,W
2109
0452:  BTFSS  03.0
2110
0453:  GOTO   43E
2111
....................                output_high(SYNC);  
2112
0454:  BSF    03.5
2113
0455:  BCF    06.4
2114
0456:  BCF    03.5
2115
0457:  BSF    06.4
2116
....................                delay_ms(1);  
2117
0458:  MOVLW  01
2118
0459:  MOVWF  42
2119
045A:  CALL   0E6
2120
....................                output_low(SYNC);  
2121
045B:  BSF    03.5
2122
045C:  BCF    06.4
2123
045D:  BCF    03.5
2124
045E:  BCF    06.4
2125
....................                break;  
2126
045F:  GOTO   61A
2127
....................   
2128
....................          case 'r':   // REPEAT  
2129
....................                n=0;  
2130
0460:  CLRF   40
2131
....................                while(true)  
2132
....................                {  
2133
....................                   printf("%Lue4 + %Lu REPEAT %u\n\r", prescale, ticks, n++);  
2134
0461:  MOVF   40,W
2135
0462:  INCF   40,F
2136
0463:  MOVWF  41
2137
0464:  MOVLW  10
2138
0465:  MOVWF  04
2139
0466:  MOVF   3D,W
2140
0467:  MOVWF  44
2141
0468:  MOVF   3C,W
2142
0469:  MOVWF  43
2143
046A:  CALL   15F
2144
046B:  MOVLW  03
2145
046C:  MOVWF  42
2146
046D:  MOVF   42,W
2147
046E:  CALL   06C
2148
046F:  INCF   42,F
2149
0470:  MOVWF  77
2150
0471:  MOVWF  4C
2151
0472:  CALL   0FE
2152
0473:  MOVLW  08
2153
0474:  SUBWF  42,W
2154
0475:  BTFSS  03.2
2155
0476:  GOTO   46D
2156
0477:  MOVLW  10
2157
0478:  MOVWF  04
2158
0479:  MOVF   3F,W
2159
047A:  MOVWF  44
2160
047B:  MOVF   3E,W
2161
047C:  MOVWF  43
2162
047D:  CALL   15F
2163
047E:  MOVLW  0B
2164
047F:  MOVWF  43
2165
0480:  MOVF   43,W
2166
0481:  CALL   06C
2167
0482:  INCF   43,F
2168
0483:  MOVWF  77
2169
0484:  MOVWF  4C
2170
0485:  CALL   0FE
2171
0486:  MOVLW  13
2172
0487:  SUBWF  43,W
2173
0488:  BTFSS  03.2
2174
0489:  GOTO   480
2175
048A:  MOVF   41,W
2176
048B:  MOVWF  44
2177
048C:  MOVLW  18
2178
048D:  MOVWF  45
2179
048E:  GOTO   1DE
2180
048F:  MOVLW  0A
2181
0490:  MOVWF  4C
2182
0491:  CALL   0FE
2183
0492:  MOVLW  0D
2184
0493:  MOVWF  4C
2185
0494:  CALL   0FE
2186
....................                   for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };  
2187
0495:  CLRF   30
2188
0496:  CLRF   2F
2189
0497:  MOVF   30,W
2190
0498:  SUBWF  3D,W
2191
0499:  BTFSS  03.0
2192
049A:  GOTO   4BD
2193
049B:  BTFSS  03.2
2194
049C:  GOTO   4A1
2195
049D:  MOVF   3C,W
2196
049E:  SUBWF  2F,W
2197
049F:  BTFSC  03.0
2198
04A0:  GOTO   4BD
2199
04A1:  CLRF   0F
2200
04A2:  CLRF   0E
2201
04A3:  MOVF   0F,W
2202
04A4:  MOVWF  7A
2203
04A5:  MOVF   0E,W
2204
04A6:  MOVWF  77
2205
04A7:  MOVF   0F,W
2206
04A8:  SUBWF  7A,W
2207
04A9:  BTFSS  03.2
2208
04AA:  GOTO   4A3
2209
04AB:  MOVF   77,W
2210
04AC:  MOVWF  41
2211
04AD:  MOVF   7A,W
2212
04AE:  MOVWF  42
2213
04AF:  MOVF   42,W
2214
04B0:  SUBLW  27
2215
04B1:  BTFSS  03.0
2216
04B2:  GOTO   4B9
2217
04B3:  BTFSS  03.2
2218
04B4:  GOTO   4A3
2219
04B5:  MOVF   41,W
2220
04B6:  SUBLW  0F
2221
04B7:  BTFSC  03.0
2222
04B8:  GOTO   4A3
2223
04B9:  INCF   2F,F
2224
04BA:  BTFSC  03.2
2225
04BB:  INCF   30,F
2226
04BC:  GOTO   497
2227
....................                   set_timer1(0); while ( get_timer1() < ticks ) ;  
2228
04BD:  CLRF   0F
2229
04BE:  CLRF   0E
2230
04BF:  MOVF   0F,W
2231
04C0:  MOVWF  7A
2232
04C1:  MOVF   0E,W
2233
04C2:  MOVWF  77
2234
04C3:  MOVF   0F,W
2235
04C4:  SUBWF  7A,W
2236
04C5:  BTFSS  03.2
2237
04C6:  GOTO   4BF
2238
04C7:  MOVF   77,W
2239
04C8:  MOVWF  41
2240
04C9:  MOVF   7A,W
2241
04CA:  MOVWF  42
2242
04CB:  MOVF   42,W
2243
04CC:  SUBWF  3F,W
2244
04CD:  BTFSS  03.0
2245
04CE:  GOTO   4D5
2246
04CF:  BTFSS  03.2
2247
04D0:  GOTO   4BF
2248
04D1:  MOVF   3E,W
2249
04D2:  SUBWF  41,W
2250
04D3:  BTFSS  03.0
2251
04D4:  GOTO   4BF
2252
....................                   output_high(SYNC);  
2253
04D5:  BSF    03.5
2254
04D6:  BCF    06.4
2255
04D7:  BCF    03.5
2256
04D8:  BSF    06.4
2257
....................                   delay_ms(20);  
2258
04D9:  MOVLW  14
2259
04DA:  MOVWF  42
2260
04DB:  CALL   0E6
2261
....................                   output_low(SYNC);  
2262
04DC:  BSF    03.5
2263
04DD:  BCF    06.4
2264
04DE:  BCF    03.5
2265
04DF:  BCF    06.4
2266
....................                   delay_ms(2000);  
2267
04E0:  MOVLW  08
2268
04E1:  MOVWF  41
2269
04E2:  MOVLW  FA
2270
04E3:  MOVWF  42
2271
04E4:  CALL   0E6
2272
04E5:  DECFSZ 41,F
2273
04E6:  GOTO   4E2
2274
....................                };  
2275
04E7:  GOTO   461
2276
....................                break;  
2277
04E8:  GOTO   61A
2278
....................   
2279
....................          case 'h':   // HACK  
2280
....................                printf("%Lue4 + %Lu HACK", prescale, ticks);  
2281
04E9:  MOVLW  10
2282
04EA:  MOVWF  04
2283
04EB:  MOVF   3D,W
2284
04EC:  MOVWF  44
2285
04ED:  MOVF   3C,W
2286
04EE:  MOVWF  43
2287
04EF:  CALL   15F
2288
04F0:  MOVLW  03
2289
04F1:  MOVWF  41
2290
04F2:  MOVF   41,W
2291
04F3:  CALL   088
2292
04F4:  INCF   41,F
2293
04F5:  MOVWF  77
2294
04F6:  MOVWF  4C
2295
04F7:  CALL   0FE
2296
04F8:  MOVLW  08
2297
04F9:  SUBWF  41,W
2298
04FA:  BTFSS  03.2
2299
04FB:  GOTO   4F2
2300
04FC:  MOVLW  10
2301
04FD:  MOVWF  04
2302
04FE:  MOVF   3F,W
2303
04FF:  MOVWF  44
2304
0500:  MOVF   3E,W
2305
0501:  MOVWF  43
2306
0502:  CALL   15F
2307
0503:  MOVLW  0B
2308
0504:  MOVWF  42
2309
0505:  MOVF   42,W
2310
0506:  CALL   088
2311
0507:  INCF   42,F
2312
0508:  MOVWF  77
2313
0509:  MOVWF  4C
2314
050A:  CALL   0FE
2315
050B:  MOVLW  10
2316
050C:  SUBWF  42,W
2317
050D:  BTFSS  03.2
2318
050E:  GOTO   505
2319
....................                for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };  
2320
050F:  CLRF   30
2321
0510:  CLRF   2F
2322
0511:  MOVF   30,W
2323
0512:  SUBWF  3D,W
2324
0513:  BTFSS  03.0
2325
0514:  GOTO   537
2326
0515:  BTFSS  03.2
2327
0516:  GOTO   51B
2328
0517:  MOVF   3C,W
2329
0518:  SUBWF  2F,W
2330
0519:  BTFSC  03.0
2331
051A:  GOTO   537
2332
051B:  CLRF   0F
2333
051C:  CLRF   0E
2334
051D:  MOVF   0F,W
2335
051E:  MOVWF  7A
2336
051F:  MOVF   0E,W
2337
0520:  MOVWF  77
2338
0521:  MOVF   0F,W
2339
0522:  SUBWF  7A,W
2340
0523:  BTFSS  03.2
2341
0524:  GOTO   51D
2342
0525:  MOVF   77,W
2343
0526:  MOVWF  41
2344
0527:  MOVF   7A,W
2345
0528:  MOVWF  42
2346
0529:  MOVF   42,W
2347
052A:  SUBLW  27
2348
052B:  BTFSS  03.0
2349
052C:  GOTO   533
2350
052D:  BTFSS  03.2
2351
052E:  GOTO   51D
2352
052F:  MOVF   41,W
2353
0530:  SUBLW  0F
2354
0531:  BTFSC  03.0
2355
0532:  GOTO   51D
2356
0533:  INCF   2F,F
2357
0534:  BTFSC  03.2
2358
0535:  INCF   30,F
2359
0536:  GOTO   511
2360
....................                set_timer1(0); while ( get_timer1() < ticks ) ;  
2361
0537:  CLRF   0F
2362
0538:  CLRF   0E
2363
0539:  MOVF   0F,W
2364
053A:  MOVWF  7A
2365
053B:  MOVF   0E,W
2366
053C:  MOVWF  77
2367
053D:  MOVF   0F,W
2368
053E:  SUBWF  7A,W
2369
053F:  BTFSS  03.2
2370
0540:  GOTO   539
2371
0541:  MOVF   77,W
2372
0542:  MOVWF  41
2373
0543:  MOVF   7A,W
2374
0544:  MOVWF  42
2375
0545:  MOVF   42,W
2376
0546:  SUBWF  3F,W
2377
0547:  BTFSS  03.0
2378
0548:  GOTO   54F
2379
0549:  BTFSS  03.2
2380
054A:  GOTO   539
2381
054B:  MOVF   3E,W
2382
054C:  SUBWF  41,W
2383
054D:  BTFSS  03.0
2384
054E:  GOTO   539
2385
....................                output_high(SYNC);  
2386
054F:  BSF    03.5
2387
0550:  BCF    06.4
2388
0551:  BCF    03.5
2389
0552:  BSF    06.4
2390
....................                output_low(CLOCK);  
2391
0553:  BSF    03.5
2392
0554:  BCF    06.6
2393
0555:  BCF    03.5
2394
0556:  BCF    06.6
2395
....................                delay_ms(10);  
2396
0557:  MOVLW  0A
2397
0558:  MOVWF  42
2398
0559:  CALL   0E6
2399
....................                output_high(HACK);  
2400
055A:  BSF    03.5
2401
055B:  BCF    06.5
2402
055C:  BCF    03.5
2403
055D:  BSF    06.5
2404
....................                delay_ms(10000);  
2405
055E:  MOVLW  28
2406
055F:  MOVWF  41
2407
0560:  MOVLW  FA
2408
0561:  MOVWF  42
2409
0562:  CALL   0E6
2410
0563:  DECFSZ 41,F
2411
0564:  GOTO   560
2412
....................                output_low(HACK);  
2413
0565:  BSF    03.5
2414
0566:  BCF    06.5
2415
0567:  BCF    03.5
2416
0568:  BCF    06.5
2417
....................                output_low(SYNC);  
2418
0569:  BSF    03.5
2419
056A:  BCF    06.4
2420
056B:  BCF    03.5
2421
056C:  BCF    06.4
2422
....................                input(CLOCK);  
2423
056D:  BSF    03.5
2424
056E:  BSF    06.6
2425
....................                break;  
2426
056F:  BCF    03.5
2427
0570:  GOTO   61A
2428
....................   
2429
....................          case 'i':   // Info  
2430
....................                printf("%s\n\r", ver);  
2431
0571:  CLRF   41
2432
0572:  MOVF   41,W
2433
0573:  CALL   03F
2434
0574:  IORLW  00
2435
0575:  BTFSC  03.2
2436
0576:  GOTO   57B
2437
0577:  INCF   41,F
2438
0578:  MOVWF  4C
2439
0579:  CALL   0FE
2440
057A:  GOTO   572
2441
057B:  MOVLW  0A
2442
057C:  MOVWF  4C
2443
057D:  CALL   0FE
2444
057E:  MOVLW  0D
2445
057F:  MOVWF  4C
2446
0580:  CALL   0FE
2447
....................                printf("%Lue4 + %Lu ticks", prescale, ticks);  
2448
0581:  MOVLW  10
2449
0582:  MOVWF  04
2450
0583:  MOVF   3D,W
2451
0584:  MOVWF  44
2452
0585:  MOVF   3C,W
2453
0586:  MOVWF  43
2454
0587:  CALL   15F
2455
0588:  MOVLW  03
2456
0589:  MOVWF  41
2457
058A:  MOVF   41,W
2458
058B:  CALL   09D
2459
058C:  INCF   41,F
2460
058D:  MOVWF  77
2461
058E:  MOVWF  4C
2462
058F:  CALL   0FE
2463
0590:  MOVLW  08
2464
0591:  SUBWF  41,W
2465
0592:  BTFSS  03.2
2466
0593:  GOTO   58A
2467
0594:  MOVLW  10
2468
0595:  MOVWF  04
2469
0596:  MOVF   3F,W
2470
0597:  MOVWF  44
2471
0598:  MOVF   3E,W
2472
0599:  MOVWF  43
2473
059A:  CALL   15F
2474
059B:  MOVLW  0B
2475
059C:  MOVWF  42
2476
059D:  MOVF   42,W
2477
059E:  CALL   09D
2478
059F:  INCF   42,F
2479
05A0:  MOVWF  77
2480
05A1:  MOVWF  4C
2481
05A2:  CALL   0FE
2482
05A3:  MOVLW  11
2483
05A4:  SUBWF  42,W
2484
05A5:  BTFSS  03.2
2485
05A6:  GOTO   59D
2486
....................                break;  
2487
05A7:  GOTO   61A
2488
....................   
2489
....................          case 'p':  
2490
....................                if (isdigit(string[1]))  
2491
05A8:  MOVF   33,W
2492
05A9:  SUBLW  2F
2493
05AA:  BTFSC  03.0
2494
05AB:  GOTO   5DF
2495
05AC:  MOVF   33,W
2496
05AD:  SUBLW  39
2497
05AE:  BTFSS  03.0
2498
05AF:  GOTO   5DF
2499
....................                {  
2500
....................                   prescale=atol(string+1);  
2501
05B0:  CLRF   42
2502
05B1:  MOVLW  33
2503
05B2:  MOVWF  41
2504
05B3:  CALL   242
2505
05B4:  MOVF   79,W
2506
05B5:  MOVWF  3D
2507
05B6:  MOVF   78,W
2508
05B7:  MOVWF  3C
2509
....................                   printf("%Lu x 10000 prescale", prescale);  
2510
05B8:  MOVLW  10
2511
05B9:  MOVWF  04
2512
05BA:  MOVF   3D,W
2513
05BB:  MOVWF  44
2514
05BC:  MOVF   3C,W
2515
05BD:  MOVWF  43
2516
05BE:  CALL   15F
2517
05BF:  MOVLW  03
2518
05C0:  MOVWF  41
2519
05C1:  MOVF   41,W
2520
05C2:  CALL   0B3
2521
05C3:  INCF   41,F
2522
05C4:  MOVWF  77
2523
05C5:  MOVWF  4C
2524
05C6:  CALL   0FE
2525
05C7:  MOVLW  07
2526
05C8:  SUBWF  41,W
2527
05C9:  BTFSS  03.2
2528
05CA:  GOTO   5C1
2529
05CB:  MOVLW  04
2530
05CC:  MOVWF  42
2531
05CD:  MOVLW  30
2532
05CE:  MOVWF  4C
2533
05CF:  CALL   0FE
2534
05D0:  DECFSZ 42,F
2535
05D1:  GOTO   5CD
2536
05D2:  MOVLW  07
2537
05D3:  MOVWF  43
2538
05D4:  MOVF   43,W
2539
05D5:  CALL   0B3
2540
05D6:  INCF   43,F
2541
05D7:  MOVWF  77
2542
05D8:  MOVWF  4C
2543
05D9:  CALL   0FE
2544
05DA:  MOVLW  10
2545
05DB:  SUBWF  43,W
2546
05DC:  BTFSS  03.2
2547
05DD:  GOTO   5D4
2548
....................                }  
2549
....................                else  
2550
05DE:  GOTO   5EA
2551
....................                printf("Error");  
2552
05DF:  CLRF   41
2553
05E0:  MOVF   41,W
2554
05E1:  CALL   0C8
2555
05E2:  INCF   41,F
2556
05E3:  MOVWF  77
2557
05E4:  MOVWF  4C
2558
05E5:  CALL   0FE
2559
05E6:  MOVLW  05
2560
05E7:  SUBWF  41,W
2561
05E8:  BTFSS  03.2
2562
05E9:  GOTO   5E0
2563
....................                break;  
2564
05EA:  GOTO   61A
2565
....................   
2566
....................          default:    // fine ticks number  
2567
....................                if (isdigit(string[0]))  
2568
05EB:  MOVF   32,W
2569
05EC:  SUBLW  2F
2570
05ED:  BTFSC  03.0
2571
05EE:  GOTO   60F
2572
05EF:  MOVF   32,W
2573
05F0:  SUBLW  39
2574
05F1:  BTFSS  03.0
2575
05F2:  GOTO   60F
2576
....................                {  
2577
....................                   ticks=atol(string);  
2578
05F3:  CLRF   42
2579
05F4:  MOVLW  32
2580
05F5:  MOVWF  41
2581
05F6:  CALL   242
2582
05F7:  MOVF   79,W
2583
05F8:  MOVWF  3F
2584
05F9:  MOVF   78,W
2585
05FA:  MOVWF  3E
2586
....................                   printf("%Lu ticks", ticks);  
2587
05FB:  MOVLW  10
2588
05FC:  MOVWF  04
2589
05FD:  MOVF   3F,W
2590
05FE:  MOVWF  44
2591
05FF:  MOVF   3E,W
2592
0600:  MOVWF  43
2593
0601:  CALL   15F
2594
0602:  MOVLW  03
2595
0603:  MOVWF  41
2596
0604:  MOVF   41,W
2597
0605:  CALL   0D2
2598
0606:  INCF   41,F
2599
0607:  MOVWF  77
2600
0608:  MOVWF  4C
2601
0609:  CALL   0FE
2602
060A:  MOVLW  09
2603
060B:  SUBWF  41,W
2604
060C:  BTFSS  03.2
2605
060D:  GOTO   604
2606
....................                }  
2607
....................                else  
2608
060E:  GOTO   61A
2609
....................                printf("Error");  
2610
060F:  CLRF   41
2611
0610:  MOVF   41,W
2612
0611:  CALL   0C8
2613
0612:  INCF   41,F
2614
0613:  MOVWF  77
2615
0614:  MOVWF  4C
2616
0615:  CALL   0FE
2617
0616:  MOVLW  05
2618
0617:  SUBWF  41,W
2619
0618:  BTFSS  03.2
2620
0619:  GOTO   610
2621
....................       };  
2622
....................   
2623
....................    };  
2624
061A:  GOTO   3B6
2625
....................   
2626
....................    while(true)  
2627
....................    {  
2628
....................       output_low(PIN_B4);  
2629
061B:  BSF    03.5
2630
061C:  BCF    06.4
2631
061D:  BCF    03.5
2632
061E:  BCF    06.4
2633
....................       delay_ms(300);  
2634
061F:  MOVLW  02
2635
0620:  MOVWF  41
2636
0621:  MOVLW  96
2637
0622:  MOVWF  42
2638
0623:  CALL   0E6
2639
0624:  DECFSZ 41,F
2640
0625:  GOTO   621
2641
....................       output_high(PIN_B4);  
2642
0626:  BSF    03.5
2643
0627:  BCF    06.4
2644
0628:  BCF    03.5
2645
0629:  BSF    06.4
2646
....................       delay_ms(300);  
2647
062A:  MOVLW  02
2648
062B:  MOVWF  41
2649
062C:  MOVLW  96
2650
062D:  MOVWF  42
2651
062E:  CALL   0E6
2652
062F:  DECFSZ 41,F
2653
0630:  GOTO   62C
2654
....................    }  
2655
0631:  GOTO   61B
2656
.................... }  
2657
....................  
2658
0632:  GOTO   632
2659
 
2660
Configuration Fuses:
2661
   Word  1: 3731   NOWDT PUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT DEBUG CCPB0 NOPROTECT INTRC
2662
   Word  2: 3FFC   NOFCMEN NOIESO