Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 81755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:30:35+00:00 2026-05-10T21:30:35+00:00

I’m following several tutorials and references trying to get my kernel set up. I’ve

  • 0

I’m following several tutorials and references trying to get my kernel set up. I’ve come across some unfamiliar code in a tutorial that isn’t explaining it at all. It’s code that I’m told maps the 16 IRQs (0-15) to ISR locations 32-47:

void irq_remap(void) {     outportb(0x20, 0x11);     outportb(0xA0, 0x11);     outportb(0x21, 0x20);     outportb(0xA1, 0x28);     outportb(0x21, 0x04);     outportb(0xA1, 0x02);     outportb(0x21, 0x01);     outportb(0xA1, 0x01);     outportb(0x21, 0x0);     outportb(0xA1, 0x0); } 

The code for outportb() is as follows, but I already have a clear grasp of what its doing:

void outPortB(unsigned short port, unsigned char data) {     __asm__ __volatile__ ('outb %1, %0' : : 'dN' (port), 'a' (data)); } 

I should mention that this is on x86 architecture in protected mode. This source code works fine and I understand what it does, but I don’t understand how it does it. Can someone explain to me what’s going on here, so that in case I need to expand on this I will know what I’m doing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:30:35+00:00Added an answer on May 10, 2026 at 9:30 pm

    outb and similar, write to hardware IO ports. Basically, there are 2 primary options for communicating with a device. You can have the device mapped to memory or IO ports.

    As for how this code works, i’ll comment it for you:

    ICW stands for ‘Initialization Commands Words’

    outportb(0x20, 0x11); /* write ICW1 to PICM, we are gonna write commands to PICM */ outportb(0xA0, 0x11); /* write ICW1 to PICS, we are gonna write commands to PICS */  outportb(0x21, 0x20); /* remap PICM to 0x20 (32 decimal) */ outportb(0xA1, 0x28); /* remap PICS to 0x28 (40 decimal) */  outportb(0x21, 0x04); /* IRQ2 -> connection to slave */  outportb(0xA1, 0x02);  outportb(0x21, 0x01); /* write ICW4 to PICM, we are gonna write commands to PICM */ outportb(0xA1, 0x01); /* write ICW4 to PICS, we are gonna write commands to PICS */  outportb(0x21, 0x0); /* enable all IRQs on PICM */ outportb(0xA1, 0x0); /* enable all IRQs on PICS */ 

    hope this helps

    Welcome to the world of OS dev 🙂 I also recommend that you visit: http://forum.osdev.org/, it is an invaluable resource for a new hobby OS developer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.