Pic programming question

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi

I am just getting into assembler pic programming, could someone answer me a
quick question, MOVLW and MOVF, do they copy or move i want to now if i move
the contents of w into a file will it also stay in w and vice a versa.

John



Re: Pic programming question
Quoted text here. Click to load it

Yes, the value in W will not change. Same if you moved the value of a file
register into W (provided it isn't a special function register).

Re: Pic programming question
Quoted text here. Click to load it


why do most instruction sets call these operations "MOVE", when they're
more like COPY? MOVE would be more like a FIFO.

--
    mac the naf

Re: Pic programming question
->>if i move
->>the contents of w into a file will it also stay in w and vice a versa.
-
->Yes, the value in W will not change. Same if you moved the value of a file
->register into W (provided it isn't a special function register).
-
-why do most instruction sets call these operations "MOVE", when they're
-more like COPY? MOVE would be more like a FIFO.

It's an assembly language convention from the early days. MOVE has always
been non destructive to the source.

BAJ

Re: Pic programming question
Quoted text here. Click to load it

Interesting question.  I think when MOVE or MOV first became popular,
the Windows (Mac?) dichotomy of Move vs. Copy hadn't been in people's
minds.  The early assembly languages usually used Load and Store
instructions: you load into a register and store from a register.  That
is a nice distinction when going to/from memory, but doesn't make quite
as much sense when going from register to register.  I guess that is why
the generic Move became popular.

As a side light, the PDP-8 minicomputer's only store instruction also
cleared the accumulator!  I guess you could call that a true move
instruction, but DEC called it DCA  - Deposit AC in memory and clear
AC.  Instead of a load, they simply had a TAD - two's complement add
operand to accumulator.  There were clear instructions and complement
instructions, but no subtract -- a truly Reduced Instruction Set
Computer!

Aside from those early days, instruction sets don't have a move in the
sense that it leaves the source, EXCEPT for stack oriented
architectures.  That operation, though, is usually call a Stack Pop
(which Motorola called "PULL" on some processors), not Move.

Thad

Re: Pic programming question

Quoted text here. Click to load it
I first became aware of MOVE instead of LOAD instructions with the
PDP-11 instruction set. The assembly language style used there was
referred to within DEC as "Nicaud notation" after the prominent Swiss
(I think) computer scientist who invented it. AFAIK this was also the
first widespread use of parentheses, at-sign and + and - to indicate
operand addressing modes.
When the 8080 came out with its backward operand order for MOV
instructions, I heard an amusing story. Supposedly the original
internal version of the assembly language used LD and STO, but then
some marketing person thought that MOV was sexier. Since this was
decided at the last minute, there was only time to change the
instruction name but not the operand order in the assembler. There
were of course still remnants of LD and STO in instructions like SHLD
and LHLD.

Jim McGinnis

Re: Pic programming question

Quoted text here. Click to load it

That might explain some of the differences in the Z80 assembler
instructions.  Although pretty much everything became a load, never mind
the destination.  (Zilog's team were rogues from Intel, who later left
Zilog but came back... A regular silicon-soap-opera:  The Chips of Our
Lives.)

--
Ron Sharp.



Re: Pic programming question
Quoted text here. Click to load it

Hmm, I'm not sure about that story. It would surprise me if anyone actually
thinks MOV is sexy. I think it was to highlight the difference between MOV (reg
to reg) and LD/ST (which were reg to/from mem). Makes it a tad bit easer on the
programmer to find the instructions that access memory. Although MOV could
indirectly address memory, the address first had to be loaded into H/L first.



Re: Pic programming question


Quoted text here. Click to load it
Intel's rivals at that time (Motorola, TI, GI and National) were all
working on chips that more closely resembled at least the style of the
PDP-11. Compared to the older IBM-style assembly language, the
PDP-11's really was sexy. Obviously changing the name of the 8080's
data transfer instructions didn't alter its essential design, but it
would have been the kind of thing a marketeer could ask for.

Re: Pic programming question
Quoted text here. Click to load it
... snip ...
Quoted text here. Click to load it

IIRC the LOD mmemnonic was used for the 8008, which was
architecturally similar.  The LD mnemnonic was used by Zilog in
their expanded set for the Z80.

--
Chuck F ( snipped-for-privacy@yahoo.com) ( snipped-for-privacy@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
We've slightly trimmed the long signature. Click to see the full one.
Re: Pic programming question

Thanks for your replies.
Sorry for seeming a bit stupid, but just so I can get it 100% in my head can
I ask you all another question?

MOVLW    6
MOVWF   NUM1

MOVF    NUM1,W        ;I know that this moves 6 into W but does it also
leave 6 in NUM1?

The reason I need to be 100% is because I want to continue using NUM1
knowing it has the value of 6 so I can compare it with a few different
values.

Cheers
JOHN



Re: Pic programming question
-
-Thanks for your replies.
-Sorry for seeming a bit stupid, but just so I can get it 100% in my head can
-I ask you all another question?

Ask away.

-
-MOVLW    6            ; Puts 6 into W
-MOVWF   NUM1          ; Copies W (which has 6) into NUM1
-
-MOVF    NUM1,W        ;I know that this moves 6 into W but does it
                       ;also leave 6 in NUM1? YES. Copies NUM1 into W

-The reason I need to be 100% is because I want to continue using NUM1
-knowing it has the value of 6 so I can compare it with a few different
-values.

That's exactly how it works. No move instruction modifies the source.

BAJ

Re: Pic programming question
On Fri, 10 Oct 2003 17:14:13 +0100, "JSW"

Quoted text here. Click to load it

Moves (copies? loads?) the literal value of 6 into the W register.
The literal value of 6 retains its previous value.  ;-)

Quoted text here. Click to load it

Copies the contents of the W register into file location NUM1.  The W
register retains its previous value.

Quoted text here. Click to load it

Assuming nothing else has been done, the W register already *has* the
value 6.  So the instruction is redundant.  However, in any case, the
value currently stored in file location NUM1 is copied into the the W
register.  The file location NUM1 retains its previous value.


Regards,

                               -=Dave
--
Change is inevitable, progress is not.

Site Timeline