## PSN-L Email List Message

Subject: Re: Basic Programming Help desired?
From: ian ian@...........
Date: Tue, 06 May 2008 18:32:33 +0100

```Hi,

I'm not familiar with this flavour of basic but 2 comments:

Is the for loop meant to be 0 to 32769?  Normally it would be 32767 for
15 bits - I don't know the application for this code.

When coding loops, I found it better (runs faster) to repeat the code in
the loop and reduce the number of times around the loop, 16 being
optimum.  For example:

FOR A = 0 to 2047
DATA_1?(A*16 + 0) = ( 65 + (A*16 + 0) MOD 58 )
DATA_1?(A*16 + 1) = ( 65 + (A*16 + 1) MOD 58 )
DATA_1?(A*16 + 2) = ( 65 + (A*16 + 2) MOD 58 )
DATA_1?(A*16 + 3) = ( 65 + (A*16 + 3) MOD 58 )
DATA_1?(A*16 + 4) = ( 65 + (A*16 + 4) MOD 58 )
DATA_1?(A*16 + 5) = ( 65 + (A*16 + 5) MOD 58 )
DATA_1?(A*16 + 6) = ( 65 + (A*16 + 6) MOD 58 )
DATA_1?(A*16 + 7) = ( 65 + (A*16 + 7) MOD 58 )
DATA_1?(A*16 + 8) = ( 65 + (A*16 + 8) MOD 58 )
DATA_1?(A*16 + 9) = ( 65 + (A*16 + 9) MOD 58 )
DATA_1?(A*16 + 10) = ( 65 + (A*16 + 10) MOD 58 )
DATA_1?(A*16 + 11) = ( 65 + (A*16 + 11) MOD 58 )
DATA_1?(A*16 + 12) = ( 65 + (A*16 + 12) MOD 58 )
DATA_1?(A*16 + 13) = ( 65 + (A*16 + 13) MOD 58 )
DATA_1?(A*16 + 14) = ( 65 + (A*16 + 14) MOD 58 )
DATA_1?(A*16 + 15) = ( 65 + (A*16 + 15) MOD 58 )
NEXT A
DATA_1?(32768) = ( 65 + 32768 MOD 58 )
DATA_1?(32769) = ( 65 + 32769 MOD 58 )

This isn't debugged or known to be syntactically correct.  Might be
worth trying though...

Ian

Geoff wrote:
> The Following Results Found;
>
> I changed VIRTUAL Array to HUGE
> which I belive keeps everything
> below the DOS 1MB RAM boundary
> and then used a RANDOM instead of a
> BINARY OPEN command. It seems RANDOM
> is best for numbers and BINARY
> is best for Strings if you want to
> do things byte by byte in PowerBasic For DOS.
> EVERYTHING now becomes;
>
> \$LIB COM        ON
> \$LIB FULLFLOAT  ON
> \$LIB VGA        ON
> \$ERROR BOUNDS   ON
> \$ERROR NUMERIC  ON
> \$ERROR OVERFLOW ON
> \$ERROR STACK    ON
> \$CPU 80386
> \$COM    1024
> \$STRING 32
> \$STACK  2048
> \$SOUND  256
> \$DYNAMIC
> \$COMPILE EXE "TEST.EXE"
> \$FLOAT NPX
> \$OPTIMIZE SPEED
> \$EVENT
> \$OPTION CNTLBREAK ON
>
> DIM HUGE DATA_1?(0:32769)
> FOR A = 0 to 32769 : DATA_1?(A) = ( 65 + A MOD 58 ) : NEXT A
> FILE1\$ = "c:\data\test.dat"
> START1 = TIMER
> OPEN FILE1\$ FOR RANDOM AS #1 LEN = 1
> FOR A?? = 0 to 32769
> PUT #1,A?? + 1,DATA_1?(A??)
> NEXT A??
> CLOSE
> STOP1 = TIMER
> IF START1 > STOP1 THEN START1 = START1 + 86400
> PRINT "FILE CREATION RUNTIME :"; ROUND(( STOP1 - START1 ) , 3 )
> ' KILL FILE1\$
> SLEEP 3
> END
>
> Best regards
> geoff
>
> __________________________________________________________
>
> Public Seismic Network Mailing List (PSN-L)
>
> To leave this list email PSN-L-REQUEST@.............. with the body of
> the message (first line only): unsubscribe
>
>
__________________________________________________________

Public Seismic Network Mailing List (PSN-L)

```