⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 picweb.lst

📁 《嵌入式系统 Web 服务器:TCP/IP Lean》
💻 LST
📖 第 1 页 / 共 5 页
字号:
CCS PCM C Compiler, Version 2.693, 3951

               Filename: C:\TCPLEAN\PCM\PICWEB.LST

               ROM used: 5779 (71%)
                         Largest free fragment is 2048
               RAM used: 269 (73%) at main() level
                         308 (84%) worst case
               Stack:    7 worst case (5 in main + 2 for interrupts)

0000:  MOVLW  08
0001:  MOVWF  0A
0002:  GOTO   34F
0003:  NOP
0004:  MOVWF  7F
0005:  SWAPF  03,W
0006:  BCF    03,5
0007:  BCF    03,6
0008:  MOVWF  21
0009:  MOVF   0A,W
000A:  MOVWF  20
000B:  CLRF   0A
000C:  MOVF   04,W
000D:  MOVWF  22
000E:  MOVF   77,W
000F:  MOVWF  23
0010:  MOVF   78,W
0011:  MOVWF  24
0012:  MOVF   79,W
0013:  MOVWF  25
0014:  MOVF   7A,W
0015:  MOVWF  26
0016:  MOVF   7B,W
0017:  MOVWF  27
0018:  BCF    03,7
0019:  BCF    03,5
001A:  MOVLW  8C
001B:  MOVWF  04
001C:  BTFSS  00,5
001D:  GOTO   020
001E:  BTFSC  0C,5
001F:  GOTO   033
0020:  MOVF   22,W
0021:  MOVWF  04
0022:  MOVF   23,W
0023:  MOVWF  77
0024:  MOVF   24,W
0025:  MOVWF  78
0026:  MOVF   25,W
0027:  MOVWF  79
0028:  MOVF   26,W
0029:  MOVWF  7A
002A:  MOVF   27,W
002B:  MOVWF  7B
002C:  MOVF   20,W
002D:  MOVWF  0A
002E:  SWAPF  21,W
002F:  MOVWF  03
0030:  SWAPF  7F,F
0031:  SWAPF  7F,W
0032:  RETFIE
0033:  BCF    0A,4
0034:  BCF    0A,3
0035:  GOTO   0CA
....................  /* Miniature Web server for PIC 16c76 Copyright (c) Iosoft Ltd 2000 
.................... ** 
.................... ** This software is only licensed for distribution with the book 'TCP/IP Lean', 
.................... ** and may only be used for personal experimentation by the purchaser 
.................... ** of that book, on condition that this copyright notice is retained. 
.................... ** For commercial licensing, contact license@iosoft.co.uk 
.................... ** 
.................... ** This is experimental software; use it entirely at your own risk */ 
....................  
.................... /* Revisions: 
.................... ** v0.01 JPB 28/2/00 
.................... ** v0.02 - v0.27 deleted to save space 
.................... ** v0.28 JPB 9/5/00  Added run-time variable substitution 
.................... ** v0.29 JPB 11/5/00 Added temperature variable 
.................... ** v0.30 JPB 11/5/00 Added time-setting capability 
.................... ** v0.31 JPB 12/5/00 Added provision for analogue temperature sensor 
.................... **                   Added digital O/Ps 
.................... ** v0.32 JPB 16/5/00 Changed from 100ms to 50ms ticks 
.................... ** v0.33 JPB 18/5/00 Removed analogue temp sensor, added PORT A digital I/Ps  
.................... ** v0.34 JPB 4/6/00  Added PORT B invert capability 
.................... */ 
....................  
.................... #define TXDROP   0          // Set to 4 to drop 1-in-4 Tx frames for test 
.................... #define PORTBINV 0          // Set to 1 to invert port B O/Ps 
....................  
.................... #include <16c76.h>          // CPU definitions, must be followed by.. 
....................  //////// Standard Header file for the PIC16C76 device //////// 
.................... #device PIC16C76 
.................... #list 
.................... 
.................... #device *=16                             // ..enable 16-bit (!) data pointers 
.................... #FUSES HS,NOWDT,NOPROTECT,PUT,BROWNOUT   // PIC fuse settings 
.................... #ID CHECKSUM                             // ID bytes are checksum 
.................... #ZERO_RAM                                // Wipe RAM for safety 
....................  
.................... #use DELAY(CLOCK=7372800)   // CPU clock frequency 7.3728 MHz 
.................... #use RS232 (BAUD=38400, XMIT=PIN_C6, RCV=PIN_C7, RESTART_WDT, ERRORS) 
*
00BB:  CLRWDT
00BC:  BTFSS  0C,5
00BD:  GOTO   0BB
00BE:  MOVF   18,W
00BF:  MOVWF  28
00C0:  MOVF   1A,W
00C1:  MOVWF  78
00C2:  BTFSS  28,1
00C3:  GOTO   0C6
00C4:  BCF    18,4
00C5:  BSF    18,4
00C6:  NOP
00C7:  BCF    0A,3
00C8:  BCF    0A,4
00C9:  GOTO   0CD
.................... #bit TX_READY =      0x98.1 // Tx ready status bit 
....................  
.................... #define WORD unsigned long  // Data type definitions 
.................... #define BOOL short          // 'short' is very short (1 bit) in this compiler 
.................... typedef union               // Longword definition (not a native type) 
.................... { 
....................     BYTE b[4]; 
....................     WORD w[2]; 
....................     BYTE l; 
.................... } LWORD; 
....................  
.................... #define PCOL_ICMP   1       // IP protocol values 
.................... #define PCOL_TCP    6 
.................... #define IPHDR_LEN   20      // IP, ICMP and TCP header lengths 
.................... #define TCPHDR_LEN  20 
.................... #define ICMPHDR_LEN 4       // Only include type, code & checksum in ICMP hdr 
....................  
.................... BYTE ipcol;                 // IP protocol byte 
.................... LWORD local, remote;        // Local & remote IP addresses 
.................... WORD locport, remport;      // ..and TCP port numbers 
.................... LWORD rseq, rack;           // TCP sequence & acknowledge values 
.................... WORD concount;              // Connection count (for high word of my seq num) 
.................... BYTE rflags, tflags;        // Rx and Tx flags 
.................... signed long iplen;          // Incoming IP length word 
.................... WORD rpdlen;                // Length of user data in incoming Rx packet 
.................... WORD tpdlen;                // Length of user data in outgoing Tx packet 
.................... BYTE portval;               // Value of port B O/Ps 
.................... BYTE hashmask, barmask;     // Mask values for EGI '#' and '|' variables 
.................... BOOL inv_byte;              // Flag to 'invert' the HTML O/P for EGI vars 
....................  
.................... #include <ctype.h> 
....................  ////        (C) Copyright 1996,1997 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.                                //// 
.................... //////////////////////////////////////////////////////////////////////////// 
.................... #list 
.................... 
.................... #include "\picc\io\picslip.h"   // Include SLIP I/O functions (no linker!) 
....................  /* SLIP I/O functions for PIC Web server Copyright (c) Iosoft Ltd 2000 
.................... ** 
.................... ** This software is only licensed for distribution with the book 'TCP/IP Lean',  
.................... ** and may only be used for personal experimentation by the purchaser  
.................... ** of that book, on condition that this copyright notice is retained.  
.................... ** For commercial licensing, contact license@iosoft.co.uk 
.................... ** 
.................... ** This is experimental software; use it entirely at your own risk */ 
....................  
.................... /* Revisions: 
.................... ** v0.01 JPB 30/3/00 Functions extracted from PICWEB v0.14 
.................... */ 
....................  
.................... #define TXBUFFLEN  96       // Tx buffer 
.................... #define RXBUFFLEN  80       // Rx buffer: more than enough for a 32-byte Ping 
.................... #define RXHDR_LEN  40       // After header, data is checksummed on arrival 
....................  
.................... #define SLIP_END    0xc0    // SLIP escape codes 
.................... #define SLIP_ESC    0xdb 
.................... #define ESC_END     0xdc 
.................... #define ESC_ESC     0xdd 
....................  
.................... BYTE txbuff[TXBUFFLEN];     // Transmit buffer 
.................... int txin, txout;            // Buffer I/P and O/P counters 
.................... WORD txi2c;                 // Count of i2c bytes to be sent 
.................... BOOL txflag;                // Flag to start sending out Tx data 
....................  
.................... BYTE rxbuff[RXBUFFLEN];     // Receive buffer, I/O ptrs, and 'Rx full' flag 
.................... int rxin, rxout, rxcount; 
.................... BOOL rxflag; 
.................... BOOL modemflag;             // Flag to show modem command received 
....................  
.................... BOOL slipend;               // Flag to mark end of I/P SLIP message 
.................... BOOL checkflag;             // Checksum flag & byte values 
.................... BYTE checkhi, checklo; 
.................... BOOL rdcheckflag;           // Checksum for Rx data (excl. IP & TCP hdrs) 
.................... BYTE rdcheckhi, rdchecklo; 
.................... int dropcount; 
....................  
.................... /* Prototypes for this file */ 
.................... int get_data(BYTE *ptr, int maxlen); 
.................... BOOL get_byte(BYTE &b); 
.................... BOOL get_word(WORD &w); 
.................... BOOL get_lword(LWORD &lw); 
.................... BOOL get_hexbyte(BYTE &val); 
.................... void discard_data(void); 
.................... BYTE getch_slip(void); 
.................... BOOL match_byte(BYTE b); 
.................... BOOL match_word(WORD w); 
.................... BOOL match_str(char *s); 
.................... void skip_space(void); 
.................... BOOL skip_byte(); 
.................... BOOL skip_word(); 
.................... BOOL skip_lword(); 
.................... int check_str(char *s); 
.................... void check_byte(BYTE b); 
.................... void check_word(WORD w); 
.................... void check_lword(LWORD &lw); 
.................... void check_bytes(BYTE *dat, int len); 
.................... void put_byte(BYTE b); 
.................... void put_str(char *s); 
.................... void put_null(void); 
.................... void put_word(WORD w); 
.................... void put_nullw(void); 
.................... void put_lword(LWORD &lw); 
.................... void tx_start(void); 
.................... void tx_byte(BYTE b); 
.................... void tx_end(void); 
.................... void check_txbytes(int n); 
.................... BYTE read_txbuff(int &oset); 
.................... void write_txbuff(int &oset, BYTE &b); 
....................  
.................... /* Get incoming data in buffer; discard any buffer overflow */ 
.................... int get_data(BYTE *ptr, int maxlen) 
.................... { 
....................     BYTE b; 
....................     int n=0; 
....................  
....................     while (maxlen-- > 0 && get_byte(b)) 
....................     { 
....................         *ptr++ = b; 
....................         n++; 
....................     } 
....................     discard_data(); 
....................     return(n); 
.................... } 
....................  
.................... /* Discard incoming data */ 
.................... void discard_data(void) 
.................... { 
....................     while (!slipend) 
*
0B4A:  BTFSC  4B,4
0B4B:  GOTO   34E
....................         getch_slip(); 
0B4C:  CALL   06E
0B4D:  GOTO   34A
0B4E:  RETLW  00
.................... } 
....................  
.................... /* Get an incoming byte value, return 0 if end of message */ 
.................... BOOL get_byte(BYTE &b) 
.................... { 
....................     b = getch_slip(); 
*
0C92:  CALL   06E
0C93:  MOVF   78,W
0C94:  MOVWF  29
*
0E41:  CALL   06E
0E42:  MOVF   78,W
0E43:  BSF    03,5
0E44:  BSF    03,6
0E45:  MOVWF  15
*
0E4F:  CALL   06E
0E50:  MOVF   78,W
0E51:  MOVWF  40
*
1357:  BCF    0A,4
1358:  BSF    0A,3
1359:  CALL   06E
135A:  BSF    0A,4
135B:  BCF    0A,3
135C:  MOVF   78,W
135D:  BSF    03,5
135E:  BSF    03,6
135F:  MOVWF  27
*
142F:  BCF    0A,4
1430:  BSF    0A,3
1431:  CALL   06E
1432:  BSF    0A,4
1433:  BCF    0A,3
1434:  MOVF   78,W
1435:  BSF    03,5
1436:  BSF    03,6
1437:  MOVWF  27
*
1507:  BCF    0A,4
1508:  BSF    0A,3
1509:  CALL   06E
150A:  BSF    0A,4
150B:  BCF    0A,3
150C:  MOVF   78,W
150D:  BSF    03,5
150E:  BSF    03,6
150F:  MOVWF  27
*
1589:  BCF    0A,4
158A:  BSF    0A,3
158B:  CALL   06E
158C:  BSF    0A,4
158D:  BCF    0A,3
158E:  MOVF   78,W
158F:  BSF    03,5
1590:  BSF    03,6
1591:  MOVWF  1F
*
15BF:  BCF    0A,4
15C0:  BSF    0A,3
15C1:  CALL   06E
15C2:  BSF    0A,4
15C3:  BCF    0A,3
15C4:  MOVF   78,W
15C5:  BSF    03,5
15C6:  BSF    03,6
15C7:  MOVWF  20
....................     return(!slipend); 
*
0C95:  MOVLW  00
0C96:  BTFSS  4B,4
0C97:  MOVLW  01
0C98:  MOVWF  78
*
0E46:  MOVLW  00
0E47:  BCF    03,5
0E48:  BCF    03,6
0E49:  BTFSS  4B,4
0E4A:  MOVLW  01
0E4B:  MOVWF  78
*
0E52:  MOVLW  00
0E53:  BTFSS  4B,4
0E54:  MOVLW  01
0E55:  MOVWF  78
*
1360:  MOVLW  00
1361:  BCF    03,5
1362:  BCF    03,6
1363:  BTFSS  4B,4
1364:  MOVLW  01
1365:  MOVWF  78
*
1438:  MOVLW  00
1439:  BCF    03,5
143A:  BCF    03,6
143B:  BTFSS  4B,4
143C:  MOVLW  01
143D:  MOVWF  78
*
1510:  MOVLW  00
1511:  BCF    03,5
1512:  BCF    03,6
1513:  BTFSS  4B,4
1514:  MOVLW  01
1515:  MOVWF  78
*
1592:  MOVLW  00
1593:  BCF    03,5
1594:  BCF    03,6
1595:  BTFSS  4B,4
1596:  MOVLW  01
1597:  MOVWF  78
*
15C8:  MOVLW  00
15C9:  BCF    03,5
15CA:  BCF    03,6
15CB:  BTFSS  4B,4
15CC:  MOVLW  01
15CD:  MOVWF  78
.................... } 
....................  
.................... /* Get an incoming word value, return 0 if end of message */ 
.................... BOOL get_word(WORD &w) 
.................... { 
....................     BYTE hi, lo; 
....................  
....................     hi = getch_slip(); 
*
0C54:  CALL   06E
0C55:  MOVF   78,W
0C56:  BSF    03,5
0C57:  BSF    03,6
0C58:  MOVWF  18
*
0DBB:  CALL   06E
0DBC:  MOVF   78,W
0DBD:  BSF    03,5
0DBE:  BSF    03,6
0DBF:  MOVWF  18
*
0DEB:  CALL   06E
0DEC:  MOVF   78,W
0DED:  BSF    03,5
0DEE:  BSF    03,6
0DEF:  MOVWF  18
....................     lo = getch_slip(); 
*
0C59:  BCF    03,5
0C5A:  BCF    03,6
0C5B:  CALL   06E
0C5C:  MOVF   78,W
0C5D:  BSF    03,5
0C5E:  BSF    03,6
0C5F:  MOVWF  19
*
0DC0:  BCF    03,5
0DC1:  BCF    03,6
0DC2:  CALL   06E
0DC3:  MOVF   78,W
0DC4:  BSF    03,5
0DC5:  BSF    03,6
0DC6:  MOVWF  19
*
0DF0:  BCF    03,5
0DF1:  BCF    03,6
0DF2:  CALL   06E
0DF3:  MOVF   78,W
0DF4:  BSF    03,5
0DF5:  BSF    03,6
0DF6:  MOVWF  19
....................     w = ((WORD)hi<<8) | (WORD)lo; 
*
0C60:  CLRF   1B
0C61:  MOVF   18,W
0C62:  MOVWF  1A
0C63:  MOVF   1A,W
0C64:  MOVWF  1B
0C65:  CLRF   1A
0C66:  BCF    03,5
0C67:  BCF    03,6
0C68:  CLRF   7A
0C69:  BSF    03,5
0C6A:  BSF    03,6
0C6B:  MOVF   19,W
0C6C:  BCF    03,5
0C6D:  BCF    03,6
0C6E:  MOVWF  77
0C6F:  MOVF   7A,W
0C70:  BSF    03,5
0C71:  BSF    03,6
0C72:  IORWF  1B,W
0C73:  BCF    03,5
0C74:  BCF    03,6
0C75:  MOVWF  43
0C76:  MOVF   77,W
0C77:  BSF    03,5
0C78:  BSF    03,6
0C79:  IORWF  1A,W
0C7A:  BCF    03,5
0C7B:  BCF    03,6
0C7C:  MOVWF  42
*
0DC7:  CLRF   1B
0DC8:  MOVF   18,W
0DC9:  MOVWF  1A
0DCA:  MOVF   1A,W
0DCB:  MOVWF  1B
0DCC:  CLRF   1A
0DCD:  BCF    03,5
0DCE:  BCF    03,6
0DCF:  CLRF   7A
0DD0:  BSF    03,5
0DD1:  BSF    03,6
0DD2:  MOVF   19,W
0DD3:  BCF    03,5
0DD4:  BCF    03,6
0DD5:  MOVWF  77
0DD6:  MOVF   7A,W
0DD7:  BSF    03,5
0DD8:  BSF    03,6
0DD9:  IORWF  1B,W
0DDA:  BCF    03,5
0DDB:  BCF    03,6
0DDC:  MOVWF  35
0DDD:  MOVF   77,W
0DDE:  BSF    03,5
0DDF:  BSF    03,6
0DE0:  IORWF  1A,W
0DE1:  BCF    03,5
0DE2:  BCF    03,6
0DE3:  MOVWF  34
*
0DF7:  CLRF   1B
0DF8:  MOVF   18,W
0DF9:  MOVWF  1A
0DFA:  MOVF   1A,W
0DFB:  MOVWF  1B
0DFC:  CLRF   1A
0DFD:  BCF    03,5
0DFE:  BCF    03,6
0DFF:  CLRF   7A
0E00:  BSF    03,5
0E01:  BSF    03,6
0E02:  MOVF   19,W
0E03:  BCF    03,5
0E04:  BCF    03,6
0E05:  MOVWF  77
0E06:  MOVF   7A,W
0E07:  BSF    03,5
0E08:  BSF    03,6
0E09:  IORWF  1B,W
0E0A:  BCF    03,5
0E0B:  BCF    03,6
0E0C:  MOVWF  33
0E0D:  MOVF   77,W
0E0E:  BSF    03,5
0E0F:  BSF    03,6
0E10:  IORWF  1A,W

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -