Graphical analog clock written in Assembly

A screenshot of the clock running on DOSBox.

A screenshot of the clock running on DOSBox.

While I took a course about microprocessor architecture at college, I worked on a program that showed time in analog and digital format. The code was written in assembly language (MASM in particular). I did not write the code from scratch. The original code is available from multiple Chinese websites. I have not been able to determine the original writer.

The original code consisted of a customizable analog clock. It used basic DOS interrupts to draw the graphics. Its size and colour could be changed during runtime. It also had some sound functionality. The code was written for Intel’s 80286 processor and a compatible version of DOS. The program ran fine as long as one did not play with the its customizable features.

I removed the buggy features from the code and added some new (non-buggy) ones. I stripped the code of runtime customizations and sound. And I added a needle for milliseconds, along with a digital clock. I used MASM 6.15 to compile the code. The program can be run in Windows XP. For newer versions of windows, a virtual machine is not able to run it very smoothly. A better option is DOSBox. Be sure to set cycles=max in the configuration file (options).

Following is a simple flowchart for the code.

Flowchart for the clock's assembly code.

Flowchart for the clock’s assembly code.

Download the source: masm-clock at GitHub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s