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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    위키백과:대문 둘러보기 메뉴기부 안내모바일판 대문크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0CebuanoDeutschEnglishEspañolFrançaisItaliano日本語NederlandsPolskiPortuguêsРусскийSvenskaTiếng ViệtWinaray中文العربيةCatalàفارسیSrpskiУкраїнськаБългарскиНохчийнČeštinaDanskEsperantoEuskaraSuomiעבריתMagyarՀայերենBahasa IndonesiaҚазақшаBaso MinangkabauBahasa MelayuBân-lâm-gúNorskRomânăSrpskohrvatskiSlovenčinaTürkçe

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh