Not knocking JSON. Just thinking it wouldn’t be the right thing for this situation.
Not knocking JSON. Just thinking it wouldn’t be the right thing for this situation.
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.
A custom binary protocol would certainly be smaller but would take a lot more time to develop and debug.
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?
I'm guessing most things written for a 6502
Until it does, like with limited hardware.