In Praise of the Puzzlers
CounterRotatingProps
Posts: 1,132
Was originally going to post this as a reply to Steve's puzzler here:
http://forums.parallax.com/showthread.php?p=833552
but thought it might get lost in the thread...
Puzzles and·examples of this kind·can be very useful, IMO, for NOOBS like me and for Near-NOOBS (N-NOOB :) too.
These ideas are often lacking in the basic and general literature, e.g. the well-written Prop manual.· That material normally doesn't have the luxury of printed·space to address what we can learn by drilling down into a specific detail or problem. Having read a reasonable amount of Prop literature so far, I'd say that there's lack of intermediate - to advanced- level examples in the paper-written world of Beeniedom.· (I like consise things I can sit in a corner and read.)
The generousity of our wonderful forum members does well to fill the need.· But it would be nice to have a textbook on· 'Advanced Propeller Techniques'... until then... more puzzlers please, Mr. and Mrs.·Wizards!
Suggestions and rational:
-· Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (CounterRotatingProps) : 8/23/2009 9:35:36 PM GMT
http://forums.parallax.com/showthread.php?p=833552
but thought it might get lost in the thread...
Puzzles and·examples of this kind·can be very useful, IMO, for NOOBS like me and for Near-NOOBS (N-NOOB :) too.
These ideas are often lacking in the basic and general literature, e.g. the well-written Prop manual.· That material normally doesn't have the luxury of printed·space to address what we can learn by drilling down into a specific detail or problem. Having read a reasonable amount of Prop literature so far, I'd say that there's lack of intermediate - to advanced- level examples in the paper-written world of Beeniedom.· (I like consise things I can sit in a corner and read.)
The generousity of our wonderful forum members does well to fill the need.· But it would be nice to have a textbook on· 'Advanced Propeller Techniques'... until then... more puzzlers please, Mr. and Mrs.·Wizards!
Suggestions and rational:
- Counter and PLL puzzlers - the counters seem to be in the 'arcana' area for intermediate to advanced
- PASM to SPIN and back - I recall only one thread on calling SPIN from PASM - advanced?
- PASM to HUB - e.g. cog mem to hub mem, cross-cog data sharing (locks, semaphores, etc. and inter-cog calls ?) - intermediate to advanced, and related:
- Simple Memory Management·- yes, there's a ton happening with LMM and the various compilers and debuggers folks are working hard at - but the shear amount is overwhelming for N-NOOBs. Something·more byte-sized if you please.
- " Breaking out of the box " - cool or unusual techniques --- the ones that leave you grabbing for the Excedrin Extra Strength bottle, or ones that make you say "Gee, I wish I'd thought of that!"·
- Naughty Stuff:· self modifying code and code obfusication. The former is probably ok 'cause we have to do it in the limited mem. space; the latter might be a bad idea because it could inspire bad coding habits. (But usually the things that are bad for you are also the most fun )
- Very Specific methods - e.g. creative use of conditionals w/flags, shifting to multiply/divide, using the ROM math tables (seems to be a repeating topic.)
- "shadow registers" - advanced
-· Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (CounterRotatingProps) : 8/23/2009 9:35:36 PM GMT
Comments
I hope others embrace the puzzle idea. This weekend finds many Propeller users in an Ohio Gym, so responses may be thin for a while.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
SPOILER! (Maybe)
I'll try. My assumption is that the cnt register is updated every time, so writing to it (even though technically it's read only according to the manual but not the assembler) doesn't do anything long term. So the first line is to throw us off. The next line writes the C flag if the cnt is 0, otherwise it doesn't write the C flag (effectivly, !bool(cnt)). The final line tests to see if value and cnt share any bits set in the same places, and if there are shared location set bits, then the flag is set.
That is my analysis.
Post Edited (kuroneko) : 8/23/2009 3:43:30 AM GMT
For example:
tjz phsa, #loop
That instruction will always jump even if phsa starts accumlating. If a wanted it to work properly I would need to do:
mov buffer, phsa
tjz·· buffer, #loop
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
OK, so haw far did I miss by?
HarryE.
I mentioned before that if cnt is used in the destination slot of an instruction it behaves like a normal register (shadow copy). I really shouldn't have written it like this [noparse]:([/noparse] OK, for people who never encountered shadow registers the following version might be easier to understand:
It has the same affect as the original fragment (apart from requiring one more register).
Edit: There is one hint I'm prepared to give but I don't think it's that time yet.
Post Edited (kuroneko) : 8/23/2009 8:12:11 AM GMT
I guess we can add "shadow registers" to the list of advanced topics.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: Forum
NTSC & PAL driver templates: ObEx Forum
OnePinTVText driver: ObEx Forum
What does this code do?
The input is value and the output is the new modified value.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Done!
Nice work eric!
and thanks kuroneko·for the·puzzle!
- H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It makes even numbers odd by adding one, and keeps odd numbers.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propeller Tools
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
This is very simple.
1) what does "getit" do?, 2) what does mask do?, 3) give "alternative spellings" for "and".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propeller Tools
1) It returns Z set if nothing is on pin P0 or P1 and C set if either but not both pins are set.
2) mask is a nop instruction as is any long with the conditional bits clear.
3) "and mask, ina nr,wc,wz" is long hand for "test mask,ina wc,wz" ... the compiler translates it for you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propeller Tools
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
often we get distracted by life and work [noparse]:)[/noparse]) Several of our resident PASM gurus are on vacation too. I've not had time the last few days to study your puzzler or Steve's last... looking forward to it this weekend (even if the puzzles are solved [noparse]:)[/noparse].
Keep in mind too please that folks can come back to these threads even years later for info.
@ALL:
One thing I've noticed is that it may get confusing to have the puzzles, guesses, hints, and answers interleaved in the same thread here. I'm not suggesting that we start separate threads for each new puzzle... that would get out of control quick.· Having them all in one mambo thread here is probably much better, do you think?· Perhaps the original puzzler poster could give their new puzzle a nickname and then we refer to it that way --- numbering probably would be a pain because you'd have to look back at count it right.
What do you all think we can do to keep things separated better?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔