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

  • Home
  • SEARCH
  • 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 8644575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:19:42+00:00 2026-06-12T12:19:42+00:00

I’m writing this bootloader that just prints out some stuff on the screen. This

  • 0

I’m writing this bootloader that just prints out some stuff on the screen. This is what I have so far in assembly:

    .globl _start

    .code16

_start:

    movw $0x0003, %ax
    int $0x10

    movb $0x0e, %ah
    movb $0x69, %al
    int $0x10

    movw $_header, %bx
    movb %bl, %al
    int $0x10

_header: .ascii "W\0"

    .org 0x1FE

    .byte 0x55
    .byte 0xAA

So right now it prints ASCII 69 (“i”), but I want it to print the .ascii declaration as well. Right now I only have it set to "W" so I could find it easily in Objdump. I can’t seem to get access to that value (57). I can leal $_header, %edx and such, but then I can’t seem to access the value at %edx.

I tried using lodsb, but I can’t seem to figure it out. I set %di to 0x00, and set %si to the address of _header with leal %si, _header but then my lodsb followed by int 0x10 doesn’t seem to print anything. Any ideas I’d appreciate.

  • 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-12T12:19:44+00:00Added an answer on June 12, 2026 at 12:19 pm

    Here:

    movw $_header, %bx
    movb %bl, %al
    

    First, movb %bl, %al isn’t reading a byte from memory into al, it’s reading a byte from bl. You want to change it to:

    movb (%bx), %al
    

    To get just one character out of _header you could load that character from the memory into al directly:

    movb _header, %al
    

    Secondly, and most importantly, it appears that you’re making several assumptions:

    1. that your code starts running with cs=0x7c0, ip=0. It can be cs=0, ip=0x7c00 instead, but your code is expecting ip=0 (I infer from the code that the assembler starts assembling it with the implicit .org 0). You should make your code resilient to this second option. You can reload cs and ip to more suitable values with a jump instruction, something like this: jmp $0x7c0,$_next and the corresponding label on the next line: _next:.
    2. that your code starts running with ds=0x7c0. ds isn’t guaranteed to be set to any value you may want or need. You have to initialize it yourself.

    Finally, what happens after the last int $0x10?

    With the corrections your code should look something like this:

        .globl _start
    
        .code16
    
    _start:
        /* .org 0 is implied here! But the code may start with ip != 0. */
    
        jmp $0x7c0,$_next
    _next:
        /* We have just ensured that cs=0x7c0,ip=$_next */
    
        /* Let's now load data segment registers with proper values */
        movw %cs, %ax
        movw %ax, %ds
        movw %ax, %es
    
        movw $0x0003, %ax
        int $0x10
    
        movb $0x0e, %ah
        movb $0x69, %al
        int $0x10
    
        movw $_header, %bx
        movb (%bx), %al /* read into al a byte from memory at address from bx */
        int $0x10
    
        /* Halt execution, don't just execute whatever garbage is in memory */
        /*after the end of the code. */
    _halt:
        hlt
        jmp _halt
    
    _header: .ascii "W\0"
    
        .org 0x1FE
    
        .byte 0x55
        .byte 0xAA
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I have a small JavaScript validation script that validates inputs based on Regex. I
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.