CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Quick question about the ASM output.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
neil



Joined: 08 Sep 2003
Posts: 128

View user's profile Send private message

Quick question about the ASM output.
PostPosted: Sun Dec 15, 2002 10:46 am     Reply with quote

I'm sure there will be a valid reason, but can anyone explain why the ASM generated by CCS uses 'F' instead of 0 or 1 for the second field for some opcodes? The Microchip datasheet specifies in the opcode explanations that (eg) ADDWF f,d "Add the contents of the W register with register 'F'. If d is 0, the result is stored in W. If d is 1, the result is stored back in F." It appears that CCS are trying to put 0xF into that 'd' field, so I guess the other 3 'ones' are truncated. This seems a bit of a silly thing to do! Any particular reason for it?

Thanks for any replies,
Neil.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10050
Tomi
Guest







Re: Quick question about the ASM output.
PostPosted: Sun Dec 15, 2002 11:08 am     Reply with quote

The second parameter is the target of the operation. It could be either "W" (W register, coded as 0 in machine code) or "F" (File Register, coded as 1 in machine code).
It is more readable and comfortable to use:
ANDWF 0x0F,F or
ANDWF 0x0F,W rather than:
ANDWF 0x0F,1 or
ANDWF 0x0F,0

So the "F" at the 2nd oper. is the mnemonic of "File Register" and not hexa "F".
Note that you can use the "F" mnemonic in assembler, e.g.:
#asm
andwf 0x0f,f
#endasm
gives the right result.


:=I'm sure there will be a valid reason, but can anyone explain why the ASM generated by CCS uses 'F' instead of 0 or 1 for the second field for some opcodes? The Microchip datasheet specifies in the opcode explanations that (eg) ADDWF f,d "Add the contents of the W register with register 'F'. If d is 0, the result is stored in W. If d is 1, the result is stored back in F." It appears that CCS are trying to put 0xF into that 'd' field, so I guess the other 3 'ones' are truncated. This seems a bit of a silly thing to do! Any particular reason for it?
:=
:=Thanks for any replies,
:=Neil.
___________________________
This message was ported from CCS's old forum
Original Post ID: 10051
neil



Joined: 08 Sep 2003
Posts: 128

View user's profile Send private message

Re: Quick question about the ASM output.
PostPosted: Sun Dec 15, 2002 11:51 am     Reply with quote

Duh, Silly me! Thanks for setting that one straight!
___________________________
This message was ported from CCS's old forum
Original Post ID: 10052
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group