StupidOS/kernel/pic.s

56 lines
616 B
ArmAsm
Raw Normal View History

2023-06-05 08:03:05 +00:00
; file: pic.s
;
2023-01-17 10:35:11 +00:00
[BITS 32]
2023-01-17 14:36:21 +00:00
PIC1_CMD equ 0x20
PIC1_DATA equ 0x21
PIC2_CMD equ 0xA0
PIC2_DATA equ 0xA1
2023-01-17 10:35:11 +00:00
section .text
2023-05-17 07:51:10 +00:00
; Function: setup_pic
;
; in:
; none
;
; out:
; none
;
2023-01-17 10:35:11 +00:00
global setup_pic
setup_pic:
mov al, 0x11
2023-01-17 14:36:21 +00:00
out PIC1_CMD, al
out PIC2_CMD, al
2023-01-17 10:35:11 +00:00
mov al, 0x20
2023-01-17 14:36:21 +00:00
out PIC1_DATA, al
2023-01-17 10:35:11 +00:00
mov al, 0x28
2023-01-17 14:36:21 +00:00
out PIC2_DATA, al
2023-01-17 10:35:11 +00:00
mov al, 4
2023-01-17 14:36:21 +00:00
out PIC1_DATA, al
2023-01-17 10:35:11 +00:00
mov al, 2
2023-01-17 14:36:21 +00:00
out PIC2_DATA, al
2023-01-17 10:35:11 +00:00
; mask all
mov al, 0xFF
2023-01-17 14:36:21 +00:00
out PIC1_DATA, al
out PIC2_DATA, al
ret
2023-05-17 07:51:10 +00:00
; Function: pic_eoi
;
; in:
; none
;
; out:
; none
;
2023-01-17 14:36:21 +00:00
global pic_eoi
pic_eoi:
mov al, 0x20
out PIC2_CMD, al
out PIC1_CMD, al
2023-01-17 10:35:11 +00:00
ret