Shop OBEX P1 Docs P2 Docs Learn Events
does cognew ignore $1F0-$1FF of the cog image in the dat section? — Parallax Forums

does cognew ignore $1F0-$1FF of the cog image in the dat section?

Bill HenningBill Henning Posts: 6,445
edited 2009-06-10 02:51 in Propeller 1
My gut feeling is yes, because I remember reading this on the forums earlier that when loading a cog, $1F0-$1FF are zero'd, regardless of the contents of the image.

However it is possible that it might load the shadow registers instead, so I thought I'd save time and ask, instead of determining it experimentally.

I intend to use that area for the standardized "driver configuration block" for Largos - 16 longs is more than enough, and it would be easy to point par at it.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Las - Large model assembler for the Propeller (alpha version this week)
Largos - a feature full nano operating system for the Propeller
www.mikronauts.com - a new blog about microcontrollers

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-09 15:11
    They have to be zeroed. Otherwise, in assembly programs that were short of the limit, they'd get loaded with whatever garbage followed.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-09 15:18
    Bill,
    I'm not positive how COGINIT works, but I believe that the RDLONG logic is used with the source data forced to zero for locations $1F0-$1FF. That would load the shadow RAM with zeros.
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-06-09 16:00
    Hi Phil,

    I just realized something.

    Cog code in DAT sections is often much shorter than the full 512 longs, so as Mike says (and my hazy memory agrees) there must be logic to zero loading $1F0-$1FF otherwise the startup state of DIRA et al (and shadow registers) would be indeterminate!

    Amazing how much it helps to drink coffee in the morning and solicit other people's advice smile.gif
    Phil Pilgrim (PhiPi) said...
    They have to be zeroed. Otherwise, in assembly programs that were short of the limit, they'd get loaded with whatever garbage followed.

    -Phil
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Las - Large model assembler for the Propeller (alpha version this week)
    Largos - a feature full nano operating system for the Propeller
    www.mikronauts.com - a new blog about microcontrollers
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-06-09 16:01
    Thanks Mike, it looks like its safe for me to use what would otherwise be $1F0-$1FF for driver parameters!
    Mike Green said...
    Bill,
    I'm not positive how COGINIT works, but I believe that the RDLONG logic is used with the source data forced to zero for locations $1F0-$1FF. That would load the shadow RAM with zeros.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Las - Large model assembler for the Propeller (alpha version this week)
    Largos - a feature full nano operating system for the Propeller
    www.mikronauts.com - a new blog about microcontrollers
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-09 16:10
    Remember that the shadow RAM under the read/write registers is not accessible. Only the shadow RAM under the read-only registers (PAR, CNT, INA) is accessible. On the Prop I, I think INB references shadow RAM since there's no "B" I/O circuitry.
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-06-10 02:39
    Bill: Only the first 496 locations from hub are copied (and always copied) into cog and is done by the hardware. The registers are also zeroed and this is·done by hardware although i am not sure exactly when. It is probably not at the start, but at reset and when a cog is stopped.

    However, the DAT section for a cog does not need to be 496 long. So for instance if it is 300 longs, then 496 will still be copied, but of course the last 196 will be whatever was in hub following the 300 longs. i.e. they are not zeroed. So for your question about using the remaining 16 longs, the point is actually irrelevant as they could be anywhere. For Largos, this could be an ideal position to place those longs. Hope this makes sense.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm

    Post Edited (Cluso99) : 6/10/2009 2:44:51 AM GMT
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-06-10 02:51
    Thanks Cluso, your analysis matches my post coffee analysis - those 16 longs are now spoken for smile.gif
    Cluso99 said...
    Bill: Only the first 496 locations from hub are copied (and always copied) into cog and is done by the hardware. The registers are also zeroed and this is done by hardware although i am not sure exactly when. It is probably not at the start, but at reset and when a cog is stopped.

    However, the DAT section for a cog does not need to be 496 long. So for instance if it is 300 longs, then 496 will still be copied, but of course the last 196 will be whatever was in hub following the 300 longs. i.e. they are not zeroed. So for your question about using the remaining 16 longs, the point is actually irrelevant as they could be anywhere. For Largos, this could be an ideal position to place those longs. Hope this makes sense.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Las - Large model assembler for the Propeller (alpha version this week)
    Largos - a feature full nano operating system for the Propeller
    www.mikronauts.com - a new blog about microcontrollers
Sign In or Register to comment.