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

前端 未结 5 2089
醉话见心
醉话见心 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:12

    I'm not sure why the code doesn't work, since I can't check the the whole environment (disk, memory dump, etc)...but what I can say is...the code is wrong. You are loading the second program, not at 0x8000 (that was the point of using 0rg 0x8000 right?), but at 0x80000.

    The reason being, you are using the segment:offset addressing in the wrong way, the address 0x8000:0x0000 is resolved to the linear address 0x80000, since the segment value is shifted left by 4 bits an then added to the offset.

    To resolve this problem, you should take a look at a memory dump and see if the program works as you expect it too....either that or you're loading the wrong sectors of the disk.

提交回复
热议问题