11.07.2015 Views

section 7 - Index of

section 7 - Index of

section 7 - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ENDDO End Current DO Loop ENDDOOperation:SSL(LF) ~ SR;SP - 1 ~ SPSSH ~ LA; SSL ~ LC;SP -1 ~ SPAssembler Syntax:ENDDODescription: Terminate the current hardware DO loop before the current loop counter(LC) equals one. If the value <strong>of</strong> the current DO loop counter (LC) is needed, it must beread before the execution <strong>of</strong> the ENDDO instruction. Initially, the loop flag (LF) isrestored from the system stack and the remaining portion <strong>of</strong> the status register (SR) andthe program counter (PC) are purged from the system stack. The loop address (LA) andthe loop counter (LC) registers are then restored from the system stack.Restrictions: Due to pipelining and the fact that the ENDDO instruction accesses theprogram controller registers, the ENDDO instruction must not be immediately precededby any <strong>of</strong> the following instructions:Immediately before ENDDOMOVEC to LA, LC, SR, SSH, SSL, or SPMOVEM to LA, LC, SR, SSH, SSL, or SPMOVEP to LA, LC, SR, SSH, SSL, or SPMOVEC from SSHMOVEM from SSHMOVEP from SSHORIMRANDI MRREPAlso, the ENDDO instruction cannot be the last (LA) instruction in a DO loop.Example:DOYO,NEXTMOVECLC,ACMPY1,AJNE ONWARDENDDOJMP NEXTONWARDNEXT MOVE #$123456,X1;exec. loop ending at NEXT (YO) times;get current value <strong>of</strong> loop counter (LC);compare loop counter with value in Y1;go to ONWARD if LC not equal to Y1;LC equal to Y1, restore all DO registers;go to NEXT;LC not equal to Y1, continue DO loop;(Iast instruction in DO loop);(first instruction AFTER DO loop)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!