About 8259A

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tresss
Posts: 21
Joined: Thu Jul 06, 2006 10:52 pm

About 8259A

Post by tresss »

Idt:
%rep 0x20
;it's right now.but after changed it into 0x255, then error, why?
dw NotIdthandle
dw SelCode
db 0
db 0x8E
dw 0
%endrep





[BITS 16]
[ORG 0x8000]
jmp main


;∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑
;GDT定义.
;代码段及数据段整合.占用整个内存.
;∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑
GDT:
GdtNULL:
dw 0x0000
dw 0x0000
dw 0x0000
dw 0x0000
GdtCode:
dw 0xffff
dw 0x0000
dw 0x9a00 ;a为Type表示,执行,只读
dw 0x00cf
GdtData:
dw 0xffff
dw 0x0000
dw 0x9200 ;2为Type表示,读/写
dw 0x00cf

GdtReg dw GdtReg-GDT-1
dd GDT

SelCode equ GdtCode-GDT
SelData equ GdtData-GDT
;-------------------GDT定义结束--------------------

Idt:
%rep 0x20
;after changed it into 255, then error, why?
dw NotIdthandle
dw SelCode
db 0
db 0x8E
dw 0
%endrep

IdtReg dw IdtReg-Idt-1
dd Idt

main: ;内核跳转时将跳转地址赋予bx

;∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑
;
;8259中断编程处理
;
;∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑
mov al,0x11
out 0x20,al ;初始化ICW1
out 0xa0,al
mov al,0x20
out 0x21,al ;指定中断号IRQ0为0x20.即从0x20开始
mov al,0x28
out 0xa1,al ;第二片从0x28开始
mov al,0x4
out 0x21,al ;ICW3设置
mov al,0x2
out 0xa1,al
mov al,0x1
out 0x21,al ;ICW4设置
out 0xa1,al
mov al,0xfe ;屏蔽所有中断,只打开时钟中断
out 0x21,al
mov al, 0xff
out 0xa1,al
;---------------------8259A初始化完成--------------------------


xor ax,ax
mov ds,ax

cli
lgdt [GdtReg]
lidt [IdtReg]

sti

in al,92h ;打开A20地址线.
or al,00000010b
out 92h,al

mov eax,cr0
or eax,1
mov cr0,eax

xor al,al
out 0x21,al
out 0xa1,al

jmp DWord SelCode:ShowM

[bits 32]
ShowM:
mov ax,0x2c41
mov [0xb8000],ax
inc ax
mov [0xb8002],ax
jmp $

%include "interupt.asm"
SpooK
Member
Member
Posts: 260
Joined: Sun Jun 18, 2006 7:21 pm

Post by SpooK »

What is the error?

Is it an error with the assembler? Or is it an error when you try to run the code?
tresss
Posts: 21
Joined: Thu Jul 06, 2006 10:52 pm

Post by tresss »

Sorry.
I have found this error!


The error is in Boot Loader,while not in this file


Thanks
http://english.writeos.com

My English is not very good
Post Reply