Tvùrce webu je i pro tebe! Postav tøeba web. Bez grafika. Bez kodéra. Hned.
wz

<< Back

cesky: , English:

TIMER

System timer

Intel 8254 system timer is a counter of 1193182 Hz clock signal (ports 40h to 43h). Counter 0 (port 40h) is used as system timer (counter of 55 ms impulses, timer period 65536). Counter 1 (port 41h) is reserved for DRAM memory refresh. Counter 2 (port 42h) is used to generate the tone for the built-in speaker.


TimerSetMode - initialize timer counter

INPUT:
AL =
timer mode (TIMER_MODE_CNT, ...)
CX = counter initial value (1 to 65535, 0 stands for 65536)
DL = counter index (0 to 2)

NOTES: On mode TIMER_MODE_GEN value of 1 is illegal. It temporaly disables interrupts. It takes aprox. 7 us.


TimerSetVal - set counter new initial value

INPUT:
CX = counter new init. value (1 to 65535, 0 stands for 65536)
DL = counter index (0 to 2)

NOTES: On mode TIMER_MODE_GEN value of 1 is illegal. It temporaly disables interrupts. It takes aprox. 4 us.


TimerGetVal - get counter current value

INPUT:
DL = counter index (0 to 2)

OUTPUT:
AX = counter current value

NOTES: It temporaly disables interrupts. It takes aprox. 7 us.


TimerGetOut - get counter ouput

INPUT:
DL = counter index (0 to 2)

OUTPUT:
AL = counter current output state (0 or 1)

NOTES: It temporaly disables interrupts. It takes aprox. 4 us.


Timer counter mode

TIMER_FREQ: (=1193182) TIMER frequency 1193181.667 Hz, = 1/3 of the NTSC color subcarrier
TIMER_IRQ: (=0) TIMER IRQ number

TIMER_BASE: (=40h) TIMER base register
TIMER_CTRL: (=TIMER_BASE+3) TIMER control register

counter mode:

TIMER_MODE_CNT: (=0) mode 0: countdown and interrupt
TIMER_MODE_SHT: (=1) mode 1: hw retriggerable one-shot
TIMER_MODE_GEN: (=2) mode 2(6): rate generator
TIMER_MODE_SQR: (=3) mode 3(7): square wave
TIMER_MODE_SWS: (=4) mode 4: sw triggered strobe
TIMER_MODE_HWS: (=5) mode 5: hw triggered strobe

TIMER_MODE_MAX: (=7) maximal mode number


Source code TIMER.ASM

<< Back