flat assembler
Message board for the users of flat assembler.

Index > OS Construction > [ask] IRQ error

Author
Thread Post new topic Reply to topic
christiandy



Joined: 03 Mar 2011
Posts: 25
Location: 101
christiandy
I'm making the kernel
I have trouble programming the IRQ
I mask int 2f int0x20 up with IRQ 0-15
IRQ 0-1 I just turn on the system timer and keyboard
my program is supposed to be true but I do not know where there is an error.
I tried using BIOS interrupt the program by returning to real mode, whether the effect on the IRQ?
Code:
start:    xor ebx,ebx
 mov bx,cs               ; BX=segment
        shl ebx,4               ; EBX=linear address of segment base
        mov eax,ebx
 mov [gdt1 + 2],ax
   mov [gdt2 + 2],ax
   mov [gdt3 + 2],ax
   shr eax,16
  mov [gdt1 + 4],al
   mov [gdt2 + 4],al
   mov [gdt3 + 4],al
   mov [gdt1 + 7],ah
   mov [gdt2 + 7],ah
   mov [gdt3 + 7],ah
; point gdtr to the gdt, point idtr to the idt
 add ebx,gdt             ; EBX=linear address of gdt
 mov [gdtr + 2],ebx
  add ebx,idt - gdt       ; EBX=linear address of idt
 mov [idtr + 2],ebx
  push bx
     push ax
     push dword 0
        popfd
; disable interrupts
       cli
; load GDT and IDT for full protected mode
   lgdt [gdtr]
 lidt [idtr]
; save real-mode CS in BP
    mov bp,cs
; set PE [protected mode enable] bit and go
    mov eax,cr0
 or al,1
     mov cr0,eax
 jmp SYS_CODE_SEL:do_pm
[bits 32]
%include "BIOSint.inc"
%include "Graphic.inc"
%include "keyboard.inc"
%include "keymapUK.inc"
do_pm: mov ax,SYS_DATA_SEL
 mov ds,ax               ; not segments anymore: SELECTORS
       mov ss,ax
   nop
 mov es,ax
   mov fs,ax
   mov ax,LINEAR_SEL
   mov gs,ax

mov al,0x11            ; put both 8259s in init mode
       out 0x20,al
 out 0xA0,al
 mov al,0x20             ; IRQ0-IRQ7 -> interrupts 0x20-0x27
      out 0x21,al
 add al,8
    out 0xA1,al             ; IRQ8-IRQ15 -> interrupts 0x28-0x2F
     mov al,4
    out 0x21,al
 mov al,2
    out 0xA1,al
 mov al,1
    out 0x21,al
 out 0xA1,al
 mov al,0xFC
 out 0x21,al
 mov al,0xFF             ; none
      out 0xA1,al

call setvga

waiting:
  jmp waiting
 
ISR20:

  pushad
      mov byte [gs:0xa0000],1
popad
call clearirq
iret
    


is there any wrong code in my interrupt masking code?
Post 13 Jul 2011, 13:11
View user's profile Send private message AIM Address Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
we don't see the rest of the code, then, what is call clearirq?

the syntax of your code is not compatible with fasm.

Code:
[bits 32]
%include "BIOSint.inc"
%include "Graphic.inc"
%include "keyboard.inc"
%include "keymapUK.inc"
    

becomes
Code:
use32
include "BIOSint.inc"
include "Graphic.inc"
include "keyboard.inc"
include "keymapUK.inc"
    

with fasm.
Post 13 Jul 2011, 14:32
View user's profile Send private message Visit poster's website Reply with quote
christiandy



Joined: 03 Mar 2011
Posts: 25
Location: 101
christiandy
I know, hmm i try compile with nasm and fasm but the interrupt doesn't work for hardware interrupt
Post 13 Jul 2011, 16:43
View user's profile Send private message AIM Address Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
My first guess is you need to enable interrupts using sti.
Post 13 Jul 2011, 18:45
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.