Giter Site home page Giter Site logo

remy / next-http Goto Github PK

View Code? Open in Web Editor NEW
44.0 9.0 6.0 293 KB

Send and recieve http requests into banks - for the Spectrum Next

Assembly 88.88% Go 2.11% JavaScript 3.30% PHP 1.40% Python 3.78% Makefile 0.53%
cspect zxnextos spectrum-next zxnext nextbasic dot-command esp

next-http's Issues

SLOTS 4,5 may be set to 0 and not restored.

prevPageA DEFB 0
prevPageB DEFB 0

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


[php server] Using local HTTP server causes errror "B HTTP read timeout"

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.

Timeout is too small and can bail before data is returned

InitESPTimeout:

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.