I am just starting to learn x86 assembly language because eventually I want to make my own OS. I wrote a boot sector in fasm and it doesn't load the second sector into memory. Because I just started, there is probably something obvious wrong with the code. Could anyone tell me what I am doing wrong? Could the problem be in the second sector?

org 0x7C00

	jmp	bootit

;*	OEM Parameter block / BIOS Parameter Block        *;

TIMES 0Bh-$+start DB 0

bpbBytesPerSector:  	DW 512
bpbSectorsPerCluster: 	DB 1
bpbReservedSectors: 	DW 1
bpbNumberOfFATs: 	DB 2
bpbRootEntries: 	DW 224
bpbTotalSectors: 	DW 2880
bpbMedia: 	        DB 0xF0
bpbSectorsPerFAT: 	DW 9
bpbSectorsPerTrack: 	DW 18
bpbHeadsPerCylinder: 	DW 2
bpbHiddenSectors:       DD 0
bpbTotalSectorsBig:     DD 0
bsDriveNumber: 	        DB 0
bsUnused: 	        DB 0
bsExtBootSignature: 	DB 0x29
bsSerialNumber:	        DD 0xa0a1a2a3
bsVolumeLabel: 	        DB "BOS FLOPPY "
bsFileSystem: 	        DB "FAT12   "

;   starting point of bootsector code    ;

	xor	ax, ax
	mov	ds, ax
	mov	es, ax
	mov	ss, ax
	mov	sp, 0xFFFF

	mov	cx, 5		;we are going to loop 5 times

	mov	si, msgloading
	call	print		;print the string
	call	crlf		;new line
	loop	mainloop	;loop 5 times because cx decreased each time

	mov	si, msgnext
	call	print
	mov	ah, 0		;procedure to call inside keypress int
	int	0x16		;keypress int

	mov	ax, 0x1000	;read sector to address 0x1000:0
	mov	es, ax
	xor	bx, bx	;Offset to read into (zero because it is cleared)
	mov	ah, 02	;BIOS read sector function
	mov	al, 01	;read one sector
	mov	ch, 01	;Track to read
	mov	cl, 02	;Sector to read
	mov	dh, 00	;Head to read
	mov	dl, 00	;Drive to read
	int 0x13

	jmp	0x1000:0x0000

; a procedure to display a string;
	mov ah,0x0E
	mov bh,0x00
	mov bl,0x07


	or al,al
	jz .return
	int 0x10
	jmp .nextchar


; a procedure to make a new line ;
	mov	al, 13
	int	0x10
	mov	al, 10
	int	0x10

; some strings and stuff              ;
msgloading db 'The os is booting!',0
msgnext db 'Press any key to load next sector. . .',0

; set the BOOT-signature at byte 510. ;
times 510-($-$$) db 0
dw 0xAA55
9 Years
Discussion Span
Last Post by Joe Shmoe

If there is nothing wrong with what I did above, then how should the next sector start?

Here is the beginning of the second sector. Is there something wrong with this or is there something I need to add?

org 0x10000
jmp main


I figured it out!!!!!!! :)

I had the track set to one and the second sector is on track zero.
So I changed this

mov	ch, 01	;Track to read

to this

mov	ch, 00	;Track to read

And I added this before the jmp 0x1000:0x0000

mov ax, 0x1000
mov ds, ax
Votes + Comments
Congrats, and thanks for the feedback of your solution.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.