SMOVU

Transferring a string

SMOVU

Strings MOVe while Unequal to zero


[Syntax]

SMOVU

 

[Operation]

unsigned char *R1, *R2, tmp;

unsigned long R3;

while ( R3 != 0 ) {

tmp = *R2++;

*R1++ = tmp;

R3--;

if ( tmp == '\0' ) {

break;

}

}

Note

If this instruction is executed with R3 set to 0, it is ignored and has no effect on registers and flags.

[Function]

This instruction transfers strings successively from the source address specified by R2 to the higher destination addresses specified by R1 until the null character "\0" (= 00h) is detected, with the number of bytes specified by R3 as the upper limit. String transfer is completed after the null character has been transferred.

In execution of the instruction, data may be prefetched from the source address specified by R2, with R3 as the upper limit. For details of the data size to be prefetched, refer to the hardware manual of each product.

The destination address specified by R1 should not be included in the range of data to be prefetched, which starts from the source address specified by R2.

The contents of R1 and R2 are undefined upon completion of the instruction.

An interrupt request during execution of this instruction will be accepted, so processing of the instruction will be suspended. That is, execution of the instruction will continue on return from the interrupt processing routine. However, be sure to save the contents of the R1, R2, R3, and PSW when an interrupt is generated and restore them when execution is returned from the interrupt routine.

 

[Instruction Format]

Syntax

Processng Size

Code size

(Byte)

SMOVU

B

2

[Flag Change]

-

This instruction does not affect the states of flags.

 

[Description Example]

SMOVU