Polydynamical
Polydynamical

Reputation: 244

What are some useful applications using logical commands in M68000 programming?

In M68000 assembly language, there are instructions such as "NOT", "OR", "AND", "BCHG", etc., that changes data in some form. My question is, what are some applications of these instructions ? Would it not be easier to use an immediate MOVE command?

Here are some definitions of these instructions:

NOT - reverses the bits of a destination operand. e.g. if D0 contains 1101 0111, after running the command NOT.B D0, D0 will contain 0010 1000.

AND - If the source and the destination is true, then the result is true

Also, do any logical commands correspond to mathematical operations or instructions? For example, I know that an LSR or LSL can do multiplication or division in binary.

Thank you in advance for any help

Upvotes: 0

Views: 43

Answers (1)

Erik Eidt
Erik Eidt

Reputation: 26666

Like negation, NOT, AND, OR, XOR all have their uses.

For one, most of our programming languages, like C, offer these operators, and so these machine code instructions directly implement operators of our programming languages — that's one huge class their uses.

Virtually all processors have these primitive boolean logic operations, and they are useful in perhaps hundreds of thousands of ways.

What C, assembly code, and other languages do with these operators is beyond enumeration.

Hashing, error detection, crypto, bit fields, bit vectors, graphics, machine learning, game engines, software floating point, i/o pin manipulation, etc...

Bit vectors alone are used in probably tens of thousands of algorithms: the various forms of analysis in compiler tech (data flow, others), for one, bloom filters, the list goes on and on.

Upvotes: 3

Related Questions