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

                    How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

                    Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?