HELP!!! My bootsector is WAY to big!!!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
EyeScream

RE:Oops:7C00=07C0

Post by EyeScream »

Because SI is not calculated right. This is right (I believe, never wrote a bootloader):

[ORG 0x7C00]

start:
  JMP 0x0000:setCS                        ; CS is now 0

setCS:
  XOR AX, AX
  MOV DS, AX
  MOV ES, AX

Better not set FS and GS at this time because your code might be running on a 286 or 8086, without any FS or GS at all.
JAAman

RE:Oops:7C00=07C0

Post by JAAman »

yes but you cannot start with that JMP if you want to be FAT12 complient

better is to leave CS alone and only use conditional jumps till you jump to your second-stage then use full sector:offset to force the offset you want and use either 7C0 or 0000 for DS

beware: if you set DS=07C0 then you MUST use ORG 0000  NOT ORG 7C00

because ORG tells your assembler what to add  to the offset when calculating  the location of variables so you want that to be the offset in DS that your code starts

I would  use DS=0000 and ORG 7C00 because it gives access to all important variables in BIOS space and your code and space to work between
Post Reply