admtek comet an983bmacro alignhere7and3ordropifnopalign;then;forth arraypop2/2/; us n5503/*fornext; r n-a db000000+2/2/; rom a-n a4+r@; 3rom nnn4rom0romdup16for2/nextswap; reset1 0r!1000us; frag0, 2000000, 0,here4+,; txalignarrayfragfragfragfrag ntx1+; atx2+;f8 fr!f@+!; first an0f! 20000000or send an 1000000ornfr!afr! 80000000txfr!4f+!; last an 42000000orsend1us-1 8r!;
movesdn move n bytes from source to destination. register 1 is used, 6 and 7 are saved array-a returns word-aligned address in dictionary usn delay n microseconds. edit cpu clock rate rn-a word address of register. edit base address fromnorth pci device configuration roma-n fetch 2 bytes of ethernet id 3romnnn 3 byte-pairs of id. 54, 32 and 10 reset controller tx-a transmit buffer. 1536 bytes. fragments must be assembled for transmission rx-b receive buffer. 8k+16 bytes n-a tx status/length. writing starts transmission sendan fragment into transmit buffer firstan fragment. wait till buffer empty lastan fragment. start transmission init ialize controller. set tx/rx address/on and perfect match
empty redefined to disable interrupts w 16-bit prefix w@b-n fetch 16-bits from byte address w!nb store 16-bits *byten-n swap bytes 0 and 1 n@b-n fetch 16-bit network-ordered number 2!nb store 16-bit number n!nb store 16-bit number in network order n,n compile 16-bit number in network order string-b returns byte address packet-b ethernet packet header dest-b destination field in packet src-b source field lengthn store length into packet 3!nnnb store 3-word mac ethernetn send header with type/length @ethernet-b return payload address of received packet
set ip addresses with edit. normal order, net bytes first .n compile byte. resembles url punctuation message-b 28-byte string me comment marking my mac/ip address to comment marking correspondent sender target dir-b fields in eithermessage or received message ipb-n fetch ip address arn send query 1, or reply 4 arp broadcast query -arpb-b return if not arp. otherwise process and skip out. me?b return if broadcast not for me. save sender only in packet query?b if a request, reply
set ip addresses with edit. normal order, net bytes first header-a 40-byte ipv6 header lengthn store 2-byte length in header dest-a 4-byte destination ip address src-a source ip ipn send ip header embedded in ethernet packet +ipb-b skip out if not ip. otherwise return payload address
b@b-n fetch byte header-a 8-byte udp header lengthn store length in header udpn send ip header for n-byte packet +udpb-b skip out if not udp. otherwise return payload address
blocks to/from server payload n-bnheader8+n!header10; +put nn1026udpoverpayloadsend+block2*2*1024last; it bdup2+swapn@300+block2*2*1024move; -got b-bdup-4+n@28+ordropifitpop;then; receive+ethernet-arp+ip+udp-dhcp-got +get bn@300+put; ... interrupt-protect words that transmit get ncli2udppayloadlaststi; put ncli0+putsti; archive161foriput1000us-next;
client can get or put blocks to server payloadn-bn 2 bytes were appended to udp header for block number +putnn send block number. append block as last fragment. packet length distinguishes two messages itb move 1024 bytes from packet to offset block -gotb-b if a 2-byte message, return. otherwise move block to archive - 300+ - and skip out receive check and decode received packet.+test returns if true,-test returns if false. otherwise theypop - skip-out - return fromreceive. resulting stack need not be empty, since/forth will restore pre-interrupt stack.pop must be in a word called byreceive, it cant be nested +getb send requested block from archive getn send block number to request. interrupt disabled lest reply interfer putn send block archive send blocks 0-161 - 9 cylindersicmpdhcp