Kevin Rhoades <TakeThisOuTPICLISTspam
MITVMA.MIT.EDU> wrote:
{Quote hidden}> In the include files (MPASM) for the '84 it lists:
>
> TRISA EQU H'0085'
>
> Further, the data book says that the direct addressing mode uses
> only 7 bits from the opcode and that operations on page 1 require
> setting RP0=1.
>
> My question is this, why does the file assign the value of 85 to be
> used when addressing the TRISA register if the msb is not even used?
> Would not a value of 05 give the same result?
Kevin:
Yes. In fact, if you use the include file and write:
MOVWF TRISA
MPASM will generate code that's equivalent to "MOVWF 005H". On top
of that, it'll give you a warning that the operand was truncated.
Given this, it seems silly to use the "085H" definition. Using that
definition, however,
1. more accurately depicts what your code's doing, making it
more self-documenting,
2. allows simulators and emulators to track the TRISA
register, and
3. builds character.
There are any number of ways to keep the "truncated" warning
messages from appearing... One of the most straightforward is to
replace instructions like:
MOVWF TRISA
with instructions like:
MOVWF 080H^TRISA
-Andy
Andrew Warren - spamBeGonefastfwd.....
@spam@ix.netcom.com
Fast Forward Engineering, Vista, California
http://www.geocities.com/SiliconValley/2499