Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
what is the most simple function for Z and C flag decisions
Posted: Sun Dec 02, 2007 11:02 am
re 16F/C family :
when doing a series of bit shifts << , >> etc of varying lengths -
and then seeing results of a specific single BIT shifted out of the variable register - reading the C or Z flag in assembler was direct and EZ
yet i find there are no compiler defined functions to just read the
flags after an operation on the order of
a zflag() or Cflag() function.
Or are there ?
so far i've been using the ( obvious) defined bit read functions of register 03 to make decisions- but is there a better way or a defined function i simply don't see? is there a reason there is no compiler defined function for these two obvious, and important flags?
am i just being excessively thick here ?
what IS the most code efficient way to do it ?
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
sorry forgot the example
Posted: Sun Dec 02, 2007 11:55 am
i'm just trying to find out if there is a predefined or lower instrux count function than this:
#bit CY = GETENV("bit:C")
#bit Z = GETENV("bit:Z")
Then use CY and Z in your code as if they were variables.
Guest
i checked the .LST
Posted: Mon Dec 03, 2007 8:20 am
WOW - i tried it and checked the resulting LST file -
Now thats as efficient as it gets!
THANKS and my apology
- i should have looked that up in the index of the compiler manual -
( if only there WAS an index ) it would have saved a lot of head scratching.
i have some old code to go clean up now with the improvement
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum