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 700119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:27:43+00:00 2026-05-14T03:27:43+00:00

We are working on a project to learn how to write a kernel and

  • 0

We are working on a project to learn how to write a kernel and learn the ins and outs. We have a bootstrap loader written and it appears to work. However we are having a problem with the kernel loading. I’ll start with the first part:

bootloader.asm:

    [BITS 16]
    [ORG 0x0000]
;
;    all the stuff in between
;
;    the bottom of the bootstrap loader

     datasector  dw 0x0000
     cluster     dw 0x0000
     ImageName   db "KERNEL  SYS"
     msgLoading  db 0x0D, 0x0A, "Loading Kernel Shell", 0x0D, 0x0A, 0x00
     msgCRLF     db 0x0D, 0x0A, 0x00
     msgProgress db ".", 0x00
     msgFailure  db 0x0D, 0x0A, "ERROR : Press key to reboot", 0x00

     TIMES 510-($-$$) DB 0
     DW 0xAA55

     ;*************************************************************************

The bootloader.asm is too long for the editor without causing it to chug and choke. In addition, the bootloader and kernel do work within bochs as we do get the message “Welcome to our OS”. Anyway, the following is what we have for a kernel at this point.

kernel.asm:

[BITS 16]
[ORG 0x0000]

[SEGMENT .text]         ; code segment
    mov     ax, 0x0100          ; location where kernel is loaded
    mov     ds, ax
    mov     es, ax

    cli
    mov     ss, ax          ; stack segment
    mov     sp, 0xFFFF          ; stack pointer at 64k limit
    sti

    mov     si, strWelcomeMsg       ; load message
    call        _disp_str

    mov     ah, 0x00
    int     0x16                ; interrupt: await keypress
    int     0x19                ; interrupt: reboot

_disp_str:
    lodsb                       ; load next character
    or      al, al          ; test for NUL character
    jz      .DONE

    mov     ah, 0x0E            ; BIOS teletype
    mov     bh, 0x00            ; display page 0
    mov     bl, 0x07            ; text attribute
    int     0x10                ; interrupt: invoke BIOS

    jmp     _disp_str

.DONE:
    ret

[SEGMENT .data]                 ; initialized data segment
    strWelcomeMsg   db  "Welcome to our OS",    0x00

[SEGMENT .bss]              ; uninitialized data segment  

Using nasm 2.06rc2 I compile as such:
nasm bootloader.asm -o bootloader.bin -f bin
nasm kernel.asm -o kernel.sys -f bin

We write bootloader.bin to the floppy as such:
dd if=bootloader.bin bs=512 count=1 of/dev/fd0

We write kernel.sys to the floppy as such:
cp kernel.sys /dev/fd0

As I stated, this works in bochs. But booting from the floppy we get output like so:

Loading Kernel Shell
………..
ERROR : Press key to reboot

Other specifics: OpenSUSE 11.2, GNOME desktop, AMD x64
Any other information I may have missed, feel free to ask. I tried to get everything in here that would be needed. If I need to, I can find a way to get the entire bootloader.asm posted somewhere. We are not really interested in using GRUB either for several reasons. This could change, but we want to see this boot successful before we really consider GRUB.

EDIT: The bootstrap loader is suppose to be 512 bytes, written to the boot sector (very first sector) of the disk. Take my word for it, bootloader is 512 bytes compiled. The kernel is suppose to be in the very next sector.

  • 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. Editorial Team
    Editorial Team
    2026-05-14T03:27:43+00:00Added an answer on May 14, 2026 at 3:27 am

    If you want kernel.sys to start at the second sector, use this instead of cp.

    dd if=kernel.sys of=/dev/fd0 bs=512 seek=1
    

    Or, assuming bootloader.bin is exactly 512 bytes, this works too:

    cat bootloader.bin kernel.sys > /dev/fd0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 500k
  • 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 This is not pretty but it works: rm -R $(ls… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer Yes. Override the base1 and base2 methods in Derived to… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer No, you can't. Unfortunately, UIEvent doesn't expose any public way… May 16, 2026 at 12:45 pm

Trending Tags

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

Top Members

Related Questions

I'm working on a Java project where I need to have multiple tasks running
I've been working on a pet project on the weekends to learn more about
I'm working on a project involving the .NET ReportViewer, and I'm having issues connecting
I'm currently on a co-op term working on a project nearing completion with one
I was hoping to write my own syntax highlighter for a summer project I
i have a .net dll written in c# which reads data off a data
The project I'm working on allows an end-user to modify CSS code to integrate
I'm working on a project which includes persistence library (JPA 1.2), EJB 3 and
I'm working on a project that needs two databases - one for the logged
I am working in migration project from VC6 to VC9. In VC9 (Visual Studio

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.