Mov cnt,cnt
aldorifor
Posts: 15
Hello,
Is there someone who can explain me what does the pasm instruction MOV CNT,CNT.:thumb:
The CNT register is a read only one, isn't it?
Is there someone who can explain me what does the pasm instruction MOV CNT,CNT.:thumb:
The CNT register is a read only one, isn't it?
Comments
Example?
Or this one: writes cnt to hub (the system counter that is), same as
Bean
"Only in the source slot of an instruction (mov cnt, cnt)."
May i understand the CNT register is read only, only in the source slot of an instruction????
"Using it in the destination slot (mov cnt, cnt) will access its shadow register which is r/w."
Hum! how to write into the shadow register?
"Only in the source slot of an instruction (mov cnt, cnt)."
May i understand the CNT register is read only, only in the source slot of an instruction????
"Using it in the destination slot (mov cnt, cnt) will access its shadow register which is r/w."
Hum! how to write into the shadow register?
Sorry, how to read the shadow register?
But you should be able to do CMP to see if it is equal to a value, or above or below a value.
Bean
One is the "real" one, the other one is just like any other cog ram location.
The read-only one can only be accessed on the "source" location of a pasm command: xxx ddd,sss
If you write to it you are writing to ram, and the word CNT is just a reserved word that now will be a generic ram location instead.
Writing to Hub ram with the d-field as source does not count as read-only, as the rule is d or s side.
Is the following true ?
The running system clock counter can be read using CNT address as the source field of an instruction and not the CNT shadow register.
An aptempt to write using CNT address as destination field of an instruction, can't write the running system clock counter but instead write to the content of the CNT shadow register. As well, using CNT address as destination field of an instruction cause the CNT shadow register to be read if the instruction used do something like "D <- D op S"
ie : MOV CNT,CNT affect the CNT shadow register with a snapshot of the running system clock counter
and MOV CNT, #2 affect the CNT shadow register with 2
and also ADD CNT, #1 read the CNT shadow register (2) add 1 and store the result (3) in the CNT shadow register.
Interresting, and what is the result of WRLONG CNT, H1 and RDLONG H2,CNT?
RDLONG H2,CNT......... will read hub location that CNT is pointing to (not useful, as that is ever increasing number)
The HUB-OP WRLONG is not a xxx sss,sss command, as that does not exist.
WRLONG is a RDLONG with NR flag set.
and underlying HUB circuit intervene and make the "source",source writes.
Tonyp12, thank for all your explanation (thank you everybody too). Now, all about "MOV CNT,CNT" is quiet clear for me.
WRLONG CNT,H1 will write the shadow to a hub address. Thus, this is a way to read shadows registers.This let me understand some Kuruneko's examples code an its reply about Mister Bean's (sorry , it's a joke so much easy to do) DJNZ example ("Yes. The only disadvantage is you can't access the loop index directly. ")
MERCI BEAUCOUP A VOUS TOUS
learning alone can be sometime a great satisfaction, but more than once very hard.
I have seen him using PHSA in this way, as you can get it to do 1/8 clock rate etc and also give it a start number.