I have 2 questions regarding this, but feel free to elaborate more if you want to, I'm really interested in this topic:
Do they really just read byte by byte until they get a valid instruction? How do they know if it's a valid instruction and which it is? I don't imagine they just had every single instruction stored in a table as that'd be very inefficient.
Found this source online that I think does this in around 700 lines (https://github.com/btbd/disassembler/blob/master/disassembler.c). If something like this is possible, why are there others that have a lot more code and logic?