Two infinity loops at the same time

48 views Asked by At

recently I have been coding a game a wanted to make a 1v1 version but after adding the two-player I realized that when I make a player move (Infinty loop) the other player stops moving to let the loop run and vice versa.

proc temp1
MOV cx, [FstX]       ; FstX-coordinate of the snake head
    MOV dx, [FstY]       ; FstY-coordinate of the snake head
    MOV SI, 0
    MOV DI, 0
    MOV AL, 5         ; MAGENTA green (you can choose a different color)

    draw_row_loop1:
        draw_pixel_loop1:
            INC cx
            INC DI
            
            INT 10h
            CMP DI, [FstBody] 
            JNE draw_pixel_loop1
            
            SUB cx, [FstBody]
            MOV DI, 0
            INC dx
            INC SI
            
            CMP SI, [FstBody] 
            JNE draw_row_loop1
ret 
        endp temp1


    proc temp
     MOV cx, [FstX]       ; FstX-coordinate of the snake head
    MOV dx, [FstY]       ; FstY-coordinate of the snake head
    MOV SI, 0
    MOV DI, 0
    MOV AL, 5         ; MAGENTA green (you can choose a different color)

    draw_row_loop1:
        draw_pixel_loop1:
            INC cx
            INC DI
            
            INT 10h
            CMP DI, [FstBody] 
            JNE draw_pixel_loop1
            
            SUB cx, [FstBody]
            MOV DI, 0
            INC dx
            INC SI
            
            CMP SI, [FstBody] 
            JNE draw_row_loop1



    ret
endp temp

everything works but they stop each other.
PROC draw
call temp
call temp1

    RET
ENDP draw

tried to move them to a different proc tried to use both in label couldn't find an answer and nothing worked they just overwrite eachother

0

There are 0 answers