Initialization and Usage Tricks
Code:
;Activate RTC IRQ by unmasking
;its corresponding bit (0 in PIC 2):
;;
;Read the bit mask:
;;
in al,0xA1
;Unmask bit 0 (IRQ8 for RTC):
;;
and al,11111110b
;Send the new bit mask:
;;
out 0xA1,al
;Now Install the ISR in the IDT, IRQ8:
;;
; AL == Interrupt Number
; EBX == Entry point of our ISR
;;
mov al,0x70 ;IRQ8, RTC installed at INT 0x70 in this example
mov ebx,OPCODE__IRQ8__RTC_handler ;Function name
call IDT_x86_32__InstallISR
Code:
align wideword_sz
OPCODE__IRQ8__RTC_handler:
;Update BDA 24 hour second counter:
;;
inc dword[0x46C]
cmp dword[0x46C],(24*60*60)
jb .noupdflag
mov dword[0x46C],0 ;Reset 24 hour counter
mov dword[0x470],1 ;Set 24 hour flag (needs to be set to 0 manually)
align wideword_sz
.noupdflag:
iretwide