ASM Webinar Follow-up Questions
CassLan
Posts: 586
Almost done watching the ASM Webinar...thanks so much for it Parallax!
I have a question at about 39 minutes in this code is up and being discussed:
It was brought up to illustrate passing information from Spin, to a new Asm cog being launched..and I guess vice/versa
So the par register of the new cog, now contains the·address of Count?
Then the first line of Asm code copies that address to the long known as Addr?
So Now..the long Addr which resides in cogram contains the address of the long Count which resides in main ram?
the long Value which resides in cogram gets incremented by 1
Then the contents of the long Value get written to the address Addr which is really the long Count in mainram?
Then it loops around.
Do I have this right? Why can't you leave the par register with the needed address first passed to it?
If I had a DAT Section which contained Longs BEFORE the org statement..is that kept in Main RAM?
If I have 2 Assembly routines each under 496 Longs each meant to run in seperate cogs, what stops the 2nd one from being copied into the 496 Long cog ram..the org statement?
Again...what a great Webinar!!!!!
Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NYC Area Prop Club
Prop Forum Search (Via Google)
·
I have a question at about 39 minutes in this code is up and being discussed:
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR long Count OBJ pst : "Parallax Serial Terminal" PUB Main pst.start(115200) cognew(@Asm, @Count) repeat pst.Dec(Count) pst.NewLine waitcnt(clkfreq / 100 + cnt) DAT Asm org mov Addr, par 'Get Spin variable address Loop add Value, #1 'Add 1 to Value wrlong Value, Addr 'Write Value to Spin variable jmp #Loop 'Loop Addr long 0 Value long 0
It was brought up to illustrate passing information from Spin, to a new Asm cog being launched..and I guess vice/versa
So the par register of the new cog, now contains the·address of Count?
Then the first line of Asm code copies that address to the long known as Addr?
So Now..the long Addr which resides in cogram contains the address of the long Count which resides in main ram?
the long Value which resides in cogram gets incremented by 1
Then the contents of the long Value get written to the address Addr which is really the long Count in mainram?
Then it loops around.
Do I have this right? Why can't you leave the par register with the needed address first passed to it?
If I had a DAT Section which contained Longs BEFORE the org statement..is that kept in Main RAM?
If I have 2 Assembly routines each under 496 Longs each meant to run in seperate cogs, what stops the 2nd one from being copied into the 496 Long cog ram..the org statement?
Again...what a great Webinar!!!!!
Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NYC Area Prop Club
Prop Forum Search (Via Google)
·
Comments
coginit copies 496 (maybe 512) starting at the address you give. It doesn'T care/know what it copies or if another portion is going to end in another COG. Each COG has its own COG RAM that is separated and not mapped to HUB RAM. You can have 3 COGs with the same code, just copies 3 times for each one of the COG RAMs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH
pPropQL: propeller.wikispaces.com/pPropQL
pPropQL020: propeller.wikispaces.com/pPropQL020
OMU for the pPropQL/020 propeller.wikispaces.com/OMU
Post Edited (Ale) : 12/23/2009 4:56:10 PM GMT
But you are correct, in this example you could have used par directly.
When code is loaded into a cog, it moves 496 longs always. So whatever is in hubram after the code gets copied too.
What the org command does it tell it what the COG address is for labels. Assume this code below is in HUB address $1000. See how ORG dictates the labels address.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropBASIC home page www.propbasic.com
Post Edited (Bean (Hitt Consulting)) : 12/23/2009 6:29:31 PM GMT
I'm hoping the webinar code included the rdlong (which I've added) otherwise the code won't do much.
An additional important note about PAR is it's only 14 bits - long addresses only!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: Forum
NTSC & PAL driver templates: ObEx Forum
OnePinTVText driver: ObEx Forum