reading floppy

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.
Post Reply
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

reading floppy

Post by suthers »

Im trying to load the kernel rom my bootloader.
I use the following code:

Code: Select all

	mov cx, 0x10
	.cylinder1
	mov ax,0x100000
	mov es,ax                     
	mov bx,0x10                   
	mov ah,2        	      
	mov al,17                     
	mov ch,0                      
	mov cl,2                      
	mov dh,0                      
	int 0x13                      
	jc .finish
	loop .cylinder1
and the following code to jump to it:

Code: Select all

jmp 08h:0x100000
But it just restarts any ideas why?
Thanks in advance,
Jules
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

if its restarting it probably means its triple faulting (some computers + bochs) reboot when this happens.
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

you've got your test the wrong way around it seems - you're looping until the read fails


And you can't fit 32 bits into a 16-bit register:

Code: Select all

mov ax,0x100000
So, fix your assembler warnings first :wink:


And IIRC some bioses don't like loading directly above 1MB anyway
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

If i change the jc to jnc it just goes into an infinite loop.
Also is there a convention on were to load the kernel?
If not anywere you would recommend loading it so it doesn't mess with anything else?
Thanks in advance,
Jules
User avatar
xyjamepa
Member
Member
Posts: 397
Joined: Fri Sep 29, 2006 8:59 am

Post by xyjamepa »

Hi...


If ther was a carry then the reading operation failed,
this means you should jump if there's no carry using "jnc"...
any way here's a simple .com program that loads the first sector
of the root directory and prints it,I'm talking about fat12 floppy driver.
Attachments
int13.asm
(2.15 KiB) Downloaded 27 times
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
Post Reply