1 REM *** Setup UTHERNET II - W5100 2 REM *** Assumes slot 5 ($C0D0) 3 SLOT=49360: REM *** $C0D0 4 MR=SLOT+4: REM *** MODE REGISTER C0D4 5 HA=SLOT+5:LA=SLOT+6: REM *** HIGH/LOW ADDR $C0D5,$C0D6 7 DP=SLOT+7: REM *** DATA PORT $C0D7 10 REM *** Init W5100 12 POKE MR,128 : REM RESET W5100 14 POKE MR,3 : REM AUTOINCREMENT 20 REM *** Setup MAC Address 21 REM *** 41:50:50:4c:45:32 22 POKE HA,0:POKE LA,9 23 POKE DP,65 23 POKE DP,80 23 POKE DP,80 23 POKE DP,76 23 POKE DP,69 23 POKE DP,50 30 REM *** Setup IP Address 31 REM *** 192.168.8.15 32 POKE LA,15 33 POKE DP,192 34 POKE DP,168 35 POKE DP,8 36 POKE DP,15 40 PRINT "UTHERNET II READY: 192.168.8.15" 100 REM *** Setup Socket 105 POKE HA,0:POKE LA,26: REM RX MEMSIZE 110 POKE DP,3: REM 8kB RX buffer 115 POKE DP,3: REM 8kB TX buffer 200 REM *** Setup TCP MODE on SOCKET 0 205 POKE HA,4: POKE LA,0: REM *** 0x400 mode 210 POKE DP,65 : REM *** 0x41 MAC FILTER (non-promisc) TCP 300 REM ** Setup Source PORT 305 POKE HA,4: POKE LA,3: REM *** 0x404 port 310 POKE DP, 80: REM *** http port 80 400 REM *** OPEN socket 405 POKE HA,4: POKE LA,1: REM *** 0x401 command register 410 POKE DP, 1: REM *** OPEN 500 REM *** Check if opened 'if (Sn_SR != SOCK_INIT) Sn_CR = CLOSE; goto START; 'If (Sn_SR == SOCK_ESTABLISHED) goto ESTABLISHED stage; ' CALL LISTEN