How to load a kernel from disk with BIOS int 13h in NASM assembly?

前端 未结 5 2033
醉话见心
醉话见心 2021-02-02 01:21

I\'ve been stuck with this for weeks now and have no idea where I\'m going wrong because NASM hasn\'t given me any errors. The code is pretty self explanatory because of the com

5条回答
  •  走了就别回头了
    2021-02-02 02:06

    I am not sure what you are trying to achieve with the code, but if I understand it correctly, You want to read a few sectors from the disk into the location 0x8000 and then execute that code?

    If that is the case, then you will have to explictly make a CALL/JUMP to that particular location. The BIOS will not call that code for you. On boot, once the BIOS is initialized, it will set the Instruction Pointer IP to the address 0x7c00. The cpu will then start to execute the code sequentially, so without a JMP/CALL to 0x8000 it wont execute the code at 0x8000 until it has executed every memory address inbetween 0x7c00 to 0x8000 etc.

    So the solution would be to have a jmp or call instruction after your jc readdisk.

    If my understanding is incorrect then I apologize. Hope this helps.

提交回复
热议问题