Smaller loopsAssembler/8086

Sometimes there is a need for small nested loops. One solution:

        mov     cl,outer_cycle_num
outer_cycle:
        ; [ outer cycle code ]
        mov     ch,inner_cycle_num
inner_cycle:
        ; [ inner cycle code ]
        dec     ch
        jne     inner_cycle
        loop    outer_cycle
this is 2 bytes shorter than DEC CL/JNE combination.
Gem writer: Ervin Toth
last updated: 1998-03-16