The best way to load files with int 13h in a FAT 16 fs

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
Karlosoft
Member
Member
Posts: 277
Joined: Thu Feb 14, 2008 10:46 am
Location: Italy
Contact:

The best way to load files with int 13h in a FAT 16 fs

Post by Karlosoft »

Hi! My bootloader is very slow in reading files (more than one minute and 30 seconds to load a 190kb file). How do you usually perform the code?
(It's using lots of stack based code, I should replace some routines too)
Last edited by Karlosoft on Sun Sep 12, 2010 1:32 pm, edited 1 time in total.
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:

Re: The best way to load files with int 10h in a FAT 16 fs

Post by Combuster »

How about caching the FAT instead of seeking to it after each data sector? I use that method to load 500k in well under 30 seconds...
"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
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: The best way to load files with int 10h in a FAT 16 fs

Post by Creature »

Here are a couple of things to try (if you haven't done these already):
  • Sequentially read more than one sector whenever possible.
  • On Bochs (if you're using it): don't forget to turn the IPS up to a number appropriate for your OS. When I started out, I used to leave it pretty low and always found that Bochs was slow. Well, of course it was slow, but it was slow because of my stupidity ;).
  • Try a better memcpy/memset (if you're using them). But seeing as you're coding in Assembly, you're probably already using fast routines (unless you're doing an Assembly for-like-loop or something and not MOVS*).
Hope this helps.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
Karlosoft
Member
Member
Posts: 277
Joined: Thu Feb 14, 2008 10:46 am
Location: Italy
Contact:

Re: The best way to load files with int 10h in a FAT 16 fs

Post by Karlosoft »

[quote="Creature"]Here are a couple of things to try (if you haven't done these already):
  • Sequentially read more than one sector whenever possible.
  • On Bochs (if you're using it): don't forget to turn the IPS up to a number appropriate for your OS. When I started out, I used to leave it pretty low and always found that Bochs was slow. Well, of course it was slow, but it was slow because of my stupidity ;).
  • Try a better memcpy/memset (if you're using them). But seeing as you're coding in Assembly, you're probably already using fast routines (unless you're doing an Assembly for-like-loop or something and not MOVS*).
Hope this helps.[/quote

#0 Thank you.
#1 The problem isn't of the emulator. I tested it on five different computers, more or less powerful
#2 I am loading file in unreal mode, so I work with a C, 16 bit code that uses peek and poke to write a byte on hight memory

@ Combuster: Wow! I'll try
Post Reply