This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

@ Addressing?

Hi,

I'm trying to adapt the C548/549 bootloader code as a "second-stage" bootloader for a 542, and there's a ton of stuff like this:

    ld    *ar1+, 8, a         ; acc A    <-- high byte
    and #0xFF00, a
    mvdk    *ar1+, ar3         ; ar3    <-- junkbyte.low byte
    andm    #0ffh, @ar3     ; ar3    <-- low byte
    or    @ar3, a             ; acc A    <-- high byte.low byte
    stl    a, @p8word

Can someone tell me what this @ thing is?  I've tried looking through the docs and online, but it's impossible to search for.  'ar3' is apparently just the standard definition, while 'p8word' is defined like so:

p8word     .set     64h

i.e. it is pointing to a word in the scratchpad ram.  I get that it assembles to e.g. "stl a, @64h", and is just a way to shorthand saving to scratchpad, but I want to know what exactly this @ operator is, what it's used for, etc.  Why is it used with aux registers sometimes??

Thanks,

MPD

  • The @ operator is just the canonical way to write DP-relative direct address operands.  You can also write such operands without the @ in most cases, except where it makes the instruction ambiguous.

    In the case of @ar3, bear in mind two things:

    1. Most of the registers are memory-mapped registers; you can access such registers by accessing its dedicated memory location
    2. Not all operand combinations are supported by the instruction set, in particular register-to-register forms.  To cover this lack, register-to-memory forms are used with the memory representing a memory-mapped register.

    For instance, there is no instruction form which allows AR3 to be OR'd into A, but there is an instruction which allows a memory location to be OR'd into A, so we can just use that.