News:

11 March 2016 - Forum Rules

Main Menu

OR Assembly Command (Mega Drive)

Started by RadioTails, January 25, 2018, 02:52:07 AM

Previous topic - Next topic

RadioTails

I feel this should be easier to understand, but something is confusing me.  The command in question:

00:589A  82 7B  OR.W    $0A(PC,D2),D1

So it is defiantly oring the value, so or 07 with 05 for example:


07 = 0111
05 = 0101

OR = 0111


So in this code, it OR 0A (1010), but I'm not sure what the brackets are doing?  I think it is taking the Program Counter, and moving the result to D2, then moving the OR result to D1.

The results in the trace are as followed:

D2 = 00000016 > D2 00000016
D1 = 8000832C > D1 8000C32C


It's basically setting the palette from 0 (832C) to 2 (C32C).

I want to set it to use palette 1 (A32C), which I would need to change the OR value 0A. It's just knowing what value to set.
Avatar by LazyNinjartist

mziab

This addressing mode is called "Program counter indirect with index" in the reference and from what I can tell it operates on the memory address calculated using this formula: $0A (immediate) + PC + D2. Anyway, $0A is NOT the value used for OR.