Shop OBEX P1 Docs P2 Docs Learn Events
clock frequency location: $14 or $44? — Parallax Forums

clock frequency location: $14 or $44?

I thought we had agreed to use the TAQOZ convention that clock frequency is at $14 and mode is at $18. Some relevant threads are:

https://forums.parallax.com/discussion/comment/1474710/#Comment_1474710

https://forums.parallax.com/discussion/170405/clockfreq-clockmode-and-others-agreement-for-what-and-where

I think most tools (TAQOZ, flexprop, p2gcc, riscvp2, Catalina) adopted this. However, it appears the Spin2 interpreter is not using those locations. @cgracey , in the first link above you indicated you were going to change Spin2 to use $14 and $1C. Are you still planning to do that?

Comments

  • cgraceycgracey Posts: 14,133

    As things worked out, I didn't do that, afterall. I put the clkmode at $40 and the clkfreq at $44, if I remember. It's in the Spin2 doc. I clear $0.. $3F to zeros, so that applicatons can use them for whatever purpose they choose.

  • cgraceycgracey Posts: 14,133

    To answer your question, I don't want to put those variables at those locations because it messes up that RAM space that I freed for applications.

  • @cgracey : Where it is isn't a big deal, but it would be nice if it were consistent. What dismays me (greatly!) is that we discussed this, reached a consensus, and then a bunch of us implemented our tools based on that... and now they're not compatible with Spin2 :(.

    There are a number of people / tools affected by this:

    @"Peter Jakacki" (TAQOZ)
    @RossH (Catalina)
    @rogloh (p2gcc, micropython)
    @Tubular , @ozpropdev (micropython)
    @Cluso99 (P2 OS and other tools)
    @"Dave Hein" (p2gcc... are you still maintaining that?)
    @evanh (debug tools)
    and of course me (loadp2, riscvp2, flexprop)

    Do we want to change all of those tools to be compatible with Spin2? (It's too late for TAQOZ in ROM, of course :().

  • My "application" chooses to use those locations for configuration constants as that makes sense not to have other data before it, as well as after it, so I just put it as low as it can go with just enough room to squeeze a jump in there etc.

    Which of the "applications" are using this "freed" space for variables instead and what are the advantages?

  • cgraceycgracey Posts: 14,133
    edited 2021-02-24 17:35

    @ersmith said:
    @cgracey : Where it is isn't a big deal, but it would be nice if it were consistent. What dismays me (greatly!) is that we discussed this, reached a consensus, and then a bunch of us implemented our tools based on that... and now they're not compatible with Spin2 :(.

    There are a number of people / tools affected by this:

    @"Peter Jakacki" (TAQOZ)
    @RossH (Catalina)
    @rogloh (p2gcc, micropython)
    @Tubular , @ozpropdev (micropython)
    @Cluso99 (P2 OS and other tools)
    @"Dave Hein" (p2gcc... are you still maintaining that?)
    @evanh (debug tools)
    and of course me (loadp2, riscvp2, flexprop)

    Do we want to change all of those tools to be compatible with Spin2? (It's too late for TAQOZ in ROM, of course :().

    As it is, my Spin2 doesn't mix with anything, yet, because of its own limitations. How about when I make a relocatable version that could mix binaries with the other tools, I have it use those locations that everyone else is using?

    Eric, I know this stresses you out. It stresses me out, too. I don't want to stress you out.

  • @ersmith , I haven't worked on p2gcc for over a year, but I am hoping to get back to it some time in the near future.

    @ cgracey , it's possible to mix your Spin2 interpreter with other implementations through the use of mailboxes like we did on the P1. It would be good if it used the same conventions for system clock frequency, and the other special locations as well. It doesn't seem like this should be difficult for you to change.

  • A simple stopgap solution would be to add that preprocessor that people have been asking for forever to Spin2. Then we could just go

    #ifdef _PNut
            rdlong clkfreq,#$40
    #else
            rdlong clkfreq,#$14
    #endif
    

    and all would be well.

  • Cluso99Cluso99 Posts: 18,069

    @Wuerfel_21 said:
    A simple stopgap solution would be to add that preprocessor that people have been asking for forever to Spin2. Then we could just go

    #ifdef _PNut
            rdlong clkfreq,#$40
    #else
            rdlong clkfreq,#$14
    #endif
    

    and all would be well.

    Yes. If we could just get Chip & Jeff to add #ifdef but that's just not happening any time soon :(

  • Cluso99Cluso99 Posts: 18,069

    Eric,
    FWIW I thought it was $40 & $44 that was finally agreed on - don't have a link tho.
    However, I share your frustrations!

    How about we move to the new proposal of Erics with my extension to add the clock - in a reserved hub block $7FBE0-$&FBFF ?

  • I looked at my copy of loadp2 before I handed it over to Eric, and it uses the following locations:

    $14 - Clock Frequency
    $18 - Clock Mode
    $1C - User Baud Rate

    That's the way it was a year ago. I'm not aware that this was changed.

  • @"Dave Hein" said:
    I looked at my copy of loadp2 before I handed it over to Eric, and it uses the following locations:

    $14 - Clock Frequency
    $18 - Clock Mode
    $1C - User Baud Rate

    That's the way it was a year ago. I'm not aware that this was changed.

    It hasn't been changed in loadp2, nor in most other tools. But the Spin2 interpreter uses different locations, so interoperation is difficult. Hence my question.

    I mean, it's certainly possible for us to change it, and all the other tools. I'm not sure there's a compelliing reason to, though.

Sign In or Register to comment.