Truncated match.
PICList
Thread
'using page 0 registers on page 1'
1995\07\01@042016
by
Andrew Warren
|
Edward Cheung (spam_OUTebc714TakeThisOuT
rs710.gsfc.nasa.gov) wrote:
>[Quoting me:]
>>AND the assembler will
>>give you warning whenever you accidently treat a page-0 register as
>>though it were on page 1.
>
>This does not verify that you have set the page bit right? It only
>makes sure you don't use the wrong variable name. Thus if you wanted
>to say :
>MOVFW PORTA
>but instead typed
>MOVFW TRISA
>The mechanism you mentioned (XORing the variable name) will catch
>this type of error only. Is my assumption correct.
Edward:
Hope you don't mind my copying this reply to the list... It may be
useful to others.
Yes, your assumption is correct; the page bits still need to be set
properly. Currently, I'm using a VERY complicated (well, complicated
to create, anyway... they're totally invisible when used) set of
instruction-redefining MPASM macros to take care of the page-selection
automatically.
The example you give isn't the best (although the "xor" will catch that
error); a much-more common error occurs when you're using a part whose
general-purpose registers aren't shadowed in all register banks (e.g.,
16C57, 16C74, etc.), and you simply forget which bank a register is in.
For instance:
REG1 EQU [any page-0 register]
REG2 EQU [any page-1 location]
....
BSF STATUS,RP0 ;Switch to page 1.
MOVF REG2^080H,W ;Copy the contents of REG2 to REG1.
MOVWF REG1^080H ;
BCF STATUS,RP0 ;Switch back to page 0.
In this case, MPASM will generate a warning on the REG1 access. If
we'd used "&07FH" instead of "^080H", no warning would have been
produced.
-Andy
--
Andrew Warren - .....fastfwdKILLspam
@spam@ix.netcom.com
Fast Forward Engineering, Vista, California
1995\07\03@081106
by
Edward Cheung
>Hope you don't mind my copying this reply to the list... It may be
Not at all.
Thanks for your clarification on the page switch idea. I had originally
skimmed over your post to the list, thought it was a great idea, and then
filed it away for later study. When I did study it, I was a little confused
and asked you the question. That is why I sent you two notes.
I still think your idea is brilliant.
+---------------------------------------------------------------------------+
| Edward Cheung, Ph.D. | The opinions expressed herein |
| NASA Goddard Space Flight Center | do not necessarily reflect |
| Code 714.1, Bldg T11B | those of my employers' |
| Greenbelt, MD 20771 | |
| 301-286-1269(office) 286-1717(fax) | My next book: |
| Internet: ebc714
KILLspamrs710.gsfc.nasa.gov | Statistics, Demos and Other Lies |
+---------------------------------------------------------------------------+
More... (looser matching)
- Last day of these posts
- In 1995
, 1996 only
- Today
- New search...