How to read Assembly

Can anybody help me to explain the following sequence ? I only had some expericence in coding x86 Assembly.

#pragma asm
CLR TR0
MOV A,#K_Timer0IntervalCompLo
ADD A,TL0
MOV TL0,A
MOV A,#K_Timer0IntervalCompHi
ADDC A,TH0
MOV TH0,A
NOP
NOP
NOP
NOP
SETB TR0
#pragma endasm

Thanks.

EricLin
eric.yc.lin@liteon.com

Parents
  • These instructions stop 16-bit timer 0 to prevent its two 8-bit registers (TH0 and TL0) from changing while the MSB and LSB of a 16-bit "reload" constant (K_Timer0IntervalCompHi and K_Timer0IntervalCompLo) are added into that register pair. The NOPs presumably pad the timing out to match the reload, then the timer is started back up again.

Reply
  • These instructions stop 16-bit timer 0 to prevent its two 8-bit registers (TH0 and TL0) from changing while the MSB and LSB of a 16-bit "reload" constant (K_Timer0IntervalCompHi and K_Timer0IntervalCompLo) are added into that register pair. The NOPs presumably pad the timing out to match the reload, then the timer is started back up again.

Children
More questions in this forum