What if assembly code doesn't end with endless loop?
Rayman
Posts: 14,789
Ok, I'm sure this question has been asked and answered before, but the "Search" function here is about worthless!
Anyway, it appears that all the assembly code examples I've looked at end in an infinite loop.· What happens if there is no "jmp" at the end of the code?
Will it proceede to try to execute whatever is in the next address?· Or, does the compiler do some magic to make it stop there?
Anyway, it appears that all the assembly code examples I've looked at end in an infinite loop.· What happens if there is no "jmp" at the end of the code?
Will it proceede to try to execute whatever is in the next address?· Or, does the compiler do some magic to make it stop there?
Comments
'now stop
COGID thisCog
COGSTOP thisCog
thisCog LONG 5
Is there an easier way?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Paul describes a tricky behaviour of the COG loading, in that when cells $1F1 to $1FF are loaded the value is substituted by zero. When $1F0 is loaded its value is substituted by
%%0000_0000_xxxx_xxx0
Where %%YYYY_YYYY_xxxx_xxxY is the value stated in the second parameter of COGNEW
(b) No, it is not "updated"
All "special registers" in a COG are "shadow registers" that will be read from "a different place", in case of INA, PHSA, CNT, PAR. There have been lengthy discussions wrt this behaviour...
I fact I was unprecise before: ALSO $1F0 is set to 0 (the "shadow" register, i.e.). You will only get the "correct" PAR when reading through the source operand. When using the "dest" operand, PAR will be zero, also CNT!
specific cog should be started or restarted." page 366
Three questions then:
1. Does the Cog get rewritten? (No, because otherwise it would be just a Cognew)
2. Where does the Cog resume? At location 0, or the last operand+1?
3. Does Par get reloaded?
2) The cog always starts at location zero
3) PAR does get reloaded (from the 14 bit field passed to COGNEW/COGINIT)
The manual in my opinion was ambiguous about 'restarting', which seems to me to have a different meaning than what was meant. Particularly when you have code already loaded. I was hoping to be able to stop a cog, and restart it without the overhead of the hub's filling up the cog's memory. In short, a jmp #0 under control of another cog.
The manual might be clearer if it uses the terms 'launch' and 'relaunch' in the Coginit assembly write up:
[font=TimesNewRoman,Bold size=3]Instruction: [/font]Start or restart·Launch or relaunch a cog, optionally by ID, to run Propeller Assembly or Spin code.
COGINIT Destination
[font=TimesNewRoman,Bold size=3]Result: [/font]Optionally, the started/restarted launched/relaunched cog’s ID (0-7) is written to [font=TimesNewRoman,Italic size=3]Destination[/font].
Post Edited (Fred Hawkins) : 9/26/2007 12:58:04 PM GMT