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

variable ORG & GLOBAL?

Hi folks

I am trying to inline some asm.

The reason I am inling is this is the way to set up interrupt on a different compiler but I am using Keil to test (cos its better!)

The inlined snippet currently looks like:

        #asm
                GLOBAL _ext1isr
                PSECT vectors,ovrld
                ORG 0x34
                MOV A,#0
                LJMP @A+DPTR
                PSECT text
        #endasm

I'll admit Im not entirely sure whats going on with this code, its from the other compilers manual, though I have changed the LJUMP which previously read LJUMP _ext1isr (ext1isr being the name of the interrupt ISR).

I'm trying to make the snippet fully dynamic so I can make a macro or callable C function of it. this means I need to be able to vary the value that the ORG instr uses (here its 0x34, this is the intr vector) and also the value that GLOBAL uses (as I said this is the ISR function name so I assume _ext1isr is a pointer to it).

Many thanks

Parents
  • I mean I write and debug snippets of the code in Keil, then copy + paste to the MultiSim code editor and compile, which uses C51-LITE.

    I know there are significant differences between the two but for niggling out small little bits like this it tells me what are legal and illegal instructions and syntax (for the most part).

    For example working out how void pointers to functions work which I havent used before. And getting the syntax of an asm instruction correct like Im trying to do here - LJMP @A+DPTR is correct whereas LJMP @DPTR was not, and threw similar errors, in either of the IDE's builds of it.

    I can then check that what I think is happening is what is *actually* happening in the memory views... I dont need it to actually work in Keil, just move the data I want to the locations I want - In Hi-Tech this actually makes something happen, in Keil its just moving data about. Or vice versa.

Reply
  • I mean I write and debug snippets of the code in Keil, then copy + paste to the MultiSim code editor and compile, which uses C51-LITE.

    I know there are significant differences between the two but for niggling out small little bits like this it tells me what are legal and illegal instructions and syntax (for the most part).

    For example working out how void pointers to functions work which I havent used before. And getting the syntax of an asm instruction correct like Im trying to do here - LJMP @A+DPTR is correct whereas LJMP @DPTR was not, and threw similar errors, in either of the IDE's builds of it.

    I can then check that what I think is happening is what is *actually* happening in the memory views... I dont need it to actually work in Keil, just move the data I want to the locations I want - In Hi-Tech this actually makes something happen, in Keil its just moving data about. Or vice versa.

Children
  • has been installed here so that students can run a project

    I do believe that Keil has very favorable "educational institution" offers, do ask them.

    It is hardly fair to make half a course "how to use mangled processes"

    Erik

  • Ha Ha, "how to use mangled processes" LOL

    Yeah well their taught on Dev-C++ and Keil
    Then for their project subject they need to be able to perform rapid development and debug before spending cash on real parts etc, so this apparently looked like a good option at the time....

    However getting C programs to run in it isnt so easy, assembly runs fine Im told. I guess the C runs fine if I was to do it "right", I just need to understand better what "right" is in this case so we can get the students up and running.

    If I can make this dynamic and get a macro for it built in a header file then the students can just include it and ints will operate just as the compilers manual specifies they should...

    The manual specifies that including the header intrpt.h will allow a call to a macro ROM_VECTOR(tt_vector, ttr_ISR), and it procedes to give the equivalent asm code pretty much as above.....But intrpt.h is apparently not included in the version we have... *sigh*

    Thanks for your help anyhoo