Bona Fide OS Development
http://forums.osdever.net/

Initialization and Usage Tricks
http://forums.osdever.net/viewtopic.php?f=13&t=3417
Page 1 of 1

Author:  ~ [ Mon Jan 18, 2021 9:50 pm ]
Post subject:  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

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/