A 16-bit x86 assembly program that displays a real-time digital clock in VGA graphics mode on DOS systems. Written for educational purposes to demonstrate low-level graphics programming and system time access.
This program creates a digital clock display that:
- Switches the display to 640×480, 16-color VGA graphics mode
- Reads the current system time from DOS
- Draws digital clock digits using custom line-drawing routines
- Displays hours, minutes, and seconds in HH:MM:SS format
- Updates the display in real-time as time changes
- Uses pixel-level graphics to render seven-segment style digits
The clock runs continuously, updating the display whenever the seconds change, providing a live digital timepiece in a retro graphics environment.
- Turbo Assembler (TASM) 5.0 - for assembling the source code
- Turbo Linker (TLINK) - for linking the object file into an executable
- DOSBox (recommended) - DOS emulator for modern systems
- FreeDOS or MS-DOS - on real hardware or virtual machine
- VGA-compatible graphics adapter - supports 640×480, 16-color mode
- 16-bit real-mode DOS environment
- VGA graphics capability (standard on most systems since the 1990s)
- Minimal memory requirements (uses small memory model)
-
Prepare directories on your host system:
C:\dos\ ├── bin\ (place TASM.EXE and TLINK.EXE here) └── src\ (place digi_clock.asm here) -
Launch DOSBox and mount the directories:
mount c c:\dos c: -
Build the program:
cd \src ..\bin\tasm digi_clock.asm ..\bin\tlink digi_clock.objThis creates
DIGI_CLOCK.EXE -
Run the clock:
digi_clock
When run, the program will:
- Clear the screen and switch to VGA graphics mode
- Display a framed area for the clock
- Show the current time as large digital numbers
- Update automatically as time progresses
- Continue running until manually terminated
Build Issues:
- Ensure TASM and TLINK are accessible in your PATH or use full paths
- Verify you're using TASM 5.0 or compatible version
Runtime Issues:
- Black screen: Ensure DOSBox supports VGA graphics mode
- Program doesn't start: Check that you're running in a DOS-compatible environment
- Graphics corruption: Verify VGA compatibility settings in DOSBox
DOSBox Configuration:
- Default DOSBox settings should work fine
- Ensure
machine=svga_s3or similar VGA-compatible setting - No special CPU speed or memory configuration needed
- Real-time updates: Reads system time using DOS interrupt 21h, function 2Ch
- Custom graphics: Draws digits using pixel-level line drawing routines
- VGA graphics mode: Uses standard 640×480, 16-color VGA mode
- Efficient rendering: Only updates display when time actually changes
This program demonstrates:
- 16-bit x86 assembly language programming
- VGA graphics programming techniques
- DOS system calls for time access
- Real-mode memory management
- Interrupt-based hardware interface programming
Perfect for learning about retro computing, low-level graphics, and DOS programming fundamentals.
Educational/demonstration code. Consider adding appropriate license if redistributing.