-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel.asm
82 lines (72 loc) · 2.1 KB
/
kernel.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ORG 0x7E00
jmp 0x0000:main
%define blackColor 0
%define blueColor 1
%define greenColor 2
%define cyanColor 3
%define redColor 4
%define magentaColor 5
%define brownColor 6
%define lightGrayColor 7
%define darkGrayColor 8
%define lightBlueColor 9
%define lightGreenColor 10
%define lightCyanColor 11
%define lightRedColor 12
%define lightMagentaColor 13
%define yellowColor 14
%define whiteColor 15
%include "functions.asm"
%include "data.asm"
%include "words.asm"
SECTION .bss
SECRET_WORD: resb 6 ; Aloca espaço para a palavra secreta
CURRENT_TRY: resb 6 ; Aloca espaço para a tentativa atual
SECTION .text
global main
;================================================ GAME ================================================
main:
call cleanRegs
call clearScreen
call initVideo
printTitle 0, 0, GAME_TITLE
call waitEnter
call initGame
call gameLoop
call endGame
jmp $
;------------------------- INICIALIZA O JOGO
initGame:
call cleanRegs
call clearScreen
call initTries
call setSecretWord
call printKeyboard
drawFiveSquares lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, ROW_X, ROW_Y_1
drawFiveSquares lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, ROW_X, ROW_Y_2
drawFiveSquares lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, ROW_X, ROW_Y_3
drawFiveSquares lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, ROW_X, ROW_Y_4
drawFiveSquares lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, ROW_X, ROW_Y_5
drawFiveSquares lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, lightGrayColor, ROW_X, ROW_Y_6
ret
;------------------------- JOGO RODANDO
gameLoop:
call playerTry
call updateGame
call checkWin
call incTries
mov cl, [NUM_TRIES]
cmp cl, 6
jge .endGameLoop
jmp gameLoop
.endGameLoop:
ret
;------------------------- FINALIZA O JOGO
endGame:
call cleanRegs
call clearScreen
printEnd 0, 0, LOSER_MESSAGE
printString 3, 17, SECRET_WORD, lightGreenColor
call waitEnter
call main
ret