How do you set or clear the C or Z flag ?
Bean
Posts: 8,129
I haven't seen anywhere, how do you set or clear the C - Carry and/or the Z - Zero flags ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 9/5/2009 9:56:42 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propeller Tools
- Propalyzer: Propeller PC Logic Analyzer
- BMA: An on-chip PASM Debugger
- SPUD: Spin Source Level Debugger
Post Edited (jazzed) : 9/5/2009 9:52:56 PM GMTOkay, try this:
-Phil
Someone attributed this trick to Phil, but apparently he forgot it.
Ok, but what if any contains 0 ?
yes, "mov $, $ wc,nr" sets it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propeller Tools
That's okay, because 0 => 0. The carry condition is "greater than or equal".
mpark,
Yes, apparently I did. I like cmpsub better, anyway, since it's less obscure. Of course, if we had macros, it wouldn't matter.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propeller Tools
There's probably several ways to do this as have already been suggested... here is what I have used...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 9/6/2009 1:51:52 AM GMT
For instance
mov $,#0 wz,nr·· 'set z flag
mov $,#0 wz,nr···'reset z flag
rol·· $,#0 wc,nr·· 'set c flag (because b31=1)
ror· ·$,#0 wc,nr·· 'reset·c flag (because b0=0)
cmp $,$·· wz,wc· 'reset c & set z (because ==)
I posted a whole set a while back - I am looking for it now - should have kept a copy :-(
If you have the c & z flags saved in b31 & b30 respectively
cz_flags long 0-0·· 'b31=c, b30=z, other bits=0
shl· cz_flags,#1·· wc,wz,nr· 'sets/resets both c & z
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
· 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) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Post Edited (Cluso99) : 9/6/2009 3:17:33 AM GMT
-Phil
This reminds me of the Perl users' mantra: TMTOWTDI.
Post Edited (Phil Pilgrim (PhiPi)) : 9/6/2009 3:21:47 AM GMT
http://forums.parallax.com/forums/default.aspx?f=25&p=6&m=114128
http://forums.parallax.com/forums/attach.aspx?a=17267
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
· 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) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm