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

Newbie dumb question

Why, when I use the Simulator on this code, does A return as 0 when it should be 3?

MAIN:
        NOP
        MOV     DPTR, #CommandTable
        MOVX    A, @DPTR                ; Get the offset
        MOV     DPTR, #Subroutines
        JMP     @A+DPTR

CommandTable:
        DB Low(GetStatus - Subroutines)

Subroutines:
SetStatus:
        NOP
        NOP
        RET
GetStatus:
        NOP
        NOP
        RET

END

Thanks for your help.

Steve

Parents
  • The MOVX is accessing XDATA space, not CODE.

    E.g. the SILabs chips can be (via a SFR) be set to MOVX access code space, for flash writing purposes.

    Also, I have, when it was advatageous to the application, on occasion 'rewired' the '51 to be a VonNeuman machine.

    I doubt very much that this is what the OP is strugglinhg with, but the statement "MOVX is accessing XDATA space, not CODE" is not correct in SOME cases.

    Erik

Reply
  • The MOVX is accessing XDATA space, not CODE.

    E.g. the SILabs chips can be (via a SFR) be set to MOVX access code space, for flash writing purposes.

    Also, I have, when it was advatageous to the application, on occasion 'rewired' the '51 to be a VonNeuman machine.

    I doubt very much that this is what the OP is strugglinhg with, but the statement "MOVX is accessing XDATA space, not CODE" is not correct in SOME cases.

    Erik

Children
No data