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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:51:17+00:00 2026-06-05T04:51:17+00:00

I’ve recently been researching Operating Systems, the boot process, and NASM. On my journeys

  • 0

I’ve recently been researching Operating Systems, the boot process, and NASM. On my journeys I ran into a piece of useful bootstrapping code which I partially understand and have tested via a virtual floppy disk. My basic question is to what some of these lines I don’t understand do. I’ve commented what I think the lines do, and any corrections or confirmations would be much appreciated.

; This is NASM

        BITS 16                 ; 16 bits!

start:                          ; Entry point
        mov ax, 07C0h           ; Move the starting address (after this bootloader) into 'ax'
        add ax, 288             ; Leave 288 bytes before the stack beginning for some reason
        mov ss, ax              ; Show 'stack segment' where our stack starts
        mov sp, 4096            ; Tell 'stack pointer'  that our stack is 4K in size

        mov ax, 07C0h           ; Use 'ax' as temporary variable for setting 'ds'
        mov ds, ax              ; Set data segment to where we're loaded


        mov si, text_string     ; Put string position into SI (the reg used for this!)
        call print_string       ; Call our string-printing routine

        jmp $                   ; Jump here - infinite loop!

        text_string db 'This is my cool new OS!', 0 ; Our null terminated string
                                                    ; For some reason declared after use


print_string:                   ; Routine: output string in SI to screen
        mov ah, 0Eh             ; I don't know what this does..
                                ; Continue on to 'repeat'
.repeat:
        lodsb                   ; Get character from DS:SI into AL
        cmp al, 0               ; If end of text_string
        je .done                ; We're done here
        int 10h                 ; Otherwise, print the character (What 10h means)
        jmp .repeat             ; And repeat

.done:
        ret

        times 510-($-$$) db 0   ; Pad remainder of boot sector with 0s
        dw 0xAA55               ; The standard PC 'magic word' boot signature

Thanks,

Joe

  • 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-06-05T04:51:18+00:00Added an answer on June 5, 2026 at 4:51 am

    Your comments are largely correct.

    mov ah,0Eh

    This sets a parameter to the BIOS interrupt call:

    int 10h

    See here for more details, but essentially the call to 10h expects an operation in ah and data for the operation in al.

    The segment registers cannot be loaded directly and can only load from a register, thus the use of ax as a ‘temporary variable.’

    The 288 bytes added to the base stack pointer are actually not bytes at all. Addresses loaded into the segment registers are actually pointers to 16-byte blocks, so to convert the number to its actual address, shift it left by 4-bits. That means that the address 07C0h is actually referring to 7C00h, which is where your bootloader code is placed. 288 is 120h in hex, and so the actual location of the stack is really 7C00h + 1200h = 8E00h.

    Also, you use words like “show” and “tell” which are fine, but it’s better to think of defining the stack by setting ss and sp as opposed to reporting where it is at… I hope that makes sense.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.