Equivalents to Z80 DJNZ instruction on other architectures?
Posted
by Justin Ethier
on Stack Overflow
See other posts from Stack Overflow
or by Justin Ethier
Published on 2010-02-22T03:20:24Z
Indexed on
2010/03/15
17:19 UTC
Read the original article
Hit count: 555
assembly
|instruction-set
First a little background. The z80 CPU has an instruction called DJNZ which can be used in a similar manner as a for
loop. Basically DJNZ decrements the B register and jumps to a label if not zero. For example:
ld b,96 ; erase all of the line
disp_version_erase_loop:
call _vputblank ; erase pixels at cursor (uses b reg)
djnz disp_version_erase_loop ; loop
Of course you can do the same thing using regular comparison and jump instructions, but often it is handy to use the single instruction.
With that out of the way, my question is, do other CPU architectures include a similar control instruction?
© Stack Overflow or respective owner