BBS: Inland Empire Archive Date: 03-18-92 (05:10) Number: 164 From: BILL BEELER Refer#: NONE To: RONNIE PIERCE Recvd: NO Subj: Powerbasic Conf: (2) Quik_Bas
In a message to Tom Kiehl <16 Mar 92 05:52> Ronnie Pierce wrote:
>TK>To really speed 'em up (and speed up linking too) dump the C code and
>TK>go to ASM. Much tighter, compact and FAST! Since the C code is
>TK>usually used to deal with lower level functions i.e. direct screen,
>TK>memory, ports and hardware they are usually easy to replace. AND the
>TK>calls to ASM are much simpler since you are dealing directly with the
RP> I would if assembly code would outrun QB's binary file mode.
RP> There is some bottleneck when calling asm file routines and I
RP> have yet to find one that beats QB's BINARY read for gathering a
RP> string buffer (4096 or so bytes).
I couldn't get assembler loads to work as fast as BINARY
either....it seems as if I read somewhere that BINARY
doesn't use a buffer (and setting LEN = to the end of the
OPEN did help as far as speed) and just reads directly into
the variable through DOS buffers. Have you ever used
something like this for up to a 64K read ?
DEFINT A-Z
TYPE SixtyFourK
Part1 AS STRING * 32767
Part2 AS STRING * 32767
Part3 AS STRING * 1
END TYPE
TYPE ThirtyTwoK
Part4 AS STRING * 32767
END TYPE
'$DYNAMIC
REDIM Buffer64K(0) AS SixtyFourK
REDIM Buffer32K(0) AS ThirtyTwoK
Arg$ = LTRIM$(RTRIM$(COMMAND$))
Break = INSTR(Arg$, " ")
IF Break = 0 THEN
END
ELSE
Length = LEN(Arg$)
Arg1$ = LEFT$(Arg$, Length - Break)
Arg2$ = MID$(Arg$, Break + 1)
IF LEN(DIR$(Arg1$)) = 0 OR LEN(Arg2$) = 0 THEN END
END IF
OPEN Arg1$ FOR BINARY AS #1
WhatsLeft& = LOF(1)
OPEN Arg2$ FOR BINARY AS #2
DO
IF WhatsLeft& < 65535 THEN
IF WhatsLeft& < 32767 THEN
LastBuffer$ = STRING$(WhatsLeft&, 32)
GET #1, , LastBuffer$
PUT #2, , LastBuffer$
WhatsLeft& = 0
ELSE
GET #1, , Buffer32K(0)
PUT #2, , Buffer32K(0)
WhatsLeft& = WhatsLeft& - 32767
END IF
ELSE
GET #1, , Buffer64K(0)
PUT #2, , Buffer64K(0)
WhatsLeft& = WhatsLeft& - 65535
END IF
LOOP UNTIL WhatsLeft& = 0
LastBuffer$ = ""
The DIR$ will only work in QBX/PDS (unless you link PDQ
after BCOM45...can't use the PDQ library because it has
limits of 32K per array element...that took me a couple of
hair pulling hours to find ;-)...and you have to add the
/ah or /d switch to BC...although MS says you can have
TYPEs of up to 64K, the seemed to have left off the part
that you need to compile with array bounds checking if you
use that TYPE in an array) but if you take it out you can
use this in QB as well. It's faster than DOS's COPY but I
think I have VERIFY ON.
...Bill...
--- GEcho/beta
* Origin: Amber Shadow BBS - MultiLine, MultiProblems - HST/V32b (1:203/988)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET