www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/08/22:03:25

Date: Tue, 8 Nov 1994 20:29:55 +0100
From: Kim Jersin <u940422 AT daimi DOT aau DOT dk>
To: Martin AT snsystems DOT co DOT uk
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Fast disk I/O in DJGPP programs.

Hi Martin

Thanks for making the effort.

> The assembly language part had a couple of problems.  There was no
> declaration for PSP and the assembler wanted some kind of override on
> the instruction  mov es,[es:2ch].  I fixed these.

I'm sorry about the assembly errors. Something must have gone wrong 
when I merge the letter and the code.
I can't tell why the "mov es,[es:2ch]" instruction needs an override 
(it works fine at my place). The assembler should have all the 
information it needs, but to spell it out for the assembler you can 
write "mov es,[WORD PTR es:2ch]".

On the other hand please try out the new version that I have posted on 
the DJGPP mailing list. Nothing new has happened to the huge read 
facility, but the new version is a non TSR version, as requested by DJ 
Delorie.

> I don't have c++ set up on my machine so I converted your program to
> plain old C.  I get some very strange results for the time taken and
> transfer rate though :

Your printf formatting is wrong. You are trying to print signed decimal 
where it really should be double. The lines could be written like this 
instead:
    printf( "Time elapsed: %g\n", TimeElapsed);
    printf( "KBytes pr. second: %g\n", BytesRead/1024/TimeElapsed);
I have replaced the "%d" with "%g", wich prints in fixed point og 
scientific notation wichever is shorter.

C++ commercial:
The piping operators << and >> knows how to format all the standard 
types, and when you introduce new types (classes) you just overwrite 
the << and >> operators for each new class where it makes sence with 
text output. This way you need never worry about what formatting to 
specify og what function to call. The type itself specifies where the 
text output code resides.

Other errors:
Right at the beginning of the function TestHugeRead(), where it says:
  if( data )
This line should be
  if( data!= -1 )	/* open() returns -1 on error */
My mistake, sorry.

---
Kim Jersin


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019