Search code examples
assemblyx86-16tasm

Loop statement in assembly error


I've built an assembly program and when I try to loop a label, compile (with 0 errors) and execute, I get this error :

    ntvdm cpu has encountered an illegal instruction

So I remove the code into the label, but i still get that error! And if I remove the loop statement, the program works

Haven't the loop statement the following sintax?

    mov  cx,5
    loop foo
    ;execute foo  5 times

Solution

  • Where's "foo"?

    Should be something like:

    mov cx,5
    foo:
    ;do stuff
    loop foo