CCS PCM C Compiler, Version 4.106, 47914               05-5-13 12:54

               Filename: C:\Users\Honza\Documents\pic\azimut\main.lst

               ROM used: 4548 words (56%)
                         Largest free fragment is 2048
               RAM used: 32 (9%) at main() level
                         97 (26%) worst case
               Stack:    4 locations

*
0000:  MOVLW  10
0001:  MOVWF  0A
0002:  GOTO   0AD
0003:  NOP
.................... #include "C:\Users\Honza\Documents\pic\azimut\main.h" 
.................... #include <16F887.h> 
.................... //////// Standard Header file for the PIC16F887 device //////////////// 
.................... #device PIC16F887 
.................... #list 
....................  
.................... #device adc=8 
....................  
.................... #FUSES NOWDT                       //No Watch Dog Timer 
.................... #FUSES INTRC                       //Internal RC Osc 
.................... #FUSES NOPUT                       //No Power Up Timer 
.................... #FUSES MCLR                        //Master Clear pin enabled 
.................... #FUSES NOPROTECT                   //Code not protected from reading 
.................... #FUSES NOCPD                       //No EE protection 
.................... #FUSES NOBROWNOUT                  //No brownout reset 
.................... #FUSES IESO                        //Internal External Switch Over mode enabled 
.................... #FUSES FCMEN                       //Fail-safe clock monitor enabled 
.................... #FUSES NOLVP                       //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O 
.................... #FUSES NODEBUG                     //No Debug mode for ICD 
.................... #FUSES NOWRT                       //Program memory not write protected 
.................... #FUSES BORV40                      //Brownout reset at 4.0V 
....................  
.................... #use delay(clock=8000000) 
*
015D:  MOVLW  4F
015E:  MOVWF  04
015F:  BCF    03.7
0160:  MOVF   00,W
0161:  BTFSC  03.2
0162:  GOTO   170
0163:  MOVLW  02
0164:  MOVWF  78
0165:  CLRF   77
0166:  DECFSZ 77,F
0167:  GOTO   166
0168:  DECFSZ 78,F
0169:  GOTO   165
016A:  MOVLW  97
016B:  MOVWF  77
016C:  DECFSZ 77,F
016D:  GOTO   16C
016E:  DECFSZ 00,F
016F:  GOTO   163
0170:  RETURN
....................  
....................  
....................  
.................... #define PIN_SDA  PIN_C4 
.................... #define PIN_SCL  PIN_C3 
.................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL) 
*
00D8:  MOVLW  08
00D9:  MOVWF  78
00DA:  NOP
00DB:  BCF    07.3
00DC:  BCF    20.3
00DD:  MOVF   20,W
00DE:  BSF    03.5
00DF:  MOVWF  07
00E0:  NOP
00E1:  BCF    03.5
00E2:  RLF    5D,F
00E3:  BCF    07.4
00E4:  BTFSS  03.0
00E5:  GOTO   0EC
00E6:  BSF    20.4
00E7:  MOVF   20,W
00E8:  BSF    03.5
00E9:  MOVWF  07
00EA:  GOTO   0F0
00EB:  BCF    03.5
00EC:  BCF    20.4
00ED:  MOVF   20,W
00EE:  BSF    03.5
00EF:  MOVWF  07
00F0:  NOP
00F1:  BCF    03.5
00F2:  BSF    20.3
00F3:  MOVF   20,W
00F4:  BSF    03.5
00F5:  MOVWF  07
00F6:  BCF    03.5
00F7:  BTFSS  07.3
00F8:  GOTO   0F7
00F9:  DECFSZ 78,F
00FA:  GOTO   0DA
00FB:  NOP
00FC:  BCF    07.3
00FD:  BCF    20.3
00FE:  MOVF   20,W
00FF:  BSF    03.5
0100:  MOVWF  07
0101:  NOP
0102:  BCF    03.5
0103:  BSF    20.4
0104:  MOVF   20,W
0105:  BSF    03.5
0106:  MOVWF  07
0107:  NOP
0108:  NOP
0109:  BCF    03.5
010A:  BSF    20.3
010B:  MOVF   20,W
010C:  BSF    03.5
010D:  MOVWF  07
010E:  BCF    03.5
010F:  BTFSS  07.3
0110:  GOTO   10F
0111:  CLRF   78
0112:  NOP
0113:  BTFSC  07.4
0114:  BSF    78.0
0115:  BCF    07.3
0116:  BCF    20.3
0117:  MOVF   20,W
0118:  BSF    03.5
0119:  MOVWF  07
011A:  BCF    03.5
011B:  BCF    07.4
011C:  BCF    20.4
011D:  MOVF   20,W
011E:  BSF    03.5
011F:  MOVWF  07
0120:  BCF    03.5
0121:  RETURN
*
038F:  MOVLW  08
0390:  MOVWF  5E
0391:  MOVF   77,W
0392:  MOVWF  5F
0393:  BSF    20.4
0394:  MOVF   20,W
0395:  BSF    03.5
0396:  MOVWF  07
0397:  NOP
0398:  BCF    03.5
0399:  BSF    20.3
039A:  MOVF   20,W
039B:  BSF    03.5
039C:  MOVWF  07
039D:  BCF    03.5
039E:  BTFSS  07.3
039F:  GOTO   39E
03A0:  BTFSC  07.4
03A1:  BSF    03.0
03A2:  BTFSS  07.4
03A3:  BCF    03.0
03A4:  RLF    78,F
03A5:  NOP
03A6:  BCF    20.3
03A7:  MOVF   20,W
03A8:  BSF    03.5
03A9:  MOVWF  07
03AA:  BCF    03.5
03AB:  BCF    07.3
03AC:  DECFSZ 5E,F
03AD:  GOTO   393
03AE:  BSF    20.4
03AF:  MOVF   20,W
03B0:  BSF    03.5
03B1:  MOVWF  07
03B2:  NOP
03B3:  BCF    03.5
03B4:  BCF    07.4
03B5:  MOVF   5F,W
03B6:  BTFSC  03.2
03B7:  GOTO   3BD
03B8:  BCF    20.4
03B9:  MOVF   20,W
03BA:  BSF    03.5
03BB:  MOVWF  07
03BC:  BCF    03.5
03BD:  NOP
03BE:  BSF    20.3
03BF:  MOVF   20,W
03C0:  BSF    03.5
03C1:  MOVWF  07
03C2:  BCF    03.5
03C3:  BTFSS  07.3
03C4:  GOTO   3C3
03C5:  NOP
03C6:  BCF    07.3
03C7:  BCF    20.3
03C8:  MOVF   20,W
03C9:  BSF    03.5
03CA:  MOVWF  07
03CB:  NOP
03CC:  BCF    03.5
03CD:  BCF    07.4
03CE:  BCF    20.4
03CF:  MOVF   20,W
03D0:  BSF    03.5
03D1:  MOVWF  07
03D2:  BCF    03.5
03D3:  RETURN
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD 
*
0222:  BCF    20.7
0223:  MOVF   20,W
0224:  BSF    03.5
0225:  MOVWF  07
0226:  BCF    03.5
0227:  BCF    07.7
0228:  MOVLW  08
0229:  MOVWF  78
022A:  GOTO   22B
022B:  NOP
022C:  BSF    78.7
022D:  GOTO   23C
022E:  BCF    78.7
022F:  RRF    59,F
0230:  BTFSC  03.0
0231:  BSF    07.7
0232:  BTFSS  03.0
0233:  BCF    07.7
0234:  BSF    78.6
0235:  GOTO   23C
0236:  BCF    78.6
0237:  DECFSZ 78,F
0238:  GOTO   22F
0239:  GOTO   23A
023A:  NOP
023B:  BSF    07.7
023C:  MOVLW  3F
023D:  MOVWF  04
023E:  DECFSZ 04,F
023F:  GOTO   23E
0240:  NOP
0241:  BTFSC  78.7
0242:  GOTO   22E
0243:  BTFSC  78.6
0244:  GOTO   236
0245:  RETURN
*
028E:  BSF    20.6
028F:  MOVF   20,W
0290:  BSF    03.5
0291:  MOVWF  07
0292:  BCF    03.5
0293:  BTFSC  07.6
0294:  GOTO   293
0295:  MOVLW  08
0296:  MOVWF  77
0297:  CLRF   49
0298:  BSF    77.7
0299:  GOTO   2A8
029A:  BCF    77.7
029B:  GOTO   2A8
029C:  BCF    03.0
029D:  BTFSC  07.6
029E:  BSF    03.0
029F:  RRF    49,F
02A0:  BSF    77.6
02A1:  GOTO   2A8
02A2:  BCF    77.6
02A3:  DECFSZ 77,F
02A4:  GOTO   29C
02A5:  MOVF   49,W
02A6:  MOVWF  78
02A7:  GOTO   2B3
02A8:  MOVLW  3F
02A9:  BTFSC  77.7
02AA:  MOVLW  11
02AB:  MOVWF  78
02AC:  DECFSZ 78,F
02AD:  GOTO   2AC
02AE:  BTFSC  77.7
02AF:  GOTO   29A
02B0:  BTFSC  77.6
02B1:  GOTO   2A2
02B2:  GOTO   29C
02B3:  RETURN
.................... #include <math.h> 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... ////        (C) Copyright 1996,2008 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.                                //// 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... ////                                                                    //// 
.................... //// History:                                                           //// 
.................... ////  * 9/20/2001 :  Improvments are made to sin/cos code.              //// 
.................... ////                 The code now is small, much faster,                //// 
.................... ////                 and more accurate.                                 //// 
.................... ////  * 2/21/2007 :  Compiler handles & operator differently and does 
.................... ////                 not return generic (int8 *) so type cast is done   //// 
.................... ////                                                                    //// 
.................... //////////////////////////////////////////////////////////////////////////// 
....................  
.................... #ifndef MATH_H 
.................... #define MATH_H 
....................  
.................... #ifdef PI 
.................... #undef  PI 
.................... #endif 
.................... #define PI     3.1415926535897932 
....................  
....................  
.................... #define SQRT2  1.4142135623730950 
....................  
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279}; 
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718}; 
....................  
.................... ///////////////////////////// Round Functions ////////////////////////////// 
....................  
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n) 
.................... { 
....................    float32 y, res; 
....................    unsigned int16 l; 
....................    int1 s; 
....................  
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       y = -y; 
....................    } 
....................  
....................    if (y <= 32768.0) 
....................   res = (float32)(unsigned int16)y; 
....................  
....................  else if (y < 10000000.0) 
....................    { 
....................   l = (unsigned int16)(y/32768.0); 
....................       y = 32768.0*(y/32768.0 - (float32)l); 
....................   res = 32768.0*(float32)l; 
....................   res += (float32)(unsigned int16)y; 
....................  } 
....................  
....................  else 
....................   res = y; 
....................  
....................  y = y - (float32)(unsigned int16)y; 
....................  
....................  if (s) 
....................   res = -res; 
....................  
....................  if (y != 0) 
....................  { 
....................   if (s == 1 && n == 0) 
....................    res -= 1.0; 
....................  
....................   if (s == 0 && n == 1) 
....................    res += 1.0; 
....................  } 
....................  if (x == 0) 
....................     res = 0; 
....................  
....................  return (res); 
.................... } 
....................  
.................... // Overloaded Functions to take care for new Data types in PCD 
.................... // Overloaded function CEIL_FLOOR() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n) 
.................... { 
....................    float48 y, res; 
....................    unsigned int16 l; 
....................    int1 s; 
....................  
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       y = -y; 
....................    } 
....................  
....................    if (y <= 32768.0) 
....................   res = (float48)(unsigned int16)y; 
....................  
....................  else if (y < 10000000.0) 
....................    { 
....................   l = (unsigned int16)(y/32768.0); 
....................       y = 32768.0*(y/32768.0 - (float48)l); 
....................   res = 32768.0*(float32)l; 
....................   res += (float48)(unsigned int16)y; 
....................  } 
....................  
....................  else 
....................   res = y; 
....................  
....................  y = y - (float48)(unsigned int16)y; 
....................  
....................  if (s) 
....................   res = -res; 
....................  
....................  if (y != 0) 
....................  { 
....................   if (s == 1 && n == 0) 
....................    res -= 1.0; 
....................  
....................   if (s == 0 && n == 1) 
....................    res += 1.0; 
....................  } 
....................  if (x == 0) 
....................     res = 0; 
....................  
....................  return (res); 
.................... } 
....................  
....................  
.................... // Overloaded function CEIL_FLOOR() for data type - Float64 
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n) 
.................... { 
....................    float64 y, res; 
....................    unsigned int16 l; 
....................    int1 s; 
....................  
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       y = -y; 
....................    } 
....................  
....................    if (y <= 32768.0) 
....................   res = (float64)(unsigned int16)y; 
....................  
....................  else if (y < 10000000.0) 
....................    { 
....................   l = (unsigned int16)(y/32768.0); 
....................       y = 32768.0*(y/32768.0 - (float64)l); 
....................   res = 32768.0*(float64)l; 
....................   res += (float64)(unsigned int16)y; 
....................  } 
....................  
....................  else 
....................   res = y; 
....................  
....................  y = y - (float64)(unsigned int16)y; 
....................  
....................  if (s) 
....................   res = -res; 
....................  
....................  if (y != 0) 
....................  { 
....................   if (s == 1 && n == 0) 
....................    res -= 1.0; 
....................  
....................   if (s == 0 && n == 1) 
....................    res += 1.0; 
....................  } 
....................  if (x == 0) 
....................     res = 0; 
....................  
....................  return (res); 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float floor(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : rounds down the number x. 
.................... // Date : N/A 
.................... // 
.................... float32 floor(float32 x) 
.................... { 
....................    return CEIL_FLOOR(x, 0); 
.................... } 
.................... // Following 2 functions are overloaded functions of floor() for PCD 
.................... // Overloaded function floor() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 floor(float48 x) 
.................... { 
....................    return CEIL_FLOOR(x, 0); 
.................... } 
....................  
.................... // Overloaded function floor() for data type - Float64 
.................... float64 floor(float64 x) 
.................... { 
....................    return CEIL_FLOOR(x, 0); 
.................... } 
.................... #endif 
....................  
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float ceil(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : rounds up the number x. 
.................... // Date : N/A 
.................... // 
.................... float32 ceil(float32 x) 
.................... { 
....................    return CEIL_FLOOR(x, 1); 
.................... } 
.................... // Following 2 functions are overloaded functions of ceil() for PCD 
.................... // Overloaded function ceil() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 ceil(float48 x) 
.................... { 
....................    return CEIL_FLOOR(x, 1); 
.................... } 
....................  
.................... // Overloaded function ceil() for data type - Float64 
.................... float64 ceil(float64 x) 
.................... { 
....................    return CEIL_FLOOR(x, 1); 
.................... } 
.................... #endif 
....................  
....................  //////////////////////////////////////////////////////////////////////////// 
.................... //   float fabs(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : Computes the absolute value of floating point number x 
.................... // Returns : returns the absolute value of x 
.................... // Date : N/A 
.................... // 
.................... #define fabs abs 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float fmod(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : Computes the floating point remainder of x/y 
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y 
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the 
.................... // magnitude of y. If y is zero then a domain error occurs. 
.................... // Date : N/A 
.................... // 
....................  
.................... float fmod(float32 x,float32 y) 
.................... { 
....................    float32 i; 
....................    if (y!=0.0) 
....................    { 
....................       i=(x/y < 0.0)? ceil(x/y): floor(x/y); 
....................       return(x-(i*y)); 
....................    } 
....................    else 
....................    { 
....................    #ifdef _ERRNO 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................    } 
.................... } 
.................... //Overloaded function for fmod() for PCD 
.................... // Overloaded function fmod() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 fmod(float48 x,float48 y) 
.................... { 
....................    float48 i; 
....................    if (y!=0.0) 
....................    { 
....................       i=(x/y < 0.0)? ceil(x/y): floor(x/y); 
....................       return(x-(i*y)); 
....................    } 
....................    else 
....................    { 
....................    #ifdef _ERRNO 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................    } 
.................... } 
.................... // Overloaded function fmod() for data type - Float64 
.................... float64 fmod(float64 x,float64 y) 
.................... { 
....................    float64 i; 
....................    if (y!=0.0) 
....................    { 
....................       i=(x/y < 0.0)? ceil(x/y): floor(x/y); 
....................       return(x-(i*y)); 
....................    } 
....................    else 
....................    { 
....................    #ifdef _ERRNO 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................    } 
.................... } 
.................... #endif 
.................... //////////////////// Exponential and logarithmic functions //////////////////// 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float exp(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the value (e^x) 
.................... // Date : N/A 
.................... // 
.................... #define LN2 0.6931471805599453 
....................  
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093, 
....................                      0.0554965651,  0.240227138,  0.693147172}; 
....................  
....................  
.................... float32 exp(float32 x) 
.................... { 
....................    float32 y, res, r; 
....................    #if defined(__PCD__) 
....................    int8 data1; 
....................    #endif 
....................    signed int8 n; 
....................    int1 s; 
....................    #ifdef _ERRNO 
....................    if(x > 88.722838) 
....................    { 
....................       errno=ERANGE; 
....................       return(0); 
....................    } 
....................    #endif 
....................    n = (signed int16)(x/LN2); 
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       n = -n; 
....................       y = -y; 
....................    } 
....................  
....................    res = 0.0; 
.................... #if !defined(__PCD__) 
....................    *((unsigned int8 *)(&res)) = n + 0x7F; 
.................... #endif 
....................  
.................... #if defined(__PCD__)  // Takes care of IEEE format for PCD 
....................    data1 = n+0x7F; 
....................    if(bit_test(data1,0)) 
....................    bit_set(*(((unsigned int8 *)(&res)+2)),7); 
....................    rotate_right(&data1,1); 
....................    bit_clear(data1,7); 
....................    *(((unsigned int8 *)(&res)+3)) = data1; 
.................... #endif 
....................  
....................    y = y/LN2 - (float32)n; 
....................  
....................    r = pe[0]*y + pe[1]; 
....................    r = r*y + pe[2]; 
....................    r = r*y + pe[3]; 
....................    r = r*y + pe[4]; 
....................    r = r*y + pe[5]; 
....................  
....................    res = res*(1.0 + y*r); 
....................  
....................    if (s) 
....................       res = 1.0/res; 
....................    return(res); 
.................... } 
....................  
....................  
.................... //Overloaded function for exp() for PCD 
.................... // Overloaded function exp() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 exp(float48 x) 
.................... { 
....................    float48 y, res, r; 
....................    int8 data1; 
....................    signed int8 n; 
....................    int1 s; 
....................    #ifdef _ERRNO 
....................    if(x > 88.722838) 
....................    { 
....................       errno=ERANGE; 
....................       return(0); 
....................    } 
....................    #endif 
....................    n = (signed int16)(x/LN2); 
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       n = -n; 
....................       y = -y; 
....................    } 
....................  
....................    res = 0.0; 
....................  
....................    data1 = n+0x7F; 
....................    if(bit_test(data1,0)) 
....................    bit_set(*(((unsigned int8 *)(&res)+4)),7); 
....................    rotate_right(&data1,1); 
....................    bit_clear(data1,7); 
....................    *(((unsigned int8 *)(&res)+5)) = data1; 
....................  
....................    y = y/LN2 - (float48)n; 
....................  
....................    r = pe[0]*y + pe[1]; 
....................    r = r*y + pe[2]; 
....................    r = r*y + pe[3]; 
....................    r = r*y + pe[4]; 
....................    r = r*y + pe[5]; 
....................  
....................    res = res*(1.0 + y*r); 
....................  
....................    if (s) 
....................       res = 1.0/res; 
....................    return(res); 
.................... } 
....................  
.................... // Overloaded function exp() for data type - Float64 
.................... float64 exp(float64 x) 
.................... { 
....................    float64 y, res, r; 
....................    unsigned int16 data1, data2; 
....................    unsigned int16 *p; 
....................    signed int16 n; 
....................    int1 s; 
....................    #ifdef _ERRNO 
....................    if(x > 709.7827128) 
....................    { 
....................       errno=ERANGE; 
....................       return(0); 
....................    } 
....................    #endif 
....................    n = (signed int16)(x/LN2); 
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       n = -n; 
....................       y = -y; 
....................    } 
....................  
....................    res = 0.0; 
....................  
.................... #if !defined(__PCD__) 
....................    *((unsigned int16 *)(&res)) = n + 0x7F; 
.................... #endif 
....................    p= (((unsigned int16 *)(&res))+3); 
....................    data1 = *p; 
....................    data2 = *p;    
....................    data1 = n + 0x3FF; 
....................    data1 = data1 <<4; 
....................    if(bit_test(data2,15)) 
....................    bit_set(data1,15); 
....................    data2 = data2 & 0x000F; 
....................    data1 ^= data2; 
....................  
....................    *(((unsigned int16 *)(&res)+3)) = data1; 
....................  
....................  
....................    y = y/LN2 - (float64)n; 
....................  
....................    r = pe[0]*y + pe[1]; 
....................    r = r*y + pe[2]; 
....................    r = r*y + pe[3]; 
....................    r = r*y + pe[4]; 
....................    r = r*y + pe[5]; 
....................  
....................    res = res*(1.0 + y*r); 
....................  
....................    if (s) 
....................       res = 1.0/res; 
....................    return(res); 
.................... } 
....................  
.................... #ENDIF 
....................  
....................  
.................... /************************************************************/ 
....................  
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; 
.................... float32 const ql[4] = {1.0000000,  -8.1354259, 16.780517, -9.9300943}; 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float log(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the the natural log of x 
.................... // Date : N/A 
.................... // 
.................... float32 log(float32 x) 
.................... { 
....................    float32 y, res, r, y2; 
....................    #if defined(__PCD__) 
....................    unsigned int8  data1,data2; 
....................    #endif 
....................    signed int8 n; 
....................    #ifdef _ERRNO 
....................    if(x <0) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    if(x ==0) 
....................    { 
....................       errno=ERANGE; 
....................       return(0); 
....................    } 
....................    #endif 
....................    y = x; 
....................  
....................    if (y != 1.0) 
....................    { 
.................... #if !defined(__PCD__) 
....................     *((unsigned int8 *)(&y)) = 0x7E;  
.................... #endif 
....................  
.................... #if defined(__PCD__) // Takes care of IEEE format 
....................    data2 = *(((unsigned int8 *)(&y))+3); 
....................    *(((unsigned int8 *)(&y))+3) = 0x3F; 
....................    data1 = *(((unsigned int8 *)(&y))+2); 
....................    bit_clear(data1,7); 
....................    *(((unsigned int8 *)(&y))+2) = data1; 
....................    if(bit_test(data2,7)) 
....................    bit_set(*(((unsigned int8 *)(&y))+3),7); 
.................... #endif 
....................  
....................       y = (y - 1.0)/(y + 1.0); 
....................  
....................       y2=y*y; 
....................  
....................       res = pl[0]*y2 + pl[1]; 
....................       res = res*y2 + pl[2]; 
....................       res = res*y2 + pl[3]; 
....................  
....................       r = ql[0]*y2 + ql[1]; 
....................       r = r*y2 + ql[2]; 
....................       r = r*y2 + ql[3]; 
....................  
....................       res = y*res/r; 
.................... #if !defined(__PCD__) 
....................       n = *((unsigned int8 *)(&x)) - 0x7E; 
.................... #endif 
.................... #if defined(__PCD__)  
....................     data1 = *(((unsigned int8 *)(&x)+3)); 
....................     rotate_left(&data1,1); 
....................     data2 = *(((unsigned int8 *)(&x)+2)); 
....................     if(bit_test (data2,7)) 
....................       bit_set(data1,0); 
....................     n = data1 - 0x7E; 
.................... #endif 
....................  
....................       if (n<0)  
....................          r = -(float32)-n; 
....................       else 
....................          r = (float32)n; 
....................  
....................       res += r*LN2; 
....................    } 
....................  
....................    else 
....................       res = 0.0; 
....................  
....................    return(res); 
.................... } 
....................  
.................... //Overloaded function for log() for PCD 
.................... // Overloaded function log() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 log(float48 x) 
.................... { 
....................    float48 y, res, r, y2; 
....................    unsigned int8  data1,data2; 
....................    signed int8 n; 
....................    #ifdef _ERRNO 
....................    if(x <0) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    if(x ==0) 
....................    { 
....................       errno=ERANGE; 
....................       return(0); 
....................    } 
....................    #endif 
....................    y = x; 
....................  
....................    if (y != 1.0) 
....................    { 
....................     
....................    #if !defined(__PCD__) 
....................        *((unsigned int8 *)(&y)) = 0x7E;  
....................    #endif 
....................       data2 = *(((unsigned int8 *)(&y))+5); 
....................       *(((unsigned int8 *)(&y))+5) = 0x3F; 
....................       data1 = *(((unsigned int8 *)(&y))+4); 
....................       bit_clear(data1,7); 
....................       *(((unsigned int8 *)(&y))+4) = data1; 
....................    
....................       if(bit_test(data2,7)) 
....................          bit_set(*(((unsigned int8 *)(&y))+4),7); 
....................       y = (y - 1.0)/(y + 1.0); 
....................  
....................       y2=y*y; 
....................  
....................       res = pl[0]*y2 + pl[1]; 
....................       res = res*y2 + pl[2]; 
....................       res = res*y2 + pl[3]; 
....................  
....................       r = ql[0]*y2 + ql[1]; 
....................       r = r*y2 + ql[2]; 
....................       r = r*y2 + ql[3]; 
....................  
....................       res = y*res/r; 
....................  
....................     data1 = *(((unsigned int8 *)(&x)+5)); 
....................     rotate_left(&data1,1); 
....................     data2 = *(((unsigned int8 *)(&x)+4)); 
....................     if(bit_test (data2,7)) 
....................        bit_set(data1,0); 
....................       
....................     n = data1 - 0x7E; 
....................  
....................       if (n<0) 
....................          r = -(float48)-n; 
....................       else 
....................          r = (float48)n; 
....................  
....................       res += r*LN2; 
....................    } 
....................  
....................    else 
....................       res = 0.0; 
....................  
....................    return(res); 
.................... } 
....................  
.................... // Overloaded function log() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189}; 
.................... float32 const ql_64[4] = {1.0000000,  -8.1354259, 16.780517, -9.9300943}; 
.................... #endif 
.................... float64 log(float64 x) 
.................... { 
....................    float64 y, res, r, y2; 
....................    unsigned int16  data1,data2; 
....................    unsigned int16 *p; 
....................    signed int16 n; 
....................    #ifdef _ERRNO 
....................    if(x <0) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    if(x ==0) 
....................    { 
....................       errno=ERANGE; 
....................       return(0); 
....................    } 
....................    #endif 
....................    y = x; 
....................  
....................    if (y != 1.0) 
....................    { 
....................    #if !defined(__PCD__) 
....................        *((unsigned int8 *)(&y)) = 0x7E;  
....................    #endif 
....................       p= (((unsigned int16 *)(&y))+3); 
....................       data1 = *p; 
....................       data2 = *p; 
....................       data1 = 0x3FE; 
....................       data1 = data1 <<4; 
....................       if(bit_test (data2,15)) 
....................       bit_set(data1,15); 
....................       data2 = data2 & 0x000F; 
....................       data1 ^=data2; 
....................  
....................       *p = data1; 
....................  
....................       y = (y - 1.0)/(y + 1.0); 
....................  
....................       y2=y*y; 
....................  
....................       res = pl_64[0]*y2 + pl_64[1]; 
....................       res = res*y2 + pl_64[2]; 
....................       res = res*y2 + pl_64[3]; 
....................  
....................       r = ql_64[0]*y2 + ql_64[1]; 
....................       r = r*y2 + ql_64[2]; 
....................       r = r*y2 + ql_64[3]; 
....................  
....................       res = y*res/r; 
....................   
....................       p= (((unsigned int16 *)(&x))+3); 
....................       data1 = *p; 
....................       bit_clear(data1,15); 
....................       data1 = data1 >>4;     
....................       n = data1 - 0x3FE; 
....................  
....................  
....................       if (n<0) 
....................          r = -(float64)-n; 
....................       else 
....................          r = (float64)n; 
....................  
....................       res += r*LN2; 
....................    } 
....................  
....................    else 
....................       res = 0.0; 
....................  
....................    return(res); 
.................... } 
.................... #endif 
....................  
....................  
.................... #define LN10 2.3025850929940456 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float log10(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the the log base 10 of x 
.................... // Date : N/A 
.................... // 
.................... float32 log10(float32 x) 
.................... { 
....................    float32 r; 
....................  
....................    r = log(x); 
....................    r = r/LN10; 
....................    return(r); 
.................... } 
....................  
.................... //Overloaded functions for log10() for PCD 
.................... // Overloaded function log10() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 log10(float48 x) 
.................... { 
....................    float48 r; 
....................  
....................    r = log(x); 
....................    r = r/LN10; 
....................    return(r); 
.................... } 
....................  
.................... // Overloaded function log10() for data type - Float64 
.................... float64 log10(float64 x) 
.................... { 
....................    float64 r; 
....................  
....................    r = log(x); 
....................    r = r/LN10; 
....................    return(r); 
.................... } 
.................... #endif 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float modf(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description :breaks the argument value int integral and fractional parts, 
.................... // ach of which have the same sign as the argument.  It stores the integral part 
.................... // as a float in the object pointed to by the iptr 
.................... // Returns : returns the signed fractional part of value. 
.................... // Date : N/A 
.................... // 
....................  
.................... float32 modf(float32 value,float32 *iptr) 
.................... { 
....................    *iptr=(value < 0.0)? ceil(value): floor(value); 
....................    return(value - *iptr); 
.................... } 
.................... //Overloaded functions for modf() for PCD 
.................... // Overloaded function modf() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 modf(float48 value,float48 *iptr) 
.................... { 
....................    *iptr=(value < 0.0)? ceil(value): floor(value); 
....................    return(value - *iptr); 
.................... } 
.................... // Overloaded function modf() for data type - Float64 
.................... float64 modf(float64 value,float64 *iptr) 
.................... { 
....................    *iptr=(value < 0.0)? ceil(value): floor(value); 
....................    return(value - *iptr); 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float pwr(float x,float y) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the value (x^y) 
.................... // Date : N/A 
.................... // Note : 0 is returned when the function will generate an imaginary number 
.................... // 
.................... float32 pwr(float32 x,float32 y) 
.................... { 
....................    if(0 > x && fmod(y, 1) == 0) { 
....................       if(fmod(y, 2) == 0) { 
....................          return (exp(log(-x) * y)); 
....................       } else { 
....................          return (-exp(log(-x) * y)); 
....................       } 
....................    } else if(0 > x && fmod(y, 1) != 0) { 
....................       return 0; 
....................    } else { 
....................       if(x != 0 || 0 >= y) { 
....................          return (exp(log(x) * y)); 
....................       } 
....................    } 
.................... } 
.................... //Overloaded functions for pwr() for PCD 
.................... // Overloaded function pwr() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 pwr(float48 x,float48 y) 
.................... { 
....................    if(0 > x && fmod(y, 1) == 0) { 
....................       if(fmod(y, 2) == 0) { 
....................          return (exp(log(-x) * y)); 
....................       } else { 
....................          return (-exp(log(-x) * y)); 
....................       } 
....................    } else if(0 > x && fmod(y, 1) != 0) { 
....................       return 0; 
....................    } else { 
....................       if(x != 0 || 0 >= y) { 
....................          return (exp(log(x) * y)); 
....................       } 
....................    } 
.................... } 
.................... // Overloaded function pwr() for data type - Float64 
.................... float64 pwr(float64 x,float64 y) 
.................... { 
....................    if(0 > x && fmod(y, 1) == 0) { 
....................       if(fmod(y, 2) == 0) { 
....................          return (exp(log(-x) * y)); 
....................       } else { 
....................          return (-exp(log(-x) * y)); 
....................       } 
....................    } else if(0 > x && fmod(y, 1) != 0) { 
....................       return 0; 
....................    } else { 
....................       if(x != 0 || 0 >= y) { 
....................          return (exp(log(x) * y)); 
....................       } 
....................    } 
.................... } 
.................... #endif 
....................  
.................... //////////////////// Power functions //////////////////// 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float pow(float x,float y) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the value (x^y) 
.................... // Date : N/A 
.................... // Note : 0 is returned when the function will generate an imaginary number 
.................... // 
.................... float32 pow(float32 x,float32 y) 
.................... { 
....................    if(0 > x && fmod(y, 1) == 0) { 
....................       if(fmod(y, 2) == 0) { 
....................          return (exp(log(-x) * y)); 
....................       } else { 
....................          return (-exp(log(-x) * y)); 
....................       } 
....................    } else if(0 > x && fmod(y, 1) != 0) { 
....................       return 0; 
....................    } else { 
....................       if(x != 0 || 0 >= y) { 
....................          return (exp(log(x) * y)); 
....................       } 
....................    } 
.................... } 
.................... //Overloaded functions for pow() for PCD 
.................... // Overloaded function for pow() data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 pow(float48 x,float48 y) 
.................... { 
....................    if(0 > x && fmod(y, 1) == 0) { 
....................       if(fmod(y, 2) == 0) { 
....................          return (exp(log(-x) * y)); 
....................       } else { 
....................          return (-exp(log(-x) * y)); 
....................       } 
....................    } else if(0 > x && fmod(y, 1) != 0) { 
....................       return 0; 
....................    } else { 
....................       if(x != 0 || 0 >= y) { 
....................          return (exp(log(x) * y)); 
....................       } 
....................    } 
.................... } 
....................  
.................... // Overloaded function pow() for data type - Float64 
.................... float64 pow(float64 x,float64 y) 
.................... { 
....................    if(0 > x && fmod(y, 1) == 0) { 
....................       if(fmod(y, 2) == 0) { 
....................          return (exp(log(-x) * y)); 
....................       } else { 
....................          return (-exp(log(-x) * y)); 
....................       } 
....................    } else if(0 > x && fmod(y, 1) != 0) { 
....................       return 0; 
....................    } else { 
....................       if(x != 0 || 0 >= y) { 
....................          return (exp(log(x) * y)); 
....................       } 
....................    } 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float sqrt(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the square root of x 
.................... // Date : N/A 
.................... // 
.................... float32 sqrt(float32 x) 
.................... { 
....................    float32 y, res; 
....................    #if defined(__PCD__) 
....................    unsigned int16 data1,data2; 
....................    #endif 
....................    BYTE *p; 
....................  
....................    #ifdef _ERRNO 
....................    if(x < 0) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................  
....................    if( x<=0.0) 
....................       return(0.0); 
....................  
....................    y=x; 
....................     
....................    #if !defined(__PCD__) 
....................     p=&y; 
....................    (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); 
....................    #endif 
....................     
....................    #if defined(__PCD__) 
....................     p = (((unsigned int8 *)(&y))+3); 
....................     data1 = *(((unsigned int8 *)(&y))+3); 
....................     data2 = *(((unsigned int8 *)(&y))+2); 
....................     rotate_left(&data1,1);     
....................     if(bit_test(data2,7))     
....................     bit_set(data1,0);     
....................     data1 = ((data1+127) >>1); 
....................     bit_clear(data2,7); 
....................     if(bit_test(data1,0)) 
....................     bit_set(data2,7); 
....................     data1 = data1 >>1; 
....................     *(((unsigned int8 *)(&y))+3) = data1; 
....................     *(((unsigned int8 *)(&y))+2) = data2; 
....................      
....................   #endif 
....................  
....................    do { 
....................       res=y; 
....................       y+=(x/y); 
....................  
....................       #if !defined(__PCD__) 
....................      (*p)--; 
....................    #endif 
....................     
....................    #if defined(__PCD__) 
....................     data1 = *(((unsigned int8 *)(&y))+3); 
....................     data2 = *(((unsigned int8 *)(&y))+2); 
....................     rotate_left(&data1,1); 
....................     if(bit_test(data2,7)) 
....................     bit_set(data1,0);     
....................     data1--; 
....................     bit_clear(data2,7); 
....................     if(bit_test(data1,0)) 
....................     bit_set(data2,7); 
....................     data1 = data1 >>1; 
....................     *(((unsigned int8 *)(&y))+3) = data1; 
....................     *(((unsigned int8 *)(&y))+2) = data2; 
....................      
....................   #endif 
....................    } while(res != y); 
....................  
....................    return(res); 
.................... } 
.................... //Overloaded functions for sqrt() for PCD 
.................... // Overloaded function sqrt() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 sqrt(float48 x) 
.................... { 
....................    float48 y, res; 
....................    unsigned int16 data1,data2; 
....................    BYTE *p; 
....................  
....................    #ifdef _ERRNO 
....................    if(x < 0) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................  
....................    if( x<=0.0) 
....................       return(0.0); 
....................  
....................    y=x; 
....................     
....................    #if !defined(__PCD__) 
....................     p=&y; 
....................    (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1); 
....................    #endif 
....................     
....................    #if defined(__PCD__) 
....................     p = (((unsigned int8 *)(&y))+5); 
....................     data1 = *(((unsigned int8 *)(&y))+5); 
....................     data2 = *(((unsigned int8 *)(&y))+4); 
....................     rotate_left(&data1,1); 
....................     if(bit_test(data2,7)) 
....................     bit_set(data1,0);     
....................     data1 = ((data1+127) >>1); 
....................     bit_clear(data2,7); 
....................     if(bit_test(data1,0)) 
....................     bit_set(data2,7); 
....................     data1 = data1 >>1; 
....................     *(((unsigned int8 *)(&y))+5) = data1; 
....................     *(((unsigned int8 *)(&y))+4) = data2; 
....................      
....................   #endif 
....................  
....................    do { 
....................       res=y; 
....................       y+=(x/y); 
....................  
....................       #if !defined(__PCD__) 
....................      (*p)--; 
....................    #endif 
....................     
....................     data1 = *(((unsigned int8 *)(&y))+5); 
....................     data2 = *(((unsigned int8 *)(&y))+4); 
....................     rotate_left(&data1,1); 
....................     if(bit_test(data2,7)) 
....................     bit_set(data1,0);     
....................     data1--; 
....................     bit_clear(data2,7); 
....................     if(bit_test(data1,0)) 
....................     bit_set(data2,7); 
....................     data1 = data1 >>1; 
....................     *(((unsigned int8 *)(&y))+5) = data1; 
....................     *(((unsigned int8 *)(&y))+4) = data2; 
....................      
....................    } while(res != y); 
....................  
....................    return(res); 
.................... } 
....................  
.................... // Overloaded function sqrt() for data type - Float64 
.................... float64 sqrt(float64 x) 
.................... { 
....................    float64 y, res; 
....................    unsigned int16 *p; 
....................    unsigned int16 temp1,temp2; 
....................  
....................    #ifdef _ERRNO 
....................    if(x < 0) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................  
....................    if( x<=0.0) 
....................       return(0.0); 
....................  
....................    y=x; 
....................    p= (((unsigned int16 *)(&y))+3); 
....................    temp1 = *p; 
....................    temp2 = *p; 
....................    bit_clear(temp1,15); 
....................    temp1 = (temp1>>4)+1023; 
....................    temp1 = temp1 >> 1; 
....................    temp1 = (temp1<<4) & 0xFFF0; 
....................    if(bit_test(temp2,15)) 
....................    bit_set(temp1,15); 
....................    temp2 = temp2 & 0x000F; 
....................    temp1 ^= temp2; 
....................     
....................    (*p) = temp1; 
....................     
....................    do { 
....................       res=y; 
....................       y+=(x/y); 
....................      temp1 = *p; 
....................      temp2 = *p; 
....................      bit_clear(temp1,15); 
....................      temp1 = (temp1>>4); 
....................      temp1--; 
....................      temp1 = (temp1<<4) & 0xFFF0; 
....................      if(bit_test(temp2,15)) 
....................      bit_set(temp1,15); 
....................      temp2 = temp2 & 0x000F; 
....................      temp1 ^= temp2; 
....................      (*p) = temp1; 
....................  
....................    } while(res != y); 
....................  
....................    return(res); 
.................... } 
.................... #endif 
....................  
.................... ////////////////////////////// Trig Functions ////////////////////////////// 
.................... #ifdef PI_DIV_BY_TWO 
.................... #undef PI_DIV_BY_TWO 
.................... #endif 
.................... #define PI_DIV_BY_TWO   1.5707963267948966 
.................... #ifdef TWOBYPI 
.................... #undef TWOBYPI 
.................... #define TWOBYPI          0.6366197723675813 
.................... #endif 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float cos(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the cosine value of the angle x, which is in radian 
.................... // Date : 9/20/2001 
.................... // 
.................... float32 cos(float32 x) 
.................... { 
....................    float32 y, t, t2 = 1.0; 
....................    unsigned int8 quad, i; 
....................    float32 frac; 
....................    float32 p[6] = {                    //by the series definition for cosine 
....................       -0.5,                            // sum ( ( (-1)^n * x^2n )/(2n)! ) 
....................        0.04166666666667, 
....................       -0.00138888888889, 
....................        0.00002480158730, 
....................       -0.00000027557319, 
....................        0.00000000208767, 
....................       //-0.00000000001147, 
....................       // 0.00000000000005 
....................    }; 
....................  
....................    if (x < 0) x = -x;                  // absolute value of input 
....................  
....................    quad = (unsigned int8)(x / PI_DIV_BY_TWO);    // quadrant 
....................    frac = (x / PI_DIV_BY_TWO) - quad;  // fractional part of input 
....................    quad = quad % 4;                    // quadrant (0 to 3) 
....................  
....................    if (quad == 0 || quad == 2) 
....................       t = frac * PI_DIV_BY_TWO; 
....................    else if (quad == 1) 
....................       t = (1-frac) * PI_DIV_BY_TWO; 
....................    else // should be 3 
....................       t = (frac-1) * PI_DIV_BY_TWO; 
....................  
....................    y = 1.0; 
....................    t = t * t; 
....................    for (i = 0; i <= 5; i++) 
....................    { 
....................       t2 = t2 * t; 
....................       y = y + p[i] * t2; 
....................    } 
....................  
....................    if (quad == 2 || quad == 1) 
....................       y = -y;  // correct sign 
....................  
....................    return (y); 
.................... } 
....................  
....................  
.................... //Overloaded functions for cos() for PCD 
.................... // Overloaded function cos() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 cos(float48 x) 
.................... { 
....................    float48 y, t, t2 = 1.0; 
....................    unsigned int8 quad, i; 
....................    float48 frac; 
....................    float48 p[6] = {                    //by the series definition for cosine 
....................       -0.5,                            // sum ( ( (-1)^n * x^2n )/(2n)! ) 
....................        0.04166666666667, 
....................       -0.00138888888889, 
....................        0.00002480158730, 
....................       -0.00000027557319, 
....................        0.00000000208767, 
....................       //-0.00000000001147, 
....................       // 0.00000000000005 
....................    }; 
....................  
....................    if (x < 0) x = -x;                  // absolute value of input 
....................  
....................    quad = (unsigned int8)(x / PI_DIV_BY_TWO);    // quadrant 
....................    frac = (x / PI_DIV_BY_TWO) - quad;  // fractional part of input 
....................    quad = quad % 4;                    // quadrant (0 to 3) 
....................  
....................    if (quad == 0 || quad == 2) 
....................       t = frac * PI_DIV_BY_TWO; 
....................    else if (quad == 1) 
....................       t = (1-frac) * PI_DIV_BY_TWO; 
....................    else // should be 3 
....................       t = (frac-1) * PI_DIV_BY_TWO; 
....................  
....................    y = 0.999999999781; 
....................    t = t * t; 
....................    for (i = 0; i <= 5; i++) 
....................    { 
....................       t2 = t2 * t; 
....................       y = y + p[i] * t2; 
....................    } 
....................  
....................    if (quad == 2 || quad == 1) 
....................       y = -y;  // correct sign 
....................  
....................    return (y); 
.................... } 
....................  
.................... // Overloaded function cos() for data type - Float48 
.................... float64 cos(float64 x) 
.................... { 
....................    float64 y, t, t2 = 1.0; 
....................    unsigned int8 quad, i; 
....................    float64 frac; 
....................    float64 p[6] = {                    //by the series definition for cosine 
....................       -0.5,                            // sum ( ( (-1)^n * x^2n )/(2n)! ) 
....................        0.04166666666667, 
....................       -0.00138888888889, 
....................        0.00002480158730, 
....................       -0.00000027557319, 
....................        0.00000000208767, 
....................       //-0.00000000001147, 
....................       // 0.00000000000005 
....................    }; 
....................  
....................    if (x < 0) x = -x;                  // absolute value of input 
....................  
....................    quad = (unsigned int8)(x / PI_DIV_BY_TWO);    // quadrant 
....................    frac = (x / PI_DIV_BY_TWO) - quad;  // fractional part of input 
....................    quad = quad % 4;                    // quadrant (0 to 3) 
....................  
....................    if (quad == 0 || quad == 2) 
....................       t = frac * PI_DIV_BY_TWO; 
....................    else if (quad == 1) 
....................       t = (1-frac) * PI_DIV_BY_TWO; 
....................    else // should be 3 
....................       t = (frac-1) * PI_DIV_BY_TWO; 
....................  
....................    y = 0.999999999781; 
....................    t = t * t; 
....................    for (i = 0; i <= 5; i++) 
....................    { 
....................       t2 = t2 * t; 
....................       y = y + p[i] * t2; 
....................    } 
....................  
....................    if (quad == 2 || quad == 1) 
....................       y = -y;  // correct sign 
....................  
....................    return (y); 
.................... } 
....................  
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float sin(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the sine value of the angle x, which is in radian 
.................... // Date : 9/20/2001 
.................... // 
.................... float32 sin(float32 x) 
.................... { 
....................    return cos(x - PI_DIV_BY_TWO); 
.................... } 
....................  
.................... //Overloaded functions for sin() for PCD 
.................... // Overloaded function sin() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 sin(float48 x) 
.................... { 
....................    return cos(x - PI_DIV_BY_TWO); 
.................... } 
....................  
.................... // Overloaded function sin() for data type - Float48 
.................... float64 sin(float64 x) 
.................... { 
....................    return cos(x - PI_DIV_BY_TWO); 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float tan(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the tangent value of the angle x, which is in radian 
.................... // Date : 9/20/2001 
.................... // 
.................... float32 tan(float32 x) 
.................... { 
....................    float32 c, s; 
....................  
....................    c = cos(x); 
....................    if (c == 0.0) 
....................       return (1.0e+36); 
....................  
....................    s = sin(x); 
....................    return(s/c); 
.................... } 
.................... //Overloaded functions for tan() for PCD 
.................... // Overloaded function tan() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 tan(float48 x) 
.................... { 
....................    float48 c, s; 
....................  
....................    c = cos(x); 
....................    if (c == 0.0) 
....................       return (1.0e+36); 
....................  
....................    s = sin(x); 
....................    return(s/c); 
.................... } 
....................  
.................... // Overloaded function tan() for data type - Float48 
.................... float64 tan(float64 x) 
.................... { 
....................    float64 c, s; 
....................  
....................    c = cos(x); 
....................    if (c == 0.0) 
....................       return (1.0e+36); 
....................  
....................    s = sin(x); 
....................    return(s/c); 
.................... } 
.................... #endif 
....................  
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290}; 
.................... float32 const qas[3] = {1.0000000,  -5.5484666, 5.6036290}; 
....................  
.................... float32 ASIN_COS(float32 x, unsigned int8 n) 
.................... { 
....................    float32 y, res, r, y2; 
....................    int1 s; 
....................    #ifdef _ERRNO 
....................    if(x <-1 || x > 1) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       y = -y; 
....................    } 
....................  
....................    if (y > 0.5) 
....................    { 
....................       y = sqrt((1.0 - y)/2.0); 
....................       n += 2; 
....................    } 
....................  
....................    y2=y*y; 
....................  
....................    res = pas[0]*y2 + pas[1]; 
....................    res = res*y2 + pas[2]; 
....................  
....................    r = qas[0]*y2 + qas[1]; 
....................    r = r*y2 + qas[2]; 
....................  
....................    res = y*res/r; 
....................  
....................    if (n & 2)     // |x| > 0.5 
....................       res = PI_DIV_BY_TWO - 2.0*res; 
....................    if (s) 
....................       res = -res; 
....................    if (n & 1)           // take arccos 
....................       res = PI_DIV_BY_TWO - res; 
....................  
....................    return(res); 
.................... } 
....................  
.................... //Overloaded functions for ASIN_COS() for PCD 
.................... // Overloaded function ASIN_COS() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 ASIN_COS(float48 x, unsigned int8 n) 
.................... { 
....................    float48 y, res, r, y2; 
....................    int1 s; 
....................    #ifdef _ERRNO 
....................    if(x <-1 || x > 1) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       y = -y; 
....................    } 
....................  
....................    if (y > 0.5) 
....................    { 
....................       y = sqrt((1.0 - y)/2.0); 
....................       n += 2; 
....................    } 
....................  
....................    y2=y*y; 
....................  
....................    res = pas[0]*y2 + pas[1]; 
....................    res = res*y2 + pas[2]; 
....................  
....................    r = qas[0]*y2 + qas[1]; 
....................    r = r*y2 + qas[2]; 
....................  
....................    res = y*res/r; 
....................  
....................    if (n & 2)     // |x| > 0.5 
....................       res = PI_DIV_BY_TWO - 2.0*res; 
....................    if (s) 
....................       res = -res; 
....................    if (n & 1)           // take arccos 
....................       res = PI_DIV_BY_TWO - res; 
....................  
....................    return(res); 
.................... } 
....................  
.................... // Overloaded function ASIN_COS() for data type - Float64 
.................... float64 ASIN_COS(float64 x, unsigned int8 n) 
.................... { 
....................    float64 y, res, r, y2; 
....................    int1 s; 
....................    #ifdef _ERRNO 
....................    if(x <-1 || x > 1) 
....................    { 
....................       errno=EDOM; 
....................    } 
....................    #endif 
....................    s = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       y = -y; 
....................    } 
....................  
....................    if (y > 0.5) 
....................    { 
....................       y = sqrt((1.0 - y)/2.0); 
....................       n += 2; 
....................    } 
....................  
....................    y2=y*y; 
....................  
....................    res = pas[0]*y2 + pas[1]; 
....................    res = res*y2 + pas[2]; 
....................  
....................    r = qas[0]*y2 + qas[1]; 
....................    r = r*y2 + qas[2]; 
....................  
....................    res = y*res/r; 
....................  
....................    if (n & 2)     // |x| > 0.5 
....................       res = PI_DIV_BY_TWO - 2.0*res; 
....................    if (s) 
....................       res = -res; 
....................    if (n & 1)           // take arccos 
....................       res = PI_DIV_BY_TWO - res; 
....................  
....................    return(res); 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float asin(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the arcsine value of the value x. 
.................... // Date : N/A 
.................... // 
.................... float32 asin(float32 x) 
.................... { 
....................    float32 r; 
....................  
....................    r = ASIN_COS(x, 0); 
....................    return(r); 
.................... } 
.................... //Overloaded functions for asin() for PCD 
.................... // Overloaded function asin() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 asin(float48 x) 
.................... { 
....................    float48 r; 
....................  
....................    r = ASIN_COS(x, 0); 
....................    return(r); 
.................... } 
....................  
.................... // Overloaded function asin() for data type - Float64 
.................... float64 asin(float64 x) 
.................... { 
....................    float64 r; 
....................  
....................    r = ASIN_COS(x, 0); 
....................    return(r); 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float acos(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the arccosine value of the value x. 
.................... // Date : N/A 
.................... // 
.................... float32 acos(float32 x) 
.................... { 
....................    float32 r; 
....................  
....................    r = ASIN_COS(x, 1); 
....................    return(r); 
.................... } 
.................... //Overloaded functions for acos() for PCD 
.................... // Overloaded function acos() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 acos(float48 x) 
.................... { 
....................    float48 r; 
....................  
....................    r = ASIN_COS(x, 1); 
....................    return(r); 
.................... } 
....................  
.................... // Overloaded function acos() for data type - Float64 
.................... float64 acos(float64 x) 
.................... { 
....................    float64 r; 
....................  
....................    r = ASIN_COS(x, 1); 
....................    return(r); 
.................... } 
.................... #endif 
....................  
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457}; 
.................... float32 const qat[4] = {1.0000000,  11.368190, 28.982246, 19.818457}; 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float atan(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : returns the arctangent value of the value x. 
.................... // Date : N/A 
.................... // 
.................... float32 atan(float32 x) 
.................... { 
....................    float32 y, res, r; 
....................    int1 s, flag; 
....................  
....................    s = 0; 
*
095D:  BCF    67.0
....................    flag = 0; 
095E:  BCF    67.1
....................    y = x; 
095F:  MOVF   5A,W
0960:  MOVWF  5E
0961:  MOVF   59,W
0962:  MOVWF  5D
0963:  MOVF   58,W
0964:  MOVWF  5C
0965:  MOVF   57,W
0966:  MOVWF  5B
....................  
....................    if (x < 0) 
0967:  MOVF   5A,W
0968:  MOVWF  6B
0969:  MOVF   59,W
096A:  MOVWF  6A
096B:  MOVF   58,W
096C:  MOVWF  69
096D:  MOVF   57,W
096E:  MOVWF  68
096F:  CLRF   6F
0970:  CLRF   6E
0971:  CLRF   6D
0972:  CLRF   6C
0973:  BCF    0A.3
0974:  CALL   5E7
0975:  BSF    0A.3
0976:  BTFSS  03.0
0977:  GOTO   17C
....................    { 
....................       s = 1; 
0978:  BSF    67.0
....................       y = -y; 
0979:  MOVF   5C,W
097A:  XORLW  80
097B:  MOVWF  5C
....................    } 
....................  
....................    if (y > 1.0) 
097C:  CLRF   6B
097D:  CLRF   6A
097E:  CLRF   69
097F:  MOVLW  7F
0980:  MOVWF  68
0981:  MOVF   5E,W
0982:  MOVWF  6F
0983:  MOVF   5D,W
0984:  MOVWF  6E
0985:  MOVF   5C,W
0986:  MOVWF  6D
0987:  MOVF   5B,W
0988:  MOVWF  6C
0989:  BCF    0A.3
098A:  CALL   5E7
098B:  BSF    0A.3
098C:  BTFSS  03.0
098D:  GOTO   1A7
....................    { 
....................       y = 1.0/y; 
098E:  CLRF   6F
098F:  CLRF   6E
0990:  CLRF   6D
0991:  MOVLW  7F
0992:  MOVWF  6C
0993:  MOVF   5E,W
0994:  MOVWF  73
0995:  MOVF   5D,W
0996:  MOVWF  72
0997:  MOVF   5C,W
0998:  MOVWF  71
0999:  MOVF   5B,W
099A:  MOVWF  70
099B:  BCF    0A.3
099C:  CALL   506
099D:  BSF    0A.3
099E:  MOVF   7A,W
099F:  MOVWF  5E
09A0:  MOVF   79,W
09A1:  MOVWF  5D
09A2:  MOVF   78,W
09A3:  MOVWF  5C
09A4:  MOVF   77,W
09A5:  MOVWF  5B
....................       flag = 1; 
09A6:  BSF    67.1
....................    } 
....................  
....................    res = pat[0]*y*y + pat[1]; 
09A7:  MOVLW  0A
09A8:  MOVWF  6F
09A9:  MOVLW  89
09AA:  MOVWF  6E
09AB:  MOVLW  34
09AC:  MOVWF  6D
09AD:  MOVLW  7C
09AE:  MOVWF  6C
09AF:  MOVF   5E,W
09B0:  MOVWF  73
09B1:  MOVF   5D,W
09B2:  MOVWF  72
09B3:  MOVF   5C,W
09B4:  MOVWF  71
09B5:  MOVF   5B,W
09B6:  MOVWF  70
09B7:  BCF    0A.3
09B8:  CALL   626
09B9:  BSF    0A.3
09BA:  MOVF   77,W
09BB:  MOVWF  68
09BC:  MOVF   78,W
09BD:  MOVWF  69
09BE:  MOVF   79,W
09BF:  MOVWF  6A
09C0:  MOVF   7A,W
09C1:  MOVWF  6B
09C2:  MOVWF  6F
09C3:  MOVF   79,W
09C4:  MOVWF  6E
09C5:  MOVF   78,W
09C6:  MOVWF  6D
09C7:  MOVF   77,W
09C8:  MOVWF  6C
09C9:  MOVF   5E,W
09CA:  MOVWF  73
09CB:  MOVF   5D,W
09CC:  MOVWF  72
09CD:  MOVF   5C,W
09CE:  MOVWF  71
09CF:  MOVF   5B,W
09D0:  MOVWF  70
09D1:  BCF    0A.3
09D2:  CALL   626
09D3:  BSF    0A.3
09D4:  MOVF   77,W
09D5:  MOVWF  68
09D6:  MOVF   78,W
09D7:  MOVWF  69
09D8:  MOVF   79,W
09D9:  MOVWF  6A
09DA:  MOVF   7A,W
09DB:  MOVWF  6B
09DC:  BCF    03.1
09DD:  MOVF   7A,W
09DE:  MOVWF  6F
09DF:  MOVF   79,W
09E0:  MOVWF  6E
09E1:  MOVF   78,W
09E2:  MOVWF  6D
09E3:  MOVF   77,W
09E4:  MOVWF  6C
09E5:  MOVLW  7C
09E6:  MOVWF  73
09E7:  MOVLW  79
09E8:  MOVWF  72
09E9:  MOVLW  35
09EA:  MOVWF  71
09EB:  MOVLW  81
09EC:  MOVWF  70
09ED:  CALL   000
09EE:  MOVF   7A,W
09EF:  MOVWF  62
09F0:  MOVF   79,W
09F1:  MOVWF  61
09F2:  MOVF   78,W
09F3:  MOVWF  60
09F4:  MOVF   77,W
09F5:  MOVWF  5F
....................    res = res*y*y + pat[2]; 
09F6:  MOVF   62,W
09F7:  MOVWF  6F
09F8:  MOVF   61,W
09F9:  MOVWF  6E
09FA:  MOVF   60,W
09FB:  MOVWF  6D
09FC:  MOVF   5F,W
09FD:  MOVWF  6C
09FE:  MOVF   5E,W
09FF:  MOVWF  73
0A00:  MOVF   5D,W
0A01:  MOVWF  72
0A02:  MOVF   5C,W
0A03:  MOVWF  71
0A04:  MOVF   5B,W
0A05:  MOVWF  70
0A06:  BCF    0A.3
0A07:  CALL   626
0A08:  BSF    0A.3
0A09:  MOVF   77,W
0A0A:  MOVWF  68
0A0B:  MOVF   78,W
0A0C:  MOVWF  69
0A0D:  MOVF   79,W
0A0E:  MOVWF  6A
0A0F:  MOVF   7A,W
0A10:  MOVWF  6B
0A11:  MOVWF  6F
0A12:  MOVF   79,W
0A13:  MOVWF  6E
0A14:  MOVF   78,W
0A15:  MOVWF  6D
0A16:  MOVF   77,W
0A17:  MOVWF  6C
0A18:  MOVF   5E,W
0A19:  MOVWF  73
0A1A:  MOVF   5D,W
0A1B:  MOVWF  72
0A1C:  MOVF   5C,W
0A1D:  MOVWF  71
0A1E:  MOVF   5B,W
0A1F:  MOVWF  70
0A20:  BCF    0A.3
0A21:  CALL   626
0A22:  BSF    0A.3
0A23:  MOVF   77,W
0A24:  MOVWF  68
0A25:  MOVF   78,W
0A26:  MOVWF  69
0A27:  MOVF   79,W
0A28:  MOVWF  6A
0A29:  MOVF   7A,W
0A2A:  MOVWF  6B
0A2B:  BCF    03.1
0A2C:  MOVF   7A,W
0A2D:  MOVWF  6F
0A2E:  MOVF   79,W
0A2F:  MOVWF  6E
0A30:  MOVF   78,W
0A31:  MOVWF  6D
0A32:  MOVF   77,W
0A33:  MOVWF  6C
0A34:  MOVLW  3F
0A35:  MOVWF  73
0A36:  MOVLW  02
0A37:  MOVWF  72
0A38:  MOVLW  33
0A39:  MOVWF  71
0A3A:  MOVLW  83
0A3B:  MOVWF  70
0A3C:  CALL   000
0A3D:  MOVF   7A,W
0A3E:  MOVWF  62
0A3F:  MOVF   79,W
0A40:  MOVWF  61
0A41:  MOVF   78,W
0A42:  MOVWF  60
0A43:  MOVF   77,W
0A44:  MOVWF  5F
....................    res = res*y*y + pat[3]; 
0A45:  MOVF   62,W
0A46:  MOVWF  6F
0A47:  MOVF   61,W
0A48:  MOVWF  6E
0A49:  MOVF   60,W
0A4A:  MOVWF  6D
0A4B:  MOVF   5F,W
0A4C:  MOVWF  6C
0A4D:  MOVF   5E,W
0A4E:  MOVWF  73
0A4F:  MOVF   5D,W
0A50:  MOVWF  72
0A51:  MOVF   5C,W
0A52:  MOVWF  71
0A53:  MOVF   5B,W
0A54:  MOVWF  70
0A55:  BCF    0A.3
0A56:  CALL   626
0A57:  BSF    0A.3
0A58:  MOVF   77,W
0A59:  MOVWF  68
0A5A:  MOVF   78,W
0A5B:  MOVWF  69
0A5C:  MOVF   79,W
0A5D:  MOVWF  6A
0A5E:  MOVF   7A,W
0A5F:  MOVWF  6B
0A60:  MOVWF  6F
0A61:  MOVF   79,W
0A62:  MOVWF  6E
0A63:  MOVF   78,W
0A64:  MOVWF  6D
0A65:  MOVF   77,W
0A66:  MOVWF  6C
0A67:  MOVF   5E,W
0A68:  MOVWF  73
0A69:  MOVF   5D,W
0A6A:  MOVWF  72
0A6B:  MOVF   5C,W
0A6C:  MOVWF  71
0A6D:  MOVF   5B,W
0A6E:  MOVWF  70
0A6F:  BCF    0A.3
0A70:  CALL   626
0A71:  BSF    0A.3
0A72:  MOVF   77,W
0A73:  MOVWF  68
0A74:  MOVF   78,W
0A75:  MOVWF  69
0A76:  MOVF   79,W
0A77:  MOVWF  6A
0A78:  MOVF   7A,W
0A79:  MOVWF  6B
0A7A:  BCF    03.1
0A7B:  MOVF   7A,W
0A7C:  MOVWF  6F
0A7D:  MOVF   79,W
0A7E:  MOVWF  6E
0A7F:  MOVF   78,W
0A80:  MOVWF  6D
0A81:  MOVF   77,W
0A82:  MOVWF  6C
0A83:  MOVLW  33
0A84:  MOVWF  73
0A85:  MOVLW  8C
0A86:  MOVWF  72
0A87:  MOVLW  1E
0A88:  MOVWF  71
0A89:  MOVLW  83
0A8A:  MOVWF  70
0A8B:  CALL   000
0A8C:  MOVF   7A,W
0A8D:  MOVWF  62
0A8E:  MOVF   79,W
0A8F:  MOVWF  61
0A90:  MOVF   78,W
0A91:  MOVWF  60
0A92:  MOVF   77,W
0A93:  MOVWF  5F
....................  
....................    r = qat[0]*y*y + qat[1]; 
0A94:  CLRF   6F
0A95:  CLRF   6E
0A96:  CLRF   6D
0A97:  MOVLW  7F
0A98:  MOVWF  6C
0A99:  MOVF   5E,W
0A9A:  MOVWF  73
0A9B:  MOVF   5D,W
0A9C:  MOVWF  72
0A9D:  MOVF   5C,W
0A9E:  MOVWF  71
0A9F:  MOVF   5B,W
0AA0:  MOVWF  70
0AA1:  BCF    0A.3
0AA2:  CALL   626
0AA3:  BSF    0A.3
0AA4:  MOVF   77,W
0AA5:  MOVWF  68
0AA6:  MOVF   78,W
0AA7:  MOVWF  69
0AA8:  MOVF   79,W
0AA9:  MOVWF  6A
0AAA:  MOVF   7A,W
0AAB:  MOVWF  6B
0AAC:  MOVWF  6F
0AAD:  MOVF   79,W
0AAE:  MOVWF  6E
0AAF:  MOVF   78,W
0AB0:  MOVWF  6D
0AB1:  MOVF   77,W
0AB2:  MOVWF  6C
0AB3:  MOVF   5E,W
0AB4:  MOVWF  73
0AB5:  MOVF   5D,W
0AB6:  MOVWF  72
0AB7:  MOVF   5C,W
0AB8:  MOVWF  71
0AB9:  MOVF   5B,W
0ABA:  MOVWF  70
0ABB:  BCF    0A.3
0ABC:  CALL   626
0ABD:  BSF    0A.3
0ABE:  MOVF   77,W
0ABF:  MOVWF  68
0AC0:  MOVF   78,W
0AC1:  MOVWF  69
0AC2:  MOVF   79,W
0AC3:  MOVWF  6A
0AC4:  MOVF   7A,W
0AC5:  MOVWF  6B
0AC6:  BCF    03.1
0AC7:  MOVF   7A,W
0AC8:  MOVWF  6F
0AC9:  MOVF   79,W
0ACA:  MOVWF  6E
0ACB:  MOVF   78,W
0ACC:  MOVWF  6D
0ACD:  MOVF   77,W
0ACE:  MOVWF  6C
0ACF:  MOVLW  1B
0AD0:  MOVWF  73
0AD1:  MOVLW  E4
0AD2:  MOVWF  72
0AD3:  MOVLW  35
0AD4:  MOVWF  71
0AD5:  MOVLW  82
0AD6:  MOVWF  70
0AD7:  CALL   000
0AD8:  MOVF   7A,W
0AD9:  MOVWF  66
0ADA:  MOVF   79,W
0ADB:  MOVWF  65
0ADC:  MOVF   78,W
0ADD:  MOVWF  64
0ADE:  MOVF   77,W
0ADF:  MOVWF  63
....................    r = r*y*y + qat[2]; 
0AE0:  MOVF   66,W
0AE1:  MOVWF  6F
0AE2:  MOVF   65,W
0AE3:  MOVWF  6E
0AE4:  MOVF   64,W
0AE5:  MOVWF  6D
0AE6:  MOVF   63,W
0AE7:  MOVWF  6C
0AE8:  MOVF   5E,W
0AE9:  MOVWF  73
0AEA:  MOVF   5D,W
0AEB:  MOVWF  72
0AEC:  MOVF   5C,W
0AED:  MOVWF  71
0AEE:  MOVF   5B,W
0AEF:  MOVWF  70
0AF0:  BCF    0A.3
0AF1:  CALL   626
0AF2:  BSF    0A.3
0AF3:  MOVF   77,W
0AF4:  MOVWF  68
0AF5:  MOVF   78,W
0AF6:  MOVWF  69
0AF7:  MOVF   79,W
0AF8:  MOVWF  6A
0AF9:  MOVF   7A,W
0AFA:  MOVWF  6B
0AFB:  MOVWF  6F
0AFC:  MOVF   79,W
0AFD:  MOVWF  6E
0AFE:  MOVF   78,W
0AFF:  MOVWF  6D
0B00:  MOVF   77,W
0B01:  MOVWF  6C
0B02:  MOVF   5E,W
0B03:  MOVWF  73
0B04:  MOVF   5D,W
0B05:  MOVWF  72
0B06:  MOVF   5C,W
0B07:  MOVWF  71
0B08:  MOVF   5B,W
0B09:  MOVWF  70
0B0A:  BCF    0A.3
0B0B:  CALL   626
0B0C:  BSF    0A.3
0B0D:  MOVF   77,W
0B0E:  MOVWF  68
0B0F:  MOVF   78,W
0B10:  MOVWF  69
0B11:  MOVF   79,W
0B12:  MOVWF  6A
0B13:  MOVF   7A,W
0B14:  MOVWF  6B
0B15:  BCF    03.1
0B16:  MOVF   7A,W
0B17:  MOVWF  6F
0B18:  MOVF   79,W
0B19:  MOVWF  6E
0B1A:  MOVF   78,W
0B1B:  MOVWF  6D
0B1C:  MOVF   77,W
0B1D:  MOVWF  6C
0B1E:  MOVLW  A4
0B1F:  MOVWF  73
0B20:  MOVLW  DB
0B21:  MOVWF  72
0B22:  MOVLW  67
0B23:  MOVWF  71
0B24:  MOVLW  83
0B25:  MOVWF  70
0B26:  CALL   000
0B27:  MOVF   7A,W
0B28:  MOVWF  66
0B29:  MOVF   79,W
0B2A:  MOVWF  65
0B2B:  MOVF   78,W
0B2C:  MOVWF  64
0B2D:  MOVF   77,W
0B2E:  MOVWF  63
....................    r = r*y*y + qat[3]; 
0B2F:  MOVF   66,W
0B30:  MOVWF  6F
0B31:  MOVF   65,W
0B32:  MOVWF  6E
0B33:  MOVF   64,W
0B34:  MOVWF  6D
0B35:  MOVF   63,W
0B36:  MOVWF  6C
0B37:  MOVF   5E,W
0B38:  MOVWF  73
0B39:  MOVF   5D,W
0B3A:  MOVWF  72
0B3B:  MOVF   5C,W
0B3C:  MOVWF  71
0B3D:  MOVF   5B,W
0B3E:  MOVWF  70
0B3F:  BCF    0A.3
0B40:  CALL   626
0B41:  BSF    0A.3
0B42:  MOVF   77,W
0B43:  MOVWF  68
0B44:  MOVF   78,W
0B45:  MOVWF  69
0B46:  MOVF   79,W
0B47:  MOVWF  6A
0B48:  MOVF   7A,W
0B49:  MOVWF  6B
0B4A:  MOVWF  6F
0B4B:  MOVF   79,W
0B4C:  MOVWF  6E
0B4D:  MOVF   78,W
0B4E:  MOVWF  6D
0B4F:  MOVF   77,W
0B50:  MOVWF  6C
0B51:  MOVF   5E,W
0B52:  MOVWF  73
0B53:  MOVF   5D,W
0B54:  MOVWF  72
0B55:  MOVF   5C,W
0B56:  MOVWF  71
0B57:  MOVF   5B,W
0B58:  MOVWF  70
0B59:  BCF    0A.3
0B5A:  CALL   626
0B5B:  BSF    0A.3
0B5C:  MOVF   77,W
0B5D:  MOVWF  68
0B5E:  MOVF   78,W
0B5F:  MOVWF  69
0B60:  MOVF   79,W
0B61:  MOVWF  6A
0B62:  MOVF   7A,W
0B63:  MOVWF  6B
0B64:  BCF    03.1
0B65:  MOVF   7A,W
0B66:  MOVWF  6F
0B67:  MOVF   79,W
0B68:  MOVWF  6E
0B69:  MOVF   78,W
0B6A:  MOVWF  6D
0B6B:  MOVF   77,W
0B6C:  MOVWF  6C
0B6D:  MOVLW  33
0B6E:  MOVWF  73
0B6F:  MOVLW  8C
0B70:  MOVWF  72
0B71:  MOVLW  1E
0B72:  MOVWF  71
0B73:  MOVLW  83
0B74:  MOVWF  70
0B75:  CALL   000
0B76:  MOVF   7A,W
0B77:  MOVWF  66
0B78:  MOVF   79,W
0B79:  MOVWF  65
0B7A:  MOVF   78,W
0B7B:  MOVWF  64
0B7C:  MOVF   77,W
0B7D:  MOVWF  63
....................  
....................    res = y*res/r; 
0B7E:  MOVF   5E,W
0B7F:  MOVWF  6F
0B80:  MOVF   5D,W
0B81:  MOVWF  6E
0B82:  MOVF   5C,W
0B83:  MOVWF  6D
0B84:  MOVF   5B,W
0B85:  MOVWF  6C
0B86:  MOVF   62,W
0B87:  MOVWF  73
0B88:  MOVF   61,W
0B89:  MOVWF  72
0B8A:  MOVF   60,W
0B8B:  MOVWF  71
0B8C:  MOVF   5F,W
0B8D:  MOVWF  70
0B8E:  BCF    0A.3
0B8F:  CALL   626
0B90:  BSF    0A.3
0B91:  MOVF   77,W
0B92:  MOVWF  68
0B93:  MOVF   78,W
0B94:  MOVWF  69
0B95:  MOVF   79,W
0B96:  MOVWF  6A
0B97:  MOVF   7A,W
0B98:  MOVWF  6B
0B99:  MOVWF  6F
0B9A:  MOVF   79,W
0B9B:  MOVWF  6E
0B9C:  MOVF   78,W
0B9D:  MOVWF  6D
0B9E:  MOVF   77,W
0B9F:  MOVWF  6C
0BA0:  MOVF   66,W
0BA1:  MOVWF  73
0BA2:  MOVF   65,W
0BA3:  MOVWF  72
0BA4:  MOVF   64,W
0BA5:  MOVWF  71
0BA6:  MOVF   63,W
0BA7:  MOVWF  70
0BA8:  BCF    0A.3
0BA9:  CALL   506
0BAA:  BSF    0A.3
0BAB:  MOVF   7A,W
0BAC:  MOVWF  62
0BAD:  MOVF   79,W
0BAE:  MOVWF  61
0BAF:  MOVF   78,W
0BB0:  MOVWF  60
0BB1:  MOVF   77,W
0BB2:  MOVWF  5F
....................  
....................  
....................    if (flag)                              // for |x| > 1 
0BB3:  BTFSS  67.1
0BB4:  GOTO   3CF
....................       res = PI_DIV_BY_TWO - res; 
0BB5:  BSF    03.1
0BB6:  MOVLW  DB
0BB7:  MOVWF  6F
0BB8:  MOVLW  0F
0BB9:  MOVWF  6E
0BBA:  MOVLW  49
0BBB:  MOVWF  6D
0BBC:  MOVLW  7F
0BBD:  MOVWF  6C
0BBE:  MOVF   62,W
0BBF:  MOVWF  73
0BC0:  MOVF   61,W
0BC1:  MOVWF  72
0BC2:  MOVF   60,W
0BC3:  MOVWF  71
0BC4:  MOVF   5F,W
0BC5:  MOVWF  70
0BC6:  CALL   000
0BC7:  MOVF   7A,W
0BC8:  MOVWF  62
0BC9:  MOVF   79,W
0BCA:  MOVWF  61
0BCB:  MOVF   78,W
0BCC:  MOVWF  60
0BCD:  MOVF   77,W
0BCE:  MOVWF  5F
....................    if (s) 
0BCF:  BTFSS  67.0
0BD0:  GOTO   3D4
....................       res = -res; 
0BD1:  MOVF   60,W
0BD2:  XORLW  80
0BD3:  MOVWF  60
....................  
....................    return(res); 
0BD4:  MOVF   5F,W
0BD5:  MOVWF  77
0BD6:  MOVF   60,W
0BD7:  MOVWF  78
0BD8:  MOVF   61,W
0BD9:  MOVWF  79
0BDA:  MOVF   62,W
0BDB:  MOVWF  7A
.................... } 
0BDC:  RETURN
.................... //Overloaded functions for atan() for PCD 
.................... // Overloaded function atan() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 atan(float48 x) 
.................... { 
....................    float48 y, res, r; 
....................    int1 s, flag; 
....................  
....................    s = 0; 
....................    flag = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       y = -y; 
....................    } 
....................  
....................    if (y > 1.0) 
....................    { 
....................       y = 1.0/y; 
....................       flag = 1; 
....................    } 
....................  
....................    res = pat[0]*y*y + pat[1]; 
....................    res = res*y*y + pat[2]; 
....................    res = res*y*y + pat[3]; 
....................  
....................    r = qat[0]*y*y + qat[1]; 
....................    r = r*y*y + qat[2]; 
....................    r = r*y*y + qat[3]; 
....................  
....................    res = y*res/r; 
....................  
....................  
....................    if (flag)                              // for |x| > 1 
....................       res = PI_DIV_BY_TWO - res; 
....................    if (s) 
....................       res = -res; 
....................  
....................    return(res); 
.................... } 
....................  
.................... // Overloaded function atan() for data type - Float64 
.................... float64 atan(float64 x) 
.................... { 
....................    float64 y, res, r; 
....................    int1 s, flag; 
....................  
....................    s = 0; 
....................    flag = 0; 
....................    y = x; 
....................  
....................    if (x < 0) 
....................    { 
....................       s = 1; 
....................       y = -y; 
....................    } 
....................  
....................    if (y > 1.0) 
....................    { 
....................       y = 1.0/y; 
....................       flag = 1; 
....................    } 
....................  
....................    res = pat[0]*y*y + pat[1]; 
....................    res = res*y*y + pat[2]; 
....................    res = res*y*y + pat[3]; 
....................  
....................    r = qat[0]*y*y + qat[1]; 
....................    r = r*y*y + qat[2]; 
....................    r = r*y*y + qat[3]; 
....................  
....................    res = y*res/r; 
....................  
....................  
....................    if (flag)                              // for |x| > 1 
....................       res = PI_DIV_BY_TWO - res; 
....................    if (s) 
....................       res = -res; 
....................  
....................    return(res); 
.................... } 
.................... #endif 
....................  
.................... ///////////////////////////////////////////////////////////////////////////// 
.................... //   float atan2(float y, float x) 
.................... ///////////////////////////////////////////////////////////////////////////// 
.................... // Description :computes the principal value of arc tangent of y/x, using the 
.................... // signs of both the arguments to determine the quadrant of the return value 
.................... // Returns : returns the arc tangent of y/x. 
.................... // Date : N/A 
.................... // 
....................  
.................... float32 atan2(float32 y,float32 x) 
.................... { 
....................    float32 z; 
....................    int1 sign; 
....................    unsigned int8 quad; 
....................    sign=0; 
....................    quad=0; //quadrant 
....................    quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); 
....................    if(y<0.0) 
....................    { 
....................       sign=1; 
....................       y=-y; 
....................    } 
....................    if(x<0.0) 
....................    { 
....................       x=-x; 
....................    } 
....................    if (x==0.0) 
....................    { 
....................       if(y==0.0) 
....................       { 
....................       #ifdef _ERRNO 
....................       { 
....................          errno=EDOM; 
....................       } 
....................       #endif 
....................       } 
....................       else 
....................       { 
....................          if(sign) 
....................          { 
....................          return (-(PI_DIV_BY_TWO)); 
....................          } 
....................          else 
....................          { 
....................          return (PI_DIV_BY_TWO); 
....................          } 
....................       } 
....................    } 
....................    else 
....................    { 
....................       z=y/x; 
....................       switch(quad) 
....................       { 
....................          case 1: 
....................          { 
....................             return atan(z); 
....................             break; 
....................          } 
....................          case 2: 
....................          { 
.................... //            return (atan(z)+PI_DIV_BY_TWO);  //2L3122 
....................             return (PI-atan(z)); 
....................             break; 
....................          } 
....................          case 3: 
....................          { 
....................             return (atan(z)-PI); 
....................             break; 
....................          } 
....................          case 4: 
....................          { 
....................             return (-atan(z)); 
....................             break; 
....................          } 
....................       } 
....................    } 
.................... } 
....................  
.................... //Overloaded functions for atan2() for PCD 
.................... // Overloaded function atan2() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 atan2(float48 y,float48 x) 
.................... { 
....................    float48 z; 
....................    int1 sign; 
....................    unsigned int8 quad; 
....................    sign=0; 
....................    quad=0; //quadrant 
....................    quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); 
....................    if(y<0.0) 
....................    { 
....................       sign=1; 
....................       y=-y; 
....................    } 
....................    if(x<0.0) 
....................    { 
....................       x=-x; 
....................    } 
....................    if (x==0.0) 
....................    { 
....................       if(y==0.0) 
....................       { 
....................       #ifdef _ERRNO 
....................       { 
....................          errno=EDOM; 
....................       } 
....................       #endif 
....................       } 
....................       else 
....................       { 
....................          if(sign) 
....................          { 
....................          return (-(PI_DIV_BY_TWO)); 
....................          } 
....................          else 
....................          { 
....................          return (PI_DIV_BY_TWO); 
....................          } 
....................       } 
....................    } 
....................    else 
....................    { 
....................       z=y/x; 
....................       switch(quad) 
....................       { 
....................          case 1: 
....................          { 
....................             return atan(z); 
....................             break; 
....................          } 
....................          case 2: 
....................          { 
.................... //            return (atan(z)+PI_DIV_BY_TWO);  //2L3122 
....................             return (PI-atan(z)); 
....................             break; 
....................          } 
....................          case 3: 
....................          { 
....................             return (atan(z)-PI); 
....................             break; 
....................          } 
....................          case 4: 
....................          { 
....................             return (-atan(z)); 
....................             break; 
....................          } 
....................       } 
....................    } 
.................... } 
....................  
.................... // Overloaded function atan2() for data type - Float64 
.................... float64 atan2(float64 y,float64 x) 
.................... { 
....................    float64 z; 
....................    int1 sign; 
....................    unsigned int8 quad; 
....................    sign=0; 
....................    quad=0; //quadrant 
....................    quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1)); 
....................    if(y<0.0) 
....................    { 
....................       sign=1; 
....................       y=-y; 
....................    } 
....................    if(x<0.0) 
....................    { 
....................       x=-x; 
....................    } 
....................    if (x==0.0) 
....................    { 
....................       if(y==0.0) 
....................       { 
....................       #ifdef _ERRNO 
....................       { 
....................          errno=EDOM; 
....................       } 
....................       #endif 
....................       } 
....................       else 
....................       { 
....................          if(sign) 
....................          { 
....................          return (-(PI_DIV_BY_TWO)); 
....................          } 
....................          else 
....................          { 
....................          return (PI_DIV_BY_TWO); 
....................          } 
....................       } 
....................    } 
....................    else 
....................    { 
....................       z=y/x; 
....................       switch(quad) 
....................       { 
....................          case 1: 
....................          { 
....................             return atan(z); 
....................             break; 
....................          } 
....................          case 2: 
....................          { 
.................... //            return (atan(z)+PI_DIV_BY_TWO);  //2L3122 
....................             return (PI-atan(z)); 
....................             break; 
....................          } 
....................          case 3: 
....................          { 
....................             return (atan(z)-PI); 
....................             break; 
....................          } 
....................          case 4: 
....................          { 
....................             return (-atan(z)); 
....................             break; 
....................          } 
....................       } 
....................    } 
.................... } 
.................... #endif 
....................  
.................... //////////////////// Hyperbolic functions //////////////////// 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float cosh(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : Computes the hyperbolic cosine value of x 
.................... // Returns : returns the hyperbolic cosine value of x 
.................... // Date : N/A 
.................... // 
....................  
.................... float32 cosh(float32 x) 
.................... { 
....................    return ((exp(x)+exp(-x))/2); 
.................... } 
.................... //Overloaded functions for cosh() for PCD 
.................... // Overloaded function cosh() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 cosh(float48 x) 
.................... { 
....................    return ((exp(x)+exp(-x))/2); 
.................... } 
....................  
.................... // Overloaded function cosh() for data type - Float64 
.................... float64 cosh(float64 x) 
.................... { 
....................    return ((exp(x)+exp(-x))/2); 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float sinh(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : Computes the hyperbolic sine value of x 
.................... // Returns : returns the hyperbolic sine value of x 
.................... // Date : N/A 
.................... // 
....................  
.................... float32 sinh(float32 x) 
.................... { 
....................  
....................    return ((exp(x) - exp(-x))/2); 
.................... } 
.................... //Overloaded functions for sinh() for PCD 
.................... // Overloaded function sinh() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 sinh(float48 x) 
.................... { 
....................  
....................    return ((exp(x) - exp(-x))/2); 
.................... } 
....................  
.................... // Overloaded function sinh() for data type - Float48 
.................... float64 sinh(float64 x) 
.................... { 
....................  
....................    return ((exp(x) - exp(-x))/2); 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float tanh(float x) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : Computes the hyperbolic tangent value of x 
.................... // Returns : returns the hyperbolic tangent value of x 
.................... // Date : N/A 
.................... // 
....................  
.................... float32 tanh(float32 x) 
.................... { 
....................    return(sinh(x)/cosh(x)); 
.................... } 
.................... //Overloaded functions for tanh() for PCD 
.................... // Overloaded function tanh() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 tanh(float48 x) 
.................... { 
....................    return(sinh(x)/cosh(x)); 
.................... } 
....................  
.................... // Overloaded function tanh() for data type - Float64 
.................... float64 tanh(float64 x) 
.................... { 
....................    return(sinh(x)/cosh(x)); 
.................... } 
.................... #endif 
....................  
.................... //////////////////////////////////////////////////////////////////////////// 
.................... //   float frexp(float x, signed int *exp) 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... // Description : breaks a floating point number into a normalized fraction and an integral 
.................... // power of 2. It stores the integer in the signed int object pointed to by exp. 
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval 
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero, 
.................... // both parts of the result are zero. 
.................... // Date : N/A 
.................... // 
....................  
.................... #define LOG2 .30102999566398119521 
.................... float32 frexp(float32 x, signed int8 *exp) 
.................... { 
....................    float32 res; 
....................    int1 sign = 0; 
....................    if(x == 0.0) 
....................    { 
....................       *exp=0; 
....................       return (0.0); 
....................    } 
....................    if(x < 0.0) 
....................    { 
....................      x=-x; 
....................      sign=1; 
....................    } 
....................    if (x > 1.0) 
....................    { 
....................       *exp=(ceil(log10(x)/LOG2)); 
....................       res=x/(pow(2, *exp)); 
....................       if (res == 1) 
....................       { 
....................          *exp=*exp+1; 
....................           res=.5; 
....................       } 
....................    } 
....................    else 
....................    { 
....................       if(x < 0.5) 
....................       { 
....................          *exp=-1; 
....................          res=x*2; 
....................       } 
....................       else 
....................       { 
....................          *exp=0; 
....................           res=x; 
....................       } 
....................    } 
....................    if(sign) 
....................    { 
....................       res=-res; 
....................    } 
....................    return res; 
.................... } 
....................  
.................... //Overloaded functions for frexp() for PCD 
.................... // Overloaded function frexp() for data type - Float48 
.................... #if defined(__PCD__) 
.................... float48 frexp(float48 x, signed int8 *exp) 
.................... { 
....................    float48 res; 
....................    int1 sign = 0; 
....................    if(x == 0.0) 
....................    { 
....................       *exp=0; 
....................       return (0.0); 
....................    } 
....................    if(x < 0.0) 
....................    { 
....................      x=-x; 
....................      sign=1; 
....................    } 
....................    if (x > 1.0) 
....................    { 
....................       *exp=(ceil(log10(x)/LOG2)); 
....................       res=x/(pow(2, *exp)); 
....................       if (res == 1) 
....................       { 
....................          *exp=*exp+1; 
....................           res=.5; 
....................       } 
....................    } 
....................    else 
....................    { 
....................       if(x < 0.5) 
....................       { 
....................          *exp=-1; 
....................          res=x*2; 
....................       } 
....................       else 
....................       { 
....................          *exp=0; 
....................           res=x; 
....................       } 
....................    } 
....................    if(sign) 
....................    { 
....................       res=-res; 
....................    } 
....................    return res; 
.................... } 
....................  
.................... // Overloaded function frexp() for data type - Float64 
.................... float64 frexp(float64 x, signed int8 *exp) 
.................... { 
....................    float64 res; 
....................    int1 sign = 0; 
....................    if(x == 0.0) 
....................    { 
....................       *exp=0; 
....................       return (0.0); 
....................    } 
....................    if(x < 0.0) 
....................    { 
....................      x=-x; 
....................      sign=1; 
....................    } 
....................    if (x > 1.0) 
....................    { 
....................       *exp=(ceil(log10(x)/LOG2)); 
....................       res=x/(pow(2, *exp)); 
....................       if (res == 1) 
....................       { 
....................          *exp=*exp+1; 
....................           res=.5; 
....................       } 
....................    } 
....................    else 
....................    { 
....................       if(x < 0.5) 
....................       { 
....................          *exp=-1; 
....................          res=x*2; 
....................       } 
....................       else 
....................       { 
....................          *exp=0; 
....................           res=x; 
....................       } 
....................    } 
....................    if(sign) 
....................    { 
....................       res=-res; 
....................    } 
....................    return res; 
.................... } 
.................... #endif 
....................  
.................... ////////////////////////////////////////////////////////////////////////////// 
.................... //   float ldexp(float x, signed int *exp) 
.................... ////////////////////////////////////////////////////////////////////////////// 
.................... // Description : multiplies a floating point number by an integral power of 2. 
.................... // Returns : returns the value of x times 2 raised to the power exp. 
.................... // Date : N/A 
.................... // 
....................  
.................... float32 ldexp(float32 value, signed int8 exp) 
.................... { 
....................    return (value * pow(2,exp)); 
.................... } 
.................... //Overloaded functions for ldexp() for PCD 
.................... // Overloaded function ldexp() for data type - Float48 
....................  
.................... #if defined(__PCD__) 
.................... float48 ldexp(float48 value, signed int8 exp) 
.................... { 
....................    return (value * pow(2,exp)); 
.................... } 
.................... // Overloaded function ldexp() for data type - Float64 
.................... float64 ldexp(float64 value, signed int8 exp) 
.................... { 
....................    return (value * pow(2,exp)); 
.................... } 
.................... #endif 
....................  
.................... #endif 
....................  
.................... #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,2008 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(unsigned int8 *)==1 
.................... #define ptrdiff_t unsigned int8 
.................... #else 
.................... #define ptrdiff_t unsigned int16 
.................... #endif 
....................  
.................... #define size_t unsigned int8 
.................... #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; 
....................   } 
....................  
.................... /* Standard template: char *strcpy(char *s1, const char *s2) 
....................    copies the string s2 including the null character to s1. 
....................    This is a compiler built in to handle the different address 
....................    spaces */ 
....................  
.................... #define strcopy strcpy 
....................  
.................... /* 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 int8 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 int8 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 int8 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 int8 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; 
....................   unsigned int8 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,unsigned int8 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, unsigned int8 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*/ 
....................  
.................... unsigned int8  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, unsigned int8 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 */ 
....................  
.................... unsigned int8  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; 
*
10CE:  CLRF   21
10CF:  CLRF   22
....................  
....................    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(unsigned int8 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) */ 
....................  
.................... unsigned int8 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 int8 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 <stdlib.h> 
.................... /////////////////////////////////////////////////////////////////////////// 
.................... ////        (C) Copyright 1996,2007 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 
....................  
....................  
.................... #IF (sizeof(int16*)>1) 
.................... #DEFINE LONG_POINTERS 1 
.................... #ELSE  
.................... #DEFINE LONG_POINTERS 0 
.................... #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(unsigned int8 *)==1 
.................... #define ptrdiff_t unsigned int8 
.................... #else 
.................... #define ptrdiff_t unsigned int16 
.................... #endif 
....................  
.................... #define size_t unsigned int8 
.................... #define wchar_t char 
.................... #define NULL 0 
....................  
.................... #define offsetof(s,f) (offsetofbit(s,f)/8) 
....................  
.................... #endif 
....................  
....................  
.................... //--------------------------------------------------------------------------- 
.................... // String conversion functions 
.................... //--------------------------------------------------------------------------- 
....................  
.................... /* 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*/ 
.................... #if (sizeof(long)==4) 
....................  #define atoi32(s) atol(s) 
.................... #else  
....................  signed int32 atoi32(char *s); 
.................... #endif 
....................  
.................... #if defined(__PCD__) 
.................... // The following functions only work on the 24 bit compiler 
.................... // for the 30F, 33F, 24F and 24H parts 
.................... /* Syntax: signed int48  atoi48(char * s) 
....................    converts the initial portion of the string s to a signed int48 
....................    returns the converted value if any, 0 otherwise*/ 
....................     
.................... signed int48 atoi48(char *s); 
....................  
.................... /* Syntax: signed int64  atoi64(char * s) 
....................    converts the initial portion of the string s to a signed int64 
....................    returns the converted value if any, 0 otherwise*/ 
.................... signed int64 atoi64(char *s); 
.................... #endif 
....................  
.................... /* 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, unsigned int base, char * s); 
....................  
.................... /* Standard template: signed int16  atol(char * s) 
....................  * converts the initial portion of the string s to a signed int16 
....................  * returns the converted value if any, 0 otherwise 
....................  */ 
.................... signed long atol(char *s); 
....................  
.................... /* Standard template: int16 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: int16 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 
....................  */ 
.................... unsigned long strtoul(char *s,char *endptr, signed int base); 
....................  
.................... /* Standart template: float strtof(char * s,char *endptr) 
....................                       float48 strtof48(char *s,char *endptr); 
....................                       float64 strtod(char *s,char *endptr); 
....................  * converts the initial portion of the string s to a float32, float48 or float64, 
....................  * returns the converted value if any, 0 otherwise 
....................  * the final string is returned in the endptr, if endptr is not null                    
.................... */ 
.................... float strtof(char *s,char *endptr); 
.................... #if defined(__PCD__) 
.................... float48 strtof48(char *s,char *endptr); 
.................... float64 strtod(char *s,char *endptr); 
.................... #else 
.................... //provided for compatibility 
.................... #define strtof48(s, e) strtof(s, e) 
.................... #define strtod(s, e) strtof(s, e) 
.................... #endif 
....................  
.................... /* Standard template: float32 atof(char * s) 
....................  * converts the initial portion of the string s to a float. 
....................  * returns the converted value if any, 0 otherwise 
....................  */ 
.................... #define atof(s)   strtof(s, 0) 
....................  
.................... #if defined(__PCD__) 
.................... // The following functions only work on the 24 bit compiler 
.................... // for the 30F, 33F, 24F and 24H parts 
....................  
.................... /* Standard template: float48 atof48(char * s) 
....................  * converts the initial portion of the string s to a float. 
....................  * returns the converted value if any, 0 otherwise 
....................  */ 
.................... #define atof48(s) strtof48(s, 0) 
....................  
.................... /* Standard template: float64 atof64(char * s) 
....................  * converts the initial portion of the string s to a float. 
....................  * returns the converted value if any, 0 otherwise 
....................  */ 
.................... #define atof64(s) strtod(s, 0) 
.................... #endif 
....................  
.................... /* Standard template: float32 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 
....................  */ 
.................... #if !defined(__PCD__) 
.................... float atoe(char * s); 
.................... #endif 
....................  
.................... #if defined(__PCD__) 
.................... float32 atoe(char * s); 
.................... #endif 
....................  
.................... //--------------------------------------------------------------------------- 
.................... // 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 
....................  */ 
.................... unsigned int16 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 int8 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(unsigned int8 *)==1 
.................... #define ptrdiff_t unsigned int8 
.................... #else 
.................... #define ptrdiff_t unsigned int16 
.................... #endif 
....................  
.................... #define size_t unsigned int8 
.................... #define wchar_t char 
.................... #define NULL 0 
....................  
.................... #define offsetof(s,f) (offsetofbit(s,f)/8) 
....................  
.................... #endif 
....................  
.................... #include <string.h> 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... ////        (C) Copyright 1996,2008 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; 
....................   } 
....................  
.................... /* Standard template: char *strcpy(char *s1, const char *s2) 
....................    copies the string s2 including the null character to s1. 
....................    This is a compiler built in to handle the different address 
....................    spaces */ 
....................  
.................... #define strcopy strcpy 
....................  
.................... /* 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 int8 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 int8 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 int8 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 int8 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; 
....................   unsigned int8 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,unsigned int8 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, unsigned int8 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*/ 
....................  
.................... unsigned int8  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, unsigned int8 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 */ 
....................  
.................... unsigned int8  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(unsigned int8 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) */ 
....................  
.................... unsigned int8 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 int8 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); 
.................... } 
....................  
.................... #if defined(__PCD__) 
.................... float32 atoe(char * s) 
.................... { 
....................    float32 pow10 = 1.0; 
....................    float32 result = 0.0; 
....................    unsigned int8 sign = 0; 
....................    unsigned int8 expsign = 0; 
....................    char c; 
....................    unsigned int8 ptr = 0; 
....................    unsigned int8 i; 
....................    float32 exp = 1.0; 
....................    unsigned int8 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); 
.................... } 
.................... #endif 
....................  
.................... #if !defined(__PCD__) 
.................... float atoe(char * s) 
.................... { 
....................    float pow10 = 1.0; 
....................    float result = 0.0; 
....................    unsigned int8 sign = 0; 
....................    unsigned int8 expsign = 0; 
....................    char c; 
....................    unsigned int8 ptr = 0; 
....................    unsigned int8 i; 
....................    float exp = 1.0; 
....................    unsigned int8 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); 
.................... } 
.................... #endif 
....................  
.................... signed int atoi(char *s) 
.................... { 
....................    signed int result; 
....................    unsigned 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; 
....................    unsigned 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) ); 
.................... } 
....................  
.................... #if sizeof(long)==2 
.................... signed int32 atoi32(char *s) 
.................... { 
....................    signed int32 result; 
....................    int8 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); 
.................... } 
.................... #endif 
....................  
.................... #if defined(__PCD__) 
....................  
.................... signed int48 atoi48(char *s) 
.................... { 
....................    signed int48 result; 
....................    int8 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); 
.................... } 
....................  
.................... signed int64 atoi64(char *s) 
.................... { 
....................    signed int64 result; 
....................    int8 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); 
.................... } 
.................... #endif 
....................  
.................... char * itoa(signed int32 num, unsigned int base, char * s) 
.................... { 
....................      unsigned int32 temp=1; 
....................      unsigned 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 strtof(char *s, char *endptr) 
.................... { 
....................    float pow10 = 1.0; 
....................    float result = 0.0; 
....................    int1 skip = 1, sign = 0, point = 0; 
....................    char c; 
....................    unsigned int8 ptr = 0; 
....................  
....................    if (!s) 
....................       return 0; 
....................  
....................    for(c=s[ptr++]; c!=0; c=s[ptr++]) 
....................    { 
....................       if (skip && !isspace(c)) 
....................       { 
....................          skip = 0; 
....................          if (c == '+') 
....................          { 
....................             sign = 0; 
....................             continue; 
....................          }             
....................          else if (c == '-') 
....................          { 
....................             sign = 1; 
....................             continue; 
....................          } 
....................       } 
....................       if (!skip && (c == '.') && !point) 
....................          point = 1; 
....................       else if (!skip && isdigit(c)) 
....................       { 
....................          c -= '0'; 
....................          if (point) 
....................          { 
....................             pow10 = pow10 * 10.0; 
....................             result += (float)c / pow10;    
....................          } 
....................          else 
....................          { 
....................             result = 10.0 * result + (float)c; 
....................          } 
....................       } 
....................       else if (!skip) 
....................          break; 
....................    } 
....................  
....................    if (sign) 
....................       result = -1*result; 
....................        
....................    if(endptr) 
....................    { 
....................       if (ptr) { 
....................          ptr--; 
....................        #IF LONG_POINTERS  
....................          *((long *)endptr)= s+ptr;  
....................        #ELSE 
....................          *((char *)endptr)=s+ptr; 
....................        #ENDIF 
....................       } 
....................       else 
....................       { 
....................       #IF LONG_POINTERS 
....................       *((long *)endptr)= s;  
....................       #ELSE 
....................       *((char *)endptr)=s; 
....................       #ENDIF 
....................       } 
....................    } 
....................  
....................    return(result); 
.................... } 
....................  
.................... #if defined(__PCD__) 
.................... float48 strtof48(char *s, char *endptr) 
.................... { 
....................    float48 pow10 = 1.0; 
....................    float48 result = 0.0; 
....................    int1 skip = 1, sign = 0, point = 0; 
....................    char c; 
....................    unsigned int8 ptr = 0; 
....................  
....................    if (!s) 
....................       return 0; 
....................  
....................    for(c=s[ptr++]; c!=0; c=s[ptr++]) 
....................    { 
....................       if (skip && !isspace(c)) 
....................       { 
....................          skip = 0; 
....................          if (c == '+') 
....................          { 
....................             sign = 0; 
....................             continue; 
....................          }             
....................          else if (c == '-') 
....................          { 
....................             sign = 1; 
....................             continue; 
....................          } 
....................       } 
....................       if (!skip && (c == '.') && !point) 
....................          point = 1; 
....................       else if (!skip && isdigit(c)) 
....................       { 
....................          c -= '0'; 
....................          if (point) 
....................          { 
....................             pow10 = pow10 * 10.0; 
....................             result += (float48)c / pow10;    
....................          } 
....................          else 
....................          { 
....................             result = 10.0 * result + (float48)c; 
....................          } 
....................       } 
....................       else if (!skip) 
....................          break; 
....................    } 
....................  
....................    if (sign) 
....................       result = -1*result; 
....................        
....................    if(endptr) 
....................    { 
....................       if (ptr) { 
....................          ptr--; 
....................        #IF LONG_POINTERS  
....................          *((long *)endptr)= s+ptr;  
....................        #ELSE 
....................          *((char *)endptr)=s+ptr; 
....................        #ENDIF 
....................       } 
....................       else 
....................       { 
....................       #IF LONG_POINTERS 
....................       *((long *)endptr)= s;  
....................       #ELSE 
....................       *((char *)endptr)=s; 
....................       #ENDIF 
....................       } 
....................    } 
....................  
....................    return(result); 
.................... } 
....................  
.................... float64 strtod(char *s, char *endptr) 
.................... { 
....................    float64 pow10 = 1.0; 
....................    float64 result = 0.0; 
....................    int1 skip = 1, sign = 0, point = 0; 
....................    char c; 
....................    unsigned int8 ptr = 0; 
....................  
....................    if (!s) 
....................       return 0; 
....................  
....................    for(c=s[ptr++]; c!=0; c=s[ptr++]) 
....................    { 
....................       if (skip && !isspace(c)) 
....................       { 
....................          skip = 0; 
....................          if (c == '+') 
....................          { 
....................             sign = 0; 
....................             continue; 
....................          }             
....................          else if (c == '-') 
....................          { 
....................             sign = 1; 
....................             continue; 
....................          } 
....................       } 
....................       if (!skip && (c == '.') && !point) 
....................          point = 1; 
....................       else if (!skip && isdigit(c)) 
....................       { 
....................          c -= '0'; 
....................          if (point) 
....................          { 
....................             pow10 = pow10 * 10.0; 
....................             result += (float64)c / pow10;    
....................          } 
....................          else 
....................          { 
....................             result = 10.0 * result + (float64)c; 
....................          } 
....................       } 
....................       else if (!skip) 
....................          break; 
....................    } 
....................  
....................    if (sign) 
....................       result = -1*result; 
....................        
....................    if(endptr) 
....................    { 
....................       if (ptr) { 
....................          ptr--; 
....................        #IF LONG_POINTERS  
....................          *((long *)endptr)= s+ptr;  
....................        #ELSE 
....................          *((char *)endptr)=s+ptr; 
....................        #ENDIF 
....................       } 
....................       else 
....................       { 
....................       #IF LONG_POINTERS 
....................       *((long *)endptr)= s;  
....................       #ELSE 
....................       *((char *)endptr)=s; 
....................       #ENDIF 
....................       } 
....................    } 
....................  
....................    return(result); 
.................... } 
.................... #endif 
....................  
.................... unsigned long strtoul(char *s, char *endptr, signed int base) 
.................... { 
....................    char *sc,*s1,*sd; 
....................    unsigned long x=0; 
....................    char sign; 
....................    char digits[]="0123456789abcdefghijklmnopqstuvwxyz"; 
....................    for(sc=s;isspace(*sc);++sc); 
....................    sign=*sc=='-'||*sc=='+'?*sc++:'+'; 
....................    if(sign=='-' || base <0 || base ==1|| base >36) // invalid base 
....................    goto StrtoulGO; 
....................  
....................    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) 
....................    { 
....................    StrtoulGO: 
....................       if (endptr) 
....................       { 
....................          #IF LONG_POINTERS 
....................          *((long *)endptr)= s;  
....................          #ELSE 
....................          *((char *)endptr)=s; 
....................          #ENDIF 
....................          } 
....................    return 0; 
....................    } 
....................    if (endptr) 
....................    { 
....................          #IF LONG_POINTERS 
....................          *((long *)endptr)= sc;  
....................          #ELSE 
....................          *((char *)endptr)=sc;  
....................          #ENDIF 
....................    } 
....................    return x; 
.................... } 
....................  
....................  
.................... 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 
....................    goto StrtolGO; 
....................    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) 
....................    { 
....................    StrtolGO: 
....................       if (endptr) 
....................       { 
....................          #IF LONG_POINTERS 
....................          *((long *)endptr)= s;  
....................          #ELSE 
....................          *((char *)endptr)=s; 
....................          #ENDIF 
....................       } 
....................    return 0; 
....................    } 
....................    if(sign=='-') 
....................       x  =-x; 
....................    if (endptr) 
....................    { 
....................         #IF LONG_POINTERS 
....................          *((long *)endptr)= sc;  
....................         #ELSE 
....................         *((char *)endptr)=sc; 
....................         #ENDIF 
....................    } 
....................    return x; 
.................... } 
....................  
.................... signed int8 system(char *string) 
.................... { 
....................    return 0; 
.................... } 
....................  
.................... int8 mblen(char *s,size_t n) 
.................... { 
....................    return strlen(s); 
.................... } 
....................  
.................... int8 mbtowc(wchar_t *pwc,char *s,size_t n) 
.................... { 
....................    *pwc=*s; 
....................    return 1; 
.................... } 
....................  
.................... int8 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; 
....................  
.................... unsigned int16 rand(void) 
.................... { 
....................    _Randseed = _Randseed * 1103515245 + 12345; 
....................    return ((unsigned int16)(_Randseed >> 16) % RAND_MAX); 
.................... } 
....................  
.................... void srand(unsigned int32 seed) 
.................... { 
....................    _Randseed = seed; 
.................... } 
....................  
.................... //--------------------------------------------------------------------------- 
.................... // Searching and sorting utilities implementation 
.................... //--------------------------------------------------------------------------- 
....................  
.................... #if !defined(__PCD__) 
.................... typedef signed int8 (*_Cmpfun)(char * p1,char * p2);  
.................... #else  
.................... typedef signed int16 (*_Cmpfun)(char * p1,char * p2);  
.................... #endif 
....................  
....................  
....................  
.................... void qsort(char * qdata, unsigned int qitems, unsigned int qsize, _Cmpfun cmp) { 
....................    unsigned int m,j,i,l; 
....................    int1 done; 
....................    unsigned int8 t[16]; 
....................  
....................    m = qitems/2; 
....................    while( m > 0 ) { 
....................      for(j=0; j<(qitems-m); ++j) { 
....................         i = j; 
....................         do 
....................         { 
....................            done=1; 
....................            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 = 0; 
....................            } 
....................         } 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 
....................  
.................... #include <input.c>  
.................... /////////////////////////////////////////////////////////////////////////// 
.................... ////        (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.                               //// 
.................... /////////////////////////////////////////////////////////////////////////// 
....................  
....................  
.................... #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 
....................  
....................  
....................  
.................... BYTE gethex1() { 
....................    char digit; 
....................  
....................    digit = getc(); 
....................  
....................    putc(digit); 
....................  
....................    if(digit<='9') 
....................      return(digit-'0'); 
....................    else 
....................      return((toupper(digit)-'A')+10); 
.................... } 
....................  
.................... BYTE gethex() { 
....................    unsigned int8 lo,hi; 
....................  
....................    hi = gethex1(); 
....................    lo = gethex1(); 
....................    if(lo==0xdd) 
....................      return(hi); 
....................    else 
....................      return( hi*16+lo ); 
.................... } 
....................  
.................... void get_string(char* s, unsigned int8 max) { 
....................    unsigned int8 len; 
....................    char c; 
....................  
....................    --max; 
....................    len=0; 
....................    do { 
....................      c=getc(); 
....................      if(c==8) {  // Backspace 
....................         if(len>0) { 
....................           len--; 
....................           putc(c); 
....................           putc(' '); 
....................           putc(c); 
....................         } 
....................      } else if ((c>=' ')&&(c<='~')) 
....................        if(len<=max) { 
....................          s[len++]=c; 
....................          putc(c); 
....................        } 
....................    } while(c!=13); 
....................    s[len]=0; 
.................... } 
....................  
.................... // stdlib.h is required for the ato_ conversions 
.................... // in the following functions 
.................... #ifdef _STDLIB 
.................... #if !defined(__PCD__) 
.................... signed int8 get_int() { 
....................   char s[5]; 
....................   signed int8 i; 
....................  
....................   get_string(s, 5); 
....................  
....................   i=atoi(s); 
....................   return(i); 
.................... } 
.................... #endif 
....................  
.................... #if defined(__PCD__) 
.................... signed int16 get_int() { 
....................   char s[5]; 
....................   signed int16 i; 
....................  
....................   get_string(s, 7); 
....................  
....................   i=atoi(s); 
....................   return(i); 
.................... } 
.................... #endif 
....................  
.................... #if !defined(__PCD__) 
.................... signed int16 get_long() { 
....................   char s[7]; 
....................   signed int16 l; 
....................  
....................   get_string(s, 7); 
....................   l=atol(s); 
....................   return(l); 
.................... } 
.................... #endif 
....................  
.................... #if defined(__PCD__) 
.................... signed int32 get_long() { 
....................   char s[7]; 
....................   signed int32 l; 
....................  
....................   get_string(s, 10); 
....................   l=atoi32(s); 
....................   return(l); 
.................... } 
.................... #endif 
....................  
.................... float get_float() { 
....................   char s[20]; 
....................   float f; 
....................  
....................   get_string(s, 20); 
....................   f = atof(s); 
....................   return(f); 
.................... } 
....................  
.................... #endif 
....................  
.................... #include <string.h> 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... ////        (C) Copyright 1996,2008 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; 
....................   } 
....................  
.................... /* Standard template: char *strcpy(char *s1, const char *s2) 
....................    copies the string s2 including the null character to s1. 
....................    This is a compiler built in to handle the different address 
....................    spaces */ 
....................  
.................... #define strcopy strcpy 
....................  
.................... /* 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 int8 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 int8 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 int8 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 int8 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; 
....................   unsigned int8 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,unsigned int8 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, unsigned int8 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*/ 
....................  
.................... unsigned int8  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, unsigned int8 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 */ 
....................  
.................... unsigned int8  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(unsigned int8 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) */ 
....................  
.................... unsigned int8 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 int8 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 
....................  
....................  
.................... //Akcelerometr 
.................... #define AK_W  0x38 //adresa akcelerometru zápis 
.................... #define AK_R  0x39 //adresa akcelerometru ètení 
.................... #define AK_XH 0x01 //osa X LSB 
.................... #define AK_XL 0x02 //osa X MSB 
.................... #define AK_YH 0x03 //osa Y LSB 
.................... #define AK_YL 0x04 //osa Y MSB 
.................... #define AK_ZH 0x05 //osa Z LSB 
.................... #define AK_ZL 0x06 //osa Z MSB 
....................  
.................... //Magnetometr 
.................... #define MAG_W  0x3C //adresa akcelerometru zápis 
.................... #define MAG_R  0x3D //adresa akcelerometru ètení 
.................... #define MAG_XH 0x03 //osa X LSB 
.................... #define MAG_XL 0x04 //osa X MSB 
.................... #define MAG_ZH 0x05 //osa Y LSB 
.................... #define MAG_ZL 0x06 //osa Y MSB 
.................... #define MAG_YH 0x07 //osa Z LSB 
.................... #define MAG_YL 0x08 //osa Z MSB 
....................  
....................  
....................  
....................  
....................  
.................... //pøipojení motorù 
.................... //AIN1 - pro vysku slunce 
.................... #define AIN1 PIN_D0  
.................... #define AIN2 PIN_D1  
.................... //motor A -cerveny vodic na AOUT1 
.................... //motor A -modry vodic na Aout2 
....................  
.................... //AIN2 - pro azimut 
.................... #define BIN1 PIN_D2  
.................... #define BIN2 PIN_D3  
.................... //motor B - èerveny vodic na BOUT2 
.................... //motor B - modrý vodic na BOUT1 
....................  
.................... signed int16 X, Y, Z,AX, AY, AZ; //promenne pro magnetometr a akcelerometr 
....................  
.................... unsigned int16 azimutZAD, elevaceZAD; 
....................  
.................... void setAK (void) //nastaveni akcelerometru 
.................... { 
....................    i2c_start(); 
*
0122:  BSF    20.4
0123:  MOVF   20,W
0124:  BSF    03.5
0125:  MOVWF  07
0126:  NOP
0127:  BCF    03.5
0128:  BSF    20.3
0129:  MOVF   20,W
012A:  BSF    03.5
012B:  MOVWF  07
012C:  NOP
012D:  BCF    03.5
012E:  BCF    07.4
012F:  BCF    20.4
0130:  MOVF   20,W
0131:  BSF    03.5
0132:  MOVWF  07
0133:  NOP
0134:  BCF    03.5
0135:  BCF    07.3
0136:  BCF    20.3
0137:  MOVF   20,W
0138:  BSF    03.5
0139:  MOVWF  07
....................    I2C_Write(AK_W); 
013A:  MOVLW  38
013B:  BCF    03.5
013C:  MOVWF  5D
013D:  CALL   0D8
....................    I2C_write(0x2A); 
013E:  MOVLW  2A
013F:  MOVWF  5D
0140:  CALL   0D8
....................    I2C_write(0x01); //nastaví aktivní stav 
0141:  MOVLW  01
0142:  MOVWF  5D
0143:  CALL   0D8
....................   
....................    i2c_stop();  
0144:  BCF    20.4
0145:  MOVF   20,W
0146:  BSF    03.5
0147:  MOVWF  07
0148:  NOP
0149:  BCF    03.5
014A:  BSF    20.3
014B:  MOVF   20,W
014C:  BSF    03.5
014D:  MOVWF  07
014E:  BCF    03.5
014F:  BTFSS  07.3
0150:  GOTO   14F
0151:  NOP
0152:  GOTO   153
0153:  NOP
0154:  BSF    20.4
0155:  MOVF   20,W
0156:  BSF    03.5
0157:  MOVWF  07
0158:  NOP
.................... } 
0159:  BCF    03.5
015A:  BCF    0A.3
015B:  BSF    0A.4
015C:  GOTO   122 (RETURN)
....................  
.................... void setmag (void) 
.................... { 
....................   i2c_start(); 
*
0171:  BSF    20.4
0172:  MOVF   20,W
0173:  BSF    03.5
0174:  MOVWF  07
0175:  NOP
0176:  BCF    03.5
0177:  BSF    20.3
0178:  MOVF   20,W
0179:  BSF    03.5
017A:  MOVWF  07
017B:  NOP
017C:  BCF    03.5
017D:  BCF    07.4
017E:  BCF    20.4
017F:  MOVF   20,W
0180:  BSF    03.5
0181:  MOVWF  07
0182:  NOP
0183:  BCF    03.5
0184:  BCF    07.3
0185:  BCF    20.3
0186:  MOVF   20,W
0187:  BSF    03.5
0188:  MOVWF  07
....................   I2C_Write(MAG_W);     // W 
0189:  MOVLW  3C
018A:  BCF    03.5
018B:  MOVWF  5D
018C:  CALL   0D8
....................   I2C_Write(0x00);    
018D:  CLRF   5D
018E:  CALL   0D8
....................   I2C_Write(0x78); 
018F:  MOVLW  78
0190:  MOVWF  5D
0191:  CALL   0D8
....................   i2c_stop(); 
0192:  BCF    20.4
0193:  MOVF   20,W
0194:  BSF    03.5
0195:  MOVWF  07
0196:  NOP
0197:  BCF    03.5
0198:  BSF    20.3
0199:  MOVF   20,W
019A:  BSF    03.5
019B:  MOVWF  07
019C:  BCF    03.5
019D:  BTFSS  07.3
019E:  GOTO   19D
019F:  NOP
01A0:  GOTO   1A1
01A1:  NOP
01A2:  BSF    20.4
01A3:  MOVF   20,W
01A4:  BSF    03.5
01A5:  MOVWF  07
01A6:  NOP
....................   Delay_ms(6); 
01A7:  MOVLW  06
01A8:  BCF    03.5
01A9:  MOVWF  4F
01AA:  CALL   15D
....................     
....................   i2c_start(); 
01AB:  BSF    20.4
01AC:  MOVF   20,W
01AD:  BSF    03.5
01AE:  MOVWF  07
01AF:  NOP
01B0:  BCF    03.5
01B1:  BSF    20.3
01B2:  MOVF   20,W
01B3:  BSF    03.5
01B4:  MOVWF  07
01B5:  NOP
01B6:  BCF    03.5
01B7:  BCF    07.4
01B8:  BCF    20.4
01B9:  MOVF   20,W
01BA:  BSF    03.5
01BB:  MOVWF  07
01BC:  NOP
01BD:  BCF    03.5
01BE:  BCF    07.3
01BF:  BCF    20.3
01C0:  MOVF   20,W
01C1:  BSF    03.5
01C2:  MOVWF  07
....................   I2C_Write(MAG_W);     // W 
01C3:  MOVLW  3C
01C4:  BCF    03.5
01C5:  MOVWF  5D
01C6:  CALL   0D8
....................   I2C_Write(0x01);    
01C7:  MOVLW  01
01C8:  MOVWF  5D
01C9:  CALL   0D8
....................   I2C_Write(0x00); 
01CA:  CLRF   5D
01CB:  CALL   0D8
....................   i2c_stop(); 
01CC:  BCF    20.4
01CD:  MOVF   20,W
01CE:  BSF    03.5
01CF:  MOVWF  07
01D0:  NOP
01D1:  BCF    03.5
01D2:  BSF    20.3
01D3:  MOVF   20,W
01D4:  BSF    03.5
01D5:  MOVWF  07
01D6:  BCF    03.5
01D7:  BTFSS  07.3
01D8:  GOTO   1D7
01D9:  NOP
01DA:  GOTO   1DB
01DB:  NOP
01DC:  BSF    20.4
01DD:  MOVF   20,W
01DE:  BSF    03.5
01DF:  MOVWF  07
01E0:  NOP
....................  
....................   Delay_ms(6); 
01E1:  MOVLW  06
01E2:  BCF    03.5
01E3:  MOVWF  4F
01E4:  CALL   15D
....................  
....................   i2c_start(); 
01E5:  BSF    20.4
01E6:  MOVF   20,W
01E7:  BSF    03.5
01E8:  MOVWF  07
01E9:  NOP
01EA:  BCF    03.5
01EB:  BSF    20.3
01EC:  MOVF   20,W
01ED:  BSF    03.5
01EE:  MOVWF  07
01EF:  NOP
01F0:  BCF    03.5
01F1:  BCF    07.4
01F2:  BCF    20.4
01F3:  MOVF   20,W
01F4:  BSF    03.5
01F5:  MOVWF  07
01F6:  NOP
01F7:  BCF    03.5
01F8:  BCF    07.3
01F9:  BCF    20.3
01FA:  MOVF   20,W
01FB:  BSF    03.5
01FC:  MOVWF  07
....................   I2C_Write(MAG_W);     // W 
01FD:  MOVLW  3C
01FE:  BCF    03.5
01FF:  MOVWF  5D
0200:  CALL   0D8
....................   I2C_Write(0x02);    
0201:  MOVLW  02
0202:  MOVWF  5D
0203:  CALL   0D8
....................   I2C_Write(0x00); 
0204:  CLRF   5D
0205:  CALL   0D8
....................   i2c_stop(); 
0206:  BCF    20.4
0207:  MOVF   20,W
0208:  BSF    03.5
0209:  MOVWF  07
020A:  NOP
020B:  BCF    03.5
020C:  BSF    20.3
020D:  MOVF   20,W
020E:  BSF    03.5
020F:  MOVWF  07
0210:  BCF    03.5
0211:  BTFSS  07.3
0212:  GOTO   211
0213:  NOP
0214:  GOTO   215
0215:  NOP
0216:  BSF    20.4
0217:  MOVF   20,W
0218:  BSF    03.5
0219:  MOVWF  07
021A:  NOP
....................   Delay_ms(6);   
021B:  MOVLW  06
021C:  BCF    03.5
021D:  MOVWF  4F
021E:  CALL   15D
.................... } 
021F:  BCF    0A.3
0220:  BSF    0A.4
0221:  GOTO   125 (RETURN)
....................  
.................... int16 akR (int8 H, int8 L) //vycitani hodnot z akcelerometru 
.................... { 
*
03D4:  CLRF   59
03D5:  CLRF   5A
.................... unsigned int8 XL=0,XH=0; 
.................... signed int16 x; 
....................  
....................    i2c_start(); 
03D6:  BSF    20.4
03D7:  MOVF   20,W
03D8:  BSF    03.5
03D9:  MOVWF  07
03DA:  NOP
03DB:  BCF    03.5
03DC:  BSF    20.3
03DD:  MOVF   20,W
03DE:  BSF    03.5
03DF:  MOVWF  07
03E0:  NOP
03E1:  BCF    03.5
03E2:  BCF    07.4
03E3:  BCF    20.4
03E4:  MOVF   20,W
03E5:  BSF    03.5
03E6:  MOVWF  07
03E7:  NOP
03E8:  BCF    03.5
03E9:  BCF    07.3
03EA:  BCF    20.3
03EB:  MOVF   20,W
03EC:  BSF    03.5
03ED:  MOVWF  07
....................    I2C_Write(AK_W); 
03EE:  MOVLW  38
03EF:  BCF    03.5
03F0:  MOVWF  5D
03F1:  CALL   0D8
....................    I2C_write(H); 
03F2:  MOVF   57,W
03F3:  MOVWF  5D
03F4:  CALL   0D8
....................    i2c_start(); 
03F5:  BSF    20.4
03F6:  MOVF   20,W
03F7:  BSF    03.5
03F8:  MOVWF  07
03F9:  NOP
03FA:  BCF    03.5
03FB:  BSF    20.3
03FC:  MOVF   20,W
03FD:  BSF    03.5
03FE:  MOVWF  07
03FF:  NOP
0400:  BCF    03.5
0401:  BTFSS  07.3
0402:  GOTO   401
0403:  BCF    07.4
0404:  BCF    20.4
0405:  MOVF   20,W
0406:  BSF    03.5
0407:  MOVWF  07
0408:  NOP
0409:  BCF    03.5
040A:  BCF    07.3
040B:  BCF    20.3
040C:  MOVF   20,W
040D:  BSF    03.5
040E:  MOVWF  07
....................    I2C_Write(AK_R); 
040F:  MOVLW  39
0410:  BCF    03.5
0411:  MOVWF  5D
0412:  CALL   0D8
....................    XH=i2c_read(0); 
0413:  CLRF   77
0414:  CALL   38F
0415:  MOVF   78,W
0416:  MOVWF  5A
....................    i2c_stop();  
0417:  BCF    20.4
0418:  MOVF   20,W
0419:  BSF    03.5
041A:  MOVWF  07
041B:  NOP
041C:  BCF    03.5
041D:  BSF    20.3
041E:  MOVF   20,W
041F:  BSF    03.5
0420:  MOVWF  07
0421:  BCF    03.5
0422:  BTFSS  07.3
0423:  GOTO   422
0424:  NOP
0425:  GOTO   426
0426:  NOP
0427:  BSF    20.4
0428:  MOVF   20,W
0429:  BSF    03.5
042A:  MOVWF  07
042B:  NOP
....................  
....................    i2c_start(); 
042C:  BCF    03.5
042D:  BSF    20.4
042E:  MOVF   20,W
042F:  BSF    03.5
0430:  MOVWF  07
0431:  NOP
0432:  BCF    03.5
0433:  BSF    20.3
0434:  MOVF   20,W
0435:  BSF    03.5
0436:  MOVWF  07
0437:  NOP
0438:  BCF    03.5
0439:  BCF    07.4
043A:  BCF    20.4
043B:  MOVF   20,W
043C:  BSF    03.5
043D:  MOVWF  07
043E:  NOP
043F:  BCF    03.5
0440:  BCF    07.3
0441:  BCF    20.3
0442:  MOVF   20,W
0443:  BSF    03.5
0444:  MOVWF  07
....................    I2C_Write(AK_W); 
0445:  MOVLW  38
0446:  BCF    03.5
0447:  MOVWF  5D
0448:  CALL   0D8
....................    I2C_write(L); 
0449:  MOVF   58,W
044A:  MOVWF  5D
044B:  CALL   0D8
....................    i2c_start(); 
044C:  BSF    20.4
044D:  MOVF   20,W
044E:  BSF    03.5
044F:  MOVWF  07
0450:  NOP
0451:  BCF    03.5
0452:  BSF    20.3
0453:  MOVF   20,W
0454:  BSF    03.5
0455:  MOVWF  07
0456:  NOP
0457:  BCF    03.5
0458:  BTFSS  07.3
0459:  GOTO   458
045A:  BCF    07.4
045B:  BCF    20.4
045C:  MOVF   20,W
045D:  BSF    03.5
045E:  MOVWF  07
045F:  NOP
0460:  BCF    03.5
0461:  BCF    07.3
0462:  BCF    20.3
0463:  MOVF   20,W
0464:  BSF    03.5
0465:  MOVWF  07
....................    I2C_Write(AK_R); 
0466:  MOVLW  39
0467:  BCF    03.5
0468:  MOVWF  5D
0469:  CALL   0D8
....................    XL=i2c_read(0); 
046A:  CLRF   77
046B:  CALL   38F
046C:  MOVF   78,W
046D:  MOVWF  59
....................    i2c_stop(); 
046E:  BCF    20.4
046F:  MOVF   20,W
0470:  BSF    03.5
0471:  MOVWF  07
0472:  NOP
0473:  BCF    03.5
0474:  BSF    20.3
0475:  MOVF   20,W
0476:  BSF    03.5
0477:  MOVWF  07
0478:  BCF    03.5
0479:  BTFSS  07.3
047A:  GOTO   479
047B:  NOP
047C:  GOTO   47D
047D:  NOP
047E:  BSF    20.4
047F:  MOVF   20,W
0480:  BSF    03.5
0481:  MOVWF  07
0482:  NOP
....................     
....................    x = (((unsigned int16) XH << 8) + XL ); //prevod na 16bit hodnotu 
0483:  BCF    03.5
0484:  CLRF   5E
0485:  MOVF   5A,W
0486:  MOVWF  5D
0487:  MOVWF  5E
0488:  CLRF   5D
0489:  MOVF   59,W
048A:  ADDWF  5D,W
048B:  MOVWF  78
048C:  MOVF   5E,W
048D:  MOVWF  7A
048E:  BTFSC  03.0
048F:  INCF   7A,F
0490:  MOVF   78,W
0491:  MOVWF  5B
0492:  MOVF   7A,W
0493:  MOVWF  5C
....................    x=x/4; 
0494:  MOVF   5C,W
0495:  MOVWF  5E
0496:  MOVF   5B,W
0497:  MOVWF  5D
0498:  CLRF   60
0499:  MOVLW  04
049A:  MOVWF  5F
*
04D8:  MOVF   79,W
04D9:  MOVWF  5C
04DA:  MOVF   78,W
04DB:  MOVWF  5B
....................     
....................    return x; 
04DC:  MOVF   5B,W
04DD:  MOVWF  78
04DE:  MOVF   5C,W
04DF:  MOVWF  79
.................... } 
04E0:  RETURN
....................  
.................... int16 magR (int8 H, int8 L) //vycitani hodnot z magnetometru 
.................... { 
*
0DBB:  CLRF   59
0DBC:  CLRF   5A
.................... unsigned int8 XL=0,XH=0; 
.................... signed int16 x; 
....................  
....................    i2c_start(); 
0DBD:  BSF    20.4
0DBE:  MOVF   20,W
0DBF:  BSF    03.5
0DC0:  MOVWF  07
0DC1:  NOP
0DC2:  BCF    03.5
0DC3:  BSF    20.3
0DC4:  MOVF   20,W
0DC5:  BSF    03.5
0DC6:  MOVWF  07
0DC7:  NOP
0DC8:  BCF    03.5
0DC9:  BCF    07.4
0DCA:  BCF    20.4
0DCB:  MOVF   20,W
0DCC:  BSF    03.5
0DCD:  MOVWF  07
0DCE:  NOP
0DCF:  BCF    03.5
0DD0:  BCF    07.3
0DD1:  BCF    20.3
0DD2:  MOVF   20,W
0DD3:  BSF    03.5
0DD4:  MOVWF  07
....................    I2C_Write(MAG_W); 
0DD5:  MOVLW  3C
0DD6:  BCF    03.5
0DD7:  MOVWF  5D
0DD8:  BCF    0A.3
0DD9:  CALL   0D8
0DDA:  BSF    0A.3
....................    I2C_write(H); 
0DDB:  MOVF   57,W
0DDC:  MOVWF  5D
0DDD:  BCF    0A.3
0DDE:  CALL   0D8
0DDF:  BSF    0A.3
....................    i2c_start(); 
0DE0:  BSF    20.4
0DE1:  MOVF   20,W
0DE2:  BSF    03.5
0DE3:  MOVWF  07
0DE4:  NOP
0DE5:  BCF    03.5
0DE6:  BSF    20.3
0DE7:  MOVF   20,W
0DE8:  BSF    03.5
0DE9:  MOVWF  07
0DEA:  NOP
0DEB:  BCF    03.5
0DEC:  BTFSS  07.3
0DED:  GOTO   5EC
0DEE:  BCF    07.4
0DEF:  BCF    20.4
0DF0:  MOVF   20,W
0DF1:  BSF    03.5
0DF2:  MOVWF  07
0DF3:  NOP
0DF4:  BCF    03.5
0DF5:  BCF    07.3
0DF6:  BCF    20.3
0DF7:  MOVF   20,W
0DF8:  BSF    03.5
0DF9:  MOVWF  07
....................    I2C_Write(MAG_R); 
0DFA:  MOVLW  3D
0DFB:  BCF    03.5
0DFC:  MOVWF  5D
0DFD:  BCF    0A.3
0DFE:  CALL   0D8
0DFF:  BSF    0A.3
....................    XH=i2c_read(0); 
0E00:  CLRF   77
0E01:  BCF    0A.3
0E02:  CALL   38F
0E03:  BSF    0A.3
0E04:  MOVF   78,W
0E05:  MOVWF  5A
....................    i2c_stop();  
0E06:  BCF    20.4
0E07:  MOVF   20,W
0E08:  BSF    03.5
0E09:  MOVWF  07
0E0A:  NOP
0E0B:  BCF    03.5
0E0C:  BSF    20.3
0E0D:  MOVF   20,W
0E0E:  BSF    03.5
0E0F:  MOVWF  07
0E10:  BCF    03.5
0E11:  BTFSS  07.3
0E12:  GOTO   611
0E13:  NOP
0E14:  GOTO   615
0E15:  NOP
0E16:  BSF    20.4
0E17:  MOVF   20,W
0E18:  BSF    03.5
0E19:  MOVWF  07
0E1A:  NOP
....................  
....................    i2c_start(); 
0E1B:  BCF    03.5
0E1C:  BSF    20.4
0E1D:  MOVF   20,W
0E1E:  BSF    03.5
0E1F:  MOVWF  07
0E20:  NOP
0E21:  BCF    03.5
0E22:  BSF    20.3
0E23:  MOVF   20,W
0E24:  BSF    03.5
0E25:  MOVWF  07
0E26:  NOP
0E27:  BCF    03.5
0E28:  BCF    07.4
0E29:  BCF    20.4
0E2A:  MOVF   20,W
0E2B:  BSF    03.5
0E2C:  MOVWF  07
0E2D:  NOP
0E2E:  BCF    03.5
0E2F:  BCF    07.3
0E30:  BCF    20.3
0E31:  MOVF   20,W
0E32:  BSF    03.5
0E33:  MOVWF  07
....................    I2C_Write(MAG_W); 
0E34:  MOVLW  3C
0E35:  BCF    03.5
0E36:  MOVWF  5D
0E37:  BCF    0A.3
0E38:  CALL   0D8
0E39:  BSF    0A.3
....................    I2C_write(L); 
0E3A:  MOVF   58,W
0E3B:  MOVWF  5D
0E3C:  BCF    0A.3
0E3D:  CALL   0D8
0E3E:  BSF    0A.3
....................    i2c_start(); 
0E3F:  BSF    20.4
0E40:  MOVF   20,W
0E41:  BSF    03.5
0E42:  MOVWF  07
0E43:  NOP
0E44:  BCF    03.5
0E45:  BSF    20.3
0E46:  MOVF   20,W
0E47:  BSF    03.5
0E48:  MOVWF  07
0E49:  NOP
0E4A:  BCF    03.5
0E4B:  BTFSS  07.3
0E4C:  GOTO   64B
0E4D:  BCF    07.4
0E4E:  BCF    20.4
0E4F:  MOVF   20,W
0E50:  BSF    03.5
0E51:  MOVWF  07
0E52:  NOP
0E53:  BCF    03.5
0E54:  BCF    07.3
0E55:  BCF    20.3
0E56:  MOVF   20,W
0E57:  BSF    03.5
0E58:  MOVWF  07
....................    I2C_Write(MAG_R); 
0E59:  MOVLW  3D
0E5A:  BCF    03.5
0E5B:  MOVWF  5D
0E5C:  BCF    0A.3
0E5D:  CALL   0D8
0E5E:  BSF    0A.3
....................    XL=i2c_read(0); 
0E5F:  CLRF   77
0E60:  BCF    0A.3
0E61:  CALL   38F
0E62:  BSF    0A.3
0E63:  MOVF   78,W
0E64:  MOVWF  59
....................    i2c_stop(); 
0E65:  BCF    20.4
0E66:  MOVF   20,W
0E67:  BSF    03.5
0E68:  MOVWF  07
0E69:  NOP
0E6A:  BCF    03.5
0E6B:  BSF    20.3
0E6C:  MOVF   20,W
0E6D:  BSF    03.5
0E6E:  MOVWF  07
0E6F:  BCF    03.5
0E70:  BTFSS  07.3
0E71:  GOTO   670
0E72:  NOP
0E73:  GOTO   674
0E74:  NOP
0E75:  BSF    20.4
0E76:  MOVF   20,W
0E77:  BSF    03.5
0E78:  MOVWF  07
0E79:  NOP
....................     
....................   x = (((unsigned int16) XH << 8) + XL ); 
0E7A:  BCF    03.5
0E7B:  CLRF   5E
0E7C:  MOVF   5A,W
0E7D:  MOVWF  5D
0E7E:  MOVWF  5E
0E7F:  CLRF   5D
0E80:  MOVF   59,W
0E81:  ADDWF  5D,W
0E82:  MOVWF  5B
0E83:  MOVF   5E,W
0E84:  MOVWF  5C
0E85:  BTFSC  03.0
0E86:  INCF   5C,F
....................  
....................     
....................    return x; 
0E87:  MOVF   5B,W
0E88:  MOVWF  78
0E89:  MOVF   5C,W
0E8A:  MOVWF  79
.................... } 
0E8B:  RETURN
....................  
.................... float elevace (void) //vypocet aktualni elevace panelu 
.................... { 
.................... //printf("Akcelerometr5:  \r\n",); 
....................  
.................... X= akR (AK_XH, AK_XL);   
*
0BDD:  MOVLW  01
0BDE:  MOVWF  57
0BDF:  MOVLW  02
0BE0:  MOVWF  58
0BE1:  BCF    0A.3
0BE2:  CALL   3D4
0BE3:  BSF    0A.3
0BE4:  MOVF   79,W
0BE5:  MOVWF  28
0BE6:  MOVF   78,W
0BE7:  MOVWF  27
.................... Y= akR (AK_YH, AK_YL);  
0BE8:  MOVLW  03
0BE9:  MOVWF  57
0BEA:  MOVLW  04
0BEB:  MOVWF  58
0BEC:  BCF    0A.3
0BED:  CALL   3D4
0BEE:  BSF    0A.3
0BEF:  MOVF   79,W
0BF0:  MOVWF  2A
0BF1:  MOVF   78,W
0BF2:  MOVWF  29
.................... Z= akR (AK_ZH, AK_ZL);  
0BF3:  MOVLW  05
0BF4:  MOVWF  57
0BF5:  MOVLW  06
0BF6:  MOVWF  58
0BF7:  BCF    0A.3
0BF8:  CALL   3D4
0BF9:  BSF    0A.3
0BFA:  MOVF   79,W
0BFB:  MOVWF  2C
0BFC:  MOVF   78,W
0BFD:  MOVWF  2B
....................  
.................... AX=abs(X); 
0BFE:  MOVF   28,W
0BFF:  MOVWF  7A
0C00:  MOVF   27,W
0C01:  BTFSS  28.7
0C02:  GOTO   40C
0C03:  MOVF   27,W
0C04:  SUBLW  00
0C05:  MOVWF  77
0C06:  CLRF   7A
0C07:  MOVF   28,W
0C08:  BTFSS  03.0
0C09:  INCFSZ 28,W
0C0A:  SUBWF  7A,F
0C0B:  MOVF   77,W
0C0C:  MOVWF  2D
0C0D:  MOVF   7A,W
0C0E:  MOVWF  2E
.................... AY=abs(Y)+250; 
0C0F:  MOVF   2A,W
0C10:  MOVWF  7A
0C11:  MOVF   29,W
0C12:  BTFSS  2A.7
0C13:  GOTO   41D
0C14:  MOVF   29,W
0C15:  SUBLW  00
0C16:  MOVWF  77
0C17:  CLRF   7A
0C18:  MOVF   2A,W
0C19:  BTFSS  03.0
0C1A:  INCFSZ 2A,W
0C1B:  SUBWF  7A,F
0C1C:  MOVF   77,W
0C1D:  MOVWF  57
0C1E:  MOVLW  FA
0C1F:  ADDWF  57,W
0C20:  MOVWF  2F
0C21:  MOVF   7A,W
0C22:  MOVWF  30
0C23:  BTFSC  03.0
0C24:  INCF   30,F
.................... AZ=abs(Z)+250; 
0C25:  MOVF   2C,W
0C26:  MOVWF  7A
0C27:  MOVF   2B,W
0C28:  BTFSS  2C.7
0C29:  GOTO   433
0C2A:  MOVF   2B,W
0C2B:  SUBLW  00
0C2C:  MOVWF  77
0C2D:  CLRF   7A
0C2E:  MOVF   2C,W
0C2F:  BTFSS  03.0
0C30:  INCFSZ 2C,W
0C31:  SUBWF  7A,F
0C32:  MOVF   77,W
0C33:  MOVWF  57
0C34:  MOVLW  FA
0C35:  ADDWF  57,W
0C36:  MOVWF  31
0C37:  MOVF   7A,W
0C38:  MOVWF  32
0C39:  BTFSC  03.0
0C3A:  INCF   32,F
....................  
.................... float a, b; 
.................... a=(float)Y/Z; 
0C3B:  MOVF   2A,W
0C3C:  MOVWF  5C
0C3D:  MOVF   29,W
0C3E:  MOVWF  5B
0C3F:  BCF    0A.3
0C40:  CALL   4E1
0C41:  BSF    0A.3
0C42:  MOVF   77,W
0C43:  MOVWF  57
0C44:  MOVF   78,W
0C45:  MOVWF  58
0C46:  MOVF   79,W
0C47:  MOVWF  59
0C48:  MOVF   7A,W
0C49:  MOVWF  5A
0C4A:  MOVF   2C,W
0C4B:  MOVWF  5C
0C4C:  MOVF   2B,W
0C4D:  MOVWF  5B
0C4E:  BCF    0A.3
0C4F:  CALL   4E1
0C50:  BSF    0A.3
0C51:  MOVF   5A,W
0C52:  MOVWF  6F
0C53:  MOVF   59,W
0C54:  MOVWF  6E
0C55:  MOVF   58,W
0C56:  MOVWF  6D
0C57:  MOVF   57,W
0C58:  MOVWF  6C
0C59:  MOVF   7A,W
0C5A:  MOVWF  73
0C5B:  MOVF   79,W
0C5C:  MOVWF  72
0C5D:  MOVF   78,W
0C5E:  MOVWF  71
0C5F:  MOVF   77,W
0C60:  MOVWF  70
0C61:  BCF    0A.3
0C62:  CALL   506
0C63:  BSF    0A.3
0C64:  MOVF   7A,W
0C65:  MOVWF  52
0C66:  MOVF   79,W
0C67:  MOVWF  51
0C68:  MOVF   78,W
0C69:  MOVWF  50
0C6A:  MOVF   77,W
0C6B:  MOVWF  4F
.................... b=atan(a); 
0C6C:  MOVF   52,W
0C6D:  MOVWF  5A
0C6E:  MOVF   51,W
0C6F:  MOVWF  59
0C70:  MOVF   50,W
0C71:  MOVWF  58
0C72:  MOVF   4F,W
0C73:  MOVWF  57
0C74:  CALL   15D
0C75:  MOVF   7A,W
0C76:  MOVWF  56
0C77:  MOVF   79,W
0C78:  MOVWF  55
0C79:  MOVF   78,W
0C7A:  MOVWF  54
0C7B:  MOVF   77,W
0C7C:  MOVWF  53
.................... b = (b/3.14)*180; 
0C7D:  MOVF   56,W
0C7E:  MOVWF  6F
0C7F:  MOVF   55,W
0C80:  MOVWF  6E
0C81:  MOVF   54,W
0C82:  MOVWF  6D
0C83:  MOVF   53,W
0C84:  MOVWF  6C
0C85:  MOVLW  C3
0C86:  MOVWF  73
0C87:  MOVLW  F5
0C88:  MOVWF  72
0C89:  MOVLW  48
0C8A:  MOVWF  71
0C8B:  MOVLW  80
0C8C:  MOVWF  70
0C8D:  BCF    0A.3
0C8E:  CALL   506
0C8F:  BSF    0A.3
0C90:  MOVF   77,W
0C91:  MOVWF  57
0C92:  MOVF   78,W
0C93:  MOVWF  58
0C94:  MOVF   79,W
0C95:  MOVWF  59
0C96:  MOVF   7A,W
0C97:  MOVWF  5A
0C98:  MOVWF  6F
0C99:  MOVF   79,W
0C9A:  MOVWF  6E
0C9B:  MOVF   78,W
0C9C:  MOVWF  6D
0C9D:  MOVF   77,W
0C9E:  MOVWF  6C
0C9F:  CLRF   73
0CA0:  CLRF   72
0CA1:  MOVLW  34
0CA2:  MOVWF  71
0CA3:  MOVLW  86
0CA4:  MOVWF  70
0CA5:  BCF    0A.3
0CA6:  CALL   626
0CA7:  BSF    0A.3
0CA8:  MOVF   7A,W
0CA9:  MOVWF  56
0CAA:  MOVF   79,W
0CAB:  MOVWF  55
0CAC:  MOVF   78,W
0CAD:  MOVWF  54
0CAE:  MOVF   77,W
0CAF:  MOVWF  53
.................... b=abs(b); 
0CB0:  MOVF   53,W
0CB1:  MOVWF  77
0CB2:  MOVF   54,W
0CB3:  MOVWF  78
0CB4:  MOVF   55,W
0CB5:  MOVWF  79
0CB6:  MOVF   56,W
0CB7:  MOVWF  7A
0CB8:  BCF    78.7
0CB9:  MOVF   56,W
0CBA:  MOVWF  56
0CBB:  MOVF   55,W
0CBC:  MOVWF  55
0CBD:  MOVF   78,W
0CBE:  MOVWF  54
0CBF:  MOVF   53,W
0CC0:  MOVWF  53
....................     
.................... if(((AX>AY) || (AX>AZ))) //indikace prevraceni panelu 
0CC1:  BTFSS  30.7
0CC2:  GOTO   4C6
0CC3:  BTFSS  2E.7
0CC4:  GOTO   4E3
0CC5:  GOTO   4C8
0CC6:  BTFSC  2E.7
0CC7:  GOTO   4D2
0CC8:  MOVF   30,W
0CC9:  SUBWF  2E,W
0CCA:  BTFSS  03.0
0CCB:  GOTO   4D2
0CCC:  BTFSS  03.2
0CCD:  GOTO   4E3
0CCE:  MOVF   2D,W
0CCF:  SUBWF  2F,W
0CD0:  BTFSS  03.0
0CD1:  GOTO   4E3
0CD2:  BTFSS  32.7
0CD3:  GOTO   4D7
0CD4:  BTFSS  2E.7
0CD5:  GOTO   4E3
0CD6:  GOTO   4D9
0CD7:  BTFSC  2E.7
0CD8:  GOTO   50C
0CD9:  MOVF   32,W
0CDA:  SUBWF  2E,W
0CDB:  BTFSS  03.0
0CDC:  GOTO   50C
0CDD:  BTFSS  03.2
0CDE:  GOTO   4E3
0CDF:  MOVF   2D,W
0CE0:  SUBWF  31,W
0CE1:  BTFSC  03.0
0CE2:  GOTO   50C
....................    {  
....................    printf("Prevracený panel)\r\n", ); 
0CE3:  MOVLW  04
0CE4:  BSF    03.6
0CE5:  MOVWF  0D
0CE6:  MOVLW  00
0CE7:  MOVWF  0F
....................    } 
.................... else 
*
0D0A:  GOTO   598
0D0B:  BCF    03.6
....................    { 
....................    if(Z==0) //osetreni proti deleni 0 
0D0C:  MOVF   2B,F
0D0D:  BTFSS  03.2
0D0E:  GOTO   527
0D0F:  MOVF   2C,F
0D10:  BTFSS  03.2
0D11:  GOTO   527
....................    {  
....................       if(Y>0) 
0D12:  BTFSC  2A.7
0D13:  GOTO   522
0D14:  MOVF   2A,F
0D15:  BTFSS  03.2
0D16:  GOTO   51B
0D17:  MOVF   29,W
0D18:  SUBLW  00
0D19:  BTFSC  03.0
0D1A:  GOTO   522
....................          {  
....................          b=180; 
0D1B:  CLRF   56
0D1C:  CLRF   55
0D1D:  MOVLW  34
0D1E:  MOVWF  54
0D1F:  MOVLW  86
0D20:  MOVWF  53
....................          } 
....................       else 
0D21:  GOTO   526
....................          { 
....................          b=0; 
0D22:  CLRF   56
0D23:  CLRF   55
0D24:  CLRF   54
0D25:  CLRF   53
....................          } 
....................    }   
....................    else 
0D26:  GOTO   597
....................       { 
....................       if(Z>0) 
0D27:  BTFSC  2C.7
0D28:  GOTO   564
0D29:  MOVF   2C,F
0D2A:  BTFSS  03.2
0D2B:  GOTO   530
0D2C:  MOVF   2B,W
0D2D:  SUBLW  00
0D2E:  BTFSC  03.0
0D2F:  GOTO   564
....................        { 
....................        if(Y>=0) 
0D30:  BTFSC  2A.7
0D31:  GOTO   54B
....................        { 
....................          b=90+b; 
0D32:  BCF    03.1
0D33:  CLRF   6F
0D34:  CLRF   6E
0D35:  MOVLW  34
0D36:  MOVWF  6D
0D37:  MOVLW  85
0D38:  MOVWF  6C
0D39:  MOVF   56,W
0D3A:  MOVWF  73
0D3B:  MOVF   55,W
0D3C:  MOVWF  72
0D3D:  MOVF   54,W
0D3E:  MOVWF  71
0D3F:  MOVF   53,W
0D40:  MOVWF  70
0D41:  CALL   000
0D42:  MOVF   7A,W
0D43:  MOVWF  56
0D44:  MOVF   79,W
0D45:  MOVWF  55
0D46:  MOVF   78,W
0D47:  MOVWF  54
0D48:  MOVF   77,W
0D49:  MOVWF  53
....................        } 
....................        else 
0D4A:  GOTO   563
....................        { 
....................          b=90-b; 
0D4B:  BSF    03.1
0D4C:  CLRF   6F
0D4D:  CLRF   6E
0D4E:  MOVLW  34
0D4F:  MOVWF  6D
0D50:  MOVLW  85
0D51:  MOVWF  6C
0D52:  MOVF   56,W
0D53:  MOVWF  73
0D54:  MOVF   55,W
0D55:  MOVWF  72
0D56:  MOVF   54,W
0D57:  MOVWF  71
0D58:  MOVF   53,W
0D59:  MOVWF  70
0D5A:  CALL   000
0D5B:  MOVF   7A,W
0D5C:  MOVWF  56
0D5D:  MOVF   79,W
0D5E:  MOVWF  55
0D5F:  MOVF   78,W
0D60:  MOVWF  54
0D61:  MOVF   77,W
0D62:  MOVWF  53
....................        } 
....................        } 
....................       else 
0D63:  GOTO   597
....................        { 
....................        if(Y>=0) 
0D64:  BTFSC  2A.7
0D65:  GOTO   57F
....................        { 
....................          b=180-b; 
0D66:  BSF    03.1
0D67:  CLRF   6F
0D68:  CLRF   6E
0D69:  MOVLW  34
0D6A:  MOVWF  6D
0D6B:  MOVLW  86
0D6C:  MOVWF  6C
0D6D:  MOVF   56,W
0D6E:  MOVWF  73
0D6F:  MOVF   55,W
0D70:  MOVWF  72
0D71:  MOVF   54,W
0D72:  MOVWF  71
0D73:  MOVF   53,W
0D74:  MOVWF  70
0D75:  CALL   000
0D76:  MOVF   7A,W
0D77:  MOVWF  56
0D78:  MOVF   79,W
0D79:  MOVWF  55
0D7A:  MOVF   78,W
0D7B:  MOVWF  54
0D7C:  MOVF   77,W
0D7D:  MOVWF  53
....................        } 
....................        else 
0D7E:  GOTO   597
....................        { 
....................          b=270+b; 
0D7F:  BCF    03.1
0D80:  CLRF   6F
0D81:  CLRF   6E
0D82:  MOVLW  07
0D83:  MOVWF  6D
0D84:  MOVLW  87
0D85:  MOVWF  6C
0D86:  MOVF   56,W
0D87:  MOVWF  73
0D88:  MOVF   55,W
0D89:  MOVWF  72
0D8A:  MOVF   54,W
0D8B:  MOVWF  71
0D8C:  MOVF   53,W
0D8D:  MOVWF  70
0D8E:  CALL   000
0D8F:  MOVF   7A,W
0D90:  MOVWF  56
0D91:  MOVF   79,W
0D92:  MOVWF  55
0D93:  MOVF   78,W
0D94:  MOVWF  54
0D95:  MOVF   77,W
0D96:  MOVWF  53
0D97:  BSF    03.6
....................        } 
....................        } 
....................           
....................       }    
....................     
....................     
....................     
....................   } 
....................   // printf("uhel namìreny %10.2f \r\n", b); 
....................     
....................    if(b>355) 
0D98:  BCF    03.6
0D99:  CLRF   6B
0D9A:  MOVLW  80
0D9B:  MOVWF  6A
0D9C:  MOVLW  31
0D9D:  MOVWF  69
0D9E:  MOVLW  87
0D9F:  MOVWF  68
0DA0:  MOVF   56,W
0DA1:  MOVWF  6F
0DA2:  MOVF   55,W
0DA3:  MOVWF  6E
0DA4:  MOVF   54,W
0DA5:  MOVWF  6D
0DA6:  MOVF   53,W
0DA7:  MOVWF  6C
0DA8:  BCF    0A.3
0DA9:  CALL   5E7
0DAA:  BSF    0A.3
0DAB:  BTFSS  03.0
0DAC:  GOTO   5B2
....................    { 
....................    b=0; 
0DAD:  CLRF   56
0DAE:  CLRF   55
0DAF:  CLRF   54
0DB0:  CLRF   53
....................    } 
.................... else 
0DB1:  GOTO   5B2
....................    { 
....................  
....................    } 
....................       return b; 
0DB2:  MOVF   53,W
0DB3:  MOVWF  77
0DB4:  MOVF   54,W
0DB5:  MOVWF  78
0DB6:  MOVF   55,W
0DB7:  MOVWF  79
0DB8:  MOVF   56,W
0DB9:  MOVWF  7A
....................     
.................... } 
0DBA:  RETURN
....................  
.................... float azimut (void) //vypocet aktualni vysky panelu 
.................... { 
.................... X= magR (MAG_XH, MAG_XL);   
*
0E8C:  MOVLW  03
0E8D:  MOVWF  57
0E8E:  MOVLW  04
0E8F:  MOVWF  58
0E90:  CALL   5BB
0E91:  MOVF   79,W
0E92:  MOVWF  28
0E93:  MOVF   78,W
0E94:  MOVWF  27
.................... Y= magR (MAG_YH, MAG_YL);  
0E95:  MOVLW  07
0E96:  MOVWF  57
0E97:  MOVLW  08
0E98:  MOVWF  58
0E99:  CALL   5BB
0E9A:  MOVF   79,W
0E9B:  MOVWF  2A
0E9C:  MOVF   78,W
0E9D:  MOVWF  29
.................... Z= magR (MAG_ZH, MAG_ZL);  
0E9E:  MOVLW  05
0E9F:  MOVWF  57
0EA0:  MOVLW  06
0EA1:  MOVWF  58
0EA2:  CALL   5BB
0EA3:  MOVF   79,W
0EA4:  MOVWF  2C
0EA5:  MOVF   78,W
0EA6:  MOVWF  2B
....................  
....................  
....................  
....................  
.................... AX=abs(X); 
0EA7:  MOVF   28,W
0EA8:  MOVWF  7A
0EA9:  MOVF   27,W
0EAA:  BTFSS  28.7
0EAB:  GOTO   6B5
0EAC:  MOVF   27,W
0EAD:  SUBLW  00
0EAE:  MOVWF  77
0EAF:  CLRF   7A
0EB0:  MOVF   28,W
0EB1:  BTFSS  03.0
0EB2:  INCFSZ 28,W
0EB3:  SUBWF  7A,F
0EB4:  MOVF   77,W
0EB5:  MOVWF  2D
0EB6:  MOVF   7A,W
0EB7:  MOVWF  2E
.................... AY=abs(Y); 
0EB8:  MOVF   2A,W
0EB9:  MOVWF  7A
0EBA:  MOVF   29,W
0EBB:  BTFSS  2A.7
0EBC:  GOTO   6C6
0EBD:  MOVF   29,W
0EBE:  SUBLW  00
0EBF:  MOVWF  77
0EC0:  CLRF   7A
0EC1:  MOVF   2A,W
0EC2:  BTFSS  03.0
0EC3:  INCFSZ 2A,W
0EC4:  SUBWF  7A,F
0EC5:  MOVF   77,W
0EC6:  MOVWF  2F
0EC7:  MOVF   7A,W
0EC8:  MOVWF  30
.................... AZ=abs(Z); 
0EC9:  MOVF   2C,W
0ECA:  MOVWF  7A
0ECB:  MOVF   2B,W
0ECC:  BTFSS  2C.7
0ECD:  GOTO   6D7
0ECE:  MOVF   2B,W
0ECF:  SUBLW  00
0ED0:  MOVWF  77
0ED1:  CLRF   7A
0ED2:  MOVF   2C,W
0ED3:  BTFSS  03.0
0ED4:  INCFSZ 2C,W
0ED5:  SUBWF  7A,F
0ED6:  MOVF   77,W
0ED7:  MOVWF  31
0ED8:  MOVF   7A,W
0ED9:  MOVWF  32
....................  
.................... float a, b; 
.................... a=(float)Y/X; 
0EDA:  MOVF   2A,W
0EDB:  MOVWF  5C
0EDC:  MOVF   29,W
0EDD:  MOVWF  5B
0EDE:  BCF    0A.3
0EDF:  CALL   4E1
0EE0:  BSF    0A.3
0EE1:  MOVF   77,W
0EE2:  MOVWF  57
0EE3:  MOVF   78,W
0EE4:  MOVWF  58
0EE5:  MOVF   79,W
0EE6:  MOVWF  59
0EE7:  MOVF   7A,W
0EE8:  MOVWF  5A
0EE9:  MOVF   28,W
0EEA:  MOVWF  5C
0EEB:  MOVF   27,W
0EEC:  MOVWF  5B
0EED:  BCF    0A.3
0EEE:  CALL   4E1
0EEF:  BSF    0A.3
0EF0:  MOVF   5A,W
0EF1:  MOVWF  6F
0EF2:  MOVF   59,W
0EF3:  MOVWF  6E
0EF4:  MOVF   58,W
0EF5:  MOVWF  6D
0EF6:  MOVF   57,W
0EF7:  MOVWF  6C
0EF8:  MOVF   7A,W
0EF9:  MOVWF  73
0EFA:  MOVF   79,W
0EFB:  MOVWF  72
0EFC:  MOVF   78,W
0EFD:  MOVWF  71
0EFE:  MOVF   77,W
0EFF:  MOVWF  70
0F00:  BCF    0A.3
0F01:  CALL   506
0F02:  BSF    0A.3
0F03:  MOVF   7A,W
0F04:  MOVWF  52
0F05:  MOVF   79,W
0F06:  MOVWF  51
0F07:  MOVF   78,W
0F08:  MOVWF  50
0F09:  MOVF   77,W
0F0A:  MOVWF  4F
.................... b=atan(a); 
0F0B:  MOVF   52,W
0F0C:  MOVWF  5A
0F0D:  MOVF   51,W
0F0E:  MOVWF  59
0F0F:  MOVF   50,W
0F10:  MOVWF  58
0F11:  MOVF   4F,W
0F12:  MOVWF  57
0F13:  CALL   15D
0F14:  MOVF   7A,W
0F15:  MOVWF  56
0F16:  MOVF   79,W
0F17:  MOVWF  55
0F18:  MOVF   78,W
0F19:  MOVWF  54
0F1A:  MOVF   77,W
0F1B:  MOVWF  53
.................... b = (b/3.14)*180; 
0F1C:  MOVF   56,W
0F1D:  MOVWF  6F
0F1E:  MOVF   55,W
0F1F:  MOVWF  6E
0F20:  MOVF   54,W
0F21:  MOVWF  6D
0F22:  MOVF   53,W
0F23:  MOVWF  6C
0F24:  MOVLW  C3
0F25:  MOVWF  73
0F26:  MOVLW  F5
0F27:  MOVWF  72
0F28:  MOVLW  48
0F29:  MOVWF  71
0F2A:  MOVLW  80
0F2B:  MOVWF  70
0F2C:  BCF    0A.3
0F2D:  CALL   506
0F2E:  BSF    0A.3
0F2F:  MOVF   77,W
0F30:  MOVWF  57
0F31:  MOVF   78,W
0F32:  MOVWF  58
0F33:  MOVF   79,W
0F34:  MOVWF  59
0F35:  MOVF   7A,W
0F36:  MOVWF  5A
0F37:  MOVWF  6F
0F38:  MOVF   79,W
0F39:  MOVWF  6E
0F3A:  MOVF   78,W
0F3B:  MOVWF  6D
0F3C:  MOVF   77,W
0F3D:  MOVWF  6C
0F3E:  CLRF   73
0F3F:  CLRF   72
0F40:  MOVLW  34
0F41:  MOVWF  71
0F42:  MOVLW  86
0F43:  MOVWF  70
0F44:  BCF    0A.3
0F45:  CALL   626
0F46:  BSF    0A.3
0F47:  MOVF   7A,W
0F48:  MOVWF  56
0F49:  MOVF   79,W
0F4A:  MOVWF  55
0F4B:  MOVF   78,W
0F4C:  MOVWF  54
0F4D:  MOVF   77,W
0F4E:  MOVWF  53
.................... b=abs(b); 
0F4F:  MOVF   53,W
0F50:  MOVWF  77
0F51:  MOVF   54,W
0F52:  MOVWF  78
0F53:  MOVF   55,W
0F54:  MOVWF  79
0F55:  MOVF   56,W
0F56:  MOVWF  7A
0F57:  BCF    78.7
0F58:  MOVF   56,W
0F59:  MOVWF  56
0F5A:  MOVF   55,W
0F5B:  MOVWF  55
0F5C:  MOVF   78,W
0F5D:  MOVWF  54
0F5E:  MOVF   53,W
0F5F:  MOVWF  53
....................     
....................  
....................     
....................  
....................    if(X==0) //osetreni proti deleni 0 
0F60:  MOVF   27,F
0F61:  BTFSS  03.2
0F62:  GOTO   77D
0F63:  MOVF   28,F
0F64:  BTFSS  03.2
0F65:  GOTO   77D
....................    {  
....................       if(Y>0) 
0F66:  BTFSC  2A.7
0F67:  GOTO   776
0F68:  MOVF   2A,F
0F69:  BTFSS  03.2
0F6A:  GOTO   76F
0F6B:  MOVF   29,W
0F6C:  SUBLW  00
0F6D:  BTFSC  03.0
0F6E:  GOTO   776
....................          {  
....................          b=90; 
0F6F:  CLRF   56
0F70:  CLRF   55
0F71:  MOVLW  34
0F72:  MOVWF  54
0F73:  MOVLW  85
0F74:  MOVWF  53
....................          } 
....................       else 
0F75:  GOTO   77C
....................          { 
....................          b=270; 
0F76:  CLRF   56
0F77:  CLRF   55
0F78:  MOVLW  07
0F79:  MOVWF  54
0F7A:  MOVLW  87
0F7B:  MOVWF  53
....................          } 
....................    }   
....................    else 
0F7C:  GOTO   7D4
....................       { 
....................       if(X>0) 
0F7D:  BTFSC  28.7
0F7E:  GOTO   7A1
0F7F:  MOVF   28,F
0F80:  BTFSS  03.2
0F81:  GOTO   786
0F82:  MOVF   27,W
0F83:  SUBLW  00
0F84:  BTFSC  03.0
0F85:  GOTO   7A1
....................        { 
....................        if(Y>=0) 
0F86:  BTFSS  2A.7
....................        { 
....................          b=b; 
....................        } 
....................        else 
0F87:  GOTO   7A0
....................        { 
....................          b=360-b; 
0F88:  BSF    03.1
0F89:  CLRF   6F
0F8A:  CLRF   6E
0F8B:  MOVLW  34
0F8C:  MOVWF  6D
0F8D:  MOVLW  87
0F8E:  MOVWF  6C
0F8F:  MOVF   56,W
0F90:  MOVWF  73
0F91:  MOVF   55,W
0F92:  MOVWF  72
0F93:  MOVF   54,W
0F94:  MOVWF  71
0F95:  MOVF   53,W
0F96:  MOVWF  70
0F97:  CALL   000
0F98:  MOVF   7A,W
0F99:  MOVWF  56
0F9A:  MOVF   79,W
0F9B:  MOVWF  55
0F9C:  MOVF   78,W
0F9D:  MOVWF  54
0F9E:  MOVF   77,W
0F9F:  MOVWF  53
....................        } 
....................        } 
....................       else 
0FA0:  GOTO   7D4
....................        { 
....................        if(Y>=0) 
0FA1:  BTFSC  2A.7
0FA2:  GOTO   7BC
....................        { 
....................          b=180-b; 
0FA3:  BSF    03.1
0FA4:  CLRF   6F
0FA5:  CLRF   6E
0FA6:  MOVLW  34
0FA7:  MOVWF  6D
0FA8:  MOVLW  86
0FA9:  MOVWF  6C
0FAA:  MOVF   56,W
0FAB:  MOVWF  73
0FAC:  MOVF   55,W
0FAD:  MOVWF  72
0FAE:  MOVF   54,W
0FAF:  MOVWF  71
0FB0:  MOVF   53,W
0FB1:  MOVWF  70
0FB2:  CALL   000
0FB3:  MOVF   7A,W
0FB4:  MOVWF  56
0FB5:  MOVF   79,W
0FB6:  MOVWF  55
0FB7:  MOVF   78,W
0FB8:  MOVWF  54
0FB9:  MOVF   77,W
0FBA:  MOVWF  53
....................        } 
....................        else 
0FBB:  GOTO   7D4
....................        { 
....................          b=180+b; 
0FBC:  BCF    03.1
0FBD:  CLRF   6F
0FBE:  CLRF   6E
0FBF:  MOVLW  34
0FC0:  MOVWF  6D
0FC1:  MOVLW  86
0FC2:  MOVWF  6C
0FC3:  MOVF   56,W
0FC4:  MOVWF  73
0FC5:  MOVF   55,W
0FC6:  MOVWF  72
0FC7:  MOVF   54,W
0FC8:  MOVWF  71
0FC9:  MOVF   53,W
0FCA:  MOVWF  70
0FCB:  CALL   000
0FCC:  MOVF   7A,W
0FCD:  MOVWF  56
0FCE:  MOVF   79,W
0FCF:  MOVWF  55
0FD0:  MOVF   78,W
0FD1:  MOVWF  54
0FD2:  MOVF   77,W
0FD3:  MOVWF  53
....................        } 
....................        } 
....................           
....................       }  
....................        
....................        
....................  if(b>355) 
0FD4:  CLRF   6B
0FD5:  MOVLW  80
0FD6:  MOVWF  6A
0FD7:  MOVLW  31
0FD8:  MOVWF  69
0FD9:  MOVLW  87
0FDA:  MOVWF  68
0FDB:  MOVF   56,W
0FDC:  MOVWF  6F
0FDD:  MOVF   55,W
0FDE:  MOVWF  6E
0FDF:  MOVF   54,W
0FE0:  MOVWF  6D
0FE1:  MOVF   53,W
0FE2:  MOVWF  6C
0FE3:  BCF    0A.3
0FE4:  CALL   5E7
0FE5:  BSF    0A.3
0FE6:  BTFSS  03.0
0FE7:  GOTO   7ED
....................    { 
....................    b=0; 
0FE8:  CLRF   56
0FE9:  CLRF   55
0FEA:  CLRF   54
0FEB:  CLRF   53
....................    } 
.................... else 
0FEC:  GOTO   7ED
....................    { 
....................  
....................    } 
....................  
....................       return b; 
0FED:  MOVF   53,W
0FEE:  MOVWF  77
0FEF:  MOVF   54,W
0FF0:  MOVWF  78
0FF1:  MOVF   55,W
0FF2:  MOVWF  79
0FF3:  MOVF   56,W
0FF4:  MOVWF  7A
....................     
.................... } 
0FF5:  RETURN
....................  
.................... void motorA (int8 H) //pro ovladani prvniho motoru nastaveni vysky 
.................... { 
.................... switch(H){ 
*
0092:  MOVF   4F,W
0093:  XORLW  01
0094:  BTFSC  03.2
0095:  GOTO   09A
0096:  XORLW  03
0097:  BTFSC  03.2
0098:  GOTO   0A3
0099:  GOTO   0AC
....................    case 1:  //reverzní chod 
....................    output_low (AIN2); 
009A:  BSF    03.5
009B:  BCF    08.1
009C:  BCF    03.5
009D:  BCF    08.1
....................    output_high (AIN1);   
009E:  BSF    03.5
009F:  BCF    08.0
00A0:  BCF    03.5
00A1:  BSF    08.0
....................    break; 
00A2:  GOTO   0B4
....................  
.................... case 2: //dopøedu 
....................    output_low (AIN1); 
00A3:  BSF    03.5
00A4:  BCF    08.0
00A5:  BCF    03.5
00A6:  BCF    08.0
....................    output_high (AIN2);    
00A7:  BSF    03.5
00A8:  BCF    08.1
00A9:  BCF    03.5
00AA:  BSF    08.1
....................    break; 
00AB:  GOTO   0B4
....................  
.................... default: 
....................    output_low (AIN2); 
00AC:  BSF    03.5
00AD:  BCF    08.1
00AE:  BCF    03.5
00AF:  BCF    08.1
....................    output_low (AIN1); 
00B0:  BSF    03.5
00B1:  BCF    08.0
00B2:  BCF    03.5
00B3:  BCF    08.0
....................          } 
.................... } 
00B4:  RETURN
....................  
.................... void motorB (int8 H) //pro ovladani prvniho motoru nastaveni vysky 
.................... { 
.................... switch(H){ 
00B5:  MOVF   4F,W
00B6:  XORLW  01
00B7:  BTFSC  03.2
00B8:  GOTO   0BD
00B9:  XORLW  03
00BA:  BTFSC  03.2
00BB:  GOTO   0C6
00BC:  GOTO   0CF
....................    case 1:  //reverzní chod 
....................    output_low (BIN2); 
00BD:  BSF    03.5
00BE:  BCF    08.3
00BF:  BCF    03.5
00C0:  BCF    08.3
....................    output_high (BIN1);   
00C1:  BSF    03.5
00C2:  BCF    08.2
00C3:  BCF    03.5
00C4:  BSF    08.2
....................    break; 
00C5:  GOTO   0D7
....................  
.................... case 2: //dopøedu 
....................    output_low (BIN1); 
00C6:  BSF    03.5
00C7:  BCF    08.2
00C8:  BCF    03.5
00C9:  BCF    08.2
....................    output_high (BIN2);    
00CA:  BSF    03.5
00CB:  BCF    08.3
00CC:  BCF    03.5
00CD:  BSF    08.3
....................    break; 
00CE:  GOTO   0D7
....................  
.................... default: 
....................    output_low (BIN2); 
00CF:  BSF    03.5
00D0:  BCF    08.3
00D1:  BCF    03.5
00D2:  BCF    08.3
....................    output_low (BIN1); 
00D3:  BSF    03.5
00D4:  BCF    08.2
00D5:  BCF    03.5
00D6:  BCF    08.2
....................          } 
.................... } 
00D7:  RETURN
....................  
.................... void elevace_set (int16 H) //slouzi pro nastaveni nove vysky panelu 
.................... { 
.................... //printf("Akcelerometr4:  \r\n",); 
.................... float a; 
.................... int16 b,c; 
....................  
....................  
....................  
....................  
....................     
....................  
....................  
.................... a=elevace(); 
*
06D8:  BSF    0A.3
06D9:  CALL   3DD
06DA:  BCF    0A.3
06DB:  MOVF   7A,W
06DC:  MOVWF  4A
06DD:  MOVF   79,W
06DE:  MOVWF  49
06DF:  MOVF   78,W
06E0:  MOVWF  48
06E1:  MOVF   77,W
06E2:  MOVWF  47
.................... b= (int16) a; 
06E3:  MOVF   4A,W
06E4:  MOVWF  52
06E5:  MOVF   49,W
06E6:  MOVWF  51
06E7:  MOVF   48,W
06E8:  MOVWF  50
06E9:  MOVF   47,W
06EA:  MOVWF  4F
06EB:  CALL   6B9
06EC:  MOVF   79,W
06ED:  MOVWF  4C
06EE:  MOVF   78,W
06EF:  MOVWF  4B
.................... c=abs(H-b);  
06F0:  MOVF   4B,W
06F1:  SUBWF  45,W
06F2:  MOVWF  4F
06F3:  MOVF   46,W
06F4:  MOVWF  50
06F5:  MOVF   4C,W
06F6:  BTFSS  03.0
06F7:  INCFSZ 4C,W
06F8:  SUBWF  50,F
06F9:  MOVF   50,W
06FA:  MOVWF  4E
06FB:  MOVF   4F,W
06FC:  MOVWF  4D
....................  
.................... while(c>2) //maximalni odchylka uhlu, aby nebylo potreba panelem hybat 
....................    { 
06FD:  MOVF   4E,F
06FE:  BTFSS  03.2
06FF:  GOTO   704
0700:  MOVF   4D,W
0701:  SUBLW  02
0702:  BTFSC  03.0
0703:  GOTO   74D
....................    while(H!=b) //probiha dokud se uhel panelu nerovna zadanemu na cele stupne 
....................       { 
0704:  MOVF   4B,W
0705:  SUBWF  45,W
0706:  BTFSS  03.2
0707:  GOTO   70C
0708:  MOVF   4C,W
0709:  SUBWF  46,W
070A:  BTFSC  03.2
070B:  GOTO   74C
....................  
....................       if(H>b) 
070C:  MOVF   4C,W
070D:  SUBWF  46,W
070E:  BTFSS  03.0
070F:  GOTO   71A
0710:  BTFSS  03.2
0711:  GOTO   716
0712:  MOVF   45,W
0713:  SUBWF  4B,W
0714:  BTFSC  03.0
0715:  GOTO   71A
....................          { 
....................          motorA(2); 
0716:  MOVLW  02
0717:  MOVWF  4F
0718:  CALL   092
....................      
....................          } 
....................       else 
0719:  GOTO   71D
....................       { 
....................       motorA(1); 
071A:  MOVLW  01
071B:  MOVWF  4F
071C:  CALL   092
....................       } 
....................  
....................       delay_ms (50); //cas sepnuti motoru 
071D:  MOVLW  32
071E:  MOVWF  4F
071F:  CALL   15D
....................  
....................       motorA(3); //vypne motor 
0720:  MOVLW  03
0721:  MOVWF  4F
0722:  CALL   092
....................       delay_ms (50); //doma na ustaleni panelu pred merenim 
0723:  MOVLW  32
0724:  MOVWF  4F
0725:  CALL   15D
....................       a=elevace(); 
0726:  BSF    0A.3
0727:  CALL   3DD
0728:  BCF    0A.3
0729:  MOVF   7A,W
072A:  MOVWF  4A
072B:  MOVF   79,W
072C:  MOVWF  49
072D:  MOVF   78,W
072E:  MOVWF  48
072F:  MOVF   77,W
0730:  MOVWF  47
....................       b= (int16) a; 
0731:  MOVF   4A,W
0732:  MOVWF  52
0733:  MOVF   49,W
0734:  MOVWF  51
0735:  MOVF   48,W
0736:  MOVWF  50
0737:  MOVF   47,W
0738:  MOVWF  4F
0739:  CALL   6B9
073A:  MOVF   79,W
073B:  MOVWF  4C
073C:  MOVF   78,W
073D:  MOVWF  4B
....................    
....................       
....................       c=abs(H-b); 
073E:  MOVF   4B,W
073F:  SUBWF  45,W
0740:  MOVWF  4F
0741:  MOVF   46,W
0742:  MOVWF  50
0743:  MOVF   4C,W
0744:  BTFSS  03.0
0745:  INCFSZ 4C,W
0746:  SUBWF  50,F
0747:  MOVF   50,W
0748:  MOVWF  4E
0749:  MOVF   4F,W
074A:  MOVWF  4D
....................       } 
074B:  GOTO   704
....................    } 
074C:  GOTO   6FD
.................... motorA(3); //vypne motor 
074D:  MOVLW  03
074E:  MOVWF  4F
074F:  CALL   092
.................... printf("Podaøené nastavení výška: %Ld\r\n", b); 
0750:  MOVLW  18
0751:  BSF    03.6
0752:  MOVWF  0D
0753:  MOVLW  00
0754:  MOVWF  0F
0755:  MOVLW  1A
0756:  BCF    03.6
0757:  MOVWF  4F
0758:  CALL   2EE
0759:  MOVLW  10
075A:  MOVWF  04
075B:  MOVF   4C,W
075C:  MOVWF  50
075D:  MOVF   4B,W
075E:  MOVWF  4F
075F:  CALL   30F
0760:  MOVLW  0D
0761:  MOVWF  59
0762:  CALL   222
0763:  MOVLW  0A
0764:  MOVWF  59
0765:  CALL   222
....................  
....................  
.................... } 
0766:  BCF    0A.3
0767:  BSF    0A.4
0768:  GOTO   254 (RETURN)
....................  
....................  
....................  
.................... void azimut_set (int16 H) //slouzi pro nastaveni nove vysky panelu 
.................... { 
.................... float a; 
.................... int16 b,c; 
....................  
....................  
.................... a=azimut(); 
*
1000:  BCF    0A.4
1001:  BSF    0A.3
1002:  CALL   68C
1003:  BSF    0A.4
1004:  BCF    0A.3
1005:  MOVF   7A,W
1006:  MOVWF  4A
1007:  MOVF   79,W
1008:  MOVWF  49
1009:  MOVF   78,W
100A:  MOVWF  48
100B:  MOVF   77,W
100C:  MOVWF  47
.................... b= (int16) a; 
100D:  MOVF   4A,W
100E:  MOVWF  52
100F:  MOVF   49,W
1010:  MOVWF  51
1011:  MOVF   48,W
1012:  MOVWF  50
1013:  MOVF   47,W
1014:  MOVWF  4F
1015:  BCF    0A.4
1016:  CALL   6B9
1017:  BSF    0A.4
1018:  MOVF   79,W
1019:  MOVWF  4C
101A:  MOVF   78,W
101B:  MOVWF  4B
.................... c=abs(H-b); 
101C:  MOVF   4B,W
101D:  SUBWF  45,W
101E:  MOVWF  4F
101F:  MOVF   46,W
1020:  MOVWF  50
1021:  MOVF   4C,W
1022:  BTFSS  03.0
1023:  INCFSZ 4C,W
1024:  SUBWF  50,F
1025:  MOVF   50,W
1026:  MOVWF  4E
1027:  MOVF   4F,W
1028:  MOVWF  4D
....................  
.................... while(c>2) //maximalni odchylka uhlu, aby nebylo potreba panelem hybat 
....................    { 
1029:  MOVF   4E,F
102A:  BTFSS  03.2
102B:  GOTO   030
102C:  MOVF   4D,W
102D:  SUBLW  02
102E:  BTFSC  03.0
102F:  GOTO   087
....................    while(H!=b) //probiha dokud se uhel panelu nerovna zadanemu na cele stupne 
....................       { 
1030:  MOVF   4B,W
1031:  SUBWF  45,W
1032:  BTFSS  03.2
1033:  GOTO   038
1034:  MOVF   4C,W
1035:  SUBWF  46,W
1036:  BTFSC  03.2
1037:  GOTO   086
....................  
....................       if(H>b) 
1038:  MOVF   4C,W
1039:  SUBWF  46,W
103A:  BTFSS  03.0
103B:  GOTO   048
103C:  BTFSS  03.2
103D:  GOTO   042
103E:  MOVF   45,W
103F:  SUBWF  4B,W
1040:  BTFSC  03.0
1041:  GOTO   048
....................          { 
....................          motorB(2); 
1042:  MOVLW  02
1043:  MOVWF  4F
1044:  BCF    0A.4
1045:  CALL   0B5
1046:  BSF    0A.4
....................       
....................          } 
....................       else 
1047:  GOTO   04D
....................       { 
....................       motorB(1); 
1048:  MOVLW  01
1049:  MOVWF  4F
104A:  BCF    0A.4
104B:  CALL   0B5
104C:  BSF    0A.4
....................       } 
....................  
....................       delay_ms (50); //cas sepnuti motoru 
104D:  MOVLW  32
104E:  MOVWF  4F
104F:  BCF    0A.4
1050:  CALL   15D
1051:  BSF    0A.4
....................  
....................       motorB(3); //vypne motor 
1052:  MOVLW  03
1053:  MOVWF  4F
1054:  BCF    0A.4
1055:  CALL   0B5
1056:  BSF    0A.4
....................       delay_ms (50); //doma na ustaleni panelu pred merenim 
1057:  MOVLW  32
1058:  MOVWF  4F
1059:  BCF    0A.4
105A:  CALL   15D
105B:  BSF    0A.4
....................       a=azimut(); 
105C:  BCF    0A.4
105D:  BSF    0A.3
105E:  CALL   68C
105F:  BSF    0A.4
1060:  BCF    0A.3
1061:  MOVF   7A,W
1062:  MOVWF  4A
1063:  MOVF   79,W
1064:  MOVWF  49
1065:  MOVF   78,W
1066:  MOVWF  48
1067:  MOVF   77,W
1068:  MOVWF  47
....................       b= (int16) a; 
1069:  MOVF   4A,W
106A:  MOVWF  52
106B:  MOVF   49,W
106C:  MOVWF  51
106D:  MOVF   48,W
106E:  MOVWF  50
106F:  MOVF   47,W
1070:  MOVWF  4F
1071:  BCF    0A.4
1072:  CALL   6B9
1073:  BSF    0A.4
1074:  MOVF   79,W
1075:  MOVWF  4C
1076:  MOVF   78,W
1077:  MOVWF  4B
....................             
....................       c=abs(H-b); 
1078:  MOVF   4B,W
1079:  SUBWF  45,W
107A:  MOVWF  4F
107B:  MOVF   46,W
107C:  MOVWF  50
107D:  MOVF   4C,W
107E:  BTFSS  03.0
107F:  INCFSZ 4C,W
1080:  SUBWF  50,F
1081:  MOVF   50,W
1082:  MOVWF  4E
1083:  MOVF   4F,W
1084:  MOVWF  4D
....................       } 
1085:  GOTO   030
....................    } 
1086:  GOTO   029
.................... motorA(3); //vypne motor 
1087:  MOVLW  03
1088:  MOVWF  4F
1089:  BCF    0A.4
108A:  CALL   092
108B:  BSF    0A.4
.................... printf("Podaøené nastavení azimut: %Ld\r\n", b); 
108C:  MOVLW  38
108D:  BSF    03.6
108E:  MOVWF  0D
108F:  MOVLW  00
1090:  MOVWF  0F
1091:  MOVLW  1B
1092:  BCF    03.6
1093:  MOVWF  4F
1094:  BCF    0A.4
1095:  CALL   2EE
1096:  BSF    0A.4
1097:  MOVLW  10
1098:  MOVWF  04
1099:  MOVF   4C,W
109A:  MOVWF  50
109B:  MOVF   4B,W
109C:  MOVWF  4F
109D:  BCF    0A.4
109E:  CALL   30F
109F:  BSF    0A.4
10A0:  MOVLW  0D
10A1:  MOVWF  59
10A2:  BCF    0A.4
10A3:  CALL   222
10A4:  BSF    0A.4
10A5:  MOVLW  0A
10A6:  MOVWF  59
10A7:  BCF    0A.4
10A8:  CALL   222
10A9:  BSF    0A.4
....................  
....................     
....................  
....................    } 
10AA:  BCF    0A.3
10AB:  BSF    0A.4
10AC:  GOTO   25A (RETURN)
....................  
.................... void main() 
.................... { 
10AD:  CLRF   04
10AE:  BCF    03.7
10AF:  MOVLW  1F
10B0:  ANDWF  03,F
10B1:  MOVLW  71
10B2:  BSF    03.5
10B3:  MOVWF  0F
10B4:  MOVF   0F,W
10B5:  BCF    03.5
10B6:  BCF    20.7
10B7:  MOVF   20,W
10B8:  BSF    03.5
10B9:  MOVWF  07
10BA:  BCF    03.5
10BB:  BSF    07.7
10BC:  BSF    03.5
10BD:  BSF    03.6
10BE:  MOVF   09,W
10BF:  ANDLW  C0
10C0:  MOVWF  09
10C1:  BCF    03.6
10C2:  BCF    1F.4
10C3:  BCF    1F.5
10C4:  MOVLW  00
10C5:  BSF    03.6
10C6:  MOVWF  08
10C7:  BCF    03.5
10C8:  CLRF   07
10C9:  CLRF   08
10CA:  CLRF   09
....................    setup_adc_ports(NO_ANALOGS|VSS_VDD); 
*
10D0:  BSF    03.5
10D1:  BSF    03.6
10D2:  MOVF   09,W
10D3:  ANDLW  C0
10D4:  MOVWF  09
10D5:  BCF    03.6
10D6:  BCF    1F.4
10D7:  BCF    1F.5
10D8:  MOVLW  00
10D9:  BSF    03.6
10DA:  MOVWF  08
....................    setup_adc(ADC_CLOCK_DIV_2); 
10DB:  BCF    03.5
10DC:  BCF    03.6
10DD:  BCF    1F.6
10DE:  BCF    1F.7
10DF:  BSF    03.5
10E0:  BCF    1F.7
10E1:  BCF    03.5
10E2:  BSF    1F.0
....................    setup_spi(SPI_SS_DISABLED); 
10E3:  BCF    14.5
10E4:  BCF    20.5
10E5:  MOVF   20,W
10E6:  BSF    03.5
10E7:  MOVWF  07
10E8:  BCF    03.5
10E9:  BSF    20.4
10EA:  MOVF   20,W
10EB:  BSF    03.5
10EC:  MOVWF  07
10ED:  BCF    03.5
10EE:  BCF    20.3
10EF:  MOVF   20,W
10F0:  BSF    03.5
10F1:  MOVWF  07
10F2:  MOVLW  01
10F3:  BCF    03.5
10F4:  MOVWF  14
10F5:  MOVLW  00
10F6:  BSF    03.5
10F7:  MOVWF  14
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 
10F8:  MOVF   01,W
10F9:  ANDLW  C7
10FA:  IORLW  08
10FB:  MOVWF  01
....................    setup_timer_1(T1_DISABLED); 
10FC:  BCF    03.5
10FD:  CLRF   10
....................    setup_timer_2(T2_DISABLED,0,1); 
10FE:  MOVLW  00
10FF:  MOVWF  78
1100:  MOVWF  12
1101:  MOVLW  00
1102:  BSF    03.5
1103:  MOVWF  12
....................    setup_ccp1(CCP_OFF); 
1104:  BCF    03.5
1105:  BSF    20.2
1106:  MOVF   20,W
1107:  BSF    03.5
1108:  MOVWF  07
1109:  BCF    03.5
110A:  CLRF   17
110B:  BSF    03.5
110C:  CLRF   1B
110D:  CLRF   1C
110E:  MOVLW  01
110F:  MOVWF  1D
....................    setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard 
1110:  BCF    03.5
1111:  BSF    03.6
1112:  CLRF   07
1113:  CLRF   08
1114:  CLRF   09
....................     
....................    //setup_adc_ports(PIN_A0); //piny pro A/D RA0 
....................    //setup_adc_ports(PIN_A1); //piny pro A/D RA1 
....................   
.................... motorA(3); //vyponuti motorù 
1115:  MOVLW  03
1116:  BCF    03.6
1117:  MOVWF  4F
1118:  BCF    0A.4
1119:  CALL   092
111A:  BSF    0A.4
.................... motorB(3); 
111B:  MOVLW  03
111C:  MOVWF  4F
111D:  BCF    0A.4
111E:  CALL   0B5
111F:  BSF    0A.4
....................  
.................... setAK(); //nastaveni akcelerometru 
1120:  BCF    0A.4
1121:  GOTO   122
1122:  BSF    0A.4
.................... setmag();   
1123:  BCF    0A.4
1124:  GOTO   171
1125:  BSF    0A.4
.................... printf("System nataceni panelu  \r\n",); 
1126:  MOVLW  59
1127:  BSF    03.6
1128:  MOVWF  0D
1129:  MOVLW  00
112A:  MOVWF  0F
112B:  BCF    0A.4
112C:  BCF    03.6
112D:  GOTO   246
112E:  BSF    0A.4
....................   while(TRUE) 
....................  {  
.................... int i[10]; 
.................... int16 vysledek; 
.................... int b=0; 
.................... int c; 
112F:  CLRF   43
....................   do { 
....................        b++;   
1130:  INCF   43,F
....................        i[b] = getchar(); 
1131:  MOVLW  37
1132:  ADDWF  43,W
1133:  MOVWF  04
1134:  BCF    03.7
1135:  CLRF   48
1136:  MOVF   04,W
1137:  MOVWF  47
1138:  BCF    48.0
1139:  BTFSC  03.7
113A:  BSF    48.0
113B:  BCF    0A.4
113C:  CALL   28E
113D:  BSF    0A.4
113E:  MOVF   47,W
113F:  MOVWF  04
1140:  BCF    03.7
1141:  BTFSC  48.0
1142:  BSF    03.7
1143:  MOVF   78,W
1144:  MOVWF  00
....................   
....................       // printf("zadaný azimut %d \r\n", i[b]); 
....................        
....................    } while (i[b] != ' '); 
1145:  MOVLW  37
1146:  ADDWF  43,W
1147:  MOVWF  04
1148:  BCF    03.7
1149:  MOVF   00,W
114A:  SUBLW  20
114B:  BTFSS  03.2
114C:  GOTO   130
.................... b=b-1; 
114D:  MOVLW  01
114E:  SUBWF  43,F
....................  
.................... switch(b){ 
114F:  MOVF   43,W
1150:  XORLW  01
1151:  BTFSC  03.2
1152:  GOTO   15A
1153:  XORLW  03
1154:  BTFSC  03.2
1155:  GOTO   15F
1156:  XORLW  01
1157:  BTFSC  03.2
1158:  GOTO   170
1159:  GOTO   199
....................    case 1:  //reverzní chod 
....................    elevaceZAD=i[1]-48; 
115A:  MOVLW  30
115B:  SUBWF  38,W
115C:  MOVWF  35
115D:  CLRF   36
....................    break; 
115E:  GOTO   199
....................  
.................... case 2: //dopøedu 
....................    elevaceZAD=(i[2]-48)+(i[1]-48)*10; 
115F:  MOVLW  30
1160:  SUBWF  39,W
1161:  MOVWF  45
1162:  MOVLW  30
1163:  SUBWF  38,W
1164:  MOVWF  47
1165:  MOVWF  48
1166:  MOVLW  0A
1167:  MOVWF  49
1168:  BCF    0A.4
1169:  CALL   2B4
116A:  BSF    0A.4
116B:  MOVF   78,W
116C:  ADDWF  45,W
116D:  MOVWF  35
116E:  CLRF   36
....................    break; 
116F:  GOTO   199
.................... case 3: //dopøedu 
....................    elevaceZAD=(i[3]-48)+(i[2]-48)*10+((int16)i[1]-48)*100; 
1170:  MOVLW  30
1171:  SUBWF  3A,W
1172:  MOVWF  45
1173:  MOVLW  30
1174:  SUBWF  39,W
1175:  MOVWF  47
1176:  MOVWF  48
1177:  MOVLW  0A
1178:  MOVWF  49
1179:  BCF    0A.4
117A:  CALL   2B4
117B:  BSF    0A.4
117C:  MOVF   78,W
117D:  ADDWF  45,F
117E:  CLRF   47
117F:  MOVF   38,W
1180:  MOVWF  46
1181:  MOVLW  30
1182:  SUBWF  46,F
1183:  MOVLW  00
1184:  BTFSS  03.0
1185:  MOVLW  01
1186:  SUBWF  47,F
1187:  MOVF   47,W
1188:  MOVWF  49
1189:  MOVF   46,W
118A:  MOVWF  48
118B:  CLRF   4B
118C:  MOVLW  64
118D:  MOVWF  4A
118E:  BCF    0A.4
118F:  CALL   2D9
1190:  BSF    0A.4
1191:  MOVF   78,W
1192:  ADDWF  45,W
1193:  MOVWF  35
1194:  MOVF   79,W
1195:  MOVWF  36
1196:  BTFSC  03.0
1197:  INCF   36,F
....................    break;    
1198:  GOTO   199
....................  
.................... default: 
....................   
....................          } 
.................... printf("Zadaná elevace %Ld \r\n", elevaceZAD);          
1199:  MOVLW  67
119A:  BSF    03.6
119B:  MOVWF  0D
119C:  MOVLW  00
119D:  MOVWF  0F
119E:  MOVLW  0F
119F:  BCF    03.6
11A0:  MOVWF  4F
11A1:  BCF    0A.4
11A2:  CALL   2EE
11A3:  BSF    0A.4
11A4:  MOVLW  10
11A5:  MOVWF  04
11A6:  MOVF   36,W
11A7:  MOVWF  50
11A8:  MOVF   35,W
11A9:  MOVWF  4F
11AA:  BCF    0A.4
11AB:  CALL   30F
11AC:  BSF    0A.4
11AD:  MOVLW  20
11AE:  MOVWF  59
11AF:  BCF    0A.4
11B0:  CALL   222
11B1:  BSF    0A.4
11B2:  MOVLW  0D
11B3:  MOVWF  59
11B4:  BCF    0A.4
11B5:  CALL   222
11B6:  BSF    0A.4
11B7:  MOVLW  0A
11B8:  MOVWF  59
11B9:  BCF    0A.4
11BA:  CALL   222
11BB:  BSF    0A.4
....................           
.................... i=0; 
11BC:  CLRF   38
11BD:  CLRF   37
.................... vysledek=0; 
11BE:  CLRF   42
11BF:  CLRF   41
.................... b=0; 
11C0:  CLRF   43
.................... c=0; 
11C1:  CLRF   44
....................   do { 
....................        b++;   
11C2:  INCF   43,F
....................        i[b] = getchar(); 
11C3:  MOVLW  37
11C4:  ADDWF  43,W
11C5:  MOVWF  04
11C6:  BCF    03.7
11C7:  CLRF   48
11C8:  MOVF   04,W
11C9:  MOVWF  47
11CA:  BCF    48.0
11CB:  BTFSC  03.7
11CC:  BSF    48.0
11CD:  BCF    0A.4
11CE:  CALL   28E
11CF:  BSF    0A.4
11D0:  MOVF   47,W
11D1:  MOVWF  04
11D2:  BCF    03.7
11D3:  BTFSC  48.0
11D4:  BSF    03.7
11D5:  MOVF   78,W
11D6:  MOVWF  00
....................   
....................        //printf("Zadaný azimut %d \r\n", i[b]); 
....................        
....................    } while (i[b] != ' '); 
11D7:  MOVLW  37
11D8:  ADDWF  43,W
11D9:  MOVWF  04
11DA:  BCF    03.7
11DB:  MOVF   00,W
11DC:  SUBLW  20
11DD:  BTFSS  03.2
11DE:  GOTO   1C2
.................... b=b-1; 
11DF:  MOVLW  01
11E0:  SUBWF  43,F
....................  
.................... switch(b){ 
11E1:  MOVF   43,W
11E2:  XORLW  01
11E3:  BTFSC  03.2
11E4:  GOTO   1EC
11E5:  XORLW  03
11E6:  BTFSC  03.2
11E7:  GOTO   1F1
11E8:  XORLW  01
11E9:  BTFSC  03.2
11EA:  GOTO   202
11EB:  GOTO   22B
....................    case 1:  //reverzní chod 
....................    azimutZAD=i[1]-48; 
11EC:  MOVLW  30
11ED:  SUBWF  38,W
11EE:  MOVWF  33
11EF:  CLRF   34
....................    break; 
11F0:  GOTO   22B
....................  
.................... case 2: //dopøedu 
....................    azimutZAD=(i[2]-48)+(i[1]-48)*10; 
11F1:  MOVLW  30
11F2:  SUBWF  39,W
11F3:  MOVWF  45
11F4:  MOVLW  30
11F5:  SUBWF  38,W
11F6:  MOVWF  47
11F7:  MOVWF  48
11F8:  MOVLW  0A
11F9:  MOVWF  49
11FA:  BCF    0A.4
11FB:  CALL   2B4
11FC:  BSF    0A.4
11FD:  MOVF   78,W
11FE:  ADDWF  45,W
11FF:  MOVWF  33
1200:  CLRF   34
....................    break; 
1201:  GOTO   22B
.................... case 3: //dopøedu 
....................    azimutZAD=(i[3]-48)+(i[2]-48)*10+((int16)i[1]-48)*100; 
1202:  MOVLW  30
1203:  SUBWF  3A,W
1204:  MOVWF  45
1205:  MOVLW  30
1206:  SUBWF  39,W
1207:  MOVWF  47
1208:  MOVWF  48
1209:  MOVLW  0A
120A:  MOVWF  49
120B:  BCF    0A.4
120C:  CALL   2B4
120D:  BSF    0A.4
120E:  MOVF   78,W
120F:  ADDWF  45,F
1210:  CLRF   47
1211:  MOVF   38,W
1212:  MOVWF  46
1213:  MOVLW  30
1214:  SUBWF  46,F
1215:  MOVLW  00
1216:  BTFSS  03.0
1217:  MOVLW  01
1218:  SUBWF  47,F
1219:  MOVF   47,W
121A:  MOVWF  49
121B:  MOVF   46,W
121C:  MOVWF  48
121D:  CLRF   4B
121E:  MOVLW  64
121F:  MOVWF  4A
1220:  BCF    0A.4
1221:  CALL   2D9
1222:  BSF    0A.4
1223:  MOVF   78,W
1224:  ADDWF  45,W
1225:  MOVWF  33
1226:  MOVF   79,W
1227:  MOVWF  34
1228:  BTFSC  03.0
1229:  INCF   34,F
....................    break;    
122A:  GOTO   22B
....................  
.................... default: 
....................   
....................          } 
....................  
....................  
.................... printf("Zadaný azimut %Ld \r\n", azimutZAD); 
122B:  MOVLW  7D
122C:  BSF    03.6
122D:  MOVWF  0D
122E:  MOVLW  00
122F:  MOVWF  0F
1230:  MOVLW  0E
1231:  BCF    03.6
1232:  MOVWF  4F
1233:  BCF    0A.4
1234:  CALL   2EE
1235:  BSF    0A.4
1236:  MOVLW  10
1237:  MOVWF  04
1238:  MOVF   34,W
1239:  MOVWF  50
123A:  MOVF   33,W
123B:  MOVWF  4F
123C:  BCF    0A.4
123D:  CALL   30F
123E:  BSF    0A.4
123F:  MOVLW  20
1240:  MOVWF  59
1241:  BCF    0A.4
1242:  CALL   222
1243:  BSF    0A.4
1244:  MOVLW  0D
1245:  MOVWF  59
1246:  BCF    0A.4
1247:  CALL   222
1248:  BSF    0A.4
1249:  MOVLW  0A
124A:  MOVWF  59
124B:  BCF    0A.4
124C:  CALL   222
124D:  BSF    0A.4
....................   
....................     
....................   
....................      
....................         elevace_set (elevaceZAD); 
124E:  MOVF   36,W
124F:  MOVWF  46
1250:  MOVF   35,W
1251:  MOVWF  45
1252:  BCF    0A.4
1253:  GOTO   6D8
1254:  BSF    0A.4
....................         azimut_set(azimutZAD); 
1255:  MOVF   34,W
1256:  MOVWF  46
1257:  MOVF   33,W
1258:  MOVWF  45
1259:  GOTO   000
....................        
....................        
....................  
.................... delay_ms (2000); 
125A:  MOVLW  08
125B:  MOVWF  45
125C:  MOVLW  FA
125D:  MOVWF  4F
125E:  BCF    0A.4
125F:  CALL   15D
1260:  BSF    0A.4
1261:  DECFSZ 45,F
1262:  GOTO   25C
....................  
....................    
.................... } 
1263:  GOTO   12F
.................... } 
1264:  SLEEP

Configuration Fuses:
   Word  1: 2CF5   INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
   Word  2: 3FFF   NOWRT BORV40