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

Ask A Question

Stats

  • Questions 211k
  • Answers 211k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer With VS2008 FindAndReplace I tried this and worked; Find what:… May 12, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer MonoDevelop does already use Microsoft's Visual Basic compiler. In fact,… May 12, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer Shamelessly lifted from the jdbc tutorial Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,… May 12, 2026 at 10:05 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.