View Full Version : Question (ASM Programing).

09-21-2007, 10:56 PM
I will not to discover circles again.
Consequently I ask or there is some method to the start of COG ASM of the program
·and on the start of consumption of memory in HUB for other aims.

sorry bad english

Nothing is impossible, there are only different degrees of difficulty.


Mike Green
09-21-2007, 11:24 PM
Are you asking how to start an assembly program in a cog? If so, the manual describes this under COGNEW and COGINIT. Look at any program in the Propeller Tool's library that uses assembly and you will see examples of this (try mouse.spin).

If your program is small and it only uses a little stack space, you can easily use the end of RAM (backwards from $7FFF) for other purposes. The PropellerOS (in the Object Exchange) uses this technique for allocating space for all of its I/O driver information and buffers.

You can also declare a block of variables in your program and pass the starting address to the cog (as shown in mouse.spin).

Post Edited (Mike Green) : 9/21/2007 4:32:39 PM GMT

09-21-2007, 11:39 PM
I think what you are asking is:

"How long after I start a PASM program can I overwrite the HUB RAM which contained the PASM code?"

The answer is on the order of 8200 cycles (512 * 16), although I'd recommend a healthy fudge factor.

Of course, the PASM code which was just loaded can overwrite it's HUB RAM version as soon as it starts executing.

09-22-2007, 12:13 AM
Thanks Mike and ericball

But my question is.

1.I start one COG with ASM prog (COG start and run)
2.HUB hold ASM Prog
3.Diskard HUB/Mem ASM-start to ASM-end in HUB
4.LOAD this MEM area with new one prog else use it with my data buffer

Nothing is impossible, there are only different degrees of difficulty.


Post Edited (Sapieha) : 9/21/2007 5:20:36 PM GMT

Mike Green
09-22-2007, 12:21 AM
Yes, once the cog is started, the HUB copy of the assembly program is not needed. There is no easy way to load this memory area with a different program, but it is easy to use the area as a buffer. It's like any other data in a DAT section, if the first long word has the label "entry", you get the address by using the "@" operator and you can refer to the data by using something like "LONG[@entry]". You can refer to the xth byte by using "BYTE[@entry][ x ]".

09-22-2007, 12:40 AM
Thanks Mike.

I have 3 ASM routiner with no HUB acces after start and this metod give my 4K extra RAM.

Nothing is impossible, there are only different degrees of difficulty.


Ken Peterson
09-22-2007, 11:50 PM
I imagine this would work best if you can define your ASM routines consecutively in HUB RAM.


The more I know, the more I know I don't know.· Is this what they call Wisdom?

09-23-2007, 01:24 AM
There was a thread some weeks ago, where suitable handling was discussed. I remember having recommended to add

padding RS 0[ 1000-padding]

after the COG code to guarantee a 1000 LONG buffer reusing this part of memory (starting from the label of the first instruction after ORG 0 )

09-23-2007, 01:46 AM
Hi deSilva

Thanks for it.

You can't remember thread?

Nothing is impossible, there are only different degrees of difficulty.


09-25-2007, 02:32 AM
Mike Green said...
... The PropellerOS (in the Object Exchange) ...

Sorry to step in, but where can I find this PropellerOS? I did searches in the object exchange, and also manually browsed the full list, and could not find it. Searches on the forum have also yielded nothing (other than this thread, when searching for propelleros).

Mike Green
09-25-2007, 03:02 AM
It's mentioned in Graham Stabler's Good Thread Index: http://forums.parallax.com/showthread.php?p=609066. Sorry, it's not actually in the Object Exchange, probably because it still needs some clean up and polishing. FemtoBasic is somewhat further along.

09-25-2007, 03:33 AM
Ah that's right, thanks. Funny though, I searched the forums for "propelleros", "os", and "operating system", each time on "all forums" and from "any time", and for "all of the keywords". And none of these attempts yielded any results whatsoever. I'm not surprised about "os" not working, because two-character words tend not to be indexed. But at least "operating system" should have given me something, I'd say.

09-25-2007, 04:55 AM
True, I wasn't. Thanks for the tip. I should have known, I saw that link given in another thread recently too.

edit: ... lol... I replied to a post that included a link to the google search facility on the parallax site. Now that post is gone. Thanks anyway http://forums.parallax.com/images/smilies/tongue.gif

Post Edited (_Mark) : 9/24/2007 10:00:00 PM GMT

Fred Hawkins
09-25-2007, 05:01 AM
_Mark, when I clicked on it, IE said it couldn't find the page. So after the second time it did that I del'ed the message. Beats me, must be a MrSofty thing.

09-25-2007, 05:05 AM
Yeah I noticed, the final character in the link "=" was not part of the "clickable" link. So when I clicked on it, I got an error too. But when I copy/pasted the entire link into the address bar manually, it worked.

Let's see... search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=%3CHOME/%3E&ie=&oe=&lr= (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=%3CHOME/%3E&ie=&oe=&lr=)

edit: Seems to work now. To illustrate, the link in your post looked like this (notice the last character is not clickable):

search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=%3CHOME/%3E&ie=&oe=&lr (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=%3CHOME/%3E&ie=&oe=&lr)=

Anyway thanks, and sorry for going off-topic.

Post Edited (_Mark) : 9/24/2007 10:15:06 PM GMT