The "SET" command is an assembler command (i.e. has effect at assemble
time, *not* at run time). As you have found, the assembler preprocessor
expands your source code to:
call test
call test
call test
test call three
The value of "word" when the assembler reaches "test" is "three". It looks
like you are trying to have the destination of the call at "test"
determined at run time. With the 16Cxx family, all CALLs are hard-coded.
You can emulate this by doing something like this (WARNING: not tested and
barely proof-read!):
;-- Set call destination to "one"
movlw high(one) ;Load upper byte of address into PC Latch High
movwf PCLATH
movlw low(one) ;Load lower byte of address into temp register
movwf CALLDEST
call test
zzz1 ... (more code here)
movlw high(two) ;Load upper byte of address into PC Latch High
movwf PCLATH
movlw low(two) ; Load lower byte of address into temp reg
ister
movwf CALLDEST
call test
zzz2 ... (more code here)
test ... (put some code here that does not change PCLATH)
movf CALLDEST,0
movwf PCL ;Jumps (chains) to desired routine
one ...(some code here)
return ;Will return to zzz1
two ...(some code here)
return ;Will return to zzz2
On Wednesday, February 11, 1998 1:51 AM, kerzer
KILLspamCST.CO.ZW
[SMTP:.....kerzerKILLspam
.....CST.CO.ZW] wrote:
{Quote hidden}> word set one
> call test
> word set two
> call test
> word set three
> call test
>
> test
> call word
> return
>
> one
> return
> two
> return
> three
> return
>
> The set command seems to only remember the last one, ie it calls three
all
> the time. I had it workin, but I don't know how I did it.
>
> Gordon
>