~hangman8086-devs/hangman8086/competition-mode

2 by Fabien LOISON
* Code refactored
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;      __   __  _______  __    _  _______  __   __  _______  __    _       ;;
3
;;     |  | |  ||   _   ||  |  | ||       ||  |_|  ||   _   ||  |  | |      ;;
4
;;     |  |_|  ||  |_|  ||   |_| ||    ___||       ||  |_|  ||   |_| |      ;;
5
;;     |       ||       ||       ||   | __ |       ||       ||       |      ;;
6
;;     |       ||       ||  _    ||   ||  ||       ||       ||  _    |      ;;
7
;;     |   _   ||   _   || | |   ||   |_| || ||_|| ||   _   || | |   |      ;;
8
;;     |__| |__||__| |__||_|  |__||_______||_|   |_||__| |__||_|  |__|      ;;
9
;;                                                                          ;;
10
;;                                                                          ;;
11
;;  HANGMAN - An implementation of the Hang Man game in assembly (Emu8086)  ;;
12
;;                                                                          ;;
13
;;  Copyright (C) 2011  Fabien LOISON                                       ;;
14
;;  Copyright (C) 2011  Mathilde BOUTIGNY                                   ;;
15
;;  Copyright (C) 2011  Vincent PEYROUSE                                    ;;
16
;;  Copyright (C) 2011  Germain CARRÉ                                       ;;
17
;;  Copyright (C) 2011  Matthis FRENAY                                      ;;
18
;;                                                                          ;;
19
;;  HangMan is free software: you can redistribute it and/or modify         ;;
20
;;  it under the terms of the GNU General Public License as published by    ;;
21
;;  the Free Software Foundation, either version 3 of the License, or       ;;
22
;;  (at your option) any later version.                                     ;;
23
;;                                                                          ;;
24
;;  This program is distributed in the hope that it will be useful,         ;;
25
;;  but WITHOUT ANY WARRANTY; without even the implied warranty of          ;;
26
;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           ;;
27
;;  GNU General Public License for more details.                            ;;
28
;;                                                                          ;;
29
;;  You should have received a copy of the GNU General Public License       ;;
30
;;  along with this program.  If not, see <http://www.gnu.org/licenses/>.   ;;
31
;;                                                                          ;;
32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33
34
35
;;
36
;; This is the main file of the program, contain the initialisation of the
37
;; program, the includes, and the _main() function.
38
;;
39
40
41
42
;=================================================================== Init ====
43
name "HANGMAN"  ;Output file name
44
org  0x100      ;Set location counter to 0x100
3.1.2 by Fabien LOISON
* TUI implemented
45
jmp _main       ;Jump to _main
46
47
48
49
;============================================================== Constants ====
2 by Fabien LOISON
* Code refactored
50
COLS equ 80     ;Terminal width
51
ROWS equ 25     ;Terminal height
52
3.1.4 by Fabien LOISON
* New sounds added for the menu
53
COLOR_HEADER equ 00101111b  ;Color of the Header an help area
54
COLOR_ACTIVE equ 00001111b  ;Color of the Menu/Game/Animation area
55
COLOR_CURSOR equ 00000010b  ;Color of the menu cursor
8 by Fabien LOISON
* Input field implemented
56
COLOR_FIELD  equ 00101111b  ;Color of the input fields
13 by Fabien LOISON
* Scorebar implemented
57
COLOR_SCORE  equ 00000010b  ;Color of the score bar
2 by Fabien LOISON
* Code refactored
58
59
60
61
;=============================================================== Includes ====
3.1.3 by Fabien LOISON
* Startup screen implemented
62
;CODE
63
include "mainfunc.asm" ;Contains the functions used everywhere in the program.
64
include "mainmenu.asm" ;Contains the functions of the main menu.
3.1.5 by Fabien LOISON
* ASCII Art exported in a separate file (asciiart.res)
65
include "playsnd.asm"  ;Contains the function for playing sounds.
3.1.3 by Fabien LOISON
* Startup screen implemented
66
include "stscreen.asm" ;Contains the function that print the startup screen.
5.1.1 by Fabien LOISON
* Gibbet ASCII Art added
67
include "game.asm"     ;Contains the game functions.
5.1.4 by Fabien LOISON
* Bug fix in _main_menu()
68
include "singlepl.asm" ;Contains the single player mode.
6.1.1 by Fabien LOISON
* Option menu implemented
69
include "options.asm"  ;Contains the options menu.
9 by Fabien LOISON
* Mode selection menu implemented
70
include "modesel.asm"  ;Contains the mode selection menu.
3.1.3 by Fabien LOISON
* Startup screen implemented
71
72
;RESOURCE
5.1.12 by Fabien LOISON
* Some code/comment improvement...
73
include "asciiart.res" ;Contains the ASCII art of the game.
3.1.5 by Fabien LOISON
* ASCII Art exported in a separate file (asciiart.res)
74
include "sounds.res"   ;Contains the sounds.
5.1.1 by Fabien LOISON
* Gibbet ASCII Art added
75
include "words.res"    ;Contains the word list for the single player mode.
2 by Fabien LOISON
* Code refactored
76
77
78
79
;================================================================ _main() ====
80
;; The main function.
81
3.1.2 by Fabien LOISON
* TUI implemented
82
2 by Fabien LOISON
* Code refactored
83
_main:
84
85
;Set the video mode to 80x25, 16 colors, 8 pages
86
mov ah, 0x00
87
mov al, 0x03
88
int 0x10
89
90
;Hide the cursor
91
mov ah, 0x01
92
mov ch, 32
93
int 0x10
94
3.1.4 by Fabien LOISON
* New sounds added for the menu
95
;Disable consol blinking and enable intensive colors
3.1.2 by Fabien LOISON
* TUI implemented
96
mov ax, 0x1003
97
mov bx, 0
98
int 0x10
99
2 by Fabien LOISON
* Code refactored
100
;Let's go !
3.1.3 by Fabien LOISON
* Startup screen implemented
101
call _print_startup_screen
102
103
mov SOUND, offset SND_START
104
call _play_sound
105
2 by Fabien LOISON
* Code refactored
106
call _main_menu
3.1.3 by Fabien LOISON
* Startup screen implemented
107
3.1.1 by Fabien LOISON
* clear_screen function impemented
108
call _clear_screen
2 by Fabien LOISON
* Code refactored
109
110
;Exit
111
mov ah, 0x4C
112
int 0x21
113
114