User:Johnburger/Demo/Dev/Timer

From OSDev Wiki
Jump to navigation Jump to search

There's not much to the Timer chip. The most important thing is the frequency that it is clocked at - the values programmed into it are based off the crystal connected to it.

To save costs, the original IBM PC was designed around a single clock that was used for multiple purposes: the CPU, this timer, and even the video. 4.77 MHz was an odd number, but it could be factored down into the different rates required. This is where the final 18.2 times-a-second value came from in DOS to really complicate keeping track of the current Time-of-Day. And once this value was chosen, all updates to the PC had to perpetuate the odd value.

Demo/Dev/Timer.inc

;
; Dev/Timer.inc
;

; These are the definitions for the Programmable Interval Timer

Dev.Timer.Port  EQU             040h

Dev.Timer.ClockFreq EQU         4_772_728 / 4