Change Interrupt Vector Table?

Programming, for all ages and all languages.
Post Reply
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Change Interrupt Vector Table?

Post by NunoLava1998 »

I am on rebuilding my OS and implementing C later, and i now want to create a custom interrupt to read sector inputted in AX, so i could use something like this to read sector 25:

Code: Select all

mov ax, 25
int 23h
But how do i edit the interrupt vector table and add that?
Last edited by NunoLava1998 on Tue Oct 11, 2016 1:10 pm, edited 1 time in total.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Change Interrupt Vector Table?

Post by iansjack »

Thanks for letting us know. A function to read a sector from a storage device is a useful component of any OS.
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: Change Interrupt Vector Table?

Post by NunoLava1998 »

iansjack wrote:Thanks for letting us know. A function to read a sector from a storage device is a useful component of any OS.
thank you for not realizing what i was saying
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Change Interrupt Vector Table?

Post by iansjack »

My confusion. I see from your edit that you are asking for code. As explained by others, writing an OS consists of doing the research and then doing the work rather than asking others to do the research and work for you. Else, what's the point?

I believe from your posts so far that you are making a series of classic beginner's mistakes. Perhaps you haven't studied the processor before starting your project? I recommend the Intel Programmer's Manuals, which will answer your questions, or at least give you a starting point. You will then be in a position to ask sensible questions.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Change Interrupt Vector Table?

Post by SpyderTL »

Check the wiki page. It has everything you need to update the IVT with your own custom interrupt handler.

IVT

But the short answer is going to be something like:

Code: Select all

push cs
pop ax

mov [142], ax
mov [140], interrupt23Handler

interrupt23Handler:
// Put Read Code Here
Your IVT starts at address 0x0, and contains 256 entries of 4 bytes each. Each entry has the segment and offset of that particular event handler, so the INT 0 handler is at address 0x00, and the INT 1 handler is at address 0x04, and so on.

Let us know if you have any questions.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: Change Interrupt Vector Table?

Post by NunoLava1998 »

SpyderTL wrote:Check the wiki page. It has everything you need to update the IVT with your own custom interrupt handler.

IVT

But the short answer is going to be something like:

Code: Select all

push cs
pop ax

mov [142], ax
mov [140], interrupt23Handler

interrupt23Handler:
// Put Read Code Here
Your IVT starts at address 0x0, and contains 256 entries of 4 bytes each. Each entry has the segment and offset of that particular event handler, so the INT 0 handler is at address 0x00, and the INT 1 handler is at address 0x04, and so on.

Let us know if you have any questions.
thank you
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
alexfru
Member
Member
Posts: 1111
Joined: Tue Mar 04, 2014 5:27 am

Re: Change Interrupt Vector Table?

Post by alexfru »

Would you please remove the large image from the signature. It eats screen space and bandwidth.
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Change Interrupt Vector Table?

Post by iansjack »

As in most forums, display of users' signatures can be turned off. Probably a good idea anyway.
Post Reply