wbeserver: update the *non-masked* version of the offset pointer

urgh, couldn't figure out why sending 8kb of additional garbage each time
This commit is contained in:
Vince Weaver 2016-12-14 13:47:46 -05:00
parent 16b87c53b1
commit 6e1ae7580b

View File

@ -86,13 +86,13 @@
720 REM *** Check if successful
725 POKE HA,4: POKE LA,3: REM *** 0x403 status register
730 RE=PEEK(DP)
740 IF RE=23 THEN GOTO 800
740 IF RE=23 THEN GOTO 800: REM ESTABLISHED
745 IF RE<>20 THEN PRINT "WAITING: UNEXPECTED STATUS=";RE
750 GOTO 700: REM *** Repeat until connected
'
' Connected, repeat waiting for incoming data
' Established, repeat waiting for incoming data
'
800 PRINT "CONNECTED"
800 PRINT "ESTABLISHED"
802 POKE HA,4: POKE LA,38: REM *** 0x426 Received Size
805 SH=PEEK(DP):SL=PEEK(DP)
810 SI=(SH*256)+SL
@ -109,9 +109,9 @@
905 OH=PEEK(DP):OL=PEEK(DP)
910 RF=(OH*256)+OL
920 REM *** MASK WITH 0x1ff
925 R%=RF/8192:RF=RF-(8192*R%)
930 RA=RF+24576:REM $6000
940 PRINT "READ OFFSET=";RF;" READ ADDRESS=";RA;" READ SIZE=";SI
925 R%=RF/8192:RM=RF-(8192*R%)
930 RA=RM+24576:REM $6000
940 PRINT "READ OFFSET=";RM;" READ ADDRESS=";RA;" READ SIZE=";SI
'
' Print received packet
'
@ -120,7 +120,7 @@
1005 POKE HA,R%: POKE LA,RA-(R%*256)
1010 FOR I=1 TO SI
1020 C=PEEK(DP)
1030 IF C<>13 THEN PRINT CHR$(C);
1030 IF C<>10 THEN PRINT CHR$(C);
1040 NEXT I
'
' TODO: handle wraparound of 8kb buffer
@ -133,6 +133,10 @@
1120 RA=RF+SI
1130 R%=RA/256
1140 POKE DP,R%: POKE DP,RA-(R%*256)
1150 REM *** RECEIVE
1160 POKE HA,4: POKE LA,1: REM *** 0x401 command register
1170 POKE DP, 64: REM *** RECV
'1180 GOTO 802
'
'"HTTP/1.1 200 OK\r\n"
'"Date: %s\r\n"
@ -157,14 +161,22 @@
' if (get_free_size < send_size) goto FREESIZE;
'
'
1700 SI=LEN(A$)
1800 POKE HA,4: POKE LA,32: REM *** 0x420 FREESIZE
1810 OH=PEEK(DP):OL=PEEK(DP)
1815 FR=(OH*256)+OL
1820 PRINT "FREE: ";FR
1830 IF SI>FR GOTO 1800: REM REPEAT UNTIL FREE
'
' Read tx offset
'
1900 POKE HA,4: POKE LA,36: REM *** 0x424 TX write ptr
1905 OH=PEEK(DP):OL=PEEK(DP)
1910 TF=(OH*256)+OL
1920 REM *** MASK WITH 0x1ff
1925 T%=TF/8192:TF=TF-(8192*T%)
1930 TA=TF+16384:REM $4000
1935 SI=LEN(A$)
1940 PRINT "OH/OL=";OH;"/";OL;" TX OFFSET=";TF;" TX ADDRESS=";TA;" TX SIZE=";SI
1925 T%=TF/8192:TM=TF-(8192*T%)
1930 TA=TM+16384:REM $4000
1940 PRINT "OH/OL=";OH;"/";OL;" TX OFFSET=";TM;" TX ADDRESS=";TA;" TX SIZE=";SI
'
' Write data to TX buffer
'
@ -181,6 +193,7 @@
2075 TA=TF+SI
2080 T%=TA/256
2085 POKE DP,T%: POKE DP,TA-(T%*256)
2090 PRINT "UPDATE TX TO ";T%;"/";TA-(T%*256)
'
' SEND packet
'
@ -194,14 +207,33 @@
4010 POKE HA,4: POKE LA,3: REM *** 0x403 status register
4020 RE=PEEK(DP)
4030 PRINT "STATUS AFTER SEND ";RE
4035 IF RE=28 THEN GOTO 6000: REM CLOSE_WAIT
4040 IF RE=0 THEN GOTO 400: REM CLOSED
4060 REM *** RECEIVE
4075 POKE HA,4: POKE LA,1: REM *** 0x401 command register
4080 POKE DP, 64: REM *** RECV
4090 GOTO 802
4090 GOTO 800
'
' Close the socket
'
5000 REM *** CLOSE
5000 REM *** CLOSE AND EXIT
5010 POKE HA,4: POKE LA,1: REM *** 0x401 command register
5020 POKE DP, 16: REM *** CLOSE
5030 END
6000 REM *** CLOSE AND RELISTEN
6010 POKE HA,4: POKE LA,1: REM *** 0x401 command register
6020 POKE DP, 16: REM *** CLOSE
' Check status?
6030 GOTO 400
'
' STATUSES
' p28 of W5100 manual
' 0x0 0 SOCK_CLOSED
' 0x13 SOCK_INIT
' 0x14 SOCK_LISTEN
' 0x17 23 SOCK_ESTABLISHED
' 0x1C 28 SOCK_CLOSE_WAIT
' 0x22 SOCK_UDP
' 0x32 SOCK_IPRAW
' 0x42 SOCK_MACRAW
' 0x5f SOCK_PPOE