Advertisement
Guest User

Untitled

a guest
Feb 13th, 2019
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %include "macros.inc"
  2.  
  3. section .data
  4.     pit_count       dq      0
  5.  
  6.     format_str      db      "Current timer count: %ld\n", 0
  7.  
  8. section .text
  9.  
  10. extern printf, pic_master_eoi
  11. global pit_interrupt
  12.  
  13.  
  14.  
  15. pit_interrupt:
  16.     pushaq
  17.     mov rax, [pit_count]
  18.     inc rax
  19.     mov [pit_count], rax
  20.  
  21.     and rax, 256            ; display message every ~2.5s (assuming PIT has a period of 10ms)
  22.     jnz .done
  23.  
  24.     mov rcx, format_str
  25.     mov rdx, pit_count
  26.     call printf
  27.  
  28.     .done:
  29.     call pic_master_eoi
  30.     popaq
  31.     iretq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement