section 7 - Index of
section 7 - Index of section 7 - Index of
REP Repeat Next Instruction REPOperation:Assembler Syntax:LC -+ TEMP; X:ea -+ LC REP X:eaRepeat next instruction until LC=1TEMP -+ LCLC -+ TEMP; X:aa -+ LC REP X:aaRepeat next instruction until LC=1TEMP -+ LCLC -+ TEMP; Y:ea -+ LC REP Y:eaRepeat next instruction until LC=1TEMP -+ LCLC -+ TEMP; Y:aa -+ LC REP Y:aaRepeat next instruction until LC=1TEMP -+ LCLC -+ TEMP; S -+ LC REP SRepeat next instruction until LC=1TEMP -+ LCLC -+ TEMP; #xxx -+ LC REP #xxxRepeat next instruction until LC=1TEMP -+ LCDescription: Repeat the single-word instruction immediately following the REPinstruction the specified number of times. The value specifying the number of times thegiven instruction is to be repeated is loaded into the 16-bit loop counter (LC) register.The single-word instruction is then executed the specified number of times, decrementingthe loop counter (LC) after each execution until LC=1. When the REP instruction is ineffect, the repeated instruction is fetched only one time, and it remains in the instructionregister for the duration of the loop count. Thus, the REP instruction is not InterruptIble (sequential repeats are also not interruptible). The current loop counter (LC) value isstored in an internal temporary register. If LC is set equal to zero, the instruction isrepeated 65,536 times. The instruction's effective address specifies the address of thevalue which is to be loaded into the loop counter (LC). All address register indirectaddressing modes may be used. The absolute short and the immediate short addressingmodes may also be used. The four MS bits of the 12-bit immediate value are zeroed toform the 16-bit value that is to be loaded into the loop counter (LC).
REP Repeat Next Instruction REPRestrictions: The REP instruction can repeat any single-word instruction· except theREP instruction itself and any instruction that changes program flow. The followinginstructions are not allowed to follow an REP instruction:Immediately after REPDOJccJCLRJMPJSETJSccJSCLRJSRJSSETREPRTIRTSSTOPSWIWAITENDDOAlso, a REP instruction cannot be the last instruction in a DO loop (at LA). The assemblerwill generate an error if any of the previous instructions are found immediately followingan REP instruction.Example:REPXO;repeat (XO) timesMAC X1 ,Y1 ,A X:(R1 )+,X1 Y:(R4)+,Y1 ;X1 *Y1 +A ~ A, update X1 ,Y1Before ExecutionXO~' _________ $0_00_10_0 __ ~After ExecutionX0l-' _________ $0_00_1_00 __ ~LC 1-1__________ $0_00_0 __--'Lci I-~ ________ $O_O_OO __---,
- Page 437 and 438: R:V Register and Y Memory Data Move
- Page 439 and 440: L: Long Memory Data Move L:Example:
- Page 441 and 442: L: Long Memory Data Move L:Instruct
- Page 443 and 444: X: Y: xv Memory Data Move X: Y:Exam
- Page 445 and 446: X: Y: xv Memory Data Move X: Y:S1 D
- Page 447 and 448: MOVEC Move Control Register MOVECst
- Page 449 and 450: MOVEC Move Control Register MOVECCo
- Page 451 and 452: MOVECMove Control RegisterMOVECInst
- Page 453 and 454: MOVEC Move Control Register MOVECTi
- Page 455 and 456: MOVEM Move Program Memory MOVEMoper
- Page 457 and 458: MOVEM Move Program Memory MOVEMInst
- Page 459 and 460: MOVEMMove Program MemoryMOVEMInstru
- Page 461 and 462: MOVEP Move Peripheral Data MOVEPist
- Page 463 and 464: MOVEP Move Peripheral Data MOVEPCon
- Page 465 and 466: MOVEP Move Peripheral Data MOVEPIns
- Page 467 and 468: MOVEP Move Peripheral Data MOVEPIns
- Page 469 and 470: MPY Signed Multiply MPYExplanation
- Page 471 and 472: MPY Signed Multiply MPYInstruction
- Page 473 and 474: MPYR Signed Multiply and Round MPYR
- Page 475 and 476: MPYR Signed Multiply and Round MPYR
- Page 477 and 478: NEGNegate AccumulatorNEGInstruction
- Page 479 and 480: NOPNo OperationNOPInstruction Forma
- Page 481 and 482: NORM Normalize Accumulator Iteratio
- Page 483 and 484: NOTLogical ComplementNOTInstruction
- Page 485 and 486: ORLogical Inclusive ORORInstruction
- Page 487: ORI OR Immediate with Control Regis
- Page 491 and 492: REPRepeat Next InstructionREPInstru
- Page 493 and 494: REPRepeat Next InstructionREPInstru
- Page 495 and 496: REP Repeat Next Instruction REPNote
- Page 497 and 498: RESETReset On-Chip Peripheral Devic
- Page 499 and 500: RND Round Accumulator RNDConvergent
- Page 501 and 502: RNDRound AccumulatorRNDInstruction
- Page 503 and 504: ROL Rotate Left ROLCondition Codes:
- Page 505 and 506: ROR Rotate Right RORCondition Codes
- Page 507 and 508: RTIReturn from InterruptRTIConditio
- Page 509 and 510: RTSReturn from SubroutineRTSInstruc
- Page 511 and 512: sec Subtract Long with Carry secExp
- Page 513 and 514: secSubtract Long with CarrysecInstr
- Page 515 and 516: STOPStop Instruction ProcessingSTOP
- Page 517 and 518: SUB Subtract SUBCondition Codes:S -
- Page 519 and 520: SUBL Shift Left and Subtract Accumu
- Page 521 and 522: SUBR Shift Right and Subtract Accum
- Page 523 and 524: SWISoftware InterruptSWICondition C
- Page 525 and 526: Tee Transfer Conditionally Teetion
- Page 527 and 528: Tee Transfer Conditionally TeeInstr
- Page 529 and 530: TFR Transfer Data ALU Register TFRC
- Page 531 and 532: TSTTest AccumulatorTSTInstruction F
- Page 533 and 534: WAIT Wait for Interrupt WAITConditi
- Page 535 and 536: including the number of words per i
- Page 537 and 538: 5. Compute final results.Thus, base
REP Repeat Next Instruction REPRestrictions: The REP instruction can repeat any single-word instruction· except theREP instruction itself and any instruction that changes program flow. The followinginstructions are not allowed to follow an REP instruction:Immediately after REPDOJccJCLRJMPJSETJSccJSCLRJSRJSSETREPRTIRTSSTOPSWIWAITENDDOAlso, a REP instruction cannot be the last instruction in a DO loop (at LA). The assemblerwill generate an error if any <strong>of</strong> the previous instructions are found immediately followingan REP instruction.Example:REPXO;repeat (XO) timesMAC X1 ,Y1 ,A X:(R1 )+,X1 Y:(R4)+,Y1 ;X1 *Y1 +A ~ A, update X1 ,Y1Before ExecutionXO~' _________ $0_00_10_0 __ ~After ExecutionX0l-' _________ $0_00_1_00 __ ~LC 1-1__________ $0_00_0 __--'Lci I-~ ________ $O_O_OO __---,