Hey!
So my changes were actually made as part of a separate demo, and live in another git repo (That only lives on my pc for the moment) so it's not quite as simple as making a branch. NESNet is linked in, so I'd need to make a separate branch for that and setup would be a pain. That said... I don't mind sharing.
I grabbed the current source in the repo including a heavily doctored nesnet, and dumped it into the attached zip file. It's extremely rough, and doesn't line up with what I wrote above. There's a method you can give to nesnet to run every frame. (That's a very weird pattern, and the reason I don't want to release it just yet) All source that you care about is in hello_world.c as well as lib/nesnet_config.asm (NOT lib/nesnet/nesnet_config.asm)
It expects a server to be running at
http://192.168.1.201:3000 with the nodejs code in the server directory. The url is defined at the top of hello_world.c - change it to the local ip of your pc, or run the nodejs app on a server. (Another thing I would want to polish!) All the server does is set a variable for the sprite's x position, then move it 8 pixels every time a request is made. If it's working, you'll see a character slowly move across your screen. Each position change is a completed http request!
Server setup should be as simple as installing node (> 4.x), doing an npm install, then doing an npm start.
I did also include a compiled version of the code as-is in hello_world.nes, just in case that's useful. The photon firmware doesn't need to be updated for this.
Hopefully this is enough to get you started if you want to play with it!
-----
About using the library from assembly, that's definitely something I haven't spent any time on yet. The pushax and popax stuff is to get the parameters being passed into the function. You could probably create a macro to get these to read from the 6502 stack (ie using the `pha` and `pla` instructions) - or just replacing that stuff with setting URL and URL+1 to the low and high bytes of the memory address of your url.
For a little more explanation on that, check out Shiru's documentation, here:
https://shiru.untergrund.net/articles/p ... s_in_c.htm (Scroll down to " Writing functions in assembly code" to see what this is supposed to do.)
Last note - I'm hoping to find some time this weekend to play with this a little. Maybe I can get a new version out with some of these tweaks! No promises, but I'll see what I can do.
-----
Sneaky update #2:
I've been working on the newer version of the library that does asynchronous stuff better and so far I've been successful. I've ported http get requests to a more sane asynchronous format.
You call http_get as before (now a void) but it returns immediately. You call nesnet_do_cycle 1x/frame to trigger the library to do it's thing and you then poll http_request_complete() until it returns true. At that point you can get the status code with http_response_code(). (And your response data will be in the provided variable)
There's also a new nesnet_pad_poll method which you
must use for all player input while web requests are running. Without it you risk corrupting the data the NES gets back. Taking this over seems to have helped get successful responses much more frequently.
Finally, there's a new demo in demos/character-movement that showcases the new asynchronous request types by having a character moved by a nodejs-based server. (The same demo I shared above, ported)
The existing photon firmware will still work - I don't actually anticipate having to change that much.
The documentation is still out of date, and post/put/delete requests don't work. You can check it out here:
https://gh.nes.science/nesnet/tree/async - I'm hoping to round out some of the missing stuff and get this thing officially released in the next few days. Stay tuned! (I promise I'll actually make a new post when that happens, too
)
5/26: ... and then life happened. I've been making incremental improvements but this weekend is completely shot for progress. Docs are mostly up to date, but I still need to fix the connection test. There is now a web-based demo too that lets you move a character around the screen on your pc, and see it on the NES. I want to apply real sprites to it soon. Sorry guys.