From 7eb87bf3f3fa6226657a7106eb255cbfa97758d2 Mon Sep 17 00:00:00 2001 From: Miguel Date: Mon, 3 Sep 2018 15:18:16 +0200 Subject: big renaming --- asm/asm_pit.s | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 asm/asm_pit.s (limited to 'asm/asm_pit.s') diff --git a/asm/asm_pit.s b/asm/asm_pit.s new file mode 100644 index 0000000..8e16d0b --- /dev/null +++ b/asm/asm_pit.s @@ -0,0 +1,40 @@ +.global asm_pit_init +.global asm_pit_tick +.global asm_pit_get_ticks + +ticks: +.int 0 + +asm_pit_get_ticks: + + mov (ticks),%eax + ret + +asm_pit_tick: + + push %eax // persist + + // INC TICK COUNTER + mov $ticks, %eax + incl (%eax) + + pop %eax // load original + + ret + +asm_pit_init: + + // configure ticking 25 times a second + // 1193180 / 25 = 47727.2 + mov $47727, %dx + + mov $0b00110100, %al + outb %al,$0x43 + + mov %dx,%ax + + out %al, $0x40 + xchg %ah,%al + out %al, $0x40 + + ret -- cgit v1.2.3