-- (c) William Welch 2005 -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; -- you must not claim that you wrote the original software. -- If you use this software in a product, an acknowledgment in -- the product documentation would be appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must -- not be misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source distribution. -- -- This license is commonly known as the zlib/libpng License. -- -- william welch 5 march 2005. ram data structures and support routines -- revised 18 march 2005, use Javi's "pointer" approach and routines. -- storage for the pointers themselves const PKT = Pointers_Seed CONST UDP_PSEUDO = PKT + 2 CONST TCP_PSEUDO = UDP_PSEUDO + 2 const IP_OFF = TCP_PSEUDO + 2 const UDP_OFF = IP_OFF + 2 const UDP_APP_OFF = UDP_OFF + 2 const TCP_OFF = UDP_APP_OFF + 2 const ICMP_OFF = TCP_OFF + 2 CONST MYMAC = ICMP_OFF + 2 const TBUF = MYMAC + 2 const MYSSID = TBUF + 2 const MYIP = MYSSID + 2 const TELNET_CONN = MYIP + 2 const HTTP_CONN = TELNET_CONN + 2 const SUM32 = HTTP_CONN + 2 const CHKTMP = SUM32 + 2 const SEG_SEQ = CHKTMP + 2 CONST SEG_ACK = SEG_SEQ + 2 CONST TCP_CLK = SEG_ACK + 2 CONST RCV_NXT = TCP_CLK + 2 CONST SND_NXT = RCV_NXT + 2 CONST P_K16 = SND_NXT + 2 CONST P_N16 = P_K16 + 2 CONST ZERO16 = P_N16 + 2 CONST L16 = ZERO16 + 2 CONST IP_LEN = L16 + 2 CONST UDP_LEN = IP_LEN + 2 CONST TCP_APP_OFF = UDP_LEN + 2 CONST FILE_CONN = TCP_APP_OFF + 2 CONST NE2K_CLK = FILE_CONN + 2 const RAM_GPR = 0x01 const RBASE = 0x100 const TBUFSZ = 50 const TCP_CONN_SZ = 36 const FILE_CONN_SZ = 2 const byte udp_hdrsize = 8 const byte ip_hdrsize = 20 SetPointer ( MYMAC , RBASE >> 8 , RBASE & 0xff ) SetPointerRel ( TBUF , MYMAC , 6 ) SetPointerRel ( MYSSID , TBUF , TBUFSZ ) SetPointerRel ( MYIP , MYSSID , 32 ) SetPointerRel ( TELNET_CONN , MYIP , 4 ) SetPointerRel ( HTTP_CONN , TELNET_CONN , TCP_CONN_SZ ) SetPointerRel ( FILE_CONN , HTTP_CONN , TCP_CONN_SZ ) SetPointerRel ( SUM32 , FILE_CONN , FILE_CONN_SZ ) SetPointerRel ( UDP_PSEUDO , SUM32 , 4 ) -- note: tcp_pseudo shares the same space with udp_pseudo SetPointerRel ( TCP_PSEUDO , UDP_PSEUDO , 0 ) SetPointerRel ( CHKTMP , TCP_PSEUDO , 12 ) SetPointerRel ( TCP_CLK , CHKTMP , 4 ) SetPointerRel ( P_K16, TCP_CLK , 4 ) SetPointerRel ( P_N16, P_K16 , 2 ) SetPointerRel ( ZERO16, P_N16 , 2 ) SetPointerRel ( L16, ZERO16, 2 ) SetPointerRel ( NE2K_CLK, L16 , 2 ) -- It is recommended that PKT be the last item defined. -- So it can grow towards the top/end of RAM. SetPointerRel ( PKT, NE2K_CLK , 2 ) -- these pointers are pointing to areas within the packet. SetPointerRel ( IP_OFF , PKT , 14 ) SetPointerRel ( IP_LEN, IP_OFF , 2 ) SetPointerRel ( TCP_OFF, IP_OFF , ip_hdrsize ) SetPointerRel ( ICMP_OFF, IP_OFF , ip_hdrsize ) SetPointerRel ( UDP_OFF, IP_OFF , ip_hdrsize ) SetPointerRel ( UDP_LEN, UDP_OFF , 4 ) SetPointerRel ( UDP_APP_OFF, UDP_OFF , udp_hdrsize ) SetPointerRel ( SEG_SEQ, TCP_OFF , 4 ) SetPointerRel ( SEG_ACK, TCP_OFF , 8 ) I16_LDL ( ZERO16 , 0 , 0 )