🎮 Tic-Tac-Toe Assembly Game

Assembly DOS License

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

  1. Install DOSBox:

  2. 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
    
  3. Assemble and Link:

    MASM main.asm;
    LINK main.obj;
    

Option 2: Using DOSEMU (Linux)

  1. 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
    
  2. Setup and compile as described above

🎮 How to Run

  1. Start the game:

    MAIN.EXE
    
  2. Main Menu:

    • Press 1 - Start Human vs Human game
    • Press 2 - Exit game
    • Press ESC - Return to main menu during game
  3. 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

  1. "File not found" errors:

    • Ensure all .asm files are in the same directory
    • Check file paths in INCLUDE statements
  2. Graphics not displaying:

    • Verify VGA compatibility
    • Check video mode support
  3. No sound:

    • Ensure PC speaker is functional
    • Check DOS sound settings
  4. Mouse not working:

    • Install mouse driver (MOUSE.COM or similar)
    • Verify mouse hardware connection

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
ASM TicTacToe
Readme 693 KiB
Languages
Assembly 100%