CCS PCM C Compiler, Version 3.245, 27853 12-V-08 00:50Filename: D:\MLAB_E\projekty\Ovladani_mobilnim_telefonem\SW\final\main.lstROM used: 2699 words (33%)Largest free fragment is 2048RAM used: 52 (30%) at main() level139 (79%) worst caseStack: 2 locations*0000: MOVLW 080001: MOVWF 0A0002: GOTO 0000003: NOP.................... #include ".\main.h".................... #include <16F876A.h>.................... //////// Standard Header file for the PIC16F876A device ////////////////.................... #device PIC16F876A.................... #list........................................ #device adc=8........................................ #FUSES WDT //Watch Dog Timer.................... #FUSES HS//XT //Crystal osc <= 4mhz.................... #FUSES NOPUT //No Power Up Timer.................... #FUSES NOPROTECT //Code not protected from reading.................... #FUSES NODEBUG //No Debug mode for ICD.................... #FUSES NOBROWNOUT //No brownout reset.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O.................... #FUSES NOCPD //No EE protection.................... #FUSES NOWRT //Program memory not write protected........................................ #use delay(clock=18432000,RESTART_WDT)*01C8: MOVLW 5201C9: MOVWF 0401CA: MOVF 00,W01CB: BTFSC 03.201CC: GOTO 1DD01CD: MOVLW 0501CE: MOVWF 7801CF: MOVLW BF01D0: MOVWF 7701D1: CLRWDT01D2: DECFSZ 77,F01D3: GOTO 1D101D4: DECFSZ 78,F01D5: GOTO 1CF01D6: MOVLW F901D7: MOVWF 7701D8: DECFSZ 77,F01D9: GOTO 1D801DA: CLRWDT01DB: DECFSZ 00,F01DC: GOTO 1CD01DD: RETLW 00.................... #use rs232(STREAM=MOBIL,baud=19200,force_sw,parity=N,xmit=PIN_C6,rcv=PIN_B5,bits=8)01DE: BCF 20.601DF: MOVF 20,W01E0: BSF 03.501E1: MOVWF 0701E2: BCF 03.501E3: BCF 07.601E4: MOVLW 0801E5: MOVWF 7801E6: NOP01E7: NOP01E8: NOP01E9: BSF 78.701EA: GOTO 1FA01EB: BCF 78.701EC: RRF 53,F01ED: BTFSC 03.001EE: BSF 07.601EF: BTFSS 03.001F0: BCF 07.601F1: BSF 78.601F2: GOTO 1FA01F3: BCF 78.601F4: DECFSZ 78,F01F5: GOTO 1EC01F6: NOP01F7: NOP01F8: NOP01F9: BSF 07.601FA: MOVLW 4901FB: MOVWF 0401FC: DECFSZ 04,F01FD: GOTO 1FC01FE: NOP01FF: NOP0200: NOP0201: BTFSC 78.70202: GOTO 1EB0203: BTFSC 78.60204: GOTO 1F30205: RETLW 000206: MOVLW 080207: MOVWF 770208: BSF 03.50209: BSF 06.5020A: BCF 03.5020B: BTFSS 06.5020C: GOTO 20F020D: BSF 03.5020E: GOTO 20A020F: CLRF 570210: BSF 77.70211: GOTO 2200212: BCF 77.70213: GOTO 2200214: BCF 03.00215: BTFSC 06.50216: BSF 03.00217: RRF 57,F0218: BSF 77.60219: GOTO 220021A: BCF 77.6021B: DECFSZ 77,F021C: GOTO 214021D: MOVF 57,W021E: MOVWF 78021F: GOTO 22D0220: MOVLW 490221: BTFSC 77.70222: MOVLW 140223: MOVWF 780224: DECFSZ 78,F0225: GOTO 2240226: NOP0227: NOP0228: BTFSC 77.70229: GOTO 212022A: BTFSC 77.6022B: GOTO 21A022C: GOTO 214022D: RETLW 00*0814: MOVLW FF0815: BCF 03.50816: MOVWF 20.................... #use rs232(STREAM=VRTULE,baud=600,parity=N,xmit=PIN_B2,rcv=PIN_B4,bits=8)*0348: BSF 03.50349: BCF 06.2034A: BCF 03.5034B: BCF 06.2034C: MOVLW 08034D: MOVWF 78034E: NOP034F: NOP0350: NOP0351: BSF 78.70352: GOTO 3620353: BCF 78.70354: RRF 52,F0355: BTFSC 03.00356: BSF 06.20357: BTFSS 03.00358: BCF 06.20359: BSF 78.6035A: GOTO 362035B: BCF 78.6035C: DECFSZ 78,F035D: GOTO 354035E: NOP035F: NOP0360: NOP0361: BSF 06.20362: MOVLW 090363: MOVWF 770364: CLRF 040365: DECFSZ 04,F0366: GOTO 3650367: DECFSZ 77,F0368: GOTO 3640369: MOVLW F0036A: MOVWF 04036B: DECFSZ 04,F036C: GOTO 36B036D: NOP036E: NOP036F: BTFSC 78.70370: GOTO 3530371: BTFSC 78.60372: GOTO 35B0373: RETLW 00................................................................................ #include <stdio.h>.................... ///////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ///////////////////////////////////////////////////////////////////////////........................................ #ifndef _STDIO.................... #define _STDIO.................... #include <string.h>.................... ////////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ////////////////////////////////////////////////////////////////////////////........................................ #ifndef _STRING.................... #define _STRING.................... #include <stddef.h>.................... ///////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ///////////////////////////////////////////////////////////////////////////........................................ #ifndef _STDDEF........................................ #define _STDDEF........................................ #if sizeof(int *)==1.................... #define ptrdiff_t int.................... #else.................... #define ptrdiff_t long.................... #endif........................................ #define size_t int.................... #define wchar_t char.................... #define NULL 0........................................ #define offsetof(s,f) (offsetofbit(s,f)/8)........................................ #endif........................................ #include <ctype.h>.................... ////////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ////////////////////////////////////////////////////////////////////////////........................................ #ifndef _CTYPE.................... #define _CTYPE........................................ #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz").................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ").................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").................... #define isdigit(x) isamong(x,"0123456789").................... #define isspace(x) (x==' ').................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef").................... #define iscntrl(x) (x<' ').................... #define isprint(x) (x>=' ').................... #define isgraph(x) (x>' ').................... #define ispunct(x) ((x>' ')&&!isalnum(x))........................................ #endif........................................................................................................................ //////////////////////////////////////////////.................... //// Uncomment the following define to ////.................... //// allow some functions to use a ////.................... //// quicker algorithm, but use more ROM ////.................... //// ////.................... //// #define FASTER_BUT_MORE_ROM ////.................... //////////////////////////////////////////////................................................................................ /*Copying functions*/.................... /* standard template:.................... void *memmove(void *s1, void *s2, size_t n)..................... Copies max of n characters safely (not following ending '\0').................... from s2 in s1; if s2 has less than n characters, appends 0 */........................................ char *memmove(void *s1,char *s2,size_t n).................... {.................... char *sc1;.................... char *sc2;.................... sc1=s1;.................... sc2=s2;.................... if(sc2<sc1 && sc1 <sc2 +n).................... for(sc1+=n,sc2+=n;0<n;--n).................... *--sc1=*--sc2;.................... else.................... for(;0<n;--n).................... *sc1++=*sc2++;.................... return s1;.................... }........................................ /* compiler ignored the name 'strcpy()'; perhaps, it's reserved?.................... Standard template: char *strcpy(char *s1, const char *s2).................... copies the string s2 including the null character to s1*/........................................ char *strcopy(char *s1, char *s2).................... {.................... char *s;........................................ for (s = s1; *s2 != 0; s++, s2++) {.................... *s = *s2;.................... }.................... *s = *s2;.................... return(s1);.................... }........................................ /* standard template:.................... char *strncpy(char *s1, const char *s2, size_t n)..................... Copies max of n characters (not following ending '\0').................... from s2 in s1; if s2 has less than n characters, appends 0 */........................................ char *strncpy(char *s1, char *s2, size_t n).................... {.................... char *s;........................................ for (s = s1; n > 0 && *s2 != '\0'; n--).................... *s++ = *s2++;.................... for (; n > 0; n--).................... *s++ = '\0';........................................ return(s1);.................... }.................... /***********************************************************/........................................ /*concatenation functions*/.................... /* standard template: char *strcat(char *s1, const char *s2).................... appends s2 to s1*/........................................ char *strcat(char *s1, char *s2).................... {.................... char *s;........................................ for (s = s1; *s != '\0'; ++s);.................... while(*s2 != '\0').................... {.................... *s = *s2;.................... ++s;.................... ++s2;.................... }........................................ *s = '\0';.................... return(s1);.................... }.................... /* standard template: char *strncat(char *s1, char *s2,size_t n).................... appends not more than n characters from s2 to s1*/........................................ char *strncat(char *s1, char *s2, size_t n).................... {.................... char *s;........................................ for (s = s1; *s != '\0'; ++s);.................... while(*s2 != '\0' && 0<n).................... {.................... *s = *s2;.................... ++s;.................... ++s2;.................... --n;.................... }........................................ *s = '\0';.................... return(s1);.................... }........................................ /***********************************************************/............................................................ /*comparison functions*/.................... /* standard template: signed int memcmp(void *s1, void *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int memcmp(void * s1,char *s2,size_t n).................... {.................... char *su1, *su2;.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n).................... {.................... if(*su1!=*su2).................... return ((*su1<*su2)?-1:+1);.................... }.................... return 0;.................... }........................................ /* standard template: int strcmp(const char *s1, const char *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int strcmp(char *s1, char *s2).................... {.................... for (; *s1 == *s2; s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }.................... /* standard template: int strcoll(const char *s1, const char *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int strcoll(char *s1, char *s2).................... {.................... for (; *s1 == *s2; s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }........................................ /* standard template:.................... int strncmp(const char *s1, const char *s2, size_t n)..................... Compares max of n characters (not following 0) from s1 to s2;.................... returns same as strcmp */........................................ signed int strncmp(char *s1, char *s2, size_t n).................... {.................... for (; n > 0; s1++, s2++, n--).................... if (*s1 != *s2).................... return((*s1 <*s2) ? -1: 1);.................... else if (*s1 == '\0').................... return(0);.................... return(0);.................... }.................... /* standard template:.................... int strxfrm(const char *s1, const char *s2, size_t n)..................... transforms maximum of n characters from s2 and places them into s1*/.................... size_t strxfrm(char *s1, char *s2, size_t n).................... {.................... char *s;.................... int n1;.................... n1=n;.................... for (s = s1; n > 0 && *s2 != '\0'; n--).................... *s++ = *s2++;.................... for (; n > 0; n--).................... *s++ = '\0';........................................ return(n1);.................... }........................................................................................................................ /***********************************************************/.................... /*Search functions*/.................... /* standard template: void *memchr(const char *s, int c)..................... Finds first occurrence of c in n characters of s */........................................ char *memchr(void *s,int c,size_t n).................... {.................... char uc;.................... char *su;.................... uc=c;*03A0: BSF 03.503A1: MOVF 47,W03A2: MOVWF 49.................... for(su=s;0<n;++su,--n)03A3: MOVF 46,W03A4: MOVWF 4A03A5: MOVF 48,W03A6: SUBLW 0003A7: BTFSC 03.003A8: GOTO 3B5.................... if(*su==uc)03A9: MOVF 4A,W03AA: MOVWF 0403AB: MOVF 49,W03AC: SUBWF 00,W03AD: BTFSS 03.203AE: GOTO 3B2.................... return su;03AF: MOVF 4A,W03B0: MOVWF 7803B1: GOTO 3B703B2: INCF 4A,F03B3: DECF 48,F03B4: GOTO 3A5.................... return NULL;03B5: MOVLW 0003B6: MOVWF 78.................... }03B7: BCF 03.503B8: RETLW 00........................................ /* standard template: char *strchr(const char *s, int c)..................... Finds first occurrence of c in s */........................................ char *strchr(char *s, int c).................... {.................... for (; *s != c; s++).................... if (*s == '\0').................... return(0);.................... return(s);.................... }.................... /* standard template:.................... size_t strcspn(const char *s1, const char *s2)..................... Computes length of max initial segment of s1 that.................... consists entirely of characters NOT from s2*/........................................ int *strcspn(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; *sc2 != 0; sc2++).................... if (*sc1 == *sc2).................... return(sc1 - s1);.................... return(sc1 - s1);.................... }.................... /* standard template:.................... char *strpbrk(const char *s1, const char *s2)..................... Locates first occurence of any character from s2 in s1;.................... returns s1 if s2 is empty string */........................................ char *strpbrk(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; *sc2 != 0; sc2++).................... if (*sc1 == *sc2).................... return(sc1);.................... return(0);.................... }............................................................ /* standard template: char *strrchr(const char *s, int c)..................... Finds last occurrence of c in s */........................................ char *strrchr(char *s, int c).................... {.................... char *p;........................................ for (p = 0; ; s++).................... {.................... if (*s == c).................... p = s;.................... if (*s == '\0').................... return(p);.................... }.................... }.................... /* computes length of max initial segment of s1 consisting.................... entirely of characters from s2 */........................................ int *strspn(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; ; sc2++).................... if (*sc2 == '\0').................... return(sc1 - s1);.................... else if (*sc1 == *sc2).................... break;.................... return(sc1 - s1);.................... }.................... /* standard template:.................... char *strstr(const char *s1, const char *s2);.................... Locates first occurence of character sequence s2 in s1;.................... returns 0 if s2 is empty string........................................ Uncomment #define FASTER_BUT_MORE_ROM at the top of the.................... file to use the faster algorithm */.................... char *strstr(char *s1, char *s2).................... {.................... char *s, *t;........................................ #ifdef FASTER_BUT_MORE_ROM.................... if (*s2 == '\0').................... return(s1);.................... #endif........................................ while (*s1).................... {.................... for(s = s1, t = s2; *t && *s == *t; ++s, ++t);........................................ if (*t == '\0').................... return s1;.................... ++s1;.................... #ifdef FASTER_BUT_MORE_ROM.................... while(*s1 != '\0' && *s1 != *s2).................... ++s1;.................... #endif.................... }.................... return 0;.................... }........................................ /* standard template: char *strtok(char *s1, const char *s2)......................................... Finds next token in s1 delimited by a character from separator.................... string s2 (which can be different from call to call). First call.................... starts at beginning of s1 searching for first character NOT.................... contained in s2; returns 0 if none is found..................... If one is found, it is the start of first token (return value)..................... Function then searches from there for a character contained in s2..................... If none is found, current token extends to end of s1, and subsequent.................... searches for a token will return 0. If one is found, it is.................... overwritten by '\0', which terminates current token. Function saves.................... pointer to following character from which next search will start..................... Each subsequent call, with 0 as first argument, starts searching.................... from saved pointer */........................................ char *strtok(char *s1, char *s2).................... {.................... char *beg, *end;.................... static char *save;*0817: CLRF 21........................................ beg = (s1)? s1: save;.................... beg += strspn(beg, s2);.................... if (*beg == '\0').................... {.................... *save = ' ';.................... return(0);.................... }.................... end = strpbrk(beg, s2);.................... if (*end != '\0').................... {.................... *end = '\0';.................... end++;.................... }.................... save = end;.................... return(beg);.................... }........................................ /*****************************************************************/.................... /*Miscellaneous functions*/.................... /* standard template.................... maps error number in errnum to an error message string.................... Returns: Pointer to string.................... */.................... #ifdef _ERRNO.................... char * strerror(int errnum).................... {.................... char s[15];.................... switch( errnum).................... {.................... case 0:.................... strcpy(s,"no errors");.................... return s;.................... case EDOM :.................... strcpy(s,"domain error");.................... return s;.................... case ERANGE:.................... strcpy(s,"range error");.................... return s;.................... }.................... }.................... #ENDIF.................... /* standard template: size_t strlen(const char *s)..................... Computes length of s1 (preceding terminating 0) */........................................ int *strlen(char *s).................... {.................... char *sc;........................................ for (sc = s; *sc != 0; sc++);.................... return(sc - s);.................... }........................................ /* standard template: size_t stricmp(const char *s1, const char *s2)..................... Compares s1 to s2 ignoring case (upper vs. lower) */........................................ signed int stricmp(char *s1, char *s2).................... {.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));.................... s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }............................................................ /* standard template: char *strlwr(char *s)..................... Replaces uppercase letters by lowercase;.................... returns pointer to new string s */........................................ char *strlwr(char *s).................... {.................... char *p;........................................ for (p = s; *p != '\0'; p++).................... if (*p >= 'A' && *p <='Z').................... *p += 'a' - 'A';.................... return(s);.................... }............................................................ /************************************************************/............................................................ #endif........................................ #ifndef getc.................... #define getc getch.................... #define getchar getch.................... #define puts(s) {printf(s); putchar(13); putchar(10);}.................... #define putc putchar.................... #endif.................... /* maps error number to an error message. Writes a sequence of characters to.................... stderr stream thus: if s is not null then string pointed to by s follwed by.................... a colon (:) and a space and the appropriate error message returned by strerror.................... function with argument errno........................................ Returns: no value.................... */........................................ #ifdef _ERRNO.................... void perror(char *s).................... {.................... if(s).................... fprintf(STDERR,"%s: ",s);.................... fprintf(STDERR,"%s\r\n",strerror(errno));.................... }.................... #endif.................... #endif........................................ #include <string.h>.................... ////////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ////////////////////////////////////////////////////////////////////////////........................................ #ifndef _STRING.................... #define _STRING.................... #include <stddef.h>.................... #include <ctype.h>................................................................................ //////////////////////////////////////////////.................... //// Uncomment the following define to ////.................... //// allow some functions to use a ////.................... //// quicker algorithm, but use more ROM ////.................... //// ////.................... //// #define FASTER_BUT_MORE_ROM ////.................... //////////////////////////////////////////////................................................................................ /*Copying functions*/.................... /* standard template:.................... void *memmove(void *s1, void *s2, size_t n)..................... Copies max of n characters safely (not following ending '\0').................... from s2 in s1; if s2 has less than n characters, appends 0 */........................................ char *memmove(void *s1,char *s2,size_t n).................... {.................... char *sc1;.................... char *sc2;.................... sc1=s1;.................... sc2=s2;.................... if(sc2<sc1 && sc1 <sc2 +n).................... for(sc1+=n,sc2+=n;0<n;--n).................... *--sc1=*--sc2;.................... else.................... for(;0<n;--n).................... *sc1++=*sc2++;.................... return s1;.................... }........................................ /* compiler ignored the name 'strcpy()'; perhaps, it's reserved?.................... Standard template: char *strcpy(char *s1, const char *s2).................... copies the string s2 including the null character to s1*/........................................ char *strcopy(char *s1, char *s2).................... {.................... char *s;........................................ for (s = s1; *s2 != 0; s++, s2++) {.................... *s = *s2;.................... }.................... *s = *s2;.................... return(s1);.................... }........................................ /* standard template:.................... char *strncpy(char *s1, const char *s2, size_t n)..................... Copies max of n characters (not following ending '\0').................... from s2 in s1; if s2 has less than n characters, appends 0 */........................................ char *strncpy(char *s1, char *s2, size_t n).................... {.................... char *s;........................................ for (s = s1; n > 0 && *s2 != '\0'; n--).................... *s++ = *s2++;.................... for (; n > 0; n--).................... *s++ = '\0';........................................ return(s1);.................... }.................... /***********************************************************/........................................ /*concatenation functions*/.................... /* standard template: char *strcat(char *s1, const char *s2).................... appends s2 to s1*/........................................ char *strcat(char *s1, char *s2).................... {.................... char *s;........................................ for (s = s1; *s != '\0'; ++s);.................... while(*s2 != '\0').................... {.................... *s = *s2;.................... ++s;.................... ++s2;.................... }........................................ *s = '\0';.................... return(s1);.................... }.................... /* standard template: char *strncat(char *s1, char *s2,size_t n).................... appends not more than n characters from s2 to s1*/........................................ char *strncat(char *s1, char *s2, size_t n).................... {.................... char *s;........................................ for (s = s1; *s != '\0'; ++s);.................... while(*s2 != '\0' && 0<n).................... {.................... *s = *s2;.................... ++s;.................... ++s2;.................... --n;.................... }........................................ *s = '\0';.................... return(s1);.................... }........................................ /***********************************************************/............................................................ /*comparison functions*/.................... /* standard template: signed int memcmp(void *s1, void *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int memcmp(void * s1,char *s2,size_t n).................... {.................... char *su1, *su2;.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n).................... {.................... if(*su1!=*su2).................... return ((*su1<*su2)?-1:+1);.................... }.................... return 0;.................... }........................................ /* standard template: int strcmp(const char *s1, const char *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int strcmp(char *s1, char *s2).................... {.................... for (; *s1 == *s2; s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }.................... /* standard template: int strcoll(const char *s1, const char *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int strcoll(char *s1, char *s2).................... {.................... for (; *s1 == *s2; s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }........................................ /* standard template:.................... int strncmp(const char *s1, const char *s2, size_t n)..................... Compares max of n characters (not following 0) from s1 to s2;.................... returns same as strcmp */........................................ signed int strncmp(char *s1, char *s2, size_t n).................... {.................... for (; n > 0; s1++, s2++, n--).................... if (*s1 != *s2).................... return((*s1 <*s2) ? -1: 1);.................... else if (*s1 == '\0').................... return(0);.................... return(0);.................... }.................... /* standard template:.................... int strxfrm(const char *s1, const char *s2, size_t n)..................... transforms maximum of n characters from s2 and places them into s1*/.................... size_t strxfrm(char *s1, char *s2, size_t n).................... {.................... char *s;.................... int n1;.................... n1=n;.................... for (s = s1; n > 0 && *s2 != '\0'; n--).................... *s++ = *s2++;.................... for (; n > 0; n--).................... *s++ = '\0';........................................ return(n1);.................... }........................................................................................................................ /***********************************************************/.................... /*Search functions*/.................... /* standard template: void *memchr(const char *s, int c)..................... Finds first occurrence of c in n characters of s */........................................ char *memchr(void *s,int c,size_t n).................... {.................... char uc;.................... char *su;.................... uc=c;.................... for(su=s;0<n;++su,--n).................... if(*su==uc).................... return su;.................... return NULL;.................... }........................................ /* standard template: char *strchr(const char *s, int c)..................... Finds first occurrence of c in s */........................................ char *strchr(char *s, int c).................... {.................... for (; *s != c; s++).................... if (*s == '\0').................... return(0);.................... return(s);.................... }.................... /* standard template:.................... size_t strcspn(const char *s1, const char *s2)..................... Computes length of max initial segment of s1 that.................... consists entirely of characters NOT from s2*/........................................ int *strcspn(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; *sc2 != 0; sc2++).................... if (*sc1 == *sc2).................... return(sc1 - s1);.................... return(sc1 - s1);.................... }.................... /* standard template:.................... char *strpbrk(const char *s1, const char *s2)..................... Locates first occurence of any character from s2 in s1;.................... returns s1 if s2 is empty string */........................................ char *strpbrk(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; *sc2 != 0; sc2++).................... if (*sc1 == *sc2).................... return(sc1);.................... return(0);.................... }............................................................ /* standard template: char *strrchr(const char *s, int c)..................... Finds last occurrence of c in s */........................................ char *strrchr(char *s, int c).................... {.................... char *p;........................................ for (p = 0; ; s++).................... {.................... if (*s == c).................... p = s;.................... if (*s == '\0').................... return(p);.................... }.................... }.................... /* computes length of max initial segment of s1 consisting.................... entirely of characters from s2 */........................................ int *strspn(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; ; sc2++).................... if (*sc2 == '\0').................... return(sc1 - s1);.................... else if (*sc1 == *sc2).................... break;.................... return(sc1 - s1);.................... }.................... /* standard template:.................... char *strstr(const char *s1, const char *s2);.................... Locates first occurence of character sequence s2 in s1;.................... returns 0 if s2 is empty string........................................ Uncomment #define FASTER_BUT_MORE_ROM at the top of the.................... file to use the faster algorithm */.................... char *strstr(char *s1, char *s2).................... {.................... char *s, *t;........................................ #ifdef FASTER_BUT_MORE_ROM.................... if (*s2 == '\0').................... return(s1);.................... #endif........................................ while (*s1).................... {.................... for(s = s1, t = s2; *t && *s == *t; ++s, ++t);........................................ if (*t == '\0').................... return s1;.................... ++s1;.................... #ifdef FASTER_BUT_MORE_ROM.................... while(*s1 != '\0' && *s1 != *s2).................... ++s1;.................... #endif.................... }.................... return 0;.................... }........................................ /* standard template: char *strtok(char *s1, const char *s2)......................................... Finds next token in s1 delimited by a character from separator.................... string s2 (which can be different from call to call). First call.................... starts at beginning of s1 searching for first character NOT.................... contained in s2; returns 0 if none is found..................... If one is found, it is the start of first token (return value)..................... Function then searches from there for a character contained in s2..................... If none is found, current token extends to end of s1, and subsequent.................... searches for a token will return 0. If one is found, it is.................... overwritten by '\0', which terminates current token. Function saves.................... pointer to following character from which next search will start..................... Each subsequent call, with 0 as first argument, starts searching.................... from saved pointer */........................................ char *strtok(char *s1, char *s2).................... {.................... char *beg, *end;.................... static char *save;........................................ beg = (s1)? s1: save;.................... beg += strspn(beg, s2);.................... if (*beg == '\0').................... {.................... *save = ' ';.................... return(0);.................... }.................... end = strpbrk(beg, s2);.................... if (*end != '\0').................... {.................... *end = '\0';.................... end++;.................... }.................... save = end;.................... return(beg);.................... }........................................ /*****************************************************************/.................... /*Miscellaneous functions*/.................... /* standard template.................... maps error number in errnum to an error message string.................... Returns: Pointer to string.................... */.................... #ifdef _ERRNO.................... char * strerror(int errnum).................... {.................... char s[15];.................... switch( errnum).................... {.................... case 0:.................... strcpy(s,"no errors");.................... return s;.................... case EDOM :.................... strcpy(s,"domain error");.................... return s;.................... case ERANGE:.................... strcpy(s,"range error");.................... return s;.................... }.................... }.................... #ENDIF.................... /* standard template: size_t strlen(const char *s)..................... Computes length of s1 (preceding terminating 0) */........................................ int *strlen(char *s).................... {.................... char *sc;........................................ for (sc = s; *sc != 0; sc++);.................... return(sc - s);.................... }........................................ /* standard template: size_t stricmp(const char *s1, const char *s2)..................... Compares s1 to s2 ignoring case (upper vs. lower) */........................................ signed int stricmp(char *s1, char *s2).................... {.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));.................... s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }............................................................ /* standard template: char *strlwr(char *s)..................... Replaces uppercase letters by lowercase;.................... returns pointer to new string s */........................................ char *strlwr(char *s).................... {.................... char *p;........................................ for (p = s; *p != '\0'; p++).................... if (*p >= 'A' && *p <='Z').................... *p += 'a' - 'A';.................... return(s);.................... }............................................................ /************************************************************/............................................................ #endif........................................ #include <stdlib.h>.................... ///////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ///////////////////////////////////////////////////////////////////////////........................................ #ifndef _STDLIB.................... #define _STDLIB........................................ //---------------------------------------------------------------------------.................... // Definitions and types.................... //---------------------------------------------------------------------------........................................ #ifndef RAND_MAX.................... #define RAND_MAX 32767 // The value of which is the maximum value.................... // ... returned by the rand function.................... #endif........................................ typedef struct {.................... signed int quot;.................... signed int rem;.................... } div_t;........................................ typedef struct {.................... signed long quot;.................... signed long rem;.................... } ldiv_t;........................................ #include <stddef.h>.................... ///////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ///////////////////////////////////////////////////////////////////////////........................................ #ifndef _STDDEF........................................ #define _STDDEF........................................ #if sizeof(int *)==1.................... #define ptrdiff_t int.................... #else.................... #define ptrdiff_t long.................... #endif........................................ #define size_t int.................... #define wchar_t char.................... #define NULL 0........................................ #define offsetof(s,f) (offsetofbit(s,f)/8)........................................ #endif............................................................ //---------------------------------------------------------------------------.................... // String conversion functions.................... //---------------------------------------------------------------------------........................................ /* Standard template: float atof(char * s).................... * converts the initial portion of the string s to a float..................... * returns the converted value if any, 0 otherwise.................... */.................... float atof(char * s);........................................ /* Standard template: float atoe(char * s).................... * converts the initial portion of the string s to a float..................... * returns the converted value if any, 0 otherwise.................... * also handles E format numbers.................... */.................... float atoe(char * s);........................................ /* Standard template: signed int atoi(char * s).................... * converts the initial portion of the string s to a signed int.................... * returns the converted value if any, 0 otherwise.................... */.................... signed int atoi(char *s);........................................ /* Syntax: signed int32 atoi32(char * s).................... converts the initial portion of the string s to a signed int32.................... returns the converted value if any, 0 otherwise*/.................... signed int32 atoi32(char *s);........................................ /* Syntax: char * itoa(signed int32 num, int8 base, char * s).................... converts the signed int32 to a string and.................... returns the converted value if any, 0 otherwise*/.................... char * itoa(signed int32 num, int8 base, char * s);........................................ /* Standard template: signed long atol(char * s).................... * converts the initial portion of the string s to a signed long.................... * returns the converted value if any, 0 otherwise.................... */.................... signed long atol(char *s);........................................ /* Standard template: float strtol(char * s,char *endptr).................... * converts the initial portion of the string s to a float.................... * returns the converted value if any, 0 otherwise.................... * the final string is returned in the endptr, if endptr is not null.................... */.................... float strtod(char *s,char *endptr);........................................ /* Standard template: long strtoul(char * s,char *endptr,signed int base).................... * converts the initial portion of the string s, represented as an.................... * integral value of radix base to a signed long..................... * Returns the converted value if any, 0 otherwise.................... * the final string is returned in the endptr, if endptr is not null.................... */.................... signed long strtol(char *s,char *endptr,signed int base);........................................ /* Standard template: long strtoul(char * s,char *endptr,signed int base).................... * converts the initial portion of the string s, represented as an.................... * integral value of radix base to a unsigned long..................... * returns the converted value if any, 0 otherwise.................... * the final string is returned in the endptr, if endptr is not null.................... */.................... long strtoul(char *s,char *endptr,signed int base);........................................ //---------------------------------------------------------------------------.................... // Pseudo-random sequence generation functions.................... //---------------------------------------------------------------------------........................................ /* The rand function computes a sequence of pseudo-random integers in.................... * the range 0 to RAND_MAX.................... *.................... * Parameters:.................... * (none).................... *.................... * Returns:.................... * The pseudo-random integer.................... */.................... long rand(void);........................................ /* The srand function uses the argument as a seed for a new sequence of.................... * pseudo-random numbers to be returned by subsequent calls to rand..................... *.................... * Parameters:.................... * [in] seed: The seed value to start from. You might need to pass.................... *.................... * Returns:.................... * (none).................... *.................... * Remarks.................... * The srand function sets the starting point for generating.................... * a series of pseudorandom integers. To reinitialize the.................... * generator, use 1 as the seed argument. Any other value for.................... * seed sets the generator to a random starting point. rand.................... * retrieves the pseudorandom numbers that are generated..................... * Calling rand before any call to srand generates the same.................... * sequence as calling srand with seed passed as 1..................... * Usually, you need to pass a time here from outer source.................... * so that the numbers will be different every time you run..................... */.................... void srand(unsigned int32 seed);........................................ //---------------------------------------------------------------------------.................... // Memory management functions.................... //---------------------------------------------------------------------------........................................ // Comming soon........................................ //---------------------------------------------------------------------------.................... // Communication with the environment.................... //---------------------------------------------------------------------------........................................ /* The function returns 0 always.................... */.................... signed int system(char *string);........................................ //---------------------------------------------------------------------------.................... // Searching and sorting utilities.................... //---------------------------------------------------------------------------........................................ /* Performs a binary search of a sorted array...................... *.................... * Parameters:.................... * [in] key: Object to search for.................... * [in] base: Pointer to base of search data.................... * [in] num: Number of elements.................... * [in] width: Width of elements.................... * [in] compare: Function that compares two elements.................... *.................... * Returns:.................... * bsearch returns a pointer to an occurrence of key in the array pointed.................... * to by base. If key is not found, the function returns NULL. If the.................... * array is not in order or contains duplicate records with identical keys,.................... * the result is unpredictable..................... */.................... //void *bsearch(const void *key, const void *base, size_t num, size_t width,.................... // int (*compare)(const void *, const void *));........................................ /* Performs the shell-metzner sort (not the quick sort algorithm). The contents.................... * of the array are sorted into ascending order according to a comparison.................... * function pointed to by compar..................... *.................... * Parameters:.................... * [in] base: Pointer to base of search data.................... * [in] num: Number of elements.................... * [in] width: Width of elements.................... * [in] compare: Function that compares two elements.................... *.................... * Returns:.................... * (none).................... */.................... //void *qsort(const void *base, size_t num, size_t width,.................... // int (*compare)(const void *, const void *));........................................ //---------------------------------------------------------------------------.................... // Integer arithmetic functions.................... //---------------------------------------------------------------------------........................................ #define labs abs........................................ div_t div(signed int numer,signed int denom);.................... ldiv_t ldiv(signed long numer,signed long denom);........................................ //---------------------------------------------------------------------------.................... // Multibyte character functions.................... //---------------------------------------------------------------------------........................................ // Not supported........................................ //---------------------------------------------------------------------------.................... // Multibyte string functions.................... //---------------------------------------------------------------------------........................................ // Not supported............................................................ //---------------------------------------------------------------------------.................... // Internal implementation.................... //---------------------------------------------------------------------------........................................ #include <stddef.h>.................... ///////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ///////////////////////////////////////////////////////////////////////////........................................ #ifndef _STDDEF........................................ #define _STDDEF........................................ #if sizeof(int *)==1.................... #define ptrdiff_t int.................... #else.................... #define ptrdiff_t long.................... #endif........................................ #define size_t int.................... #define wchar_t char.................... #define NULL 0........................................ #define offsetof(s,f) (offsetofbit(s,f)/8)........................................ #endif........................................ #include <string.h>.................... ////////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ////////////////////////////////////////////////////////////////////////////........................................ #ifndef _STRING.................... #define _STRING.................... #include <stddef.h>.................... #include <ctype.h>................................................................................ //////////////////////////////////////////////.................... //// Uncomment the following define to ////.................... //// allow some functions to use a ////.................... //// quicker algorithm, but use more ROM ////.................... //// ////.................... //// #define FASTER_BUT_MORE_ROM ////.................... //////////////////////////////////////////////................................................................................ /*Copying functions*/.................... /* standard template:.................... void *memmove(void *s1, void *s2, size_t n)..................... Copies max of n characters safely (not following ending '\0').................... from s2 in s1; if s2 has less than n characters, appends 0 */........................................ char *memmove(void *s1,char *s2,size_t n).................... {.................... char *sc1;.................... char *sc2;.................... sc1=s1;.................... sc2=s2;.................... if(sc2<sc1 && sc1 <sc2 +n).................... for(sc1+=n,sc2+=n;0<n;--n).................... *--sc1=*--sc2;.................... else.................... for(;0<n;--n).................... *sc1++=*sc2++;.................... return s1;.................... }........................................ /* compiler ignored the name 'strcpy()'; perhaps, it's reserved?.................... Standard template: char *strcpy(char *s1, const char *s2).................... copies the string s2 including the null character to s1*/........................................ char *strcopy(char *s1, char *s2).................... {.................... char *s;........................................ for (s = s1; *s2 != 0; s++, s2++) {.................... *s = *s2;.................... }.................... *s = *s2;.................... return(s1);.................... }........................................ /* standard template:.................... char *strncpy(char *s1, const char *s2, size_t n)..................... Copies max of n characters (not following ending '\0').................... from s2 in s1; if s2 has less than n characters, appends 0 */........................................ char *strncpy(char *s1, char *s2, size_t n).................... {.................... char *s;........................................ for (s = s1; n > 0 && *s2 != '\0'; n--).................... *s++ = *s2++;.................... for (; n > 0; n--).................... *s++ = '\0';........................................ return(s1);.................... }.................... /***********************************************************/........................................ /*concatenation functions*/.................... /* standard template: char *strcat(char *s1, const char *s2).................... appends s2 to s1*/........................................ char *strcat(char *s1, char *s2).................... {.................... char *s;........................................ for (s = s1; *s != '\0'; ++s);.................... while(*s2 != '\0').................... {.................... *s = *s2;.................... ++s;.................... ++s2;.................... }........................................ *s = '\0';.................... return(s1);.................... }.................... /* standard template: char *strncat(char *s1, char *s2,size_t n).................... appends not more than n characters from s2 to s1*/........................................ char *strncat(char *s1, char *s2, size_t n).................... {.................... char *s;........................................ for (s = s1; *s != '\0'; ++s);.................... while(*s2 != '\0' && 0<n).................... {.................... *s = *s2;.................... ++s;.................... ++s2;.................... --n;.................... }........................................ *s = '\0';.................... return(s1);.................... }........................................ /***********************************************************/............................................................ /*comparison functions*/.................... /* standard template: signed int memcmp(void *s1, void *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int memcmp(void * s1,char *s2,size_t n).................... {.................... char *su1, *su2;.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n).................... {.................... if(*su1!=*su2).................... return ((*su1<*su2)?-1:+1);.................... }.................... return 0;.................... }........................................ /* standard template: int strcmp(const char *s1, const char *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int strcmp(char *s1, char *s2).................... {.................... for (; *s1 == *s2; s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }.................... /* standard template: int strcoll(const char *s1, const char *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int strcoll(char *s1, char *s2).................... {.................... for (; *s1 == *s2; s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }........................................ /* standard template:.................... int strncmp(const char *s1, const char *s2, size_t n)..................... Compares max of n characters (not following 0) from s1 to s2;.................... returns same as strcmp */........................................ signed int strncmp(char *s1, char *s2, size_t n).................... {.................... for (; n > 0; s1++, s2++, n--).................... if (*s1 != *s2).................... return((*s1 <*s2) ? -1: 1);.................... else if (*s1 == '\0').................... return(0);.................... return(0);.................... }.................... /* standard template:.................... int strxfrm(const char *s1, const char *s2, size_t n)..................... transforms maximum of n characters from s2 and places them into s1*/.................... size_t strxfrm(char *s1, char *s2, size_t n).................... {.................... char *s;.................... int n1;.................... n1=n;.................... for (s = s1; n > 0 && *s2 != '\0'; n--).................... *s++ = *s2++;.................... for (; n > 0; n--).................... *s++ = '\0';........................................ return(n1);.................... }........................................................................................................................ /***********************************************************/.................... /*Search functions*/.................... /* standard template: void *memchr(const char *s, int c)..................... Finds first occurrence of c in n characters of s */........................................ char *memchr(void *s,int c,size_t n).................... {.................... char uc;.................... char *su;.................... uc=c;.................... for(su=s;0<n;++su,--n).................... if(*su==uc).................... return su;.................... return NULL;.................... }........................................ /* standard template: char *strchr(const char *s, int c)..................... Finds first occurrence of c in s */........................................ char *strchr(char *s, int c).................... {.................... for (; *s != c; s++).................... if (*s == '\0').................... return(0);.................... return(s);.................... }.................... /* standard template:.................... size_t strcspn(const char *s1, const char *s2)..................... Computes length of max initial segment of s1 that.................... consists entirely of characters NOT from s2*/........................................ int *strcspn(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; *sc2 != 0; sc2++).................... if (*sc1 == *sc2).................... return(sc1 - s1);.................... return(sc1 - s1);.................... }.................... /* standard template:.................... char *strpbrk(const char *s1, const char *s2)..................... Locates first occurence of any character from s2 in s1;.................... returns s1 if s2 is empty string */........................................ char *strpbrk(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; *sc2 != 0; sc2++).................... if (*sc1 == *sc2).................... return(sc1);.................... return(0);.................... }............................................................ /* standard template: char *strrchr(const char *s, int c)..................... Finds last occurrence of c in s */........................................ char *strrchr(char *s, int c).................... {.................... char *p;........................................ for (p = 0; ; s++).................... {.................... if (*s == c).................... p = s;.................... if (*s == '\0').................... return(p);.................... }.................... }.................... /* computes length of max initial segment of s1 consisting.................... entirely of characters from s2 */........................................ int *strspn(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; ; sc2++).................... if (*sc2 == '\0').................... return(sc1 - s1);.................... else if (*sc1 == *sc2).................... break;.................... return(sc1 - s1);.................... }.................... /* standard template:.................... char *strstr(const char *s1, const char *s2);.................... Locates first occurence of character sequence s2 in s1;.................... returns 0 if s2 is empty string........................................ Uncomment #define FASTER_BUT_MORE_ROM at the top of the.................... file to use the faster algorithm */.................... char *strstr(char *s1, char *s2).................... {.................... char *s, *t;........................................ #ifdef FASTER_BUT_MORE_ROM.................... if (*s2 == '\0').................... return(s1);.................... #endif........................................ while (*s1).................... {.................... for(s = s1, t = s2; *t && *s == *t; ++s, ++t);........................................ if (*t == '\0').................... return s1;.................... ++s1;.................... #ifdef FASTER_BUT_MORE_ROM.................... while(*s1 != '\0' && *s1 != *s2).................... ++s1;.................... #endif.................... }.................... return 0;.................... }........................................ /* standard template: char *strtok(char *s1, const char *s2)......................................... Finds next token in s1 delimited by a character from separator.................... string s2 (which can be different from call to call). First call.................... starts at beginning of s1 searching for first character NOT.................... contained in s2; returns 0 if none is found..................... If one is found, it is the start of first token (return value)..................... Function then searches from there for a character contained in s2..................... If none is found, current token extends to end of s1, and subsequent.................... searches for a token will return 0. If one is found, it is.................... overwritten by '\0', which terminates current token. Function saves.................... pointer to following character from which next search will start..................... Each subsequent call, with 0 as first argument, starts searching.................... from saved pointer */........................................ char *strtok(char *s1, char *s2).................... {.................... char *beg, *end;.................... static char *save;........................................ beg = (s1)? s1: save;.................... beg += strspn(beg, s2);.................... if (*beg == '\0').................... {.................... *save = ' ';.................... return(0);.................... }.................... end = strpbrk(beg, s2);.................... if (*end != '\0').................... {.................... *end = '\0';.................... end++;.................... }.................... save = end;.................... return(beg);.................... }........................................ /*****************************************************************/.................... /*Miscellaneous functions*/.................... /* standard template.................... maps error number in errnum to an error message string.................... Returns: Pointer to string.................... */.................... #ifdef _ERRNO.................... char * strerror(int errnum).................... {.................... char s[15];.................... switch( errnum).................... {.................... case 0:.................... strcpy(s,"no errors");.................... return s;.................... case EDOM :.................... strcpy(s,"domain error");.................... return s;.................... case ERANGE:.................... strcpy(s,"range error");.................... return s;.................... }.................... }.................... #ENDIF.................... /* standard template: size_t strlen(const char *s)..................... Computes length of s1 (preceding terminating 0) */........................................ int *strlen(char *s).................... {.................... char *sc;........................................ for (sc = s; *sc != 0; sc++);.................... return(sc - s);.................... }........................................ /* standard template: size_t stricmp(const char *s1, const char *s2)..................... Compares s1 to s2 ignoring case (upper vs. lower) */........................................ signed int stricmp(char *s1, char *s2).................... {.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));.................... s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }............................................................ /* standard template: char *strlwr(char *s)..................... Replaces uppercase letters by lowercase;.................... returns pointer to new string s */........................................ char *strlwr(char *s).................... {.................... char *p;........................................ for (p = s; *p != '\0'; p++).................... if (*p >= 'A' && *p <='Z').................... *p += 'a' - 'A';.................... return(s);.................... }............................................................ /************************************************************/............................................................ #endif............................................................ div_t div(signed int numer,signed int denom).................... {.................... div_t val;.................... val.quot = numer / denom;.................... val.rem = numer - (denom * val.quot);.................... return (val);.................... }........................................ ldiv_t ldiv(signed long numer,signed long denom).................... {.................... ldiv_t val;.................... val.quot = numer / denom;.................... val.rem = numer - (denom * val.quot);.................... return (val);.................... }........................................ float atof(char * s).................... {.................... float pow10 = 1.0;.................... float result = 0.0;.................... int sign = 0;.................... char c;.................... int ptr = 0;........................................ c = s[ptr++];........................................ if ((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {.................... if(c == '-') {.................... sign = 1;.................... c = s[ptr++];.................... }.................... if(c == '+').................... c = s[ptr++];........................................ while((c >= '0' && c <= '9')) {.................... result = 10*result + c - '0';.................... c = s[ptr++];.................... }........................................ if (c == '.') {.................... c = s[ptr++];.................... while((c >= '0' && c <= '9')) {.................... pow10 = pow10*10;.................... result += (c - '0')/pow10;.................... c = s[ptr++];.................... }.................... }........................................ }........................................ if (sign == 1).................... result = -1*result;.................... return(result);.................... }........................................ float atoe(char * s).................... {.................... float pow10 = 1.0;.................... float result = 0.0;.................... int sign = 0;.................... int expsign = 0;.................... char c;.................... int ptr = 0;.................... int i;.................... float exp = 1.0;.................... int expcnt = 0;........................................ c = s[ptr++];........................................ if ((c>='0' && c<='9') || c=='+' || c=='-' || c=='.' || c=='E' || c=='e') {.................... if(c == '-') {.................... sign = 1;.................... c = s[ptr++];.................... }.................... if(c == '+').................... c = s[ptr++];........................................ while((c >= '0' && c <= '9')) {.................... result = 10*result + c - '0';.................... c = s[ptr++];.................... }........................................ if (c == '.') {.................... c = s[ptr++];.................... while((c >= '0' && c <= '9')) {.................... pow10 = pow10*10;.................... result += (c - '0')/pow10;.................... c = s[ptr++];.................... }.................... }........................................ // Handling the exponent.................... if (c=='e' || c=='E') {.................... c = s[ptr++];........................................ if(c == '-') {.................... expsign = 1;.................... c = s[ptr++];.................... }.................... if(c == '+').................... c = s[ptr++];........................................ while((c >= '0' && c <= '9')) {.................... expcnt = 10*expcnt + c - '0';.................... c = s[ptr++];.................... }........................................ for(i=0;i<expcnt;i++).................... exp*=10;........................................ if(expsign==1).................... result/=exp;.................... else.................... result*=exp;.................... }.................... }........................................ if (sign == 1).................... result = -1*result;.................... return(result);.................... }........................................ signed int atoi(char *s).................... {.................... signed int result;.................... int sign, base, index;.................... char c;........................................ index = 0;.................... sign = 0;.................... base = 10;.................... result = 0;........................................ if (!s).................... return 0;.................... // Omit all preceeding alpha characters.................... c = s[index++];........................................ // increase index if either positive or negative sign is detected.................... if (c == '-').................... {.................... sign = 1; // Set the sign to negative.................... c = s[index++];.................... }.................... else if (c == '+').................... {.................... c = s[index++];.................... }........................................ if (c >= '0' && c <= '9').................... {........................................ // Check for hexa number.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X')).................... {.................... base = 16;.................... index++;.................... c = s[index++];.................... }........................................ // The number is a decimal number.................... if (base == 10).................... {.................... while (c >= '0' && c <= '9').................... {.................... result = 10*result + (c - '0');.................... c = s[index++];.................... }.................... }.................... else if (base == 16) // The number is a hexa number.................... {.................... c = toupper(c);.................... while ( (c >= '0' && c <= '9') || (c >= 'A' && c<='F')).................... {.................... if (c >= '0' && c <= '9').................... result = (result << 4) + (c - '0');.................... else.................... result = (result << 4) + (c - 'A' + 10);........................................ c = s[index++];.................... c = toupper(c);.................... }.................... }.................... }........................................ if (sign == 1 && base == 10).................... result = -result;........................................ return(result);.................... }........................................ signed long atol(char *s).................... {.................... signed long result;.................... int sign, base, index;.................... char c;........................................ index = 0;.................... sign = 0;.................... base = 10;.................... result = 0;........................................ if (!s).................... return 0;.................... c = s[index++];........................................ // increase index if either positive or negative sign is detected.................... if (c == '-').................... {.................... sign = 1; // Set the sign to negative.................... c = s[index++];.................... }.................... else if (c == '+').................... {.................... c = s[index++];.................... }........................................ if (c >= '0' && c <= '9').................... {.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X')).................... {.................... base = 16;.................... index++;.................... c = s[index++];.................... }........................................ // The number is a decimal number.................... if (base == 10).................... {.................... while (c >= '0' && c <= '9').................... {.................... result = 10*result + (c - '0');.................... c = s[index++];.................... }.................... }.................... else if (base == 16) // The number is a hexa number.................... {.................... c = toupper(c);.................... while ( (c >= '0' && c <= '9') || (c >= 'A' && c <='F')).................... {.................... if (c >= '0' && c <= '9').................... result = (result << 4) + (c - '0');.................... else.................... result = (result << 4) + (c - 'A' + 10);........................................ c = s[index++];c = toupper(c);.................... }.................... }.................... }........................................ if (base == 10 && sign == 1).................... result = -result;........................................ return(result);.................... }........................................ /* A fast routine to multiply by 10.................... */.................... signed int32 mult_with10(int32 num).................... {.................... return ( (num << 1) + (num << 3) );.................... }........................................ signed int32 atoi32(char *s).................... {.................... signed int32 result;.................... int sign, base, index;.................... char c;........................................ index = 0;.................... sign = 0;.................... base = 10;.................... result = 0;........................................ if (!s).................... return 0;.................... c = s[index++];........................................ // increase index if either positive or negative sign is detected.................... if (c == '-').................... {.................... sign = 1; // Set the sign to negative.................... c = s[index++];.................... }.................... else if (c == '+').................... {.................... c = s[index++];.................... }........................................ if (c >= '0' && c <= '9').................... {.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X')).................... {.................... base = 16;.................... index++;.................... c = s[index++];.................... }........................................ // The number is a decimal number.................... if (base == 10).................... {.................... while (c >= '0' && c <= '9') {.................... result = (result << 1) + (result << 3); // result *= 10;.................... result += (c - '0');.................... c = s[index++];.................... }.................... }.................... else if (base == 16) // The number is a hexa number.................... {.................... c = toupper(c);.................... while ((c >= '0' && c <= '9') || (c >= 'A' && c <='F')).................... {.................... if (c >= '0' && c <= '9').................... result = (result << 4) + (c - '0');.................... else.................... result = (result << 4) + (c - 'A' + 10);........................................ c = s[index++];c = toupper(c);.................... }.................... }.................... }........................................ if (base == 10 && sign == 1).................... result = -result;........................................ return(result);.................... }........................................ char * itoa(signed int32 num, int8 base, char *s).................... {.................... int32 temp=1;.................... int8 i,sign=0,cnt=0;.................... char c;........................................ if(num<0) {.................... sign=1; // Check for negative number.................... num*=-1;.................... }........................................ while(temp>0) {.................... temp=(num/base);.................... s[cnt]=(num%base)+'0'; // Conversion........................................ if(s[cnt]>0x39).................... s[cnt]+=0x7;........................................ cnt++;.................... num=temp;.................... }........................................ if(sign==1) {.................... s[cnt]=0x2D; // Negative sign.................... cnt++;.................... }........................................ for(i = 0;i<(int8)(cnt/2);i++) {........................................ c=s[i];.................... s[i]=s[cnt-i-1]; // Reverse the number.................... s[cnt-i-1]=c;.................... }.................... s[cnt]='\0'; // End the string.................... return s;.................... }........................................ float strtod(char *s,char *endptr) {.................... float pow10 = 1.0;.................... float result = 0.0;.................... int sign = 0, point = 0;.................... char c;.................... int ptr = 0;........................................ if (!s).................... return 0;.................... c=s[ptr++];............................................................ while((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {.................... if(c == '-') {.................... sign = 1;.................... c = s[ptr++];.................... }........................................ while((c >= '0' && c <= '9') && point == 0) {.................... result = 10*result + c - '0';.................... c = s[ptr++];.................... }........................................ if (c == '.') {.................... point = 1;.................... c = s[ptr++];.................... }........................................ while((c >= '0' && c <= '9') && point == 1) {.................... pow10 = pow10*10;.................... result += (c - '0')/pow10;.................... c = s[ptr++];.................... }........................................ if (c == '+') {.................... c = s[ptr++];.................... }.................... }........................................ if (sign == 1).................... result = -1*result;.................... if(endptr).................... {.................... if (ptr) {.................... ptr--;.................... *((char *)endptr)=s+ptr;.................... }.................... else.................... *((char *)endptr)=s;.................... }........................................ return(result);.................... }........................................ long strtoul(char *s,char *endptr,signed int base).................... {.................... char *sc,*s1,*sd;.................... unsigned long x=0;*03D2: CLRF 5703D3: CLRF 58.................... char sign;.................... char digits[]="0123456789abcdefghijklmnopqstuvwxyz";03D4: MOVLW 3003D5: BSF 03.503D6: MOVWF 2003D7: MOVLW 3103D8: MOVWF 2103D9: MOVLW 3203DA: MOVWF 2203DB: MOVLW 3303DC: MOVWF 2303DD: MOVLW 3403DE: MOVWF 2403DF: MOVLW 3503E0: MOVWF 2503E1: MOVLW 3603E2: MOVWF 2603E3: MOVLW 3703E4: MOVWF 2703E5: MOVLW 3803E6: MOVWF 2803E7: MOVLW 3903E8: MOVWF 2903E9: MOVLW 6103EA: MOVWF 2A03EB: MOVLW 6203EC: MOVWF 2B03ED: MOVLW 6303EE: MOVWF 2C03EF: MOVLW 6403F0: MOVWF 2D03F1: MOVLW 6503F2: MOVWF 2E03F3: MOVLW 6603F4: MOVWF 2F03F5: MOVLW 6703F6: MOVWF 3003F7: MOVLW 6803F8: MOVWF 3103F9: MOVLW 6903FA: MOVWF 3203FB: MOVLW 6A03FC: MOVWF 3303FD: MOVLW 6B03FE: MOVWF 3403FF: MOVLW 6C0400: MOVWF 350401: MOVLW 6D0402: MOVWF 360403: MOVLW 6E0404: MOVWF 370405: MOVLW 6F0406: MOVWF 380407: MOVLW 700408: MOVWF 390409: MOVLW 71040A: MOVWF 3A040B: MOVLW 73040C: MOVWF 3B040D: MOVLW 74040E: MOVWF 3C040F: MOVLW 750410: MOVWF 3D0411: MOVLW 760412: MOVWF 3E0413: MOVLW 770414: MOVWF 3F0415: MOVLW 780416: MOVWF 400417: MOVLW 790418: MOVWF 410419: MOVLW 7A041A: MOVWF 42041B: CLRF 43.................... for(sc=s;isspace(*sc);++sc);041C: BCF 03.5041D: MOVF 51,W041E: MOVWF 54041F: MOVF 54,W0420: MOVWF 040421: MOVF 00,W0422: SUBLW 200423: BTFSS 03.20424: GOTO 4270425: INCF 54,F0426: GOTO 41F.................... sign=*sc=='-'||*sc=='+'?*sc++:'+';0427: MOVF 54,W0428: MOVWF 040429: MOVF 00,W042A: SUBLW 2D042B: BTFSC 03.2042C: GOTO 433042D: MOVF 54,W042E: MOVWF 04042F: MOVF 00,W0430: SUBLW 2B0431: BTFSS 03.20432: GOTO 4380433: MOVF 54,W0434: INCF 54,F0435: MOVWF 040436: MOVF 00,W0437: GOTO 4390438: MOVLW 2B0439: MOVWF 59.................... if(sign=='-')043A: MOVF 59,W043B: SUBLW 2D043C: BTFSS 03.2043D: GOTO 449.................... {.................... if (endptr)043E: MOVF 52,F043F: BTFSC 03.20440: GOTO 445.................... {.................... *((char *)endptr)=s;0441: MOVF 52,W0442: MOVWF 040443: MOVF 51,W0444: MOVWF 00.................... }.................... return 0;0445: MOVLW 000446: MOVWF 780447: MOVWF 790448: GOTO 555.................... }........................................ if (base <0 || base ==1|| base >36) // invalid base0449: BTFSC 53.7044A: GOTO 454044B: DECFSZ 53,W044C: GOTO 44E044D: GOTO 454044E: BTFSC 53.7044F: GOTO 4600450: MOVF 53,W0451: SUBLW 240452: BTFSC 03.00453: GOTO 460.................... {.................... if (endptr)0454: MOVF 52,F0455: BTFSC 03.20456: GOTO 45B.................... {.................... *((char *)endptr)=s;0457: MOVF 52,W0458: MOVWF 040459: MOVF 51,W045A: MOVWF 00.................... }.................... return 0;045B: MOVLW 00045C: MOVWF 78045D: MOVWF 79045E: GOTO 555.................... }.................... else if (base)045F: GOTO 4C60460: MOVF 53,F0461: BTFSC 03.20462: GOTO 49D.................... {.................... if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X'))0463: MOVF 53,W0464: SUBLW 100465: BTFSS 03.20466: GOTO 47D0467: MOVF 54,W0468: MOVWF 040469: MOVF 00,W046A: SUBLW 30046B: BTFSS 03.2046C: GOTO 47D046D: MOVLW 01046E: ADDWF 54,W046F: MOVWF 040470: MOVF 00,W0471: SUBLW 780472: BTFSC 03.20473: GOTO 47B0474: MOVLW 010475: ADDWF 54,W0476: MOVWF 040477: MOVF 00,W0478: SUBLW 580479: BTFSS 03.2047A: GOTO 47D.................... sc+=2;047B: MOVLW 02047C: ADDWF 54,F.................... if(base==8 && *sc =='0')047D: MOVF 53,W047E: SUBLW 08047F: BTFSS 03.20480: GOTO 4890481: MOVF 54,W0482: MOVWF 040483: MOVF 00,W0484: SUBLW 300485: BTFSS 03.20486: GOTO 489.................... sc+=1;0487: MOVLW 010488: ADDWF 54,F.................... if(base==2 && *sc =='0'&&sc[1]=='b')0489: MOVF 53,W048A: SUBLW 02048B: BTFSS 03.2048C: GOTO 49C048D: MOVF 54,W048E: MOVWF 04048F: MOVF 00,W0490: SUBLW 300491: BTFSS 03.20492: GOTO 49C0493: MOVLW 010494: ADDWF 54,W0495: MOVWF 040496: MOVF 00,W0497: SUBLW 620498: BTFSS 03.20499: GOTO 49C.................... sc+=2;049A: MOVLW 02049B: ADDWF 54,F........................................ }.................... else if(*sc!='0') // base is 0, find base049C: GOTO 4C6049D: MOVF 54,W049E: MOVWF 04049F: MOVF 00,W04A0: SUBLW 3004A1: BTFSC 03.204A2: GOTO 4A6.................... base=10;04A3: MOVLW 0A04A4: MOVWF 53.................... else if (sc[1]=='x' || sc[1]=='X')04A5: GOTO 4C604A6: MOVLW 0104A7: ADDWF 54,W04A8: MOVWF 0404A9: MOVF 00,W04AA: SUBLW 7804AB: BTFSC 03.204AC: GOTO 4B404AD: MOVLW 0104AE: ADDWF 54,W04AF: MOVWF 0404B0: MOVF 00,W04B1: SUBLW 5804B2: BTFSS 03.204B3: GOTO 4B9.................... base =16,sc+=2;04B4: MOVLW 1004B5: MOVWF 5304B6: MOVLW 0204B7: ADDWF 54,F.................... else if(sc[1]=='b')04B8: GOTO 4C604B9: MOVLW 0104BA: ADDWF 54,W04BB: MOVWF 0404BC: MOVF 00,W04BD: SUBLW 6204BE: BTFSS 03.204BF: GOTO 4C4.................... base=2,sc+=2;04C0: MOVLW 0204C1: MOVWF 5304C2: ADDWF 54,F.................... else04C3: GOTO 4C6.................... base=8;04C4: MOVLW 0804C5: MOVWF 53.................... for (s1=sc;*sc=='0';++sc);// skip leading zeroes04C6: MOVF 54,W04C7: MOVWF 5504C8: MOVF 54,W04C9: MOVWF 0404CA: MOVF 00,W04CB: SUBLW 3004CC: BTFSS 03.204CD: GOTO 4D004CE: INCF 54,F04CF: GOTO 4C8.................... sd=memchr(digits,tolower(*sc),base);04D0: MOVF 54,W04D1: MOVWF 0404D2: MOVF 00,W04D3: MOVWF 5A04D4: SUBLW 4004D5: BTFSC 03.004D6: GOTO 4DE04D7: MOVF 5A,W04D8: SUBLW 5A04D9: BTFSS 03.004DA: GOTO 4DE04DB: MOVF 5A,W04DC: IORLW 2004DD: GOTO 4DF04DE: MOVF 5A,W04DF: MOVWF 5B04E0: MOVLW A004E1: BSF 03.504E2: MOVWF 4604E3: BCF 03.504E4: MOVF 5A,W04E5: BSF 03.504E6: MOVWF 4704E7: BCF 03.504E8: MOVF 53,W04E9: BSF 03.504EA: MOVWF 4804EB: BCF 03.504EC: CALL 3A004ED: MOVF 78,W04EE: MOVWF 56.................... for(; sd!=0; )04EF: MOVF 56,F04F0: BTFSC 03.204F1: GOTO 53B.................... {.................... x=x*base+(int16)(sd-digits);04F2: CLRF 7A04F3: MOVF 53,W04F4: MOVWF 7704F5: BTFSC 53.704F6: DECF 7A,F04F7: MOVWF 5A04F8: MOVF 7A,W04F9: MOVWF 5B04FA: MOVF 58,W04FB: BSF 03.504FC: MOVWF 4704FD: BCF 03.504FE: MOVF 57,W04FF: BSF 03.50500: MOVWF 460501: BCF 03.50502: MOVF 7A,W0503: BSF 03.50504: MOVWF 490505: BCF 03.50506: MOVF 5A,W0507: BSF 03.50508: MOVWF 480509: BCF 03.5050A: GOTO 3B9050B: MOVF 78,W050C: MOVWF 5B050D: MOVLW A0050E: SUBWF 56,W050F: CLRF 7A0510: ADDWF 78,W0511: MOVWF 780512: BTFSC 03.00513: INCF 7A,F0514: MOVF 79,W0515: ADDWF 7A,F0516: MOVF 78,W0517: MOVWF 570518: MOVF 7A,W0519: MOVWF 58.................... ++sc;051A: INCF 54,F.................... sd=memchr(digits,tolower(*sc),base);051B: MOVF 54,W051C: MOVWF 04051D: MOVF 00,W051E: MOVWF 5A051F: SUBLW 400520: BTFSC 03.00521: GOTO 5290522: MOVF 5A,W0523: SUBLW 5A0524: BTFSS 03.00525: GOTO 5290526: MOVF 5A,W0527: IORLW 200528: GOTO 52A0529: MOVF 5A,W052A: MOVWF 5B052B: MOVLW A0052C: BSF 03.5052D: MOVWF 46052E: BCF 03.5052F: MOVF 5A,W0530: BSF 03.50531: MOVWF 470532: BCF 03.50533: MOVF 53,W0534: BSF 03.50535: MOVWF 480536: BCF 03.50537: CALL 3A00538: MOVF 78,W0539: MOVWF 56.................... }053A: GOTO 4EF.................... if(s1==sc)053B: MOVF 54,W053C: SUBWF 55,W053D: BTFSS 03.2053E: GOTO 54A.................... {.................... if (endptr)053F: MOVF 52,F0540: BTFSC 03.20541: GOTO 546.................... {.................... *((char *)endptr)=s;0542: MOVF 52,W0543: MOVWF 040544: MOVF 51,W0545: MOVWF 00.................... }.................... return 0;0546: MOVLW 000547: MOVWF 780548: MOVWF 790549: GOTO 555.................... }.................... if (endptr)054A: MOVF 52,F054B: BTFSC 03.2054C: GOTO 551.................... *((char *)endptr)=sc;054D: MOVF 52,W054E: MOVWF 04054F: MOVF 54,W0550: MOVWF 00.................... return x;0551: MOVF 57,W0552: MOVWF 780553: MOVF 58,W0554: MOVWF 79.................... }0555: BSF 0A.30556: BCF 0A.40557: GOTO 503 (RETURN)............................................................ signed long strtol(char *s,char *endptr,signed int base).................... {.................... char *sc,*s1,*sd;.................... signed long x=0;.................... char sign;.................... char digits[]="0123456789abcdefghijklmnopqstuvwxyz";.................... for(sc=s;isspace(*sc);++sc);.................... sign=*sc=='-'||*sc=='+'?*sc++:'+';.................... if (base <0 || base ==1|| base >36) // invalid base.................... {.................... if (endptr).................... {.................... *((char *)endptr)=s;.................... }.................... return 0;.................... }.................... else if (base).................... {.................... if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X')).................... sc+=2;.................... if(base==8 && *sc =='0').................... sc+=1;.................... if(base==2 && *sc =='0'&&sc[1]=='b').................... sc+=2;........................................ }.................... else if(*sc!='0') // base is 0, find base.................... base=10;.................... else if (sc[1]=='x' || sc[1]=='X').................... base =16,sc+=2;.................... else if(sc[1]=='b').................... base=2,sc+=2;.................... else.................... base=8;.................... for (s1=sc;*sc=='0';++sc);// skip leading zeroes........................................ sd=memchr(digits,tolower(*sc),base);.................... for(;sd!=0;).................... {.................... x=x*base+(int16)(sd-digits);.................... ++sc;.................... sd=memchr(digits,tolower(*sc),base);.................... }.................... if(s1==sc).................... {.................... if (endptr).................... {.................... *((char *)endptr)=s;.................... }.................... return 0;.................... }.................... if(sign=='-').................... x =-x;.................... if (endptr).................... *((char *)endptr)=sc;.................... return x;.................... }........................................ signed int system(char *string).................... {.................... return 0;.................... }........................................ int mblen(char *s,size_t n).................... {.................... return strlen(s);.................... }........................................ int mbtowc(wchar_t *pwc,char *s,size_t n).................... {.................... *pwc=*s;.................... return 1;.................... }........................................ int wctomb(char *s,wchar_t wchar).................... {.................... *s=wchar;.................... return 1;.................... }........................................ size_t mbstowcs(wchar_t *pwcs,char *s,size_t n).................... {.................... strncpy(pwcs,s,n);.................... return strlen(pwcs);.................... }........................................ size_t wcstombs(char *s,wchar_t *pwcs,size_t n).................... {.................... strncpy(s,pwcs,n);.................... return strlen(s);.................... }........................................ //---------------------------------------------------------------------------.................... // The random number implementation.................... //---------------------------------------------------------------------------........................................ unsigned int32 _Randseed = 1;*0818: MOVLW 010819: MOVWF 22081A: CLRF 23081B: CLRF 24081C: CLRF 25........................................ long rand(void).................... {.................... _Randseed = _Randseed * 1103515245 + 12345;.................... return ((unsigned long)(_Randseed >> 16) % RAND_MAX);.................... }........................................ void srand(unsigned int32 seed).................... {.................... _Randseed = seed;.................... }........................................ //---------------------------------------------------------------------------.................... // Searching and sorting utilities implementation.................... //---------------------------------------------------------------------------........................................ typedef signed int (*_Cmpfun)(char * p1,char * p2);........................................ void qsort(char * qdata, int qitems, int qsize, _Cmpfun cmp) {.................... int m,j,i,l;.................... short done;.................... BYTE t[16];........................................ m = qitems/2;.................... while( m > 0 ) {.................... for(j=0; j<(qitems-m); ++j) {.................... i = j;.................... do.................... {.................... done=TRUE;.................... l = i+m;.................... if( (*cmp)(qdata+i*qsize, qdata+l*qsize) > 0 ) {.................... memcpy(t, qdata+i*qsize, qsize);.................... memcpy(qdata+i*qsize, qdata+l*qsize, qsize);.................... memcpy(qdata+l*qsize, t, qsize);.................... if(m <= i).................... i -= m;.................... done = FALSE;.................... }.................... } while(!done);.................... }.................... m = m/2;.................... }.................... }............................................................ char *bsearch(char *key, char *base, size_t num, size_t width,_Cmpfun cmp).................... {.................... char *p, *q;.................... size_t n;.................... size_t pivot;.................... signed int val;........................................ p = base;.................... n = num;........................................ while (n > 0).................... {.................... pivot = n >> 1;.................... q = p + width * pivot;........................................ val = (*cmp)(key, q);........................................ if (val < 0).................... n = pivot;.................... else if (val == 0).................... return ((char *)q);.................... else {.................... p = q + width;.................... n -= pivot + 1;.................... }.................... }........................................ return NULL; // There's no match.................... }............................................................ #endif............................................................ #define DELKA 40.................... #define VYKON 100........................................ char odp[DELKA];........................................ int1 check_new_sms().................... {.................... fprintf(MOBIL,"AT+CMGL=0\r"); //vycti prijate SMS (0=nove;1=vsechny)*022E: CLRF 51022F: MOVF 51,W0230: CALL 0040231: IORLW 000232: BTFSC 03.20233: GOTO 2380234: INCF 51,F0235: MOVWF 530236: CALL 1DE0237: GOTO 22F.................... while(fgetc(MOBIL)!=0x0A); // predkoc prvni radek odpovedi0238: CALL 2060239: MOVF 78,W023A: SUBLW 0A023B: BTFSS 03.2023C: GOTO 238.................... odp[0]=fgetc(MOBIL); // Nacti prvni dva znaky druheho radku odpovedi023D: CALL 206023E: MOVF 78,W023F: MOVWF 26.................... odp[1]=fgetc(MOBIL);0240: CALL 2060241: MOVF 78,W0242: MOVWF 27.................... while(fgetc(MOBIL)!=0x0A); // Preskoc zbytek radku0243: CALL 2060244: MOVF 78,W0245: SUBLW 0A0246: BTFSS 03.20247: GOTO 243........................................ if(odp[0] == 'O' && odp[1] == 'K') return 1;0248: MOVF 26,W0249: SUBLW 4F024A: BTFSS 03.2024B: GOTO 254024C: MOVF 27,W024D: SUBLW 4B024E: BTFSS 03.2024F: GOTO 2540250: MOVLW 010251: MOVWF 780252: GOTO 257.................... else return 0;0253: GOTO 2570254: MOVLW 000255: MOVWF 780256: GOTO 257.................... }0257: BSF 0A.30258: BCF 0A.40259: GOTO 0A1 (RETURN)........................................ read_sms().................... {.................... int pom,pom2,pom3,odkl,odkl2,maskovadlo;.................... for(pom=0;pom<54;pom++) //preskoc nedulezite informace025A: CLRF 51025B: MOVF 51,W025C: SUBLW 35025D: BTFSS 03.0025E: GOTO 262.................... {.................... fgetc(MOBIL);025F: CALL 206.................... }0260: INCF 51,F0261: GOTO 25B........................................ //gets(odp); //uloz zakodovany text SMS........................................ odp[0]=fgetc(MOBIL);0262: CALL 2060263: MOVF 78,W0264: MOVWF 26.................... odp[1]=fgetc(MOBIL);0265: CALL 2060266: MOVF 78,W0267: MOVWF 27.................... odp[2]=fgetc(MOBIL);0268: CALL 2060269: MOVF 78,W026A: MOVWF 28.................... odp[3]=fgetc(MOBIL);026B: CALL 206026C: MOVF 78,W026D: MOVWF 29.................... odp[4]=fgetc(MOBIL);026E: CALL 206026F: MOVF 78,W0270: MOVWF 2A.................... odp[5]=fgetc(MOBIL);0271: CALL 2060272: MOVF 78,W0273: MOVWF 2B.................... odp[6]=fgetc(MOBIL);0274: CALL 2060275: MOVF 78,W0276: MOVWF 2C.................... odp[7]=fgetc(MOBIL);0277: CALL 2060278: MOVF 78,W0279: MOVWF 2D........................................ /*lcd_gotoxy(1,1);.................... printf(lcd_putc,"\f%s\n",odp);*/........................................ if(odp[0]==0) odp[1]='0'; // Prevod z ASCII do BIN027A: MOVF 26,F027B: BTFSS 03.2027C: GOTO 27F027D: MOVLW 30027E: MOVWF 27.................... odp[0]=odp[0] - '0';027F: MOVLW 300280: SUBWF 26,F.................... odp[1]=odp[1] - '0';0281: SUBWF 27,F.................... if(odp[0]>9) odp[0]=odp[0]-7;0282: MOVF 26,W0283: SUBLW 090284: BTFSC 03.00285: GOTO 2880286: MOVLW 070287: SUBWF 26,F.................... if(odp[1]>9) odp[1]=odp[1]-7;0288: MOVF 27,W0289: SUBLW 09028A: BTFSC 03.0028B: GOTO 28E028C: MOVLW 07028D: SUBWF 27,F.................... odp[0]=odp[0] << 4;028E: SWAPF 26,F028F: MOVLW F00290: ANDWF 26,F.................... odp[0] |= odp[1];0291: MOVF 27,W0292: IORWF 26,F........................................ if(odp[2]==0) odp[3]='0';0293: MOVF 28,F0294: BTFSS 03.20295: GOTO 2980296: MOVLW 300297: MOVWF 29.................... odp[2]=odp[2] - '0';0298: MOVLW 300299: SUBWF 28,F.................... odp[3]=odp[3] - '0';029A: SUBWF 29,F.................... if(odp[2]>9) odp[2]=odp[2]-7;029B: MOVF 28,W029C: SUBLW 09029D: BTFSC 03.0029E: GOTO 2A1029F: MOVLW 0702A0: SUBWF 28,F.................... if(odp[3]>9) odp[3]=odp[3]-7;02A1: MOVF 29,W02A2: SUBLW 0902A3: BTFSC 03.002A4: GOTO 2A702A5: MOVLW 0702A6: SUBWF 29,F.................... odp[2]=odp[2] << 4;02A7: SWAPF 28,F02A8: MOVLW F002A9: ANDWF 28,F.................... odp[2] |= odp[3];02AA: MOVF 29,W02AB: IORWF 28,F........................................ if(odp[4]==0) odp[5]='0';02AC: MOVF 2A,F02AD: BTFSS 03.202AE: GOTO 2B102AF: MOVLW 3002B0: MOVWF 2B.................... odp[4]=odp[4] - '0';02B1: MOVLW 3002B2: SUBWF 2A,F.................... odp[5]=odp[5] - '0';02B3: SUBWF 2B,F.................... if(odp[4]>9) odp[4]=odp[4]-7;02B4: MOVF 2A,W02B5: SUBLW 0902B6: BTFSC 03.002B7: GOTO 2BA02B8: MOVLW 0702B9: SUBWF 2A,F.................... if(odp[5]>9) odp[5]=odp[5]-7;02BA: MOVF 2B,W02BB: SUBLW 0902BC: BTFSC 03.002BD: GOTO 2C002BE: MOVLW 0702BF: SUBWF 2B,F.................... odp[4]=odp[4] << 4;02C0: SWAPF 2A,F02C1: MOVLW F002C2: ANDWF 2A,F.................... odp[4] |= odp[5];02C3: MOVF 2B,W02C4: IORWF 2A,F........................................ if(odp[6]==0) odp[7]='0';02C5: MOVF 2C,F02C6: BTFSS 03.202C7: GOTO 2CA02C8: MOVLW 3002C9: MOVWF 2D.................... odp[6]=odp[6] - '0';02CA: MOVLW 3002CB: SUBWF 2C,F.................... odp[7]=odp[7] - '0';02CC: SUBWF 2D,F.................... if(odp[6]>9) odp[6]=odp[6]-7;02CD: MOVF 2C,W02CE: SUBLW 0902CF: BTFSC 03.002D0: GOTO 2D302D1: MOVLW 0702D2: SUBWF 2C,F.................... if(odp[7]>9) odp[7]=odp[7]-7;02D3: MOVF 2D,W02D4: SUBLW 0902D5: BTFSC 03.002D6: GOTO 2D902D7: MOVLW 0702D8: SUBWF 2D,F.................... odp[6]=odp[6] << 4;02D9: SWAPF 2C,F02DA: MOVLW F002DB: ANDWF 2C,F.................... odp[6] |= odp[7];02DC: MOVF 2D,W02DD: IORWF 2C,F........................................ odp[1]=odp[2];02DE: MOVF 28,W02DF: MOVWF 27.................... odp[2]=odp[4];02E0: MOVF 2A,W02E1: MOVWF 28.................... odp[3]=odp[6];02E2: MOVF 2C,W02E3: MOVWF 29.................... odp[4]=odp[5]=odp[6]=0;02E4: CLRF 2C02E5: MOVF 2C,W02E6: MOVWF 2B02E7: MOVWF 2A........................................ /*lcd_gotoxy(1,2);.................... printf(lcd_putc,"%u %u %u %u",odp[0],odp[1],odp[2]odp[3]); */........................................ pom3=0;02E8: CLRF 53.................... for (pom = 0; pom < 4;pom++)02E9: CLRF 5102EA: MOVF 51,W02EB: SUBLW 0302EC: BTFSS 03.002ED: GOTO 341.................... {.................... maskovadlo = maskovadlo >> 1; //rotace promene urcene pro maskovani02EE: BCF 03.002EF: RRF 56,F.................... maskovadlo = maskovadlo | 0x80;02F0: BSF 56.7.................... odkl = odp[pom] & maskovadlo; //odlozeni "prenosu" do odkl pomoci maskovadla02F1: MOVLW 2602F2: ADDWF 51,W02F3: MOVWF 0402F4: MOVF 00,W02F5: ANDWF 56,W02F6: MOVWF 54.................... odp[pom] = odp[pom] << pom3; //rotace znaku02F7: MOVLW 2602F8: ADDWF 51,W02F9: MOVWF 5702FA: MOVLW 2602FB: ADDWF 51,W02FC: MOVWF 0402FD: MOVF 00,W02FE: MOVWF 7702FF: MOVF 53,W0300: MOVWF 780301: BTFSC 03.20302: GOTO 3070303: BCF 03.00304: RLF 77,F0305: DECFSZ 78,F0306: GOTO 3030307: MOVF 57,W0308: MOVWF 040309: MOVF 77,W030A: MOVWF 00.................... for (pom2 = 0; pom2 < (8-pom3);pom2++) //rotace odkl2030B: CLRF 52030C: MOVF 53,W030D: SUBLW 08030E: SUBWF 52,W030F: BTFSC 03.00310: GOTO 316.................... {.................... odkl2 = odkl2 >> 1;0311: BCF 03.00312: RRF 55,F.................... odkl2 = odkl2 & 127;0313: BCF 55.7.................... }0314: INCF 52,F0315: GOTO 30C.................... odp[pom] = odp[pom] | odkl2; //pridani odkl2 ke znaku0316: MOVLW 260317: ADDWF 51,W0318: MOVWF 570319: MOVLW 26031A: ADDWF 51,W031B: MOVWF 04031C: MOVF 00,W031D: IORWF 55,W031E: MOVWF 59031F: MOVF 57,W0320: MOVWF 040321: MOVF 59,W0322: MOVWF 00.................... odp[pom] = odp[pom] & 127; //smazani nejvysiho bitu0323: MOVLW 260324: ADDWF 51,W0325: MOVWF 570326: MOVLW 260327: ADDWF 51,W0328: MOVWF 040329: MOVF 00,W032A: ANDLW 7F032B: MOVWF 59032C: MOVF 57,W032D: MOVWF 04032E: MOVF 59,W032F: MOVWF 00.................... odkl2 = odkl; //ulozeni odlk na dalsi pruchod0330: MOVF 54,W0331: MOVWF 55.................... pom3++; //inkrementace citace rotace0332: INCF 53,F.................... if (pom3 == 8) //kazdy 8my znak0333: MOVF 53,W0334: SUBLW 080335: BTFSS 03.20336: GOTO 33F.................... {.................... pom3 = 0; //smaz citac0337: CLRF 53.................... odp[pom+1] = odkl2; //uloz 8my znak vznikly z "prenosu"0338: MOVLW 010339: ADDWF 51,W033A: ADDLW 26033B: MOVWF 04033C: MOVF 55,W033D: MOVWF 00.................... maskovadlo = 0; //smaz maskovadlo033E: CLRF 56.................... }.................... }033F: INCF 51,F0340: GOTO 2EA.................... odp[pom]='\0';0341: MOVLW 260342: ADDWF 51,W0343: MOVWF 040344: CLRF 00.................... }0345: BSF 0A.30346: BCF 0A.40347: GOTO 0B1 (RETURN)........................................ void read_time().................... {.................... unsigned int8 n;............................................................ fprintf(MOBIL,"AT+CCLK?\r");*037F: CLRF 520380: MOVF 52,W0381: CALL 0130382: IORLW 000383: BTFSC 03.20384: GOTO 3890385: INCF 52,F0386: MOVWF 530387: CALL 1DE0388: GOTO 380.................... while(fgetc(MOBIL)!='"');0389: CALL 206038A: MOVF 78,W038B: SUBLW 22038C: BTFSS 03.2038D: GOTO 389.................... for(n=0;n<12;n++) //preskoc nedulezite informace038E: CLRF 51038F: MOVF 51,W0390: SUBLW 0B0391: BTFSS 03.00392: GOTO 396.................... {.................... fgetc(MOBIL);0393: CALL 206.................... }0394: INCF 51,F0395: GOTO 38F.................... odp[0]=fgetc(MOBIL);0396: CALL 2060397: MOVF 78,W0398: MOVWF 26.................... odp[1]=fgetc(MOBIL);0399: CALL 206039A: MOVF 78,W039B: MOVWF 27.................... odp[2]=0;039C: CLRF 28.................... }039D: BSF 0A.3039E: BCF 0A.4039F: GOTO 4FA (RETURN)........................................ void del_sms().................... {.................... fprintf(MOBIL,"AT+CMGD=1\r"); //smaz prijatou SMSku*0374: CLRF 510375: MOVF 51,W0376: CALL 0210377: IORLW 000378: BTFSC 03.20379: GOTO 37E037A: INCF 51,F037B: MOVWF 53037C: CALL 1DE037D: GOTO 375.................... }037E: RETLW 00........................................ void main().................... {*0800: CLRF 040801: MOVLW 1F0802: ANDWF 03,F0803: BCF 20.60804: MOVF 20,W0805: BSF 03.50806: MOVWF 070807: BCF 03.50808: BSF 07.60809: BSF 03.5080A: BCF 06.2080B: BCF 03.5080C: BSF 06.2080D: BSF 03.5080E: BSF 1F.0080F: BSF 1F.10810: BSF 1F.20811: BCF 1F.30812: MOVLW 070813: MOVWF 1C.................... setup_adc_ports(NO_ANALOGS);*081D: BSF 03.5081E: BSF 1F.0081F: BSF 1F.10820: BSF 1F.20821: BCF 1F.3.................... setup_adc(ADC_OFF);0822: BCF 03.50823: BCF 1F.0.................... setup_spi(SPI_SS_DISABLED);0824: BCF 14.50825: BCF 20.50826: MOVF 20,W0827: BSF 03.50828: MOVWF 070829: BCF 03.5082A: BSF 20.4082B: MOVF 20,W082C: BSF 03.5082D: MOVWF 07082E: BCF 03.5082F: BCF 20.30830: MOVF 20,W0831: BSF 03.50832: MOVWF 070833: MOVLW 010834: BCF 03.50835: MOVWF 140836: MOVLW 000837: BSF 03.50838: MOVWF 14.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);0839: MOVF 01,W083A: ANDLW C7083B: IORLW 08083C: MOVWF 01.................... setup_timer_1(T1_DISABLED);083D: BCF 03.5083E: CLRF 10.................... setup_timer_2(T2_DIV_BY_4,255,1);083F: MOVLW 000840: MOVWF 780841: IORLW 050842: MOVWF 120843: MOVLW FF0844: BSF 03.50845: MOVWF 12.................... setup_ccp1(CCP_PWM);0846: BCF 03.50847: BCF 20.20848: MOVF 20,W0849: BSF 03.5084A: MOVWF 07084B: BCF 03.5084C: BCF 07.2084D: MOVLW 0C084E: MOVWF 17.................... setup_ccp2(CCP_PWM);084F: BCF 20.10850: MOVF 20,W0851: BSF 03.50852: MOVWF 070853: BCF 03.50854: BCF 07.10855: MOVLW 0C0856: MOVWF 1D.................... setup_comparator(NC_NC_NC_NC);0857: MOVLW 070858: BSF 03.50859: MOVWF 1C085A: MOVF 05,W085B: CLRWDT085C: MOVLW 0E085D: MOVWF 77085E: DECFSZ 77,F085F: GOTO 05E0860: NOP0861: NOP0862: MOVF 1C,W0863: BCF 03.50864: BCF 0D.6.................... setup_vref(FALSE);0865: BSF 03.50866: CLRF 1D.................... setup_wdt(WDT_2304MS);0867: MOVLW 0F0868: MOVWF 770869: MOVLW 07086A: BCF 03.5086B: CLRF 01086C: MOVLW 81086D: MOVWF 04086E: MOVF 00,W086F: ANDLW F00870: IORLW 070871: MOVWF 000872: CLRWDT0873: MOVF 00,W0874: ANDLW F70875: BTFSC 77.30876: ANDLW F00877: IORWF 77,W0878: MOVWF 00........................................ set_pwm1_duty(0);0879: CLRF 15.................... set_pwm2_duty(0);087A: CLRF 1B........................................ while(TRUE).................... {.................... unsigned int8 n;.................... char *ptr;.................... int time;........................................ output_low(PIN_A4) ;087B: BSF 03.5087C: BCF 05.4087D: BCF 03.5087E: BCF 05.4.................... delay_ms(150);087F: MOVLW 960880: MOVWF 520881: BCF 0A.30882: CALL 1C80883: BSF 0A.3.................... output_high(PIN_A4);0884: BSF 03.50885: BCF 05.40886: BCF 03.50887: BSF 05.4.................... delay_ms(150);0888: MOVLW 960889: MOVWF 52088A: BCF 0A.3088B: CALL 1C8088C: BSF 0A.3.................... output_low(PIN_A4) ;088D: BSF 03.5088E: BCF 05.4088F: BCF 03.50890: BCF 05.4.................... delay_ms(150);0891: MOVLW 960892: MOVWF 520893: BCF 0A.30894: CALL 1C80895: BSF 0A.3.................... output_high(PIN_A4);0896: BSF 03.50897: BCF 05.40898: BCF 03.50899: BSF 05.4.................... delay_ms(150);089A: MOVLW 96089B: MOVWF 52089C: BCF 0A.3089D: CALL 1C8089E: BSF 0A.3............................................................ if(check_new_sms()) // Je odpoved "OK"?089F: BCF 0A.308A0: GOTO 22E08A1: BSF 0A.308A2: MOVF 78,F08A3: BTFSC 03.208A4: GOTO 0AF.................... {.................... // printf(lcd_putc,"736 655 250");.................... delay_ms(1000);08A5: MOVLW 0408A6: MOVWF 5108A7: MOVLW FA08A8: MOVWF 5208A9: BCF 0A.308AA: CALL 1C808AB: BSF 0A.308AC: DECFSZ 51,F08AD: GOTO 0A7.................... }.................... else08AE: GOTO 4F8.................... {.................... read_sms();08AF: BCF 0A.308B0: GOTO 25A08B1: BSF 0A.3........................................ if (toupper(odp[0]) == 'A')08B2: MOVF 26,W08B3: SUBLW 6008B4: BTFSC 03.008B5: GOTO 0BD08B6: MOVF 26,W08B7: SUBLW 7A08B8: BTFSS 03.008B9: GOTO 0BD08BA: MOVF 26,W08BB: ANDLW DF08BC: GOTO 0BE08BD: MOVF 26,W08BE: SUBLW 4108BF: BTFSS 03.208C0: GOTO 101.................... {.................... set_pwm1_duty(VYKON);08C1: MOVLW 6408C2: MOVWF 15.................... set_pwm2_duty(VYKON);08C3: MOVWF 1B.................... Delay_ms(10000);08C4: MOVLW 2808C5: MOVWF 5108C6: MOVLW FA08C7: MOVWF 5208C8: BCF 0A.308C9: CALL 1C808CA: BSF 0A.308CB: DECFSZ 51,F08CC: GOTO 0C6.................... fprintf(VRTULE,"JACK[BARmk"); // "JACK BAR :)"08CD: CLRF 5108CE: MOVF 51,W08CF: BCF 0A.308D0: CALL 03008D1: BSF 0A.308D2: IORLW 0008D3: BTFSC 03.208D4: GOTO 0DB08D5: INCF 51,F08D6: MOVWF 5208D7: BCF 0A.308D8: CALL 34808D9: BSF 0A.308DA: GOTO 0CE.................... Delay_ms(2000);08DB: MOVLW 0808DC: MOVWF 5108DD: MOVLW FA08DE: MOVWF 5208DF: BCF 0A.308E0: CALL 1C808E1: BSF 0A.308E2: DECFSZ 51,F08E3: GOTO 0DD.................... fprintf(VRTULE,"JACK[BARmk"); // "JACK BAR :)"08E4: CLRF 5108E5: MOVF 51,W08E6: BCF 0A.308E7: CALL 03008E8: BSF 0A.308E9: IORLW 0008EA: BTFSC 03.208EB: GOTO 0F208EC: INCF 51,F08ED: MOVWF 5208EE: BCF 0A.308EF: CALL 34808F0: BSF 0A.308F1: GOTO 0E5.................... Delay_ms(5000);08F2: MOVLW 1408F3: MOVWF 5108F4: MOVLW FA08F5: MOVWF 5208F6: BCF 0A.308F7: CALL 1C808F8: BSF 0A.308F9: DECFSZ 51,F08FA: GOTO 0F4.................... set_pwm1_duty(0);08FB: CLRF 15.................... set_pwm2_duty(0);08FC: CLRF 1B.................... del_sms();08FD: BCF 0A.308FE: CALL 37408FF: BSF 0A.3.................... break;0900: GOTO 532.................... }........................................ if (toupper(odp[0]) == 'B')0901: MOVF 26,W0902: SUBLW 600903: BTFSC 03.00904: GOTO 10C0905: MOVF 26,W0906: SUBLW 7A0907: BTFSS 03.00908: GOTO 10C0909: MOVF 26,W090A: ANDLW DF090B: GOTO 10D090C: MOVF 26,W090D: SUBLW 42090E: BTFSS 03.2090F: GOTO 160.................... {.................... set_pwm1_duty(VYKON);0910: MOVLW 640911: MOVWF 15.................... set_pwm2_duty(VYKON);0912: MOVWF 1B.................... Delay_ms(10000);0913: MOVLW 280914: MOVWF 510915: MOVLW FA0916: MOVWF 520917: BCF 0A.30918: CALL 1C80919: BSF 0A.3091A: DECFSZ 51,F091B: GOTO 115.................... for(n=0;n<=1;n++)091C: CLRF 4E091D: MOVF 4E,W091E: SUBLW 01091F: BTFSS 03.00920: GOTO 151.................... {.................... fprintf(VRTULE,"[ERROR[d[["); // " ERROR 3 "0921: CLRF 510922: MOVF 51,W0923: BCF 0A.30924: CALL 03F0925: BSF 0A.30926: IORLW 000927: BTFSC 03.20928: GOTO 12F0929: INCF 51,F092A: MOVWF 52092B: BCF 0A.3092C: CALL 348092D: BSF 0A.3092E: GOTO 122.................... Delay_ms(2000);092F: MOVLW 080930: MOVWF 510931: MOVLW FA0932: MOVWF 520933: BCF 0A.30934: CALL 1C80935: BSF 0A.30936: DECFSZ 51,F0937: GOTO 131.................... fprintf(VRTULE,"[OVERFLOW["); // " OVERFLOW "0938: CLRF 510939: MOVF 51,W093A: BCF 0A.3093B: CALL 04E093C: BSF 0A.3093D: IORLW 00093E: BTFSC 03.2093F: GOTO 1460940: INCF 51,F0941: MOVWF 520942: BCF 0A.30943: CALL 3480944: BSF 0A.30945: GOTO 139.................... Delay_ms(2000);0946: MOVLW 080947: MOVWF 510948: MOVLW FA0949: MOVWF 52094A: BCF 0A.3094B: CALL 1C8094C: BSF 0A.3094D: DECFSZ 51,F094E: GOTO 148.................... }094F: INCF 4E,F0950: GOTO 11D.................... Delay_ms(5000);0951: MOVLW 140952: MOVWF 510953: MOVLW FA0954: MOVWF 520955: BCF 0A.30956: CALL 1C80957: BSF 0A.30958: DECFSZ 51,F0959: GOTO 153.................... set_pwm1_duty(0);095A: CLRF 15.................... set_pwm2_duty(0);095B: CLRF 1B.................... del_sms();095C: BCF 0A.3095D: CALL 374095E: BSF 0A.3.................... break;095F: GOTO 532.................... }........................................ if (toupper(odp[0]) == 'C')0960: MOVF 26,W0961: SUBLW 600962: BTFSC 03.00963: GOTO 16B0964: MOVF 26,W0965: SUBLW 7A0966: BTFSS 03.00967: GOTO 16B0968: MOVF 26,W0969: ANDLW DF096A: GOTO 16C096B: MOVF 26,W096C: SUBLW 43096D: BTFSS 03.2096E: GOTO 1D6.................... {.................... set_pwm1_duty(VYKON);096F: MOVLW 640970: MOVWF 15.................... set_pwm2_duty(VYKON);0971: MOVWF 1B.................... Delay_ms(10000);0972: MOVLW 280973: MOVWF 510974: MOVLW FA0975: MOVWF 520976: BCF 0A.30977: CALL 1C80978: BSF 0A.30979: DECFSZ 51,F097A: GOTO 174.................... for(n=0;n<=1;n++)097B: CLRF 4E097C: MOVF 4E,W097D: SUBLW 01097E: BTFSS 03.0097F: GOTO 1C7.................... {.................... fprintf(VRTULE,"[ERROR[e[["); // " ERROR 4 "0980: CLRF 510981: MOVF 51,W0982: BCF 0A.30983: CALL 05D0984: BSF 0A.30985: IORLW 000986: BTFSC 03.20987: GOTO 18E0988: INCF 51,F0989: MOVWF 52098A: BCF 0A.3098B: CALL 348098C: BSF 0A.3098D: GOTO 181.................... Delay_ms(2000);098E: MOVLW 08098F: MOVWF 510990: MOVLW FA0991: MOVWF 520992: BCF 0A.30993: CALL 1C80994: BSF 0A.30995: DECFSZ 51,F0996: GOTO 190.................... fprintf(VRTULE,"[OPAKUJTE["); // " OPAKUJTE "0997: CLRF 510998: MOVF 51,W0999: BCF 0A.3099A: CALL 06C099B: BSF 0A.3099C: IORLW 00099D: BTFSC 03.2099E: GOTO 1A5099F: INCF 51,F09A0: MOVWF 5209A1: BCF 0A.309A2: CALL 34809A3: BSF 0A.309A4: GOTO 198.................... Delay_ms(2000);09A5: MOVLW 0809A6: MOVWF 5109A7: MOVLW FA09A8: MOVWF 5209A9: BCF 0A.309AA: CALL 1C809AB: BSF 0A.309AC: DECFSZ 51,F09AD: GOTO 1A7.................... fprintf(VRTULE,"[[VOLBU[[["); // " VOLBU "09AE: CLRF 5109AF: MOVF 51,W09B0: BCF 0A.309B1: CALL 07B09B2: BSF 0A.309B3: IORLW 0009B4: BTFSC 03.209B5: GOTO 1BC09B6: INCF 51,F09B7: MOVWF 5209B8: BCF 0A.309B9: CALL 34809BA: BSF 0A.309BB: GOTO 1AF.................... Delay_ms(2000);09BC: MOVLW 0809BD: MOVWF 5109BE: MOVLW FA09BF: MOVWF 5209C0: BCF 0A.309C1: CALL 1C809C2: BSF 0A.309C3: DECFSZ 51,F09C4: GOTO 1BE.................... }09C5: INCF 4E,F09C6: GOTO 17C.................... Delay_ms(3000);09C7: MOVLW 0C09C8: MOVWF 5109C9: MOVLW FA09CA: MOVWF 5209CB: BCF 0A.309CC: CALL 1C809CD: BSF 0A.309CE: DECFSZ 51,F09CF: GOTO 1C9.................... set_pwm1_duty(0);09D0: CLRF 15.................... set_pwm2_duty(0);09D1: CLRF 1B.................... del_sms();09D2: BCF 0A.309D3: CALL 37409D4: BSF 0A.3.................... break;09D5: GOTO 532.................... }........................................ if (toupper(odp[0]) == 'D')09D6: MOVF 26,W09D7: SUBLW 6009D8: BTFSC 03.009D9: GOTO 1E109DA: MOVF 26,W09DB: SUBLW 7A09DC: BTFSS 03.009DD: GOTO 1E109DE: MOVF 26,W09DF: ANDLW DF09E0: GOTO 1E209E1: MOVF 26,W09E2: SUBLW 4409E3: BTFSS 03.209E4: GOTO 225.................... {.................... set_pwm1_duty(VYKON);09E5: MOVLW 6409E6: MOVWF 15.................... set_pwm2_duty(VYKON);09E7: MOVWF 1B.................... Delay_ms(10000);09E8: MOVLW 2809E9: MOVWF 5109EA: MOVLW FA09EB: MOVWF 5209EC: BCF 0A.309ED: CALL 1C809EE: BSF 0A.309EF: DECFSZ 51,F09F0: GOTO 1EA.................... fprintf(VRTULE,"[[PEACE[[["); // " PEACE "09F1: CLRF 5109F2: MOVF 51,W09F3: BCF 0A.309F4: CALL 08A09F5: BSF 0A.309F6: IORLW 0009F7: BTFSC 03.209F8: GOTO 1FF09F9: INCF 51,F09FA: MOVWF 5209FB: BCF 0A.309FC: CALL 34809FD: BSF 0A.309FE: GOTO 1F2.................... Delay_ms(2000);09FF: MOVLW 080A00: MOVWF 510A01: MOVLW FA0A02: MOVWF 520A03: BCF 0A.30A04: CALL 1C80A05: BSF 0A.30A06: DECFSZ 51,F0A07: GOTO 201.................... fprintf(VRTULE,"[[PEACE[[[");0A08: CLRF 510A09: MOVF 51,W0A0A: BCF 0A.30A0B: CALL 08A0A0C: BSF 0A.30A0D: IORLW 000A0E: BTFSC 03.20A0F: GOTO 2160A10: INCF 51,F0A11: MOVWF 520A12: BCF 0A.30A13: CALL 3480A14: BSF 0A.30A15: GOTO 209.................... Delay_ms(3000);0A16: MOVLW 0C0A17: MOVWF 510A18: MOVLW FA0A19: MOVWF 520A1A: BCF 0A.30A1B: CALL 1C80A1C: BSF 0A.30A1D: DECFSZ 51,F0A1E: GOTO 218.................... set_pwm1_duty(0);0A1F: CLRF 15.................... set_pwm2_duty(0);0A20: CLRF 1B.................... del_sms();0A21: BCF 0A.30A22: CALL 3740A23: BSF 0A.3.................... break;0A24: GOTO 532.................... }........................................ if (toupper(odp[0]) == 'E')0A25: MOVF 26,W0A26: SUBLW 600A27: BTFSC 03.00A28: GOTO 2300A29: MOVF 26,W0A2A: SUBLW 7A0A2B: BTFSS 03.00A2C: GOTO 2300A2D: MOVF 26,W0A2E: ANDLW DF0A2F: GOTO 2310A30: MOVF 26,W0A31: SUBLW 450A32: BTFSS 03.20A33: GOTO 284.................... {.................... set_pwm1_duty(VYKON);0A34: MOVLW 640A35: MOVWF 15.................... set_pwm2_duty(VYKON);0A36: MOVWF 1B.................... Delay_ms(10000);0A37: MOVLW 280A38: MOVWF 510A39: MOVLW FA0A3A: MOVWF 520A3B: BCF 0A.30A3C: CALL 1C80A3D: BSF 0A.30A3E: DECFSZ 51,F0A3F: GOTO 239.................... for(n=0;n<=1;n++)0A40: CLRF 4E0A41: MOVF 4E,W0A42: SUBLW 010A43: BTFSS 03.00A44: GOTO 275.................... {.................... fprintf(VRTULE,"[[[MORE[[["); // " MORE "0A45: CLRF 510A46: MOVF 51,W0A47: BCF 0A.30A48: CALL 0990A49: BSF 0A.30A4A: IORLW 000A4B: BTFSC 03.20A4C: GOTO 2530A4D: INCF 51,F0A4E: MOVWF 520A4F: BCF 0A.30A50: CALL 3480A51: BSF 0A.30A52: GOTO 246.................... Delay_ms(2000);0A53: MOVLW 080A54: MOVWF 510A55: MOVLW FA0A56: MOVWF 520A57: BCF 0A.30A58: CALL 1C80A59: BSF 0A.30A5A: DECFSZ 51,F0A5B: GOTO 255.................... fprintf(VRTULE,"[[ZE[JO[[["); // " ZE JO "0A5C: CLRF 510A5D: MOVF 51,W0A5E: BCF 0A.30A5F: CALL 0A80A60: BSF 0A.30A61: IORLW 000A62: BTFSC 03.20A63: GOTO 26A0A64: INCF 51,F0A65: MOVWF 520A66: BCF 0A.30A67: CALL 3480A68: BSF 0A.30A69: GOTO 25D.................... Delay_ms(2000);0A6A: MOVLW 080A6B: MOVWF 510A6C: MOVLW FA0A6D: MOVWF 520A6E: BCF 0A.30A6F: CALL 1C80A70: BSF 0A.30A71: DECFSZ 51,F0A72: GOTO 26C.................... }0A73: INCF 4E,F0A74: GOTO 241.................... Delay_ms(5000);0A75: MOVLW 140A76: MOVWF 510A77: MOVLW FA0A78: MOVWF 520A79: BCF 0A.30A7A: CALL 1C80A7B: BSF 0A.30A7C: DECFSZ 51,F0A7D: GOTO 277.................... set_pwm1_duty(0);0A7E: CLRF 15.................... set_pwm2_duty(0);0A7F: CLRF 1B.................... del_sms();0A80: BCF 0A.30A81: CALL 3740A82: BSF 0A.3.................... break;0A83: GOTO 532.................... }........................................ if (toupper(odp[0]) == 'F')0A84: MOVF 26,W0A85: SUBLW 600A86: BTFSC 03.00A87: GOTO 28F0A88: MOVF 26,W0A89: SUBLW 7A0A8A: BTFSS 03.00A8B: GOTO 28F0A8C: MOVF 26,W0A8D: ANDLW DF0A8E: GOTO 2900A8F: MOVF 26,W0A90: SUBLW 460A91: BTFSS 03.20A92: GOTO 2E3.................... {.................... set_pwm1_duty(VYKON);0A93: MOVLW 640A94: MOVWF 15.................... set_pwm2_duty(VYKON);0A95: MOVWF 1B.................... Delay_ms(10000);0A96: MOVLW 280A97: MOVWF 510A98: MOVLW FA0A99: MOVWF 520A9A: BCF 0A.30A9B: CALL 1C80A9C: BSF 0A.30A9D: DECFSZ 51,F0A9E: GOTO 298.................... for(n=0;n<=1;n++)0A9F: CLRF 4E0AA0: MOVF 4E,W0AA1: SUBLW 010AA2: BTFSS 03.00AA3: GOTO 2D4.................... {.................... fprintf(VRTULE,"[ROZBITY[["); // " ROZBITY "0AA4: CLRF 510AA5: MOVF 51,W0AA6: BCF 0A.30AA7: CALL 0B70AA8: BSF 0A.30AA9: IORLW 000AAA: BTFSC 03.20AAB: GOTO 2B20AAC: INCF 51,F0AAD: MOVWF 520AAE: BCF 0A.30AAF: CALL 3480AB0: BSF 0A.30AB1: GOTO 2A5.................... Delay_ms(2000);0AB2: MOVLW 080AB3: MOVWF 510AB4: MOVLW FA0AB5: MOVWF 520AB6: BCF 0A.30AB7: CALL 1C80AB8: BSF 0A.30AB9: DECFSZ 51,F0ABA: GOTO 2B4.................... fprintf(VRTULE,"[[BUDIK[[["); // " BUDIK "0ABB: CLRF 510ABC: MOVF 51,W0ABD: BCF 0A.30ABE: CALL 0C60ABF: BSF 0A.30AC0: IORLW 000AC1: BTFSC 03.20AC2: GOTO 2C90AC3: INCF 51,F0AC4: MOVWF 520AC5: BCF 0A.30AC6: CALL 3480AC7: BSF 0A.30AC8: GOTO 2BC.................... Delay_ms(2000);0AC9: MOVLW 080ACA: MOVWF 510ACB: MOVLW FA0ACC: MOVWF 520ACD: BCF 0A.30ACE: CALL 1C80ACF: BSF 0A.30AD0: DECFSZ 51,F0AD1: GOTO 2CB.................... }0AD2: INCF 4E,F0AD3: GOTO 2A0.................... Delay_ms(5000);0AD4: MOVLW 140AD5: MOVWF 510AD6: MOVLW FA0AD7: MOVWF 520AD8: BCF 0A.30AD9: CALL 1C80ADA: BSF 0A.30ADB: DECFSZ 51,F0ADC: GOTO 2D6.................... set_pwm1_duty(0);0ADD: CLRF 15.................... set_pwm2_duty(0);0ADE: CLRF 1B.................... del_sms();0ADF: BCF 0A.30AE0: CALL 3740AE1: BSF 0A.3.................... break;0AE2: GOTO 532.................... }........................................ if (toupper(odp[0]) == 'G')0AE3: MOVF 26,W0AE4: SUBLW 600AE5: BTFSC 03.00AE6: GOTO 2EE0AE7: MOVF 26,W0AE8: SUBLW 7A0AE9: BTFSS 03.00AEA: GOTO 2EE0AEB: MOVF 26,W0AEC: ANDLW DF0AED: GOTO 2EF0AEE: MOVF 26,W0AEF: SUBLW 470AF0: BTFSS 03.20AF1: GOTO 342.................... {.................... set_pwm1_duty(VYKON);0AF2: MOVLW 640AF3: MOVWF 15.................... set_pwm2_duty(VYKON);0AF4: MOVWF 1B.................... Delay_ms(10000);0AF5: MOVLW 280AF6: MOVWF 510AF7: MOVLW FA0AF8: MOVWF 520AF9: BCF 0A.30AFA: CALL 1C80AFB: BSF 0A.30AFC: DECFSZ 51,F0AFD: GOTO 2F7.................... for(n=0;n<=1;n++)0AFE: CLRF 4E0AFF: MOVF 4E,W0B00: SUBLW 010B01: BTFSS 03.00B02: GOTO 333.................... {.................... fprintf(VRTULE,"[ZAPOJIT[["); // " ZAPOJIT "0B03: CLRF 510B04: MOVF 51,W0B05: BCF 0A.30B06: CALL 0D50B07: BSF 0A.30B08: IORLW 000B09: BTFSC 03.20B0A: GOTO 3110B0B: INCF 51,F0B0C: MOVWF 520B0D: BCF 0A.30B0E: CALL 3480B0F: BSF 0A.30B10: GOTO 304.................... Delay_ms(2000);0B11: MOVLW 080B12: MOVWF 510B13: MOVLW FA0B14: MOVWF 520B15: BCF 0A.30B16: CALL 1C80B17: BSF 0A.30B18: DECFSZ 51,F0B19: GOTO 313.................... fprintf(VRTULE,"[ZASUVKU[["); // " ZASUVKU "0B1A: CLRF 510B1B: MOVF 51,W0B1C: BCF 0A.30B1D: CALL 0E40B1E: BSF 0A.30B1F: IORLW 000B20: BTFSC 03.20B21: GOTO 3280B22: INCF 51,F0B23: MOVWF 520B24: BCF 0A.30B25: CALL 3480B26: BSF 0A.30B27: GOTO 31B.................... Delay_ms(2000);0B28: MOVLW 080B29: MOVWF 510B2A: MOVLW FA0B2B: MOVWF 520B2C: BCF 0A.30B2D: CALL 1C80B2E: BSF 0A.30B2F: DECFSZ 51,F0B30: GOTO 32A.................... }0B31: INCF 4E,F0B32: GOTO 2FF.................... Delay_ms(5000);0B33: MOVLW 140B34: MOVWF 510B35: MOVLW FA0B36: MOVWF 520B37: BCF 0A.30B38: CALL 1C80B39: BSF 0A.30B3A: DECFSZ 51,F0B3B: GOTO 335.................... set_pwm1_duty(0);0B3C: CLRF 15.................... set_pwm2_duty(0);0B3D: CLRF 1B.................... del_sms();0B3E: BCF 0A.30B3F: CALL 3740B40: BSF 0A.3.................... break;0B41: GOTO 532.................... }........................................ if (toupper(odp[0]) == 'H')0B42: MOVF 26,W0B43: SUBLW 600B44: BTFSC 03.00B45: GOTO 34D0B46: MOVF 26,W0B47: SUBLW 7A0B48: BTFSS 03.00B49: GOTO 34D0B4A: MOVF 26,W0B4B: ANDLW DF0B4C: GOTO 34E0B4D: MOVF 26,W0B4E: SUBLW 480B4F: BTFSS 03.20B50: GOTO 3FD.................... {.................... set_pwm1_duty(VYKON);0B51: MOVLW 640B52: MOVWF 15.................... set_pwm2_duty(VYKON);0B53: MOVWF 1B.................... Delay_ms(10000);0B54: MOVLW 280B55: MOVWF 510B56: MOVLW FA0B57: MOVWF 520B58: BCF 0A.30B59: CALL 1C80B5A: BSF 0A.30B5B: DECFSZ 51,F0B5C: GOTO 356.................... for(n=0;n<=1;n++)0B5D: CLRF 4E0B5E: MOVF 4E,W0B5F: SUBLW 010B60: BTFSS 03.00B61: GOTO 3EE.................... {.................... fprintf(VRTULE,"[[MARTIN[["); // " MARTIN "0B62: CLRF 510B63: MOVF 51,W0B64: BCF 0A.30B65: CALL 0F30B66: BSF 0A.30B67: IORLW 000B68: BTFSC 03.20B69: GOTO 3700B6A: INCF 51,F0B6B: MOVWF 520B6C: BCF 0A.30B6D: CALL 3480B6E: BSF 0A.30B6F: GOTO 363.................... Delay_ms(2000);0B70: MOVLW 080B71: MOVWF 510B72: MOVLW FA0B73: MOVWF 520B74: BCF 0A.30B75: CALL 1C80B76: BSF 0A.30B77: DECFSZ 51,F0B78: GOTO 372.................... fprintf(VRTULE,"[[SVEJDA[["); // " SVEJDA "0B79: CLRF 510B7A: MOVF 51,W0B7B: BCF 0A.30B7C: CALL 1050B7D: BSF 0A.30B7E: IORLW 000B7F: BTFSC 03.20B80: GOTO 3870B81: INCF 51,F0B82: MOVWF 520B83: BCF 0A.30B84: CALL 3480B85: BSF 0A.30B86: GOTO 37A.................... Delay_ms(2000);0B87: MOVLW 080B88: MOVWF 510B89: MOVLW FA0B8A: MOVWF 520B8B: BCF 0A.30B8C: CALL 1C80B8D: BSF 0A.30B8E: DECFSZ 51,F0B8F: GOTO 389.................... fprintf(VRTULE,"[[TOMAS[[["); // " TOMAS "0B90: CLRF 510B91: MOVF 51,W0B92: BCF 0A.30B93: CALL 1140B94: BSF 0A.30B95: IORLW 000B96: BTFSC 03.20B97: GOTO 39E0B98: INCF 51,F0B99: MOVWF 520B9A: BCF 0A.30B9B: CALL 3480B9C: BSF 0A.30B9D: GOTO 391.................... Delay_ms(2000);0B9E: MOVLW 080B9F: MOVWF 510BA0: MOVLW FA0BA1: MOVWF 520BA2: BCF 0A.30BA3: CALL 1C80BA4: BSF 0A.30BA5: DECFSZ 51,F0BA6: GOTO 3A0.................... fprintf(VRTULE,"[[[KAPL[[["); // "KAPL"0BA7: CLRF 510BA8: MOVF 51,W0BA9: BCF 0A.30BAA: CALL 1230BAB: BSF 0A.30BAC: IORLW 000BAD: BTFSC 03.20BAE: GOTO 3B50BAF: INCF 51,F0BB0: MOVWF 520BB1: BCF 0A.30BB2: CALL 3480BB3: BSF 0A.30BB4: GOTO 3A8.................... Delay_ms(2000);0BB5: MOVLW 080BB6: MOVWF 510BB7: MOVLW FA0BB8: MOVWF 520BB9: BCF 0A.30BBA: CALL 1C80BBB: BSF 0A.30BBC: DECFSZ 51,F0BBD: GOTO 3B7.................... fprintf(VRTULE,"[[JAKUB[[["); // " JAKUB "0BBE: CLRF 510BBF: MOVF 51,W0BC0: BCF 0A.30BC1: CALL 1320BC2: BSF 0A.30BC3: IORLW 000BC4: BTFSC 03.20BC5: GOTO 3CC0BC6: INCF 51,F0BC7: MOVWF 520BC8: BCF 0A.30BC9: CALL 3480BCA: BSF 0A.30BCB: GOTO 3BF.................... Delay_ms(2000);0BCC: MOVLW 080BCD: MOVWF 510BCE: MOVLW FA0BCF: MOVWF 520BD0: BCF 0A.30BD1: CALL 1C80BD2: BSF 0A.30BD3: DECFSZ 51,F0BD4: GOTO 3CE.................... fprintf(VRTULE,"[[KAKONA[["); // "KAKONA"0BD5: CLRF 510BD6: MOVF 51,W0BD7: BCF 0A.30BD8: CALL 1410BD9: BSF 0A.30BDA: IORLW 000BDB: BTFSC 03.20BDC: GOTO 3E30BDD: INCF 51,F0BDE: MOVWF 520BDF: BCF 0A.30BE0: CALL 3480BE1: BSF 0A.30BE2: GOTO 3D6.................... Delay_ms(2000);0BE3: MOVLW 080BE4: MOVWF 510BE5: MOVLW FA0BE6: MOVWF 520BE7: BCF 0A.30BE8: CALL 1C80BE9: BSF 0A.30BEA: DECFSZ 51,F0BEB: GOTO 3E5.................... }0BEC: INCF 4E,F0BED: GOTO 35E.................... Delay_ms(3000);0BEE: MOVLW 0C0BEF: MOVWF 510BF0: MOVLW FA0BF1: MOVWF 520BF2: BCF 0A.30BF3: CALL 1C80BF4: BSF 0A.30BF5: DECFSZ 51,F0BF6: GOTO 3F0.................... set_pwm1_duty(0);0BF7: CLRF 15.................... set_pwm2_duty(0);0BF8: CLRF 1B.................... del_sms();0BF9: BCF 0A.30BFA: CALL 3740BFB: BSF 0A.3.................... break;0BFC: GOTO 532.................... }........................................ if (toupper(odp[0]) == 'I')0BFD: MOVF 26,W0BFE: SUBLW 600BFF: BTFSC 03.00C00: GOTO 4080C01: MOVF 26,W0C02: SUBLW 7A0C03: BTFSS 03.00C04: GOTO 4080C05: MOVF 26,W0C06: ANDLW DF0C07: GOTO 4090C08: MOVF 26,W0C09: SUBLW 490C0A: BTFSS 03.20C0B: GOTO 4A2.................... {.................... set_pwm1_duty(VYKON);0C0C: MOVLW 640C0D: MOVWF 15.................... set_pwm2_duty(VYKON);0C0E: MOVWF 1B.................... Delay_ms(10000);0C0F: MOVLW 280C10: MOVWF 510C11: MOVLW FA0C12: MOVWF 520C13: BCF 0A.30C14: CALL 1C80C15: BSF 0A.30C16: DECFSZ 51,F0C17: GOTO 411.................... for(n=0;n<=1;n++)0C18: CLRF 4E0C19: MOVF 4E,W0C1A: SUBLW 010C1B: BTFSS 03.00C1C: GOTO 492.................... {.................... fprintf(VRTULE,"ODPOVED[NA"); // "ODPOVED NA"0C1D: CLRF 510C1E: MOVF 51,W0C1F: BCF 0A.30C20: CALL 1500C21: BSF 0A.30C22: IORLW 000C23: BTFSC 03.20C24: GOTO 42B0C25: INCF 51,F0C26: MOVWF 520C27: BCF 0A.30C28: CALL 3480C29: BSF 0A.30C2A: GOTO 41E.................... Delay_ms(2000);0C2B: MOVLW 080C2C: MOVWF 510C2D: MOVLW FA0C2E: MOVWF 520C2F: BCF 0A.30C30: CALL 1C80C31: BSF 0A.30C32: DECFSZ 51,F0C33: GOTO 42D.................... fprintf(VRTULE,"[[VASI[[[["); // " VASI "0C34: CLRF 510C35: MOVF 51,W0C36: BCF 0A.30C37: CALL 15F0C38: BSF 0A.30C39: IORLW 000C3A: BTFSC 03.20C3B: GOTO 4420C3C: INCF 51,F0C3D: MOVWF 520C3E: BCF 0A.30C3F: CALL 3480C40: BSF 0A.30C41: GOTO 435.................... Delay_ms(2000);0C42: MOVLW 080C43: MOVWF 510C44: MOVLW FA0C45: MOVWF 520C46: BCF 0A.30C47: CALL 1C80C48: BSF 0A.30C49: DECFSZ 51,F0C4A: GOTO 444.................... fprintf(VRTULE,"[[OTAZKU[["); // " OTAZKU "0C4B: CLRF 510C4C: MOVF 51,W0C4D: BCF 0A.30C4E: CALL 16E0C4F: BSF 0A.30C50: IORLW 000C51: BTFSC 03.20C52: GOTO 4590C53: INCF 51,F0C54: MOVWF 520C55: BCF 0A.30C56: CALL 3480C57: BSF 0A.30C58: GOTO 44C.................... Delay_ms(2000);0C59: MOVLW 080C5A: MOVWF 510C5B: MOVLW FA0C5C: MOVWF 520C5D: BCF 0A.30C5E: CALL 1C80C5F: BSF 0A.30C60: DECFSZ 51,F0C61: GOTO 45B.................... fprintf(VRTULE,"[[[[JE[[[["); // "JE"0C62: CLRF 510C63: MOVF 51,W0C64: BCF 0A.30C65: CALL 17D0C66: BSF 0A.30C67: IORLW 000C68: BTFSC 03.20C69: GOTO 4700C6A: INCF 51,F0C6B: MOVWF 520C6C: BCF 0A.30C6D: CALL 3480C6E: BSF 0A.30C6F: GOTO 463.................... Delay_ms(2000);0C70: MOVLW 080C71: MOVWF 510C72: MOVLW FA0C73: MOVWF 520C74: BCF 0A.30C75: CALL 1C80C76: BSF 0A.30C77: DECFSZ 51,F0C78: GOTO 472.................... fprintf(VRTULE,"[[[[ec[[[["); // " 42 "0C79: CLRF 510C7A: MOVF 51,W0C7B: BCF 0A.30C7C: CALL 18C0C7D: BSF 0A.30C7E: IORLW 000C7F: BTFSC 03.20C80: GOTO 4870C81: INCF 51,F0C82: MOVWF 520C83: BCF 0A.30C84: CALL 3480C85: BSF 0A.30C86: GOTO 47A.................... Delay_ms(2000);0C87: MOVLW 080C88: MOVWF 510C89: MOVLW FA0C8A: MOVWF 520C8B: BCF 0A.30C8C: CALL 1C80C8D: BSF 0A.30C8E: DECFSZ 51,F0C8F: GOTO 489.................... }0C90: INCF 4E,F0C91: GOTO 419.................... Delay_ms(3000);0C92: MOVLW 0C0C93: MOVWF 510C94: MOVLW FA0C95: MOVWF 520C96: BCF 0A.30C97: CALL 1C80C98: BSF 0A.30C99: DECFSZ 51,F0C9A: GOTO 494.................... set_pwm1_duty(0);0C9B: CLRF 15.................... set_pwm2_duty(0);0C9C: CLRF 1B.................... del_sms();0C9D: BCF 0A.30C9E: CALL 3740C9F: BSF 0A.3.................... break;0CA0: GOTO 532.................... }.................... else0CA1: GOTO 4F8.................... {.................... set_pwm1_duty(VYKON);0CA2: MOVLW 640CA3: MOVWF 15.................... set_pwm2_duty(VYKON);0CA4: MOVWF 1B.................... Delay_ms(10000);0CA5: MOVLW 280CA6: MOVWF 510CA7: MOVLW FA0CA8: MOVWF 520CA9: BCF 0A.30CAA: CALL 1C80CAB: BSF 0A.30CAC: DECFSZ 51,F0CAD: GOTO 4A7.................... fprintf(VRTULE,"[[NEUMIS[["); // "NEUMIS"0CAE: CLRF 510CAF: MOVF 51,W0CB0: BCF 0A.30CB1: CALL 19B0CB2: BSF 0A.30CB3: IORLW 000CB4: BTFSC 03.20CB5: GOTO 4BC0CB6: INCF 51,F0CB7: MOVWF 520CB8: BCF 0A.30CB9: CALL 3480CBA: BSF 0A.30CBB: GOTO 4AF.................... Delay_ms(2000);0CBC: MOVLW 080CBD: MOVWF 510CBE: MOVLW FA0CBF: MOVWF 520CC0: BCF 0A.30CC1: CALL 1C80CC2: BSF 0A.30CC3: DECFSZ 51,F0CC4: GOTO 4BE.................... fprintf(VRTULE,"[[[PSAT[[["); // " PSAT "0CC5: CLRF 510CC6: MOVF 51,W0CC7: BCF 0A.30CC8: CALL 1AA0CC9: BSF 0A.30CCA: IORLW 000CCB: BTFSC 03.20CCC: GOTO 4D30CCD: INCF 51,F0CCE: MOVWF 520CCF: BCF 0A.30CD0: CALL 3480CD1: BSF 0A.30CD2: GOTO 4C6.................... Delay_ms(2000);0CD3: MOVLW 080CD4: MOVWF 510CD5: MOVLW FA0CD6: MOVWF 520CD7: BCF 0A.30CD8: CALL 1C80CD9: BSF 0A.30CDA: DECFSZ 51,F0CDB: GOTO 4D5.................... fprintf(VRTULE,"[[TRUBKO[["); // " TRUBKO "0CDC: CLRF 510CDD: MOVF 51,W0CDE: BCF 0A.30CDF: CALL 1B90CE0: BSF 0A.30CE1: IORLW 000CE2: BTFSC 03.20CE3: GOTO 4EA0CE4: INCF 51,F0CE5: MOVWF 520CE6: BCF 0A.30CE7: CALL 3480CE8: BSF 0A.30CE9: GOTO 4DD.................... Delay_ms(3000);0CEA: MOVLW 0C0CEB: MOVWF 510CEC: MOVLW FA0CED: MOVWF 520CEE: BCF 0A.30CEF: CALL 1C80CF0: BSF 0A.30CF1: DECFSZ 51,F0CF2: GOTO 4EC.................... set_pwm1_duty(0);0CF3: CLRF 15.................... set_pwm2_duty(0);0CF4: CLRF 1B.................... del_sms();0CF5: BCF 0A.30CF6: CALL 3740CF7: BSF 0A.3.................... }.................... }.................... read_time();0CF8: BCF 0A.30CF9: GOTO 37F0CFA: BSF 0A.3.................... time=strtoul(odp,&ptr,10);0CFB: MOVLW 260CFC: MOVWF 510CFD: MOVLW 4F0CFE: MOVWF 520CFF: MOVLW 0A0D00: MOVWF 530D01: BCF 0A.30D02: GOTO 3D20D03: BSF 0A.30D04: MOVF 78,W0D05: MOVWF 50.................... if((time >= 30 && time <= 32) || (time >= 0 && time <= 2) || (time >= 45 && time <= 47) || (time >= 15 && time <= 17))0D06: MOVF 50,W0D07: SUBLW 1D0D08: BTFSC 03.00D09: GOTO 50E0D0A: MOVF 50,W0D0B: SUBLW 200D0C: BTFSC 03.00D0D: GOTO 5220D0E: MOVF 50,W0D0F: SUBLW 020D10: BTFSC 03.00D11: GOTO 5220D12: MOVF 50,W0D13: SUBLW 2C0D14: BTFSC 03.00D15: GOTO 51A0D16: MOVF 50,W0D17: SUBLW 2F0D18: BTFSC 03.00D19: GOTO 5220D1A: MOVF 50,W0D1B: SUBLW 0E0D1C: BTFSC 03.00D1D: GOTO 5260D1E: MOVF 50,W0D1F: SUBLW 110D20: BTFSS 03.00D21: GOTO 526.................... {.................... set_pwm1_duty(VYKON);0D22: MOVLW 640D23: MOVWF 15.................... set_pwm2_duty(VYKON);0D24: MOVWF 1B.................... }.................... else0D25: GOTO 528.................... {.................... set_pwm1_duty(0);0D26: CLRF 15.................... set_pwm2_duty(0);0D27: CLRF 1B.................... }........................................ delay_ms(1000);0D28: MOVLW 040D29: MOVWF 510D2A: MOVLW FA0D2B: MOVWF 520D2C: BCF 0A.30D2D: CALL 1C80D2E: BSF 0A.30D2F: DECFSZ 51,F0D30: GOTO 52A.................... }0D31: GOTO 07B.................... }0D32: SLEEPConfiguration Fuses:Word 1: 3F3E HS WDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT