📄 icmp.lis
字号:
.module icmp.c
.area lit(rom, con, rel)
0000 _icmp_str1::
0000 2020202049434D504864723A20747970 .byte 32,32,32,32,'I,'C,'M,'P,'H,'d,'r,58,32,'t,'y,'p
0010 653A00 .byte 'e,58,0
0013 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\icmp.c
0013 .dbsym e icmp_str1 _icmp_str1 A[19:19]kc
0013 _icmp_str2::
0013 20436F64653A00 .byte 32,'C,'o,'d,'e,58,0
001A .dbsym e icmp_str2 _icmp_str2 A[7:7]kc
001A _icmp_str3::
001A 2043686B73756D3A00 .byte 32,'C,'h,'k,'s,'u,'m,58,0
0023 .dbsym e icmp_str3 _icmp_str3 A[9:9]kc
0023 _icmp_str4::
0023 2049443A00 .byte 32,'I,'D,58,0
0028 .dbsym e icmp_str4 _icmp_str4 A[5:5]kc
0028 _icmp_str5::
0028 205365714E756D3A00 .byte 32,'S,'e,'q,'N,'u,'m,58,0
0031 .dbsym e icmp_str5 _icmp_str5 A[9:9]kc
0031 _icmp_str6::
0031 204461746142797465733A00 .byte 32,'D,'a,'t,'a,'B,'y,'t,'e,'s,58,0
003D .dbsym e icmp_str6 _icmp_str6 A[12:12]kc
003D _icmp_str7::
003D 202D20424C4F434B45440A00 .byte 32,45,32,'B,'L,'O,'C,'K,'E,'D,10,0
0049 .dbsym e icmp_str7 _icmp_str7 A[12:12]kc
0049 _icmp_str8::
0049 2A2A2A2049434D502063686B73756D20 .byte 42,42,42,32,'I,'C,'M,'P,32,'c,'h,'k,'s,'u,'m,32
0059 6572720A00 .byte 'e,'r,'r,10,0
005E .dbsym e icmp_str8 _icmp_str8 A[21:21]kc
.area data(ram, con, rel)
0000 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\icmp.c
0000 _ICMP_Header::
0000 .blkb 2
.area idata
0000 0000 .word 0
.area data(ram, con, rel)
0002 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\icmp.c
0002 .dbstruct 0 8 TICMPHeader
0002 .dbfield 0 Type c
0002 .dbfield 1 Code c
0002 .dbfield 2 Checksum s
0002 .dbfield 4 ID s
0002 .dbfield 6 SeqNum s
0002 .dbend
0002 .dbsym e ICMP_Header _ICMP_Header pS[TICMPHeader]
.area text(rom, con, rel)
0000 .dbfile C:\AVR\AT-Modem__PPP__UDP__IC\icmp.c
0000 .dbfunc e ICMP_DisplayHeader _ICMP_DisplayHeader fV
0000 ; TotalBytes -> R20,R21
0000 ; HeaderIdx -> R22,R23
.even
0000 _ICMP_DisplayHeader::
0000 0E940000 xcall push_gset2
0004 A901 movw R20,R18
0006 B801 movw R22,R16
0008 2297 sbiw R28,2
000A .dbline -1
000A .dbline 76
000A ;
000A ; /*
000A ; * Copyright (C) 2003-2004 by Clive Moss All rights reserved.
000A ; *
000A ; * Help & Contributions from D.J.Armstrong
000A ;
000A ; * Redistribution and use in source and binary forms, with or without
000A ; * modification, are permitted provided that the following conditions
000A ; * are met:
000A ; *
000A ; * 1. Redistributions of source code must retain the above copyright
000A ; * notice, this list of conditions and the following disclaimer.
000A ; * 2. Redistributions in binary form must reproduce the above copyright
000A ; * notice, this list of conditions and the following disclaimer in the
000A ; * documentation and/or other materials provided with the distribution.
000A ; * 3. Neither the name of the copyright holders nor the names of
000A ; * contributors may be used to endorse or promote products derived
000A ; * from this software without specific prior written permission.
000A ; *
000A ; * THIS SOFTWARE IS PROVIDED BY CLIVE MOSS 'AS IS' AND ANY EXPRESS OR
000A ; * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
000A ; * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
000A ; * ARE DISCLAIMED.
000A ; * IN NO EVENT SHALL CLIVE MOSS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
000A ; * INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
000A ; * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
000A ; * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
000A ; * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
000A ; * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
000A ; * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
000A ; * SUCH DAMAGE.
000A ; */
000A ;
000A ; //#ifdef CPU_eZ8
000A ; // #pragma stkck // enable stack checking
000A ; //#endif
000A ;
000A ; #include <string.h>
000A ; #include <stdlib.h>
000A ; #include <stdio.h>
000A ;
000A ; #include "common.h"
000A ; #include "ppp.h"
000A ; #include "ip.h"
000A ; #include "icmp.h"
000A ;
000A ; #ifdef Debug
000A ; flash char icmp_str1[] = " ICMPHdr: type:";
000A ; flash char icmp_str2[] = " Code:";
000A ; flash char icmp_str3[] = " Chksum:";
000A ; flash char icmp_str4[] = " ID:";
000A ; flash char icmp_str5[] = " SeqNum:";
000A ; flash char icmp_str6[] = " DataBytes:";
000A ; flash char icmp_str7[] = " - BLOCKED\n";
000A ; flash char icmp_str8[] = "*** ICMP chksum err\n";
000A ; #endif
000A ;
000A ; #ifdef CPU_eZ8
000A ; volatile near u16 ICMP_Timer;
000A ; volatile near u16 ICMP_SeqNum;
000A ; volatile near T_IP_Addr ICMP_IP;
000A ; #endif
000A ; #ifdef CPU_ATmega128
000A ; volatile u16 ICMP_Timer;
000A ; volatile u16 ICMP_SeqNum;
000A ; volatile T_IP_Addr ICMP_IP;
000A ; #endif
000A ;
000A ; T_ICMP_Header *ICMP_Header = NULL;
000A ;
000A ; // **************************************************************************
000A ;
000A ; #ifdef Debug
000A ;
000A ; void ICMP_DisplayHeader(int HeaderIdx, int TotalBytes)
000A ; {
000A .dbline 90
000A ;
000A ; /*
000A ; 0 1 2 3
000A ; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
000A ; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
000A ; | Type | Code | Checksum |
000A ; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
000A ; | ID | Sequence Number |
000A ; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
000A ; */
000A ;
000A ; // show the header
000A ;
000A ; if (!SendDebugRStr(icmp_str1)) return;
000A 00E0 ldi R16,<_icmp_str1
000C 10E0 ldi R17,>_icmp_str1
000E 0E940000 xcall _SendDebugRStr
0012 0023 tst R16
0014 09F4 brne L2
0016 .dbline 90
0016 A5C0 xjmp L1
0018 L2:
0018 .dbline 91
0018 ; sprintf((char*)ScratchPad, "%u", ICMP_Header->Type);
0018 E0910000 lds R30,_ICMP_Header
001C F0910100 lds R31,_ICMP_Header+1
0020 2080 ldd R2,z+0
0022 3324 clr R3
0024 3982 std y+1,R3
0026 2882 std y+0,R2
0028 20E0 ldi R18,<L4
002A 30E0 ldi R19,>L4
002C 00E0 ldi R16,<_ScratchPad
002E 10E0 ldi R17,>_ScratchPad
0030 0E940000 xcall _sprintf
0034 .dbline 92
0034 ; if (!SendDebugStr((char*)ScratchPad)) return;
0034 00E0 ldi R16,<_ScratchPad
0036 10E0 ldi R17,>_ScratchPad
0038 0E940000 xcall _SendDebugStr
003C 0023 tst R16
003E 09F4 brne L5
0040 .dbline 92
0040 90C0 xjmp L1
0042 L5:
0042 .dbline 94
0042 ;
0042 ; if (!SendDebugRStr(icmp_str2)) return;
0042 00E0 ldi R16,<_icmp_str2
0044 10E0 ldi R17,>_icmp_str2
0046 0E940000 xcall _SendDebugRStr
004A 0023 tst R16
004C 09F4 brne L7
004E .dbline 94
004E 89C0 xjmp L1
0050 L7:
0050 .dbline 95
0050 ; sprintf((char*)ScratchPad, "%u", ICMP_Header->Code);
0050 E0910000 lds R30,_ICMP_Header
0054 F0910100 lds R31,_ICMP_Header+1
0058 2180 ldd R2,z+1
005A 3324 clr R3
005C 3982 std y+1,R3
005E 2882 std y+0,R2
0060 20E0 ldi R18,<L4
0062 30E0 ldi R19,>L4
0064 00E0 ldi R16,<_ScratchPad
0066 10E0 ldi R17,>_ScratchPad
0068 0E940000 xcall _sprintf
006C .dbline 96
006C ; if (!SendDebugStr((char*)ScratchPad)) return;
006C 00E0 ldi R16,<_ScratchPad
006E 10E0 ldi R17,>_ScratchPad
0070 0E940000 xcall _SendDebugStr
0074 0023 tst R16
0076 09F4 brne L9
0078 .dbline 96
0078 74C0 xjmp L1
007A L9:
007A .dbline 98
007A ;
007A ; if (!SendDebugRStr(icmp_str3)) return;
007A 00E0 ldi R16,<_icmp_str3
007C 10E0 ldi R17,>_icmp_str3
007E 0E940000 xcall _SendDebugRStr
0082 0023 tst R16
0084 09F4 brne L11
0086 .dbline 98
0086 6DC0 xjmp L1
0088 L11:
0088 .dbline 99
0088 ; sprintf((char*)ScratchPad, "%04X", ntohs(ICMP_Header->Checksum));
0088 E0910000 lds R30,_ICMP_Header
008C F0910100 lds R31,_ICMP_Header+1
0090 0281 ldd R16,z+2
0092 1381 ldd R17,z+3
0094 0E940000 xcall _ntohs
0098 1983 std y+1,R17
009A 0883 std y+0,R16
009C 20E0 ldi R18,<L13
009E 30E0 ldi R19,>L13
00A0 00E0 ldi R16,<_ScratchPad
00A2 10E0 ldi R17,>_ScratchPad
00A4 0E940000 xcall _sprintf
00A8 .dbline 100
00A8 ; if (!SendDebugStr((char*)ScratchPad)) return;
00A8 00E0 ldi R16,<_ScratchPad
00AA 10E0 ldi R17,>_ScratchPad
00AC 0E940000 xcall _SendDebugStr
00B0 0023 tst R16
00B2 09F4 brne L14
00B4 .dbline 100
00B4 56C0 xjmp L1
00B6 L14:
00B6 .dbline 102
00B6 ;
00B6 ; if (!SendDebugRStr(icmp_str4)) return;
00B6 00E0 ldi R16,<_icmp_str4
00B8 10E0 ldi R17,>_icmp_str4
00BA 0E940000 xcall _SendDebugRStr
00BE 0023 tst R16
00C0 09F4 brne L16
00C2 .dbline 102
00C2 4FC0 xjmp L1
00C4 L16:
00C4 .dbline 103
00C4 ; sprintf((char*)ScratchPad, "%u", ntohs(ICMP_Header->ID));
00C4 E0910000 lds R30,_ICMP_Header
00C8 F0910100 lds R31,_ICMP_Header+1
00CC 0481 ldd R16,z+4
00CE 1581 ldd R17,z+5
00D0 0E940000 xcall _ntohs
00D4 1983 std y+1,R17
00D6 0883 std y+0,R16
00D8 20E0 ldi R18,<L4
00DA 30E0 ldi R19,>L4
00DC 00E0 ldi R16,<_ScratchPad
00DE 10E0 ldi R17,>_ScratchPad
00E0 0E940000 xcall _sprintf
00E4 .dbline 104
00E4 ; if (!SendDebugStr((char*)ScratchPad)) return;
00E4 00E0 ldi R16,<_ScratchPad
00E6 10E0 ldi R17,>_ScratchPad
00E8 0E940000 xcall _SendDebugStr
00EC 0023 tst R16
00EE 09F4 brne L18
00F0 .dbline 104
00F0 38C0 xjmp L1
00F2 L18:
00F2 .dbline 106
00F2 ;
00F2 ; if (!SendDebugRStr(icmp_str5)) return;
00F2 00E0 ldi R16,<_icmp_str5
00F4 10E0 ldi R17,>_icmp_str5
00F6 0E940000 xcall _SendDebugRStr
00FA 0023 tst R16
00FC 09F4 brne L20
00FE .dbline 106
00FE 31C0 xjmp L1
0100 L20:
0100 .dbline 107
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -