4 ms·
As surprising as it sounds, this might actually have a practical use --- with the 6502 being such a tiny core it ends up in a lot of obscure MCUs, possibly with
by userbinator 6y ago
As surprising as it sounds, this might actually have a practical use --- with the 6502 being such a tiny core it ends up in a lot of obscure MCUs, possibly with IoT-ish/toys/etc. high-volume low-cost applications, and the seeming unwillingness of a certain subset of developers to use more efficient binary protocols, I wouldn't be surprised if someone does end up needing to get a 6502 to parse JSON.
The 8051 and Z80 fill similar roles today --- when even the cheapest ARM core is too expensive.
- deleted 6y ago[deleted]
- colejohnson66 6y agoI just can’t imagine anyone who knows how to write assembly being one of the “JSON everything” people. But who knows. Not knocking JSON. Just thinking it wouldn’t be the right thing for this situation.
- mpoteat 6y agoEnter a JSON wrapper format for specifying assembly applications, compete with a NodeJS transpiler toolchain a la Babel. Seriously though, it's been a while since I've had to work with assembly or IDA but JSON is great as an interoperable data format. Sure, it's not maximally efficient, but what needs to be?
- lambda_obrien 6y ago> it's not maximally efficient, what needs to be? I'm guessing most things written for a 6502
- QuesnayJr 6y agoEmacs had to add JSON parsing to its C core to get reasonable performance when using JSON for interprocess communication.
- nineteen999 6y agoWhat, you mean Emacs Lisp wasn't fast enough?
- userbinator 6y agoI agree, but unfortunately you sometimes don't get a choice of what the other end has created for you to consume.
- seibelj 6y agoIf it’s good enough and it’s what you need. Proper engineering doesn’t need to be maximally efficient, just adequate for the task at hand.
- colejohnson66 6y agoI get what you’re saying, but why would a (relatively) wasteful format such as JSON be used on a design using a 6502? Why not a binary one?
- goatlover 6y ago> Proper engineering doesn’t need to be maximally efficient, Until it does, like with limited hardware.
- KingOfCoders 6y agoI like JSON. I write Z80.
- magicalhippo 6y agoI have a few STM32 projects where I need bidir communication between the microcontroller and the PC. The microcontroller has on the order of 10-20kB of RAM total and around 100kB of Flash. After trying several other solutions I ended up with JSON over USB serial. I tried several of the binary JSON-like variants, but they were all a PITA to port or ended up eating a lot of space, either in RAM or Flash or both. For this project I wasn't too concerned about message size or performance as such, as long as it could be read or generated in small portions. I ended up adapting two JSON libraries, a one for parsing and for generating. The parser was SAX-like, so worked just fine for incremental parsing. Worked quite well, in total considerably smaller both in RAM and Flash than the alternatives.
- bradstewart 6y agoAn STM32 is several orders of magnitude more powerful than an 8051 (or a 6052) though.
- magicalhippo 6y agoSure but I wasn't after fast parsing, I was after a somewhat flexible data exchange format that didn't take a lot of space (both data and code), and ideally was easy to debug. A custom binary protocol would certainly be smaller but would take a lot more time to develop and debug.
- winrid 6y agoI imagine it would be easier to have a proxy that exposes a binary protocol, but that's me...
- catblast01 6y ago> The 8051 and Z80 fill similar roles today --- when even the cheapest ARM core is too expensive. This is a bit of a reach. There is no world in which these and JSON appropriately intersect. If you’re parsing json then you’re probably dealing with enough need for sanitization that you have already fucked up if you’re at the point of an 8 bit MCU — how did the json get there in the first place? The 6502 used to be a General purpose CPU, so for some retro hacking stuff that may be different.
- wiz21c 6y agoDo you have nulbers to back that ? As it happens, I'm coding on the 6502 for fun (demo maker :-)). And of course, I want to build my own super coll tools to help my development. However, I always come to the same conclusion : developping tools makes sense only if other people will use it (ie the effort I put in that must be amortized). Now, if you say the 6502 is still a thing, then I may have some incentive to complete these tools...
- userbinator 6y agoHere's one example: http://forum.6502.org/viewtopic.php?f=1&t=3346 http://forum.6502.org/viewtopic.php?f=1&t=3346