You use int 0x13 to load into the required number of sectors and move to the location of the new code. In the second step, you have nothing to do, but you must make sure that you set the DS for valid values ββfor wherever you download the code.
An example from my small OS archive:
pushw $STAGE1_WORKSEG popw %es movw $STAGE1_OFFSET, %bx read_stage1: movb $0x2, %cl movb $0x0, %ch movb $0x0, %dh movb $0x0, %dl movb $0x2, %ah movb $STAGE1_SIZE, %al int $0x13 jnc read_stage1_done xorw %ax, %ax int $0x13 jmp read_stage1 read_stage1_done: ljmp $STAGE1_WORKSEG, $STAGE1_OFFSET call halt halt: hlt jmp halt
This is in GAS format, so you'll want to reverse the order of the operands because it looks like you are using NASM from the times statement. Variable names must be clear.
If you are developing a hosting OS, then http://forum.osdev.org/ is a good place to get support from others doing the same. This is a little more specialized than stackoverflow, and many OS things can be quite esoteric.
source share