
2004 Microchip Technology Inc.
Preliminary
DS39637A-page 405
PIC18F2480/2580/4480/4580
CALLW
MOVSF
Subroutine Call Using WREG
Syntax:
CALLW
Operands:
None
Operation:
(PC + 2)
→
TOS,
(W)
→
PCL,
(PCLATH)
→
PCH,
(PCLATU)
→
PCU
Status Affected:
None
Encoding:
0000
0000
0001
0100
Description
First, the return address (PC + 2) is
pushed onto the return stack. Next, the
contents of W are written to PCL; the
existing value is discarded. Then, the
contents of PCLATH and PCLATU are
latched into PCH and PCU,
respectively. The second cycle is
executed as a
NOP
instruction while the
new next instruction is fetched.
Unlike
CALL
, there is no option to
update W, Status or BSR.
Words:
1
Cycles:
2
Q Cycle Activity:
Q1
Q2
Q3
Q4
No
Decode
Read
WREG
No
operation
Push PC to
stack
No
operation
operation
No
operation
No
operation
Example:
HERE
CALLW
Before Instruction
PC
PCLATH =
PCLATU =
W
After Instruction
PC
TOS
PCLATH =
PCLATU =
W
=
address
(HERE)
10h
00h
06h
=
=
=
001006h
address
(HERE + 2)
10h
00h
06h
=
Move Indexed to f
Syntax:
MOVSF [z
s
], f
d
0
≤
z
s
≤
127
0
≤
f
d
≤
4095
((FSR2) + z
s
)
→
f
d
None
Operands:
Operation:
Status Affected:
Encoding:
1st word (source)
2nd word (destin.)
1110
1111
1011
ffff
0zzz
ffff
zzzz
s
ffff
d
Description:
The contents of the source register are
moved to destination register ‘f
d
’. The
actual address of the source register is
determined by adding the 7-bit literal
offset ‘z
s
’ in the first word to the value of
FSR2. The address of the destination
register is specified by the 12-bit literal
‘f
d
’ in the second word. Both addresses
can be anywhere in the 4096-byte data
space (000h to FFFh).
The
MOVSF
instruction cannot use the
PCL, TOSU, TOSH or TOSL as the
destination register.
If the resultant source address points to
an indirect addressing register, the
value returned will be 00h.
Words:
2
Cycles:
2
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Determine
source addr
No
operation
No dummy
read
Determine
source addr
No
operation
Read
source reg
Write
register ‘f’
(dest)
Decode
Example:
MOVSF [05h], REG2
Before Instruction
FSR2
Contents
of 85h
REG2
After Instruction
FSR2
Contents
of 85h
REG2
=
80h
=
=
33h
11h
=
80h
=
=
33h
33h