Answers for "while loop in assembly"

3

do while loop in assembly

; WHILE LOOP:

        jmp loop1   ; Jump to condition first
cloop1  nop         ; Execute the content of the loop
loop1   cmp ax,1    ; Check the condition
        je cloop1   ; Jump to content of the loop if met


; DO-WHILE LOOP:

        mov ax,1
loop1   nop         ; Whatever you wanna do goes here
        cmp ax,1    ; Check wether cx is 1
        je loop1    ; And loop if equal
Posted by: Guest on October-10-2020

Browse Popular Code Answers by Language