assembly68hc12

Assembly Language: Result in accumulator


Can someone help me understand this question that I have on a handout. What is the result in Accumulator A of the following code

LDAA #$3B ______________

and

ORAA #$23 ______________

I understand that the first one says Load in Accumulator A the hex 3B in immediate mode. And the second is to OR in Accumulator A the hex 23 in immediate mode. The second one is more confusing because I don't know what to OR it with.

Any help would be appreciated!


Solution

  • Well, assuming they're sequential instructions, you know what the value of A is before the OR:

    LDAA #$3B --> 3b
    ORAA #$23 --> 3b or'ed with 23
    

    If they're not sequential, the answer is simply "whatever A was before but with bits five, one and zero set to 1 (counting bits starting at zero from the least significant end)".

    I think it's probably the former, simply because that voluminous essay I had to write above for the alternative possibility, won't easily fit into the answer area provided :-)