On Sat, 31 Oct 2020, Jim Hall wrote:

I didn't know how to report a bug to the GW-BASIC folks, but TK Chia hangs
out on this list, so I thought I'd mention it here.

I noticed TK Chia released a new GW-BASIC the other day. I started playing
around with it, just writing a few simple BASIC programs. I think I found a
bug:

RND(1) should always generate new random numbers. GW-BASIC resets the
sequence every time you RUN a program. So you were supposed to seed the
random number generator with the RANDOMIZE statement, passing a value as
the seed.

To have RANDOMIZE use an internal timer as the seed, you can add the TIMER
keyword:

RANDOMIZE TIMER


But this GW-BASIC seems to treat "TIMER" as a variable, so it's the same as
typing:

RANDOMIZE 0

or any uninitialized variable: (which are set to zero)

RANDOMIZE VAL

However, a workaround is to use the value from the system time (TIME$) and
use only the seconds. You can do that with the MID$() function.

LET SEED = VAL(MID$(TIME$,7,2))

That picks up only the seconds from the system time.


I found a copy of the GW-BASIC manual at
https://hwiegman.home.xs4all.nl/gw-man/


This is a 1.x GW-BASIC. The TIMER function only exists in GW-BASIC 2 and later. (I learned this when debugging "In Search of the Most Amazing Thing" on 3.14, which was written for BASICA 1.10.)

I don't know how hard it would be to add the 2.x functionality in, especially if it needs to be done "clean", as opposed to taking it from what I refer to as "black code" (i.e., leaked sources to QBASIC). (And I don't know whether MS would have problems with reconstituting a 3.2x GW-BASIC - from what I can tell, TK Chia's taken a play-it-safe approach.)

-uso.


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to