🎮 Tic-Tac-Toe Assembly Game
A classic Tic-Tac-Toe game implemented in 8086 Assembly language with graphics, sound effects, and mouse support.
🎯 Features
- 🎨 Graphics Mode: VGA graphics with colorful display
- 🖱️ Mouse Support: Click-to-play interface
- 🔊 Sound Effects: PC speaker sound feedback
- 👥 Two Players: Human vs Human gameplay
- 🏆 Win Detection: Automatic win/draw detection
- 🎵 Game Over Sounds: Audio feedback for game completion
📋 Game Components
The project is organized into modular assembly files:
File | Purpose |
---|---|
main.asm |
Main program entry point and control flow |
game.asm |
Core game logic and win detection |
draw.asm |
Graphics rendering (circles, crosses, grid) |
sound.asm |
PC speaker sound effects |
logic.asm |
Mouse handling and timer interrupts |
data.asm |
Game variables and constants |
🛠️ Requirements
Software Requirements
- DOS-compatible system or DOS emulator (DOSBox recommended)
- MASM (Microsoft Macro Assembler) or compatible assembler
- LINK (Microsoft Linker)
- VGA-compatible graphics adapter
- Mouse driver (for mouse support)
Hardware Requirements
- 8086 or higher processor
- VGA graphics capability
- PC speaker (for sound effects)
- Mouse (optional but recommended)
🚀 Setup & Installation
Option 1: Using DOSBox (Recommended)
-
Install DOSBox:
- Download from DOSBox official website
- Install following the instructions for your OS
-
Setup DOS Development Environment:
# Mount your project directory mount C: E:\git\tictactoe C: # You'll need MASM and LINK utilities # These should be available in your DOS development environment
-
Assemble and Link:
MASM main.asm; LINK main.obj;
Option 2: Using DOSEMU (Linux)
-
Install DOSEMU:
sudo add-apt-repository ppa:dosemu2/ppa sudo apt update sudo apt install dosemu2
For older versions, you might need:
sudo apt-get install dosemu
-
Setup and compile as described above
🎮 How to Run
-
Start the game:
MAIN.EXE
-
Main Menu:
- Press
1
- Start Human vs Human game - Press
2
- Exit game - Press
ESC
- Return to main menu during game
- Press
-
Gameplay:
- Use mouse to click on grid squares
- Player 1 (X) plays first
- Players alternate turns
- First to get 3 in a row wins!
🎯 Game Rules
- Objective: Get three of your marks (X or O) in a row
- Winning Conditions:
- 3 in a row horizontally
- 3 in a row vertically
- 3 in a row diagonally
- Draw: All squares filled with no winner
🎨 Graphics & Sound
Graphics Features
- VGA Mode 12h: 640x480 16-color graphics
- Colorful Interface: Different colors for X's and O's
- Grid System: 3x3 clickable game board
- Pixel-perfect Drawing: Custom circle and cross rendering
Sound Features
- Place Sound: Feedback when placing X or O
- Game Over Sound: Victory/draw notification
- PC Speaker: Classic retro sound effects
🔧 Technical Details
Memory Model
- Small Model: Code and data in separate 64KB segments
- Stack: 256 bytes allocated
Interrupts Used
- INT 10h: Video services
- INT 21h: DOS services
- INT 33h: Mouse services
- INT 16h: Keyboard services
- INT 1Ch: Timer interrupt
Graphics Implementation
- Digital Differential Analyzer: For smooth circle drawing
- Pixel-level control: Direct VGA memory manipulation
- Color mapping: 16-color palette utilization
📁 File Structure
tictactoe/
├── main.asm # Main program entry point
├── game.asm # Game logic and rules
├── draw.asm # Graphics and drawing functions
├── sound.asm # Sound effects
├── logic.asm # Mouse and timer handling
├── data.asm # Variables and constants
├── MAIN.EXE # Compiled executable
├── MAIN.OBJ # Object file
├── MAIN.MAP # Memory map
└── readme.md # This file
🐛 Troubleshooting
Common Issues
-
"File not found" errors:
- Ensure all
.asm
files are in the same directory - Check file paths in INCLUDE statements
- Ensure all
-
Graphics not displaying:
- Verify VGA compatibility
- Check video mode support
-
No sound:
- Ensure PC speaker is functional
- Check DOS sound settings
-
Mouse not working:
- Install mouse driver (
MOUSE.COM
or similar) - Verify mouse hardware connection
- Install mouse driver (
Assembly Errors
- Ensure MASM version compatibility
- Check syntax for 8086 instruction set
- Verify memory model directives
👨💻 Author
Elmar Kresse - 19-INB-1 (2021)
🏆 Acknowledgments
- Circle drawing algorithm inspired by Digital Differential Analyzer
- Sound implementation reference: 8086 Assembly Sound Tutorial
- Classic DOS game development techniques
🎮 Screenshots
Game runs in VGA graphics mode with a colorful 3x3 grid interface
Enjoy playing this retro Tic-Tac-Toe game! 🎯
Description
Languages
Assembly
100%