0

I understand that assembly language instructions will eventually be translated to binary, eg. 5F 3A E3 F1, and processor has a set of instructions tables.

But, when reading a stream of binary how does processor/computer knows when instructions begin or when actual text message begins/ends?

Text messages can be a simple 'Hello World' or a mix with characters that happens to be 5F(-) 3A(:) E3(ã) F1(ñ) or 0xa(line-feed)

If anything can be mapped to ASCII tables then terminating/delimiter character/s that marks the end of text message can be mis-interpreted as being part of the text message instead of becoming a real instruction since there is no limit of how long text can be nor limitation of what characters we can put as text message.

AHa
  • 63
  • 7
  • 1
    The processor doesn't know if something is code or data. It's up to the programmer/compiler/linker to organize the executable in such a way that only actual code will get executed. – Michael Feb 07 '20 at 19:03
  • 2
    The next instruction begins right after the end of the previous one. (Or at a branch target). Variable instruction-length machine code like x86 is typically not self-synchronizing; tools like disassemblers need to know a valid starting point. Don't put your data where it will be executed as code. – Peter Cordes Feb 07 '20 at 19:04
  • how does a train steer? it follows the tracks that have been laid out in front of it. no different on a processor there is a known starting point and the programmer must insure there are a valid path of instructions from that point forward, not necessarily linear, you can jump, just like train tracks can have a fork and take one of two paths. If you examine the binary in execution order from the known/agreed entry point then there is no confusion whatsoever (if it is a properly constructed program). – old_timer Feb 07 '20 at 19:40

0 Answers0