PDA

View Full Version : How to force the carry flag to 1 ?



Bean
05-19-2010, 10:31 PM
Okay, we've been before, but I cannot find the thread.

I need 1 instruction that will set the carry flag without have any specific value in any variable.

In my notes I have:

· rol $,#0 WC,NR·· 'set c flag (because b31=1)

But that doesn't seem right because bit 31 is NOT a 1 for the rol instruction.

The only instruction I see that might work is:

·CMPSUB $,$ WC, NR

It seem kind of strange to set the carry flag if the values are =·doesn't it ??? This isn't a typo·in the manual is it ?

Bean

·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [RUSH - Freewill]

Phil Pilgrim (PhiPi)
05-19-2010, 10:37 PM
Bean said...
It seem kind of strange to set the carry flag if the values are = doesn't it ??? This isn't a typo in the manual is it ?

That's what I thought, too, when I first saw it; but it's no typo. It was designed that way to facilitate division.

-Phil

Ale
05-19-2010, 10:37 PM
I thought the mov method was the better one...

mov 0, $ wc, nr

it writes the C with the value at bit 31, set for the mov instruction...

quoting the manual (v1.1) for cmpsub "If the WC effect is specified, the C flag is set (1) if a subtraction is possible (Value1 is equal to or greater than Value2).".

Edit: Phil is right.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH (http://propeller.wikispaces.com/MATH)
pPropQL: propeller.wikispaces.com/pPropQL (http://propeller.wikispaces.com/pPropQL)
pPropQL020: propeller.wikispaces.com/pPropQL020 (http://propeller.wikispaces.com/pPropQL020)
OMU for the pPropQL/020 propeller.wikispaces.com/OMU (http://propeller.wikispaces.com/OMU)
pPropellerSim - A propeller simulator for ASM development sourceforge.net/projects/ppropellersim (http://sourceforge.net/projects/ppropellersim)

Phil Pilgrim (PhiPi)
05-19-2010, 10:42 PM
BTW, here's the thread you might have been looking for: http://forums.parallax.com/showthread.php?p=764220.

-Phil

Bean
05-19-2010, 10:43 PM
Thanks guys.
Yeah, I prefer the MOV instruction too. It's just a simpler instruction.

I wish Parallax would put a set of prefered instructions in the manual for setting/clearing the carry and zero flag.
P.S. Yes Phil, that is the thread I was looking for.

Bean

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [RUSH - Freewill]

Post Edited (Bean) : 5/19/2010 2:48:03 PM GMT

Ale
05-19-2010, 11:12 PM
I wanted to suggest that thread too. Phil made a great contribution... is the thread in the wiki already ?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH (http://propeller.wikispaces.com/MATH)
pPropQL: propeller.wikispaces.com/pPropQL (http://propeller.wikispaces.com/pPropQL)
pPropQL020: propeller.wikispaces.com/pPropQL020 (http://propeller.wikispaces.com/pPropQL020)
OMU for the pPropQL/020 propeller.wikispaces.com/OMU (http://propeller.wikispaces.com/OMU)
pPropellerSim - A propeller simulator for ASM development sourceforge.net/projects/ppropellersim (http://sourceforge.net/projects/ppropellersim)

Phil Pilgrim (PhiPi)
05-19-2010, 11:15 PM
Once we get macros and #INCLUDE files, we can define our own setc, clrz, etc. instructions in a separate file and be done with it, without having to look them up every time.

-Phil

Cluso99
05-20-2010, 10:04 AM
How true Phil. I thought OBC was going to add it to the cookbook?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:

· Home of the MultiBladeProps: TriBlade (http://forums.parallax.com/showthread.php?p=786418),·RamBlade (http://forums.parallax.com/showthread.php?p=849265),·SixBlade (http://forums.parallax.com/showthread.php?p=780033), website (http://bluemagic.biz/cluso.htm)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator) (http://forums.parallax.com/showthread.php?p=790917)
· Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) (http://forums.parallax.com/showthread.php?p=778427) ZiCog (Z80) (http://forums.parallax.com/showthread.php?p=788511) , MoCog (6809) (http://forums.parallax.com/showthread.php?p=811043)·
· Prop OS: SphinxOS (http://forums.parallax.com/showthread.php?p=819353)·, PropDos (http://www.orrtech.us/propdos/) , PropCmd (http://obex.parallax.com/objects/440/)··· Search the Propeller forums (http://www.google.com/advanced_search?q=+site:forums.parallax.com&num=20&hl=en&lr=)·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz (http://www.bluemagic.biz)·· MultiBlade Props: www.cluso.bluemagic.biz (http://www.cluso.bluemagic.biz)