Does writing a value to the BX register have an effect on the ES register?Boot loader doesn't jump to kernel codeWhat is exactly the base pointer and stack pointer? To what do they point?Assembly: Using the Data Segment Register (DS)Confused with setting up Segment RegistersWhy does GCC generate 15-20% faster code if I optimize for size instead of speed?Replacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsNASM how to set label address relative the load address without orgwhat does size of registers and stack really mean in assembly x86Register usage tracking x86Why does gdb register and stack value are not equals?Understanding of boot loader assembly code and memory locations

Do any aircraft carry boats?

Are there any space probes or landers which regained communication after being lost?

Why should I always enable compiler warnings?

Why do sellers care about down payments?

Can a magnet rip protons from a nucleus?

What's the biggest organic molecule that could have a smell?

„nichts wie raus hier“ - explanation based on the literal meaning?

How can I fix a framing mistake so I can drywall?

Seized engine due to being run without oil

If you have multiple situational racial save bonuses and are in a situation where they all apply do they stack?

Renewed US passport, did not receive expired US passport

How to find a missing person abroad

How do I improve my SXA sites Google PageSpeed Insights Score?

Writing a worded mathematical expression

Job offer without any details but asking me to withdraw other applications - is it normal?

How can I maximize the impact of my charitable donations?

Were Roman public roads build by private companies?

Is it possible to PIVOT on a LIKE statement

Creating a Master Image to roll out to 30 new Machines Licensing Issues

Random point on a sphere

How to help my 2.5-year-old daughter take her medicine when she refuses to?

Why is the T-1000 humanoid?

Double it your way

Who are the two thieves that appear the opening of Batman: TAS?



Does writing a value to the BX register have an effect on the ES register?


Boot loader doesn't jump to kernel codeWhat is exactly the base pointer and stack pointer? To what do they point?Assembly: Using the Data Segment Register (DS)Confused with setting up Segment RegistersWhy does GCC generate 15-20% faster code if I optimize for size instead of speed?Replacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsNASM how to set label address relative the load address without orgwhat does size of registers and stack really mean in assembly x86Register usage tracking x86Why does gdb register and stack value are not equals?Understanding of boot loader assembly code and memory locations






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















[org 0x7c00]
mov bp, 0x8000 ; set the stack safely away from us
mov sp, bp

mov bx, 0x9000 ; es:bx = 0x0000:0x9000 = 0x09000


As you can see in the comment it says: es:bx = 0x0000:0x9000 = 0x09000. Is there any relationship between register ES and BX? The code only sets register BX but the comment shows register ES is also set?










share|improve this question
































    2















    [org 0x7c00]
    mov bp, 0x8000 ; set the stack safely away from us
    mov sp, bp

    mov bx, 0x9000 ; es:bx = 0x0000:0x9000 = 0x09000


    As you can see in the comment it says: es:bx = 0x0000:0x9000 = 0x09000. Is there any relationship between register ES and BX? The code only sets register BX but the comment shows register ES is also set?










    share|improve this question




























      2












      2








      2








      [org 0x7c00]
      mov bp, 0x8000 ; set the stack safely away from us
      mov sp, bp

      mov bx, 0x9000 ; es:bx = 0x0000:0x9000 = 0x09000


      As you can see in the comment it says: es:bx = 0x0000:0x9000 = 0x09000. Is there any relationship between register ES and BX? The code only sets register BX but the comment shows register ES is also set?










      share|improve this question
















      [org 0x7c00]
      mov bp, 0x8000 ; set the stack safely away from us
      mov sp, bp

      mov bx, 0x9000 ; es:bx = 0x0000:0x9000 = 0x09000


      As you can see in the comment it says: es:bx = 0x0000:0x9000 = 0x09000. Is there any relationship between register ES and BX? The code only sets register BX but the comment shows register ES is also set?







      assembly x86 cpu-registers bootloader real-mode






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 11:32









      Michael Petch

      31.5k7 gold badges61 silver badges121 bronze badges




      31.5k7 gold badges61 silver badges121 bronze badges










      asked Mar 28 at 9:02









      Henok TesfayeHenok Tesfaye

      1,0432 gold badges8 silver badges25 bronze badges




      1,0432 gold badges8 silver badges25 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          5
















          TL;DR : Setting the BX register doesn't affect the ES segment register.




          The OS tutorial you are looking at has potential bugs. The author incorrectly assumes that ES is set to zero by the BIOS prior to transferring control to the bootloader. This isn't guaranteed. You need to explicitly set ES to zero yourself. My Bootloader Tips covers this topic:




          1. When the BIOS jumps to your code you can't rely on CS,DS,ES,SS,SP registers having valid or expected values. They should be set up appropriately when your bootloader starts. You can only be guaranteed that your bootloader will be loaded and run from physical address 0x00007c00 and that the boot drive number is loaded into the DL register.



          The specific OS tutorial code you are looking at should have been:



          xor ax, ax ; AX=0 (XOR register to itself clears all bits)
          mov es, ax ; ES=0
          mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


          If you take into account the quoted bootloader tip above, then the start of the bootloader should have looked something like:



          mov bp, 0x8000 
          xor ax, ax ; AX=0 (XOR register to itself clears all bits)
          mov es, ax ; ES=0
          mov ds, ax ; DS=0
          mov ss, ax ; SS=0
          mov sp, bp ; SP=0x8000 (SS:SP = stack pointer)

          mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


          It is not uncommon for bootloader tutorials to have inaccurate or misleading information.






          share|improve this answer


























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393637%2fdoes-writing-a-value-to-the-bx-register-have-an-effect-on-the-es-register%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            5
















            TL;DR : Setting the BX register doesn't affect the ES segment register.




            The OS tutorial you are looking at has potential bugs. The author incorrectly assumes that ES is set to zero by the BIOS prior to transferring control to the bootloader. This isn't guaranteed. You need to explicitly set ES to zero yourself. My Bootloader Tips covers this topic:




            1. When the BIOS jumps to your code you can't rely on CS,DS,ES,SS,SP registers having valid or expected values. They should be set up appropriately when your bootloader starts. You can only be guaranteed that your bootloader will be loaded and run from physical address 0x00007c00 and that the boot drive number is loaded into the DL register.



            The specific OS tutorial code you are looking at should have been:



            xor ax, ax ; AX=0 (XOR register to itself clears all bits)
            mov es, ax ; ES=0
            mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


            If you take into account the quoted bootloader tip above, then the start of the bootloader should have looked something like:



            mov bp, 0x8000 
            xor ax, ax ; AX=0 (XOR register to itself clears all bits)
            mov es, ax ; ES=0
            mov ds, ax ; DS=0
            mov ss, ax ; SS=0
            mov sp, bp ; SP=0x8000 (SS:SP = stack pointer)

            mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


            It is not uncommon for bootloader tutorials to have inaccurate or misleading information.






            share|improve this answer































              5
















              TL;DR : Setting the BX register doesn't affect the ES segment register.




              The OS tutorial you are looking at has potential bugs. The author incorrectly assumes that ES is set to zero by the BIOS prior to transferring control to the bootloader. This isn't guaranteed. You need to explicitly set ES to zero yourself. My Bootloader Tips covers this topic:




              1. When the BIOS jumps to your code you can't rely on CS,DS,ES,SS,SP registers having valid or expected values. They should be set up appropriately when your bootloader starts. You can only be guaranteed that your bootloader will be loaded and run from physical address 0x00007c00 and that the boot drive number is loaded into the DL register.



              The specific OS tutorial code you are looking at should have been:



              xor ax, ax ; AX=0 (XOR register to itself clears all bits)
              mov es, ax ; ES=0
              mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


              If you take into account the quoted bootloader tip above, then the start of the bootloader should have looked something like:



              mov bp, 0x8000 
              xor ax, ax ; AX=0 (XOR register to itself clears all bits)
              mov es, ax ; ES=0
              mov ds, ax ; DS=0
              mov ss, ax ; SS=0
              mov sp, bp ; SP=0x8000 (SS:SP = stack pointer)

              mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


              It is not uncommon for bootloader tutorials to have inaccurate or misleading information.






              share|improve this answer





























                5














                5










                5









                TL;DR : Setting the BX register doesn't affect the ES segment register.




                The OS tutorial you are looking at has potential bugs. The author incorrectly assumes that ES is set to zero by the BIOS prior to transferring control to the bootloader. This isn't guaranteed. You need to explicitly set ES to zero yourself. My Bootloader Tips covers this topic:




                1. When the BIOS jumps to your code you can't rely on CS,DS,ES,SS,SP registers having valid or expected values. They should be set up appropriately when your bootloader starts. You can only be guaranteed that your bootloader will be loaded and run from physical address 0x00007c00 and that the boot drive number is loaded into the DL register.



                The specific OS tutorial code you are looking at should have been:



                xor ax, ax ; AX=0 (XOR register to itself clears all bits)
                mov es, ax ; ES=0
                mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


                If you take into account the quoted bootloader tip above, then the start of the bootloader should have looked something like:



                mov bp, 0x8000 
                xor ax, ax ; AX=0 (XOR register to itself clears all bits)
                mov es, ax ; ES=0
                mov ds, ax ; DS=0
                mov ss, ax ; SS=0
                mov sp, bp ; SP=0x8000 (SS:SP = stack pointer)

                mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


                It is not uncommon for bootloader tutorials to have inaccurate or misleading information.






                share|improve this answer















                TL;DR : Setting the BX register doesn't affect the ES segment register.




                The OS tutorial you are looking at has potential bugs. The author incorrectly assumes that ES is set to zero by the BIOS prior to transferring control to the bootloader. This isn't guaranteed. You need to explicitly set ES to zero yourself. My Bootloader Tips covers this topic:




                1. When the BIOS jumps to your code you can't rely on CS,DS,ES,SS,SP registers having valid or expected values. They should be set up appropriately when your bootloader starts. You can only be guaranteed that your bootloader will be loaded and run from physical address 0x00007c00 and that the boot drive number is loaded into the DL register.



                The specific OS tutorial code you are looking at should have been:



                xor ax, ax ; AX=0 (XOR register to itself clears all bits)
                mov es, ax ; ES=0
                mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


                If you take into account the quoted bootloader tip above, then the start of the bootloader should have looked something like:



                mov bp, 0x8000 
                xor ax, ax ; AX=0 (XOR register to itself clears all bits)
                mov es, ax ; ES=0
                mov ds, ax ; DS=0
                mov ss, ax ; SS=0
                mov sp, bp ; SP=0x8000 (SS:SP = stack pointer)

                mov bx, 0x9000 ; ES:BX = 0x0000:0x9000 = 0x09000 . Memory location disk read will read to


                It is not uncommon for bootloader tutorials to have inaccurate or misleading information.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 28 at 11:29

























                answered Mar 28 at 11:13









                Michael PetchMichael Petch

                31.5k7 gold badges61 silver badges121 bronze badges




                31.5k7 gold badges61 silver badges121 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393637%2fdoes-writing-a-value-to-the-bx-register-have-an-effect-on-the-es-register%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript