remy / next-http Goto Github PK
View Code? Open in Web Editor NEWSend and recieve http requests into banks - for the Spectrum Next
Send and recieve http requests into banks - for the Spectrum Next
Line 94 in c5bcc66
The above line causes a 0 byte to be written to $c000 on whatever bank is in SLOT 6.
bc should be 1 byte less = $3fff
:)
Line 1 in 0acf320
The timeout gives up too quickly if a request takes some seconds to process eg:
https://zxnext.uk/scr?s=!hollywood&p=1
I have done a bodge fix to wait for raster
InitESPTimeout:
MODULE InitESPTimeout
push hl
ld hl, ESPTimeout mod 65536 ; Timeout is a 32-bit value, so save the two LSBs first,
ld (CheckESPTimeout.Value), hl
ld hl, ESPTimeout / 65536 ; then the two MSBs.
ld (CheckESPTimeout.Value2), hl
pop hl
ret
ENDMODULE
; Modifies: nothing
CheckESPTimeout:
MODULE CheckESPTimeout
push hl
push af
Value EQU $+1
ld hl, SMC
dec hl
ld (Value), hl
call WaitRaster
ld a, h
or l
jr z, Rollover
Success: pop af
pop hl
ret
Failure: ld hl, (Wifi.timeout)
HandleError:
call Error ; Ignore current stack depth, and just jump
Rollover:
Value2 EQU $+1
ld hl, SMC ; Check the two upper values
ld a, h
or l
jr z, Failure ; If we hit here, 32 bit value is $00000000
dec hl
call WaitRaster
ld (Value2), hl
ld hl, ESPTimeout mod 65536
ld (Value), hl
jr Success
WaitRaster:
push bc
push af
waitloop:
ld bc, $243b
ld a, $1f ; only really care about lsb
out (c) , a
inc b
in a, (c)
cp 192
jr nz, waitloop
pop af
pop bc
ret
ENDMODULE
Firstly, thanks for your work on this. It's very useful!
I think I've found a bug which seems to occur only with very small downloads. I was trying to download the following file, which was on my local web server:
https://github.com/em00k/next-zxdb-downloader/blob/main/zxdb-dl/zxdb-loader.bas?raw=true
I have a PHP server running locally, with the files from here in the root directory:
https://github.com/em00k/next-zxdb-downloader/tree/main/zxdb-dl
Downloading zxdb-dl.bin to the Next worked fine (81Kb), but downloading zxdb-loader.bas (188b) failed.
The command I used to serve the files was:
php -S 0.0.0.0:8000 -t ./
The command I used to get the file on the Next was:
.http -h 192.168.0.6 -p 8000 -u /zxdb-loader.bas -f zxdb-loader.bas
I see the server return a 200 for the request on my laptop, but http on the Next the fails with "B HTTP read timeout".
I've put the code in a basic program, and retried the download using ON ERROR, but the download never succeeds. The Next is running at 28Mhz, by the way.
I've not experimented to find out what the minimum file size is that will work - that's next on my list.
Let me know if there's anything I can do to help, or if you need any more information.
Lines 3 to 4 in 0acf320
SLOTS 4,5 are used for the buffer and its possible in certain circumstances for http to error out (missing a parameter such as -f) and http will leave SLOTS 4, 5 set to 0
An easy solution to this is start with the default banks defined instead of 0,0
prevPageA DEFB 4
prevPageB DEFB 5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.