source: xtideuniversalbios/trunk/Assembly_Library/Src/Time/SystemTimer.asm@ 572

Last change on this file since 572 was 526, checked in by krille_n_@…, 12 years ago

Changes:

  • Update of the copyright notices to include the year 2013.
File size: 2.2 KB
RevLine 
[256]1; Project name : Assembly Library
2; Description : Functions to operate with
3; 8254 Programmable Interval Timer.
4
[376]5;
[526]6; XTIDE Universal BIOS and Associated Tools
7; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]8;
9; This program is free software; you can redistribute it and/or modify
10; it under the terms of the GNU General Public License as published by
11; the Free Software Foundation; either version 2 of the License, or
12; (at your option) any later version.
[526]13;
[376]14; This program is distributed in the hope that it will be useful,
15; but WITHOUT ANY WARRANTY; without even the implied warranty of
16; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[526]17; GNU General Public License for more details.
[376]18; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[526]19;
[376]20
[256]21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
25; SystemTimer_IntializePreciseEventTimer
26; Parameters:
27; Nothing
28; Returns:
29; Nothing
30; Corrupts registers:
31; AX
32;--------------------------------------------------------------------
33ALIGN JUMP_ALIGN
34SystemTimer_IntializePreciseEventTimer:
35 STOP_PRECISE_EVENT_TIMER
36 OUTPUT_COUNTER_COMMAND_TO TIMER_2, READ_OR_WRITE_LSB_THEN_MSB, MODE_0_SINGLE_TIMEOUT, BINARY_COUNTER
37 xor ax, ax
38 WRITE_COUNT_FROM_AX_TO TIMER_2
39 ret
40
41
42;--------------------------------------------------------------------
43; This is how to use precise event timer:
44; 1. Call SystemTimer_IntializePreciseEventTimer
45; 2. Use START_PRECISE_EVENT_TIMER macro to start timer
46; 3. Use STOP_PRECISE_EVENT_TIMER to stop timer (optional)
[287]47; 4. Call SystemTimer_GetPreciseEventTimerTicksToAX to get event duration
[256]48;
[287]49; SystemTimer_GetPreciseEventTimerTicksToAX
[256]50; Parameters:
51; Nothing
52; Returns:
[287]53; AX: Event duration in timer ticks
[256]54; Corrupts registers:
55; Nothing
56;--------------------------------------------------------------------
57ALIGN JUMP_ALIGN
[287]58SystemTimer_GetPreciseEventTimerTicksToAX:
[256]59 OUTPUT_COUNTER_COMMAND_TO TIMER_2, LATCH, MODE_0_SINGLE_TIMEOUT, BINARY_COUNTER
60 READ_COUNT_TO_AX_FROM TIMER_2
61 neg ax ; 0 - count (Mode 0 counts toward zero)
62 ret
Note: See TracBrowser for help on using the repository browser.