PIC instruction!

Status
Not open for further replies.

I thought your improved macro just inserted the single required BSF? - perhaps I was thinking of someone elses?.
 
My macro throws a message in the listing anytime it switches banks, and a different message when it leaves the bank unchanged. That way, once my code is stable, I can make it more efficient by rearranging things to put operations in a common bank together, and I don't have to memorize which bank has what register.
 
I thought your improved macro just inserted the single required BSF? - perhaps I was thinking of someone elses?.

It does, however, if I don't know which bank something is in I have to do,
Code:
	mysel	TRISA
	movwf	TRISA
	mysel	ANSEL
	clrf	ANSEL
	mysel	ANSELH
	clrf	ANSELH
Yes, the above will assemble efficiently but is just ugly.

Mike.
 
Next time I am up for macro hacking I plan to create macros corresponding to all the register-oriented instructions (e.g. movf/movfw/movwf/bsf/bcf etc.) which will set the bank bits (skipping this if they're already set correctly) and assemble in the instruction in question.

So, instead of Pommie's code above, I could code:

Code:
	mymovwf	TRISA
	myclrf	ANSEL
	myclrf	ANSELH
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…