How is "load, R3, 7" a mnemonic?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How is "load, R3, 7" a mnemonic?

ouverson
This post was updated on .
6.1 Background

"Clearly, specifying these operations in binary code is a pain. A natural solution is using an agreed-upon equivalent symbolic syntax, say, “load R3,7”. The load operation code is sometimes called a mnemonic, which in Latin means a pattern of letters designed to help with remembering something."

Examples of popular mnemonics that come to mind:

Kingdom, Phylum, Class, Order, Family, Genus, Species.
King Phillip Cried Out “For Goodness Sakes!”

There's also using knuckles of both hands to help remember which months have 31 days and which ones have 28 or 30 days.



What is the pattern of letters "load, R3, 7" to help us remember? The binary code? I doubt that.

I can see that "load, R3, 7" is symbolic, but I can't see how it is mnemonic.
Reply | Threaded
Open this post in threaded view
|

Re: How is "load, R3, 7" a mnemonic?

rleininger
The mnemonic referred to in the quoted passage is "load", not the full assembly language statement "load R3, 7". The mnemonic "load" is a short string of letters used here to recall a larger idea, just as the quote suggests.  The idea usually being expressed is "get a value from one place and copy it into another place."  In most cases it also implies that the value in the source location remains unchanged and any value currently in the destination location is overwritten with the copied value.  That's a lot of information contained in only four letters.

As you suggest, this does seem like a kind of code, but in the context of assembly language programming, the word "mnemonic" is a term of art and always refers to a short string which represents a specific machine instruction operation code (opcode).  As the authors point out, this is much more compact and easier to understand than using a full description of the operation or its binary (or hexadecimal) representation.
Reply | Threaded
Open this post in threaded view
|

Re: How is "load, R3, 7" a mnemonic?

WBahn
Administrator
This post was updated on .
In reply to this post by ouverson
rleininger said it pretty well. To add a bit of context, keep in mind the capabilities at the time this term was coined.

We didn't have lots of memory, either in RAM or in whatever was being used to store the source code for the program (paper tape, punch cards, etc.). So everything had to be very compact. Initially programs were written directly in machine language op codes (i.e., binary, octal, or hex), which humans are not particularly good at remembering. So replacing this with letter sequences was a major step forward. These letter sequences needed to be very short, too, so many were two or three characters, such as LD for load, ST for store. Longer ones were much closer to what you have in mind, for instance INCFSZ is for "Increment F, Skip if Zero" and IORLW is "Inclusive OR Literal and Store in W". The key point is that the mnemonic instruction is not to help humans remember the binary opcodes, but rather what those opcodes mean.

So calling these mnemonics was an extremely reasonable thing to do at the time and, as noted previously, this became a "term of art" that is retained and continues to be used regardless of the degree to which it might or might not be strictly applicable. But it really is largely still applicable. When we have "D+M" that is NOT a mathematical expression in which we have an operator with two operands. It is a sequence of three characters that helps us remember what the corresponding opcode does.
Reply | Threaded
Open this post in threaded view
|

Re: How is "load, R3, 7" a mnemonic?

ouverson
Thank you rleininger and WBahn for providing clarification and the historical context!