mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-12 15:30:55 +00:00
webserver: attempt to handle circular buffer overflow properly
This commit is contained in:
parent
447cc49f6c
commit
ad9db0d0e7
@ -113,6 +113,11 @@
|
||||
930 RA=RM+24576:REM $6000
|
||||
940 PRINT "READ OFFSET=";RM;" READ ADDRESS=";RA;" READ SIZE=";SI
|
||||
'
|
||||
' Check for buffer wraparound
|
||||
'
|
||||
942 BW=0
|
||||
945 IF (SI+TA>=32768) THEN BW=1:BO=32768-TA:PRINT "RX BUFFER WRAPAROUND IN ";BO
|
||||
'
|
||||
' Print received packet
|
||||
'
|
||||
1000 REM *** PRINT PACKET
|
||||
@ -124,7 +129,12 @@
|
||||
1025 IF FL=1 THEN FL$=FL$+C$
|
||||
1027 IF C=10 THEN FL=0
|
||||
1030 IF C<>10 THEN PRINT C$;
|
||||
1032 IF BW=0 THEN GOTO 1040
|
||||
1033 BO=BO-1: IF BO=0 THEN POKE HA,96:POKE LA,0:BW=0
|
||||
1040 NEXT I
|
||||
'
|
||||
' Deal with first line
|
||||
'
|
||||
1050 PRINT "FIRST LINE=";FL$
|
||||
1060 IF LEFT$(FL$,3)<>"GET" GOTO 7000
|
||||
1065 N$=""
|
||||
@ -139,7 +149,7 @@
|
||||
' TODO: handle wraparound of 8kb buffer
|
||||
'
|
||||
'
|
||||
' TODO: Update read pointer
|
||||
' Update read pointer
|
||||
'
|
||||
1100 REM *** Update read pointer
|
||||
1110 POKE HA,4: POKE LA,40: REM *** 0x428 Received ptr
|
||||
@ -191,15 +201,24 @@
|
||||
1930 TA=TM+16384:REM $4000
|
||||
1940 PRINT "OH/OL=";OH;"/";OL;" TX OFFSET=";TM;" TX ADDRESS=";TA;" TX SIZE=";SI
|
||||
'
|
||||
' Check for buffer wraparound
|
||||
'
|
||||
1942 BW=0
|
||||
1945 IF (SI+TA>=24576) THEN BW=1:BO=24576-TA:PRINT "TX BUFFER WRAPAROUND IN ";BO
|
||||
'
|
||||
' Write data to TX buffer
|
||||
'
|
||||
2000 T%=TA/256
|
||||
2005 POKE HA,T%: POKE LA,TA-(T%*256)
|
||||
2010 FOR I=1 TO LEN(A$)
|
||||
2015 POKE DP,ASC(MID$(A$,I,1))
|
||||
2017 IF BW=0 THEN GOTO 2020
|
||||
2018 BO=BO-1: IF BO=0 THEN POKE HA,96:POKE LA,0:BW=0
|
||||
2020 NEXT I
|
||||
2025 FOR I=1 TO FS
|
||||
2030 POKE DP,PEEK(16383+I)
|
||||
2032 IF BW=0 THEN GOTO 2035
|
||||
2033 BO=BO-1: IF BO=0 THEN POKE HA,96:POKE LA,0:BW=0
|
||||
2035 NEXT I
|
||||
'
|
||||
' Update TX write ptr
|
||||
|
Loading…
x
Reference in New Issue
Block a user