This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

clarity of dual dptr code

to make an assembly routine clearer to read, I want to indicate which of the 2 dptrs are used in each instance. One is fetch, another is store.

So, to achieve that, I insert the following:

 fptr equ   dptr
sptr equ   dptr

And these lines error out.

and below it could be

 movx a,@fptr
mov r7,a
inc fptr
inc auxr1
movx a,@sptr
orl a,r7
movx @sptr,a
inc sptr
inc auxr1

Obviously I can do two macros FETCH and STORE, That, however would not support the identical name when mov dptr,# is there, and as seen in the above 3 macros (or 4 or 5) would be needed.

Is there a way to do this other than the above?

Erik

PS the actual code is far more complicated than the above example.

Parents
  • "inc dptr" is a unique instruction with its own opcode. EQU lets you set values for an address, which winds up turning into an "inc <addr>" instruction. I expect the assembler is unhappy because the equates don't resolve to an actual address.

    You can equate symbols to A and R0-R7, but not DPTR for some reason. No doubt DPTR's 16-bit width plays into the rationale.

    The AX51 asssembler has a "LIT" directive that sounds like what you might want: literal text substitution of short strings rather than blocks of code, more like the C #define macro.

    fptr LIT 'dptr'
    sptr LIT 'dptr'

Reply
  • "inc dptr" is a unique instruction with its own opcode. EQU lets you set values for an address, which winds up turning into an "inc <addr>" instruction. I expect the assembler is unhappy because the equates don't resolve to an actual address.

    You can equate symbols to A and R0-R7, but not DPTR for some reason. No doubt DPTR's 16-bit width plays into the rationale.

    The AX51 asssembler has a "LIT" directive that sounds like what you might want: literal text substitution of short strings rather than blocks of code, more like the C #define macro.

    fptr LIT 'dptr'
    sptr LIT 'dptr'

Children