pic.asm 1.04 KB
Newer Older
Ian Seyler's avatar
Ian Seyler committed
1 2
; =============================================================================
; Pure64 -- a 64-bit OS/software loader written in Assembly for x86-64 systems
3
; Copyright (C) 2008-2018 Return Infinity -- see LICENSE.TXT
Ian Seyler's avatar
Ian Seyler committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
;
; INIT PIC
; =============================================================================


init_pic:
	; Enable specific interrupts
	in al, 0x21
	mov al, 11111001b		; Enable Cascade, Keyboard
	out 0x21, al
	in al, 0xA1
	mov al, 11111110b		; Enable RTC
	out 0xA1, al

	; Set the periodic flag in the RTC
	mov al, 0x0B			; Status Register B
	out 0x70, al			; Select the address
	in al, 0x71			; Read the current settings
	push rax
	mov al, 0x0B			; Status Register B
	out 0x70, al			; Select the address
	pop rax
	bts ax, 6			; Set Periodic(6)
	out 0x71, al			; Write the new settings

	sti				; Enable interrupts

	; Acknowledge the RTC
	mov al, 0x0C			; Status Register C
	out 0x70, al			; Select the address
	in al, 0x71			; Read the current settings

	ret


; =============================================================================
; EOF