Сборка х86 - проблемы с кодом
У меня есть свой проект на завтра, и я закончил его, но у меня все еще есть некоторые ошибки, которые я не могу понять, как их исправить. Я давно сижу и просто не знаю что делать. Я объясню код после.
* Примечание. Этот пост очень длинный, но мне очень нужна помощь. Если кто-то действительно хочет мне помочь, у меня есть Skype.
Я загружу около половины своего кода, потому что другая половина 100% работает:
proc CheckIfPlayer1Won
Row1:
cmp [FirstColumnArray], 1
je Continue1Row1
jmp Row2
Continue1Row1:
cmp [SecondColumnArray], 1
je Continue2Row1
jmp Row2
Continue2Row1:
cmp [ThirdColumnArray], 1
je Continue3Row1
jmp Row2
Continue3Row1:
cmp [FourthColumnArray], 1
je Player1WinnerAnnounce1
jmp Row2
Row2:
cmp [FirstColumnArray + 1], 1
je Continue1Row2
jmp Row3
Continue1Row2:
cmp [SecondColumnArray + 1], 1
je Continue2Row2
jmp Row3
Continue2Row2:
cmp [ThirdColumnArray + 1], 1
je Continue3Row2
jmp Row3
Continue3Row2:
cmp [FourthColumnArray + 1], 1
je Player1WinnerAnnounce1
jmp Row3
Row3:
cmp [FirstColumnArray + 2], 1
je Continue1Row3
jmp Row4
Continue1Row3:
cmp [SecondColumnArray + 2], 1
je Continue2Row2
jmp Row4
Continue2Row3:
cmp [ThirdColumnArray + 2], 1
je Continue3Row2
jmp Row4
Continue3Row3:
cmp [FourthColumnArray + 2], 1
je Player1WinnerAnnounce1
jmp Row4
Row4:
cmp [FirstColumnArray + 3], 1
je Continue1Row4
jmp Column1
Continue1Row4:
cmp [SecondColumnArray + 3], 1
je Continue2Row4
jmp Column1
Continue2Row4:
cmp [ThirdColumnArray + 3], 1
je Continue3Row4
jmp Column1
Continue3Row4:
cmp [FourthColumnArray + 3], 1
je Player1WinnerAnnounce1
jmp Column1
Player1WinnerAnnounce1:
mov dl, 22
mov dh, 12
mov ah, 2
mov bh, 0
int 10h
lea dx, [Player1Winner]
mov dx, offset Player1Winner
mov ah, 9
int 21h
jmp exit
Column1:
cmp [FirstColumnArray], 1
je Continue1Column1
jmp Column2
Continue1Column1:
cmp [FirstColumnArray + 1], 1
je Continue2Column1
jmp Column2
Continue2Column1:
cmp [FirstColumnArray + 2], 1
je Continue3Column1
jmp Column2
Continue3Column1:
cmp [FirstColumnArray + 3], 1
je Player1WinnerAnnounce2
jmp Column2
Column2:
cmp [SecondColumnArray], 1
je Continue1Column2
jmp Column3
Continue1Column2:
cmp [SecondColumnArray + 1], 1
je Continue2Column2
jmp Column3
Continue2Column2:
cmp [SecondColumnArray + 2], 1
je Continue3Column2
jmp Column3
Continue3Column2:
cmp [SecondColumnArray + 3], 1
je Player1WinnerAnnounce2
jmp Column3
Column3:
cmp [ThirdColumnArray], 1
je Continue1Column3
jmp Column4
Continue1Column3:
cmp [ThirdColumnArray + 1], 1
je Continue2Column3
jmp Column4
Continue2Column3:
cmp [ThirdColumnArray + 2], 1
je Continue3Column3
jmp Column4
Continue3Column3:
cmp [ThirdColumnArray + 3], 1
je Player1WinnerAnnounce2
jmp Column4
Column4:
cmp [FourthColumnArray], 1
je Continue1Column4
jmp DiagnolLine1
Continue1Column4:
cmp [FourthColumnArray + 1], 1
je Continue2Column4
jmp DiagnolLine1
Continue2Column4:
cmp [FourthColumnArray + 2], 1
je Continue3Column4
jmp DiagnolLine1
Continue3Column4:
cmp [FourthColumnArray + 3], 1
je Player1WinnerAnnounce2
jmp DiagnolLine1
Player1WinnerAnnounce2:
mov dl, 22
mov dh, 12
mov ah, 2
mov bh, 0
int 10h
lea dx, [Player1Winner]
mov dx, offset Player1Winner
mov ah, 9
int 21h
jmp exit
DiagnolLine1:
cmp [FirstColumnArray], 1
je Continue1DiagnolLine1
jmp DiagnolLine2
Continue1DiagnolLine1:
cmp [SecondColumnArray + 1], 1
je Continue2DiagnolLine1
jmp DiagnolLine2
Continue2DiagnolLine1:
cmp [ThirdColumnArray + 2], 1
je Continue3DiagnolLine1
jmp DiagnolLine2
Continue3DiagnolLine1:
cmp [FourthColumnArray + 3], 1
je Player1WinnerAnnounce3
jmp DiagnolLine2
DiagnolLine2:
cmp [FourthColumnArray], 1
je Continue1DiagnolLine2
jmp CheckPlayer1Number
Continue1DiagnolLine2:
cmp [ThirdColumnArray + 1], 1
je Continue2DiagnolLine2
jmp CheckPlayer1Number
Continue2DiagnolLine2:
cmp [SecondColumnArray + 2], 1
je Continue3DiagnolLine2
jmp CheckPlayer1Number
Continue3DiagnolLine2:
cmp [FirstColumnArray + 3], 1
je Player1WinnerAnnounce3
jmp CheckIfPlayer2Won
Player1WinnerAnnounce3:
mov dl, 22
mov dh, 12
mov ah, 2
mov bh, 0
int 10h
lea dx, [Player1Winner]
mov dx, offset Player1Winner
mov ah, 9
int 21h
jmp exit
ret
endp CheckIfPlayer1Won
proc CheckIfPlayer2Won
Row1T:
cmp [FirstColumnArray], 2
je Continue1Row1T
jmp Row2T
Continue1Row1T:
cmp [SecondColumnArray], 2
je Continue2Row1T
jmp Row2T
Continue2Row1T:
cmp [ThirdColumnArray], 2
je Continue3Row1T
jmp Row2T
Continue3Row1T:
cmp [FourthColumnArray], 2
je Player2WinnerAnnounce1
jmp Row2T
Row2T:
cmp [FirstColumnArray + 1], 2
je Continue1Row2T
jmp Row3T
Continue1Row2T:
cmp [SecondColumnArray + 1], 2
je Continue2Row2T
jmp Row3T
Continue2Row2T:
cmp [ThirdColumnArray + 1], 2
je Continue3Row2T
jmp Row3T
Continue3Row2T:
cmp [FourthColumnArray + 1], 2
je Player2WinnerAnnounce1
jmp Row3T
Row3T:
cmp [FirstColumnArray + 2], 2
je Continue1Row3T
jmp Row4T
Continue1Row3T:
cmp [SecondColumnArray + 2], 2
je Continue2Row3T
jmp Row4T
Continue2Row3T:
cmp [ThirdColumnArray + 2], 2
je Continue3Row3T
jmp Row4T
Continue3Row3T:
cmp [FourthColumnArray + 2], 2
je Player2WinnerAnnounce1
jmp Row4T
Row4T:
cmp [FirstColumnArray + 3], 2
je Continue1Row4T
jmp Column1T
Continue1Row4T:
cmp [SecondColumnArray + 3], 2
je Continue2Row4T
jmp Column1T
Continue2Row4T:
cmp [ThirdColumnArray + 3], 2
je Continue3Row4T
jmp Column1T
Continue3Row4T:
cmp [FourthColumnArray + 3], 2
je Player2WinnerAnnounce1
jmp Column1T
Player2WinnerAnnounce1:
mov dl, 22
mov dh, 12
mov ah, 2
mov bh, 0
int 10h
lea dx, [Player2Winner]
mov dx, offset Player2Winner
mov ah, 9
int 21h
jmp exit
Column1T:
cmp [FirstColumnArray], 2
je Continue1Column1T
jmp Column2T
Continue1Column1T:
cmp [FirstColumnArray + 1], 2
je Continue2Column1T
jmp Column2T
Continue2Column1T:
cmp [FirstColumnArray + 2], 2
je Continue3Column1T
jmp Column2T
Continue3Column1T:
cmp [FirstColumnArray + 3], 2
je Player2WinnerAnnounce2
jmp Column2T
Column2T:
cmp [SecondColumnArray], 2
je Continue1Column2T
jmp Column3T
Continue1Column2T:
cmp [SecondColumnArray + 1], 2
je Continue2Column2T
jmp Column3T
Continue2Column2T:
cmp [SecondColumnArray + 2], 2
je Continue3Column2T
jmp Column3T
Continue3Column2T:
cmp [SecondColumnArray + 3], 2
je Player2WinnerAnnounce2
jmp Column3T
Column3T:
cmp [ThirdColumnArray], 2
je Continue1Column3T
jmp Column4T
Continue1Column3T:
cmp [ThirdColumnArray + 1], 2
je Continue2Column3T
jmp Column4T
Continue2Column3T:
cmp [ThirdColumnArray + 2], 2
je Continue3Column3T
jmp Column4T
Continue3Column3T:
cmp [ThirdColumnArray + 3], 2
je Player2WinnerAnnounce2
jmp Column4T
Column4T:
cmp [FourthColumnArray], 2
je Continue1Column4T
jmp DiagnolLine1T
Continue1Column4T:
cmp [FourthColumnArray + 1], 2
je Continue2Column4T
jmp DiagnolLine1T
Continue2Column4T:
cmp [FourthColumnArray + 2], 2
je Continue3Column4T
jmp DiagnolLine1T
Continue3Column4T:
cmp [FourthColumnArray + 3], 2
je Player2WinnerAnnounce2
jmp DiagnolLine1T
Player2WinnerAnnounce2:
mov dl, 22
mov dh, 12
mov ah, 2
mov bh, 0
int 10h
lea dx, [Player2Winner]
mov dx, offset Player2Winner
mov ah, 9
int 21h
jmp exit
DiagnolLine1T:
cmp [FirstColumnArray], 2
je Continue1DiagnolLine1T
jmp DiagnolLine2T
Continue1DiagnolLine1T:
cmp [SecondColumnArray + 1], 2
je Continue2DiagnolLine1T
jmp DiagnolLine2T
Continue2DiagnolLine1T:
cmp [ThirdColumnArray + 2], 2
je Continue3DiagnolLine1T
jmp DiagnolLine2T
Continue3DiagnolLine1T:
cmp [FourthColumnArray + 3], 2
je Player2WinnerAnnounce3
jmp DiagnolLine2T
DiagnolLine2T:
cmp [FourthColumnArray], 2
je Continue1DiagnolLine2T
jmp CheckPlayer1Number
Continue1DiagnolLine2T:
cmp [ThirdColumnArray + 1], 2
je Continue2DiagnolLine2T
jmp CheckPlayer1Number
Continue2DiagnolLine2T:
cmp [SecondColumnArray + 2], 2
je Continue3DiagnolLine2T
jmp CheckPlayer1Number
Continue3DiagnolLine2T:
cmp [FirstColumnArray + 3], 2
je Player2WinnerAnnounce3
jmp CheckPlayer1Number
Player2WinnerAnnounce3:
mov dl, 22
mov dh, 12
mov ah, 2
mov bh, 0
int 10h
lea dx, [Player2Winner]
mov dx, offset Player2Winner
mov ah, 9
int 21h
jmp exit
ret
endp CheckIfPlayer2Won
proc CheckPlayer1Number
mov ah, 7
int 21h
cmp al, 31h
je CheckColumn1
cmp al, 32h
je CheckColumn2
cmp al, 33h
je MoveToCheckColumn3
cmp al, 34h
je MoveToCheckColumn4
jmp CheckPlayer1Number
endp CheckPlayer1Number
proc CheckColumn1
cmp [FirstColumnArray], 0
je ChangeColumn1Number1
cmp [FirstColumnArray + 1], 0
je ChangeColumn1Number2
cmp [FirstColumnArray + 2], 0
je ChangeColumn1Number3
cmp [FirstColumnArray + 3], 0
je ChangeColumn1Number4
jmp CheckPlayer1Number
endp CheckColumn1
proc ChangeColumn1Number1
inc [FirstColumnArray]
mov [Player1Drawx], 25h
mov [Player1Drawy], 85h
jmp DrawPlayer1Disc
endp ChangeColumn1Number1
proc ChangeColumn1Number2
inc [FirstColumnArray + 1]
mov [Player1Drawx], 25h
mov [Player1Drawy], 67h
jmp DrawPlayer1Disc
endp ChangeColumn1Number2
proc ChangeColumn1Number3
inc [FirstColumnArray + 2]
mov [Player1Drawx], 25h
mov [Player1Drawy], 47h
jmp DrawPlayer1Disc
endp ChangeColumn1Number3
proc ChangeColumn1Number4
inc [FirstColumnArray + 3]
mov [Player1Drawx], 25h
mov [Player1Drawy], 27h
jmp DrawPlayer1Disc
endp ChangeColumn1Number4
proc MoveToCheckColumn3
jmp CheckColumn3
endp MoveToCheckColumn3
proc MoveToCheckColumn4
jmp CheckColumn4
endp MoveToCheckColumn4
proc CheckColumn2
cmp [SecondColumnArray], 0
je ChangeColumn2Number1
cmp [SecondColumnArray + 1], 0
je ChangeColumn2Number2
cmp [SecondColumnArray + 2], 0
je ChangeColumn2Number3
cmp [SecondColumnArray + 3], 0
je ChangeColumn2Number4
jmp CheckPlayer1Number
endp CheckColumn2
proc ChangeColumn2Number1
inc [SecondColumnArray]
mov [Player1Drawx], 45h
mov [Player1Drawy], 85h
jmp DrawPlayer1Disc
endp ChangeColumn2Number1
proc ChangeColumn2Number2
inc [SecondColumnArray + 1]
mov [Player1Drawx], 45h
mov [Player1Drawy], 67h
jmp DrawPlayer1Disc
endp ChangeColumn2Number2
proc ChangeColumn2Number3
inc [SecondColumnArray + 2]
mov [Player1Drawx], 45h
mov [Player1Drawy], 47h
jmp DrawPlayer1Disc
endp ChangeColumn2Number3
proc ChangeColumn2Number4
inc [SecondColumnArray + 3]
mov [Player1Drawx], 45h
mov [Player1Drawy], 27h
jmp DrawPlayer1Disc
endp ChangeColumn2Number4
proc CheckColumn3
cmp [ThirdColumnArray], 0
je ChangeColumn3Number1
cmp [ThirdColumnArray + 1], 0
je ChangeColumn3Number2
cmp [ThirdColumnArray + 2], 0
je ChangeColumn3Number3
cmp [ThirdColumnArray + 3], 0
je ChangeColumn3Number4
jmp CheckPlayer1Number
endp CheckColumn3
proc ChangeColumn3Number1
inc [ThirdColumnArray]
mov [Player1Drawx], 65h
mov [Player1Drawy], 85h
jmp DrawPlayer1Disc
endp ChangeColumn3Number1
proc ChangeColumn3Number2
inc [ThirdColumnArray + 1]
mov [Player1Drawx], 65h
mov [Player1Drawy], 67h
jmp DrawPlayer1Disc
endp ChangeColumn3Number2
proc ChangeColumn3Number3
inc [ThirdColumnArray + 2]
mov [Player1Drawx], 65h
mov [Player1Drawy], 47h
jmp DrawPlayer1Disc
endp ChangeColumn3Number3
proc ChangeColumn3Number4
inc [ThirdColumnArray + 3]
mov [Player1Drawx], 65h
mov [Player1Drawy], 27h
jmp DrawPlayer1Disc
endp ChangeColumn3Number4
proc CheckColumn4
cmp [FourthColumnArray], 0
je ChangeColumn4Number1
cmp [FourthColumnArray + 1], 0
je ChangeColumn4Number2
cmp [FourthColumnArray + 2], 0
je ChangeColumn4Number3
cmp [FourthColumnArray + 3], 0
je ChangeColumn4Number4
jmp CheckPlayer1Number
endp CheckColumn4
proc ChangeColumn4Number1
inc [FourthColumnArray]
mov [Player1Drawx], 85h
mov [Player1Drawy], 85h
jmp DrawPlayer1Disc
endp ChangeColumn4Number1
proc ChangeColumn4Number2
inc [FourthColumnArray + 1]
mov [Player1Drawx], 85h
mov [Player1Drawy], 67h
jmp DrawPlayer1Disc
endp ChangeColumn4Number2
proc ChangeColumn4Number3
inc [FourthColumnArray + 2]
mov [Player1Drawx], 85h
mov [Player1Drawy], 47h
jmp DrawPlayer1Disc
endp ChangeColumn4Number3
proc ChangeColumn4Number4
inc [FourthColumnArray + 3]
mov [Player1Drawx], 85h
mov [Player1Drawy], 27h
jmp DrawPlayer1Disc
endp ChangeColumn4Number4
DrawPlayer1Loop:
mov bh,0h
mov cx,[Player1Drawx]
mov dx,[Player1Drawy]
mov al,[player1disccolor]
mov ah,0ch
int 10h
add [Player1Drawx], 1h
cmp cx, [Player1Drawx + 14h]
jl DrawPlayer1Loop
DrawPlayer1Disc:
mov bh, 0h
mov dx, [Player1Drawy]
add [Player1Drawy], 1h
cmp dx, [Player1Drawy + 14h]
jl DrawPlayer1Loop
jg GoToCheckIfPlayer1Won
proc GoToCheckIfPlayer1Won
call CheckIfPlayer1Won
jmp CheckPlayer2Number
endp GoToCheckIfPlayer1Won
proc CheckPlayer2Number
mov ah, 7
int 21h
cmp al, 31h
je Player2CheckColumn1
cmp al, 32h
je Player2CheckColumn2
cmp al, 33h
je MoveToCheck2Column3
cmp al, 34h
je MoveToCheck2Column4
jmp CheckPlayer2Number
endp CheckPlayer2Number
proc Player2CheckColumn1
cmp [FirstColumnArray], 0
je Change2Column1Number1
cmp [FirstColumnArray + 1], 0
je Change2Column1Number2
cmp [FirstColumnArray + 2], 0
je Change2Column1Number3
cmp [FirstColumnArray + 3], 0
je Change2Column1Number4
jmp CheckPlayer2Number
endp Player2CheckColumn1
proc Change2Column1Number1
add [FirstColumnArray], 2
mov [Player2Drawx], 25h
mov [Player2Drawy], 85h
jmp DrawPlayer2Disc
endp Change2Column1Number1
proc Change2Column1Number2
add [FirstColumnArray + 1], 2
mov [Player2Drawx], 25h
mov [Player2Drawy], 67h
jmp DrawPlayer2Disc
endp Change2Column1Number2
proc Change2Column1Number3
add [FirstColumnArray + 2], 2
mov [Player2Drawx], 25h
mov [Player2Drawy], 47h
jmp DrawPlayer2Disc
endp Change2Column1Number3
proc Change2Column1Number4
add [FirstColumnArray + 3], 2
mov [Player2Drawx], 25h
mov [Player2Drawy], 27h
jmp DrawPlayer2Disc
endp Change2Column1Number4
proc MoveToCheck2Column3
jmp Player2CheckColumn3
endp MoveToCheck2Column3
proc MoveToCheck2Column4
jmp Player2CheckColumn4
endp MoveToCheck2Column4
proc Player2CheckColumn2
cmp [SecondColumnArray], 0
je Change2Column2Number1
cmp [SecondColumnArray + 1], 0
je Change2Column2Number2
cmp [SecondColumnArray + 2], 0
je Change2Column2Number3
cmp [SecondColumnArray + 3], 0
je Change2Column2Number4
jmp CheckPlayer2Number
endp Player2CheckColumn2
proc Change2Column2Number1
add [SecondColumnArray], 2
mov [Player2Drawx], 45h
mov [Player2Drawy], 85h
jmp DrawPlayer2Disc
endp Change2Column2Number1
proc Change2Column2Number2
add [SecondColumnArray + 1], 2
mov [Player2Drawx], 45h
mov [Player2Drawy], 67h
jmp DrawPlayer2Disc
endp Change2Column2Number2
proc Change2Column2Number3
add [SecondColumnArray + 2], 2
mov [Player2Drawx], 45h
mov [Player2Drawy], 47h
jmp DrawPlayer2Disc
endp Change2Column2Number3
proc Change2Column2Number4
add [SecondColumnArray + 3], 2
mov [Player2Drawx], 45h
mov [Player2Drawy], 47h
jmp DrawPlayer2Disc
endp Change2Column2Number4
proc Player2CheckColumn3
cmp [ThirdColumnArray], 0
je Change2Column3Number1
cmp [ThirdColumnArray + 1], 0
je Change2Column3Number2
cmp [ThirdColumnArray + 2], 0
je Change2Column3Number3
cmp [ThirdColumnArray + 3], 0
je Change2Column3Number4
jmp CheckPlayer2Number
endp Player2CheckColumn3
proc Change2Column3Number1
add [ThirdColumnArray], 2
mov [Player2Drawx], 65h
mov [Player2Drawy], 85h
jmp DrawPlayer2Disc
endp Change2Column3Number1
proc Change2Column3Number2
add [ThirdColumnArray], 2
mov [Player2Drawx], 65h
mov [Player2Drawy], 67h
jmp DrawPlayer2Disc
endp Change2Column3Number2
proc Change2Column3Number3
add [ThirdColumnArray], 2
mov [Player2Drawx], 65h
mov [Player2Drawy], 47h
jmp DrawPlayer2Disc
endp Change2Column3Number3
proc Change2Column3Number4
add [ThirdColumnArray], 2
mov [Player2Drawx], 65h
mov [Player2Drawy], 27h
jmp DrawPlayer2Disc
endp Change2Column3Number4
proc Player2CheckColumn4
cmp [FourthColumnArray], 0
je Change2Column4Number1
cmp [FourthColumnArray + 1], 0
je Change2Column4Number2
cmp [FourthColumnArray + 2], 0
je Change2Column4Number3
cmp [FourthColumnArray + 3], 0
je Change2Column4Number4
jmp CheckPlayer2Number
endp Player2CheckColumn4
proc Change2Column4Number1
add [FourthColumnArray], 2
mov [Player2Drawx], 85h
mov [Player2Drawy], 85h
jmp DrawPlayer2Disc
endp Change2Column4Number1
proc Change2Column4Number2
add [FourthColumnArray], 2
mov [Player2Drawx], 85h
mov [Player2Drawy], 67h
jmp DrawPlayer2Disc
endp Change2Column4Number2
proc Change2Column4Number3
add [FourthColumnArray], 2
mov [Player2Drawx], 85h
mov [Player2Drawy], 47h
jmp DrawPlayer2Disc
endp Change2Column4Number3
proc Change2Column4Number4
add [FourthColumnArray], 2
mov [Player2Drawx], 85h
mov [Player2Drawy], 27h
jmp DrawPlayer2Disc
endp Change2Column4Number4
DrawPlayer2Loop:
mov bh,0h
mov cx,[Player2Drawx]
mov dx,[Player2Drawy]
mov al,[player2disccolor]
mov ah,0ch
int 10h
inc [Player2Drawx]
cmp cx, [Player2Drawx + 14h]
jl DrawPlayer2Loop
DrawPlayer2Disc:
mov bh, 0h
inc [Player2Drawy]
cmp dx, [Player2Drawy + 14h]
jl DrawPlayer2Loop
proc GoToCheckIfPlayer2Won
call CheckIfPlayer2Won
jmp CheckPlayer1Number
endp GoToCheckIfPlayer2Won
next:
; Wait for key press
mov ah,00h
int 16h
; Return to text mode
mov ah, 0
mov al, 2
int 10h
exit:
mov ax, 4c00h
int 21h
END start
Я делаю игру "Подключи четверых" (это очень простая игра, если ты не знаешь об этом, ее можно прочитать за 2 минуты). У меня две проблемы с моим кодом:
1 - чертежная часть, которая должна рисовать диски (квадрат). Вот как это выглядит, когда вы пытаетесь это сделать:
Проблема возникает в части рисования (DrawPlayer1Loop и DrawPlayer1Disc, конечно, это также происходит в Player2).
2 - игра должна переключаться между игроками, но по какой-то причине этого не происходит. Когда 1-й ход игрока заканчивается, он должен перейти к GoToCheckIfPlayer1Won. После этого он вызывает CheckPlayer1Won и проверяет, выиграл ли он. Если нет, он переходит к CheckPlayer2Number, который в основном переключает ход на второго игрока, но это не так.
Спасибо за помощь.
1 ответ
Сравните эти коды.
Для 1-го игрока:
DrawPlayer1Disc: mov bh, 0h mov dx, [Player1Drawy] add [Player1Drawy], 1h cmp dx, [Player1Drawy + 14h] jl DrawPlayer1Loop jg GoToCheckIfPlayer1Won . proc GoToCheckIfPlayer1Won
Для второго игрока:
DrawPlayer2Disc: mov bh, 0h inc [Player2Drawy] cmp dx, [Player2Drawy + 14h] jl DrawPlayer2Loop . proc GoToCheckIfPlayer2Won
Эти коды должны очень похожи друг на друга!
- В 1-м коде
jg GoToCheckIfPlayer1Won
избыточно Вы хотите провалиться, как только нарисована фигура. - Во втором коде вы не инициализируете регистр DX перед его использованием!
Я подозреваю, что везде, где вы написали `[... + 14h], вы думаете, что это число 14h является фактическим размером объекта. Если это так, то вы не можете сравнить это так, как вы.
mov dx, [Player1Drawy]
add [Player1Drawy], 1h
mov ax, dx
add ax, 14h ;This makes AX the position of the bottom side!
cmp dx, ax
jl DrawPlayer1Loop
Чтобы иметь возможность переключать пользователей, вам необходимо вернуться из процедур CheckIfPlayer1Won и ChackIfPlayer2Won:
je Player1WinnerAnnounce3
jmp CheckIfPlayer2Won <<<< Change into a RET instruction!
.
Player1WinnerAnnounce3:
также
je Player2WinnerAnnounce3
jmp CheckPlayer1Number <<<< Change into a RET instruction!
Player2WinnerAnnounce3: