The Snake Game – DOS Edition is a retro-inspired implementation of the classic Snake game, designed for the DOS environment using Turbo C.
It features keyboard interrupts, direct cursor manipulation, custom ASCII graphics, and even sound effects for a nostalgic arcade feel 🎮.
This project brings the Snake Game to life in a DOS environment.
It leverages low-level hardware interrupts, cursor control, and direct screen drawing to simulate an interactive game experience.
The game includes:
- Snake movement with arrow keys
- Food spawning with ASCII art 🍎
- Walls as obstacles
- Music and scoring
- Cursor control following the snake’s head
- 🎮 Real-time Snake Movement with keyboard interrupt handler
- 🍏 ASCII Art Food (a small apple drawn with characters)
- 🧱 Walls & Obstacles dynamically spawned
- 🎶 Retro Music Support
- 📊 Score Tracking
- ⚡ Fast Rendering with display buffer (
display_draft) - ⌨️ Low-level Keyboard Handler
- Use Arrow Keys to move the snake.
- Eat the apple to grow and increase your score.
- Avoid crashing into the walls or yourself.
- Enjoy the retro sound effects and cursor tracking.
| Category | Technologies |
|---|---|
| Language | C (Turbo C, Borland C) |
| Platform | DOS |
| Graphics | ASCII Characters + Drafting |
| Input | Keyboard Interrupt Handler |
| Sound | Turbo C <dos.h> + speaker |
| IDE | Turbo C / DOSBox-X |
### 1. Clone the project
git clone https://github.com/KoganTheDev/DOSBOX_Snake-RTOS-project.git
### 2. Open in Turbo C (or DOSBox-X with TCC) and run the batch file from src which runs the game| Module | Summary |
|---|---|
| dosbox_snake.c | Main loop |
| clock.c | Controls the game`s timer and ticking speed using interrupts |
| cursor.c | Controls the hardware text cursor (block mode + follow snake’s head). |
| food.c | Spawns, draws, and checks collisions with food (ASCII apple). |
| snake.c | Manages snake movement, growth, and self-collision detection. |
| wall.c | Spawns walls as obstacles in the play area. |
| music.c | Handles retro sound effects and background music. |
| score.c | Tracks and updates player score. |
| screens.c | Displays welcome, game, and game-over screens. |
| keyboard.c | Interrupt-driven keyboard input handling. |
| game_management.c | Orchestrates updates and rendering. |
| colors | Handles the colors for the game screen |
| Yuval Kogan |
|
|
| Almog Raz |
|
|
| Ron Salama |
|
|