MCS51: Flag F0 in use by SDCC?

  • Matthias Arndt

    Matthias Arndt - 2009-06-27


    is the flag F0 (part of the 8051 PSW) in use by SDCC or is it free for usage by the coder as intended by the architecture?


    • Maarten Brock

      Maarten Brock - 2009-06-27

      The F0 flag can be used by SDCC and furthermore PSW will be saved/restored often thus overwriting whatever you put in F0 in between.

      But F0 is intended by the architecture to be used by any user and the compiler is just another user in this regard.


    • Matthias Arndt

      Matthias Arndt - 2009-06-27

      Is this really overwritten or is it just preserved? E.q. just pushed on the stack and restored or is it manipulated and used for calculations? If just preserved and restored as pushed, it is fine for my purpose.


      • Frieder Ferlemann

        you can search through SDCC's sources (SDCC being free as in freedom),
        f.e. with
        > grep F0 sdcc/src/mcs51/*.c
        and you'll find some places where F0 is used in the file gen.c...

        How about using a bit variable do instead of F0?

    • Matthias Arndt

      Matthias Arndt - 2009-06-27

      Normally no problem with the latter - in my case it is a bit more problematic.

      I want to hack CMON51 to bypass the singlestep code if the user wants do so that a user program can use Timer 1.

      Basically I want to add to the CMON51 Timer 1 ISR something like this:

      jnb F0,do_singlestep
      ...CMON51 single step ISR here

      I could poke around with the DPTR somewhere into the user code instead but IMHo that would be quite slow, esp if the user wanst his Timer 1 ISR to be rather fast, even if run from CMON51.

      I'm still thinking of this issue...



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks