This is a practice project (PP) for the course CSC 204 - Assembly in x86, which I took in the second semester of my second year. The goal was to deepen my understanding of x86 assembly programming by building a functional Pomodoro timer as a TSR (Terminate-Stay-Resident) program in real-mode DOS. It hooks into keyboard (IRQ1) and timer (IRQ0) interrupts to create an interactive countdown timer with work/rest cycles.
Stay tuned—I'll be dropping a detailed article soon explaining the code step-by-step, the challenges I faced (like handling interrupt chaining and short jump ranges), how I solved them, and key learnings from the project. Watch out for it!
- Countdown Timer: Starts at 25 minutes for work sessions, decrements in ~55ms ticks using the hardware timer.
- Modes: Toggles between active work (25 min) and resting (short: 5 min or long: 15 min after every 4 cycles).
- Controls:
- S, C, or Space: Start/toggle pause.
- P: Pause/unpause.
- R: Reset to 25:00:000.
- Display: Real-time update on VGA text mode (80x25 screen), showing MM:SS:MS format.
- TSR: Runs in the background as a memory-resident program.
- DOSBox: Emulator for running DOS programs (free and cross-platform).
- NASM: Netwide Assembler for compiling .asm to .com (download the DOS version and place
nasm.exein your project folder). - Basic familiarity with command-line tools.
-
Clone or download this repository.
-
Navigate to the project root (
cd pomodoroor similar). -
Copy the entire
pomodorofolder to your home directory (or an accessible root-like location for DOSBox mounting). Use these OS-specific commands:Ubuntu/Linux:
cp -r pomodoro ~macOS:
cp -r pomodoro ~Windows:
- Open Command Prompt as Administrator.
- Run:
xcopy pomodoro C:\pomodoro /E /I(createsC:\pomodorowith all files). - Alternatively, drag the
pomodorofolder toC:\via File Explorer.
-
Download and install DOSBox for your OS.
-
Download the DOS version of NASM, extract
nasm.exe, and copy it into yourpomodorofolder (e.g.,~/pomodoro/nasm.exeorC:\pomodoro\nasm.exe).
Configure DOSBox to mount your project folder as drive C:.
-
Launch DOSBox.
-
Run the configuration tool:
- Windows: Go to the DOSBox installation folder and double-click
DOSBox 0.74 Options.bat(opensdosbox-0.74-3.confin Notepad). - Ubuntu/Linux or macOS: Run
dosbox -editconfin terminal (opens the config file in your default editor).
- Windows: Go to the DOSBox installation folder and double-click
-
At the end of the
[autoexec]section, add these lines (adjust the path if yourpomodorofolder is elsewhere):mount c ~/pomodoro c:- Windows Note: Use
mount c c:\pomodoro(backslashes are fine in DOSBox config).
- Windows Note: Use
-
Save the file and restart DOSBox.
- Start DOSBox (it should auto-mount
C:to yourpomodorofolder and switch toC:prompt). - Compile the assembly code:
nasm pomodoro.asm -o pomodoro.com - Run the Pomodoro timer:
pomodoro.com- The screen will clear and display:
MIN : S : MSwith25 : 0 : 0. - Press S (or C/Space) to start the countdown.
- Use P to pause/unpause, R to reset.
- The screen will clear and display:
To quit: Close DOSBox or reboot the emulated DOS (type reboot at prompt, but TSRs may persist—full restart recommended).
To step through the code assembly:
afd pomodoro.com
- This uses the DOS DEBUG utility (
debug.exe—ensure it's in your DOSBox setup or mounted drive). - Commands:
t(trace),g(go),q(quit).
pomodoro.asm: Main assembly source code.pomodoro.com: Compiled executable (generated via NASM).README.md: This file.dosbox.conf(optional): Example config snippet—copy to your DOSBox setup if needed.
(Teaser: Covered in upcoming article!)
- Interrupt handling in real-mode (e.g., chaining IRQs without breaking DOS input).
- Short jump range errors in NASM.
- Precise timing with ~55ms decrements for smooth countdown.
- VGA text mode manipulation for real-time display.
MIT License—feel free to fork, modify, and learn!
Built with ❤️ for assembly enthusiasts. Questions? Open an issue!