QBasic syntax error?

On Fri, 21 Dec 2012 20:33:10 -0800 (PST), Bill Bowden
<bperryb@bowdenshobbycircuits.info> wrote:

On Dec 21, 7:42 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 17:55:42 -0800 (PST), Bill Bowden





bper...@bowdenshobbycircuits.info> wrote:

On Dec 20, 10:32 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Thu, 20 Dec 2012 21:28:36 -0800 (PST), Bill Bowden

bper...@bowdenshobbycircuits.info> wrote:

Why does QBasic give me a syntax error with this code?

Comments aren't permitted on DATA statements, memory serving.
When I get a moment, I'll double check that detail, though.

Jon


I forget to mention the code works ok with Borland Turbo Basic. I did
find that adding an extra '2' to the data list fixes the problem so it
runs right in QBasic. I'm just wondering why I need an extra data
character in one case and not the other?

-Bill


Because QBASIC doesn't accept comments. Borland most
certainly does, by comparison.

Jon

I don't think the comments are the problem. In one case with Turbo
Basic the line reads "DATA
0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2 '11100001011100"

In the second case with QBasic, the line reads "DATA
0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2,2 '11100001011100 "

All I did was add an extra 2 which fixed the problem. But looking at
the code, the extra 2 at the end is not needed, but QBasic says it is.
Comments are the problem. I went through a bunch of trouble
to set up a VM with a 32-bit Virtual XP and then copy all my
QBASIC stuff over from an older machine to try it out after
posting my response.

It was pretty easy to test. I didn't use just your code. I
used some I wrote, too, just to be absolutely sure.

No comments on DATA statements in QBASIC. The documentation
even mentions it: "A remark can be inserted on a line after
an executable statement if it is preceded by the single-quote
form of REM or if REM is preceded by a colon." Note the use
of "executable statement" in the above description. DATA is
not an executable statement.

Besides. I tried a lot of different ways to check this out.
You can't do it. Check it out yourself. It will actually read
up the comment, if you try using a string variable instead of
a numeric one. It is NOT a comment on a DATA statement. It is
part of the data, like it or not.

Jon
 
On Fri, 21 Dec 2012 10:23:31 -0800 (PST), George Herold
<gherold@teachspin.com> wrote:

<snip>
Robbie the Robot (a nice Asimov story.) was not on the screen with
Will Robinson. (Undoubtedly the worst Sci-fi series ever!)
Robbie the Robot was from "Forbidden Planet", which was a
classic sci-fi version of Shakespeare's "The Tempest".
Robbie appeared in numerous other movie and TV productions
over the years. (Regarding "The Tempest" / "Forbidden
Planet", Michael Crichton also "borrowed" the same basic
"creatures from the id" theme for "Sphere".)

Best regards,




Bob Masta

DAQARTA v7.10
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
Frequency Counter, Pitch Track, Pitch-to-MIDI
FREE Signal Generator, DaqMusic generator
Science with your sound card!
 
On Fri, 21 Dec 2012 18:42:48 -0800 (PST), George Herold
<gherold@teachspin.com> wrote:


I ordered a copy of power basic for $50, on someone's recommendation
(James A.?)
---
Larkin, more than likely.
---

I haven't written anything in it yet though.

George H.
---
It's pretty nice.

--
JF
 
On Fri, 21 Dec 2012 00:44:17 -0600, Tim Wescott <tim@seemywebsite.com> wrote:

On Thu, 20 Dec 2012 21:28:36 -0800, Bill Bowden wrote:

Why does QBasic give me a syntax error with this code?


----------------------------------------------------------------------------------------

DATA 0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2 '11100001011100

CLS

WHILE TI < 2 AND INKEY$ = ""

READ TI

IF TI = 0 THEN

IF I = 0 AND P = 1 THEN PRINT "1";
IF I = 1 AND P = 1 THEN PRINT "0";
P = P + 1
IF P = 2 THEN P = 0

END IF

IF TI = 1 THEN

I = I + 1
IF I = 2 THEN I = 0
IF I = 0 THEN PRINT "0";
IF I = 1 THEN PRINT "1";

END IF

WEND

IF P = 0 THEN END
IF I = 1 THEN PRINT "0" ELSE PRINT "1"

END

acause you're using BASIC. Do the job in C and you'll get more syntax
errors at first, but once you have them straightened out your program
will run faster (and be much more cool).
One of my guys wrote a C program (GCC, linux) that involved some signal
averaging. One subroutine added 4 million 16-bit ADC samples to a 32-bit array.
It seemed awfully slow to me, so I did it on my PC in PowerBasic, just a FOR
loop with the obvious subscripts, no pointers or anything, 8 lines of code or
some such. It took a minute or two to code and compile. Mine was 4x faster than
his. After a day of futzing with compiler optimizations and stuff, he got his
runtime down to 1.2x of mine.

What's cool about an ugly, hazardous, 40 year old programming language? What's
good about syntax errors?




--

John Larkin Highland Technology Inc
www.highlandtechnology.com jlarkin at highlandtechnology dot com

Precision electronic instrumentation
Picosecond-resolution Digital Delay and Pulse generators
Custom timing and laser controllers
Photonics and fiberoptic TTL data links
VME analog, thermocouple, LVDT, synchro, tachometer
Multichannel arbitrary waveform generators
 
On Fri, 21 Dec 2012 18:42:48 -0800 (PST), George Herold <gherold@teachspin.com>
wrote:

On Dec 21, 4:40 pm, John Fields <jfie...@austininstruments.com> wrote:
On Fri, 21 Dec 2012 10:23:31 -0800 (PST), George Herold





gher...@teachspin.com> wrote:
On Dec 21, 11:22 am, Phil Hobbs
pcdhSpamMeSensel...@electrooptical.net> wrote:
On 12/21/2012 01:44 AM, Tim Wescott wrote:

On Thu, 20 Dec 2012 21:28:36 -0800, Bill Bowden wrote:

Why does QBasic give me a syntax error with this code?

---------------------------------------------------------------------------­­-------------

DATA 0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2  '11100001011100

CLS

WHILE TI<  2 AND INKEY$ = ""

   READ TI

   IF TI = 0 THEN

          IF I = 0 AND P = 1 THEN PRINT "1";
          IF I = 1 AND P = 1 THEN PRINT "0";
          P = P + 1
          IF P = 2 THEN P = 0

   END IF

   IF TI = 1 THEN

          I = I + 1
          IF I = 2 THEN I = 0
          IF I = 0 THEN PRINT "0";
          IF I = 1 THEN PRINT "1";

   END IF

WEND

     IF P = 0 THEN END
     IF I = 1 THEN PRINT "0" ELSE PRINT "1"

END

acause you're using BASIC.  Do the job in C and you'll get more syntax
errors at first, but once you have them straightened out your program
will run faster (and be much more cool).

Also it won't be shouting blather at the top of its little lungs.  When
I read this sort of code, I always think of Robbie the Robot.

10 WHILE 1
20 PRINT "DANGER WILL ROBINSON!!!!!"
30 WEND

;)

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510

hobbs at electrooptical dot nethttp://electrooptical.net-Hide quoted text -

- Show quoted text -

Now, now... for 'we bears of very little brain'* basic is a fine
language.
I've got several little programs that help me on my way.

GOSUB nitpick

All in good fun :^)
Hey there's this white fluffy stuff falling outside my window.
What's that?
And here's wishing all the SEBers a wonderful Holiday season!
I'm cutting out early to go decorate Xmas cookies at granma's with the
kids.

George H.

SUB nitpick
   basic doesn't need line numbers anymore
   the commands are still in caps, but I use lower case for variables
     which makes it easier to read.
   Robbie the Robot (a nice Asimov story.) was not on the screen with
Will Robinson.  (Undoubtedly the worst Sci-fi series ever!)
RETURN

*no insult intended for other basic users.

---
Power BASIC's Console Compiler commands are all lower case and the
source code is gorgeous.

Here's an example, the application being a 2 resistor voltage divider
solver, with the executable at abse:

function pbmain() as long

          color 0,15
          cursor on,10

e1sw:
          gosub loopa
          print "Solve for E1? <y/n>"
          locate 13,20

e1yorn:
          i$ = waitkey$
          if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto e1out
          if i$ = "n" or i$ = "N" then goto r1sw
          goto e1yorn

r1sw:
          print""
          print "Solve for R1? <y/n>"
          locate 14,20

r1yorn:
          i$ = waitkey$
          if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto r1out
          if i$ = "n" or i$ = "N" then goto e2sw
          goto r1yorn

e2sw:
          print""
          print "Solve for E2? <y/n>"
          locate 15,20

e2yorn:
          i$ = waitkey$
          if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto e2out
          if i$ = "n" or i$ = "N" then goto r2sw
          goto e2yorn

r2sw:
          print""
          print "Solve for R2? <y/n>"
          locate 16,20

r2yorn:
          i$ = waitkey$
          if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto r2out
          if i$ = "n" or i$ = "N" then goto endsw
          goto r2yorn

endsw:
          print ""
          print "End? <y/n> "
          locate 17,11

endyorn:
          i$ = waitkey$
          if i$ = "y" or i$ = "Y" or i$ = chr$(13) then end
          if i$ = "n" or i$ = "N" then goto more
          goto endyorn

more:
          print""
          print "Another try? <y/n> "
          locate 18,19

moreyn:
          i$ = waitkey$
          if i$ = "y" or i$ = "Y" or i$ = chr$(13) then goto e1sw
          if i$ = "n" or t$ = "N" then end
          goto moreyn

e1out:
         print""
         input "Enter resistance of R1 in ohms: " ,r1!
         input "Enter voltage of E2 in volts " ,e2!
         input "Enter resistance of R2 in ohms: " ,r2!

         e1!=(e2!)*(r1!+r2!)/r2!

         print""
         print "E1 = "e1!" volts."

         print "another run? <y/n> "
         i$ = waitkey$
         if i$ = "y" then gosub loopa else end
         goto e1out

r1out:
         print""
         input "Enter voltage of E1 in volts: " ,e1!
         input "Enter voltage of E2 in volts " ,e2!
         input "Enter resistance of R2 in ohms: " ,r2!

         r1!=(r2!)*(e1!-e2!)/e2!

         print""
         print "R1 = "r1!" ohms."

         print "another run? <y/n> "
         i$ = waitkey$
         if i$ = "y" then gosub loopa else end
         goto r1out

e2out:
         print""
         input "Enter voltage of E1 in volts: " ,e1!
         input "Enter resistance of R1 in ohms: " ,r1!
         input "Enter resistance of R2 in ohms: " ,r2!

         e2!=(e1!*r2!)/(r1!+r2!)

         print""
         print "E2 = "e2!" volts."

         print "another run? <y/n> "
         i$ = waitkey$
         if i$ = "y" then gosub loopa else end
         goto e2out

r2out:
         print""
         input "Enter voltage of E1 in volts: " ,e1!
         input "Enter resistance of R1 in ohms: " ,r1!
         input "Enter voltage of E2 in volts " ,e2!

         r2!=(e2!*r1!)/(e1!-e2!)

         print""
         print "R2 = "r2!" ohms."

         print""
         print "another run? <y/n> "
         i$ = waitkey$
         if i$ = "y" then gosub loopa else end
         goto r2out

loopa:
          cls
          print""
          print "    E1"
          print "    |"
          print "   [R1]"
          print "    |"
          print "    +---E2"
          print "    |"
          print "   [R2]"
          print "    |"
          print "   GND
          print""
          print""

          return

end function

--
JF- Hide quoted text -

- Show quoted text -

I ordered a copy of power basic for $50, on someone's recommendation
(James A.?)
I haven't written anything in it yet though.

George H.
Was the $50 thing the DOS version? It's OK, but the 32-bit Console Compiler
rocks. It does Ethernet / TCP/IP beautifully. Good Windows graphics.


--

John Larkin Highland Technology Inc
www.highlandtechnology.com jlarkin at highlandtechnology dot com

Precision electronic instrumentation
Picosecond-resolution Digital Delay and Pulse generators
Custom timing and laser controllers
Photonics and fiberoptic TTL data links
VME analog, thermocouple, LVDT, synchro, tachometer
Multichannel arbitrary waveform generators
 
On 12/21/2012 1:23 PM, George Herold wrote:
On Dec 21, 11:22 am, Phil Hobbs
pcdhSpamMeSensel...@electrooptical.net> wrote:
On 12/21/2012 01:44 AM, Tim Wescott wrote:





On Thu, 20 Dec 2012 21:28:36 -0800, Bill Bowden wrote:

Why does QBasic give me a syntax error with this code?

---------------------------------------------------------------------------­-------------

DATA 0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2 '11100001011100

CLS

WHILE TI< 2 AND INKEY$ = ""

READ TI

IF TI = 0 THEN

IF I = 0 AND P = 1 THEN PRINT "1";
IF I = 1 AND P = 1 THEN PRINT "0";
P = P + 1
IF P = 2 THEN P = 0

END IF

IF TI = 1 THEN

I = I + 1
IF I = 2 THEN I = 0
IF I = 0 THEN PRINT "0";
IF I = 1 THEN PRINT "1";

END IF

WEND

IF P = 0 THEN END
IF I = 1 THEN PRINT "0" ELSE PRINT "1"

END

acause you're using BASIC. Do the job in C and you'll get more syntax
errors at first, but once you have them straightened out your program
will run faster (and be much more cool).

Also it won't be shouting blather at the top of its little lungs. When
I read this sort of code, I always think of Robbie the Robot.

10 WHILE 1
20 PRINT "DANGER WILL ROBINSON!!!!!"
30 WEND

;)

Cheers

Phil Hobbs

- Show quoted text -

Now, now... for 'we bears of very little brain'* basic is a fine
language.
I've got several little programs that help me on my way.

GOSUB nitpick

All in good fun :^)
Hey there's this white fluffy stuff falling outside my window.
What's that?
And here's wishing all the SEBers a wonderful Holiday season!
I'm cutting out early to go decorate Xmas cookies at granma's with the
kids.

George H.



SUB nitpick
basic doesn't need line numbers anymore
the commands are still in caps, but I use lower case for variables
which makes it easier to read.
Robbie the Robot (a nice Asimov story.) was not on the screen with
Will Robinson. (Undoubtedly the worst Sci-fi series ever!)
RETURN

*no insult intended for other basic users.
Okay, I checked, the one in Lost In Space was "Robby", not "Robbie".
Being Canadian, obviously my ear for American accents missed the
distinction. ;)

I have no big issue with BASIC--old FORTRAN code has the same problem.

But Merry Christmas to you and your family as well.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510 USA
+1 845 480 2058

hobbs at electrooptical dot net
http://electrooptical.net
 
On 12/21/2012 4:40 PM, John Fields wrote:
On Fri, 21 Dec 2012 10:23:31 -0800 (PST), George Herold
gherold@teachspin.com> wrote:

On Dec 21, 11:22 am, Phil Hobbs
pcdhSpamMeSensel...@electrooptical.net> wrote:
On 12/21/2012 01:44 AM, Tim Wescott wrote:





On Thu, 20 Dec 2012 21:28:36 -0800, Bill Bowden wrote:

Why does QBasic give me a syntax error with this code?

---------------------------------------------------------------------------­-------------

DATA 0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2 '11100001011100

CLS

WHILE TI< 2 AND INKEY$ = ""

READ TI

IF TI = 0 THEN

IF I = 0 AND P = 1 THEN PRINT "1";
IF I = 1 AND P = 1 THEN PRINT "0";
P = P + 1
IF P = 2 THEN P = 0

END IF

IF TI = 1 THEN

I = I + 1
IF I = 2 THEN I = 0
IF I = 0 THEN PRINT "0";
IF I = 1 THEN PRINT "1";

END IF

WEND

IF P = 0 THEN END
IF I = 1 THEN PRINT "0" ELSE PRINT "1"

END

acause you're using BASIC. Do the job in C and you'll get more syntax
errors at first, but once you have them straightened out your program
will run faster (and be much more cool).

Also it won't be shouting blather at the top of its little lungs. When
I read this sort of code, I always think of Robbie the Robot.

10 WHILE 1
20 PRINT "DANGER WILL ROBINSON!!!!!"
30 WEND

;)

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510

hobbs at electrooptical dot nethttp://electrooptical.net- Hide quoted text -

- Show quoted text -

Now, now... for 'we bears of very little brain'* basic is a fine
language.
I've got several little programs that help me on my way.

GOSUB nitpick

All in good fun :^)
Hey there's this white fluffy stuff falling outside my window.
What's that?
And here's wishing all the SEBers a wonderful Holiday season!
I'm cutting out early to go decorate Xmas cookies at granma's with the
kids.

George H.



SUB nitpick
basic doesn't need line numbers anymore
the commands are still in caps, but I use lower case for variables
which makes it easier to read.
Robbie the Robot (a nice Asimov story.) was not on the screen with
Will Robinson. (Undoubtedly the worst Sci-fi series ever!)
RETURN

*no insult intended for other basic users.

---
Power BASIC's Console Compiler commands are all lower case and the
source code is gorgeous.

Here's an example, the application being a 2 resistor voltage divider
solver, with the executable at abse:
<snip>

If you think that's gorgeous, you need to get out more.

;)

Cheers

Phil Hobbs


--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510 USA
+1 845 480 2058

hobbs at electrooptical dot net
http://electrooptical.net
 
On 2012-12-22, John Larkin <jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:

One of my guys wrote a C program (GCC, linux) that involved some signal
averaging. One subroutine added 4 million 16-bit ADC samples to a 32-bit array.
It seemed awfully slow to me, so I did it on my PC in PowerBasic, just a FOR
loop with the obvious subscripts, no pointers or anything, 8 lines of code or
some such. It took a minute or two to code and compile. Mine was 4x faster than
his. After a day of futzing with compiler optimizations and stuff, he got his
runtime down to 1.2x of mine.
there's no shortage of bad programmers.

What's cool about an ugly, hazardous, 40 year old programming language? What's
good about syntax errors?
So you think an older programming language is better?

--
⚂⚃ 100% natural

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
 
On Dec 21, 9:57 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 18:38:46 -0800 (PST), George Herold





gher...@teachspin.com> wrote:
On Dec 21, 3:06 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 06:55:59 -0800 (PST), George Herold

gher...@teachspin.com> wrote:
On Dec 21, 1:32 am, Jon Kirwan <j...@infinitefactors.org> wrote:
On Thu, 20 Dec 2012 21:28:36 -0800 (PST), Bill Bowden

bper...@bowdenshobbycircuits.info> wrote:
Why does QBasic give me a syntax error with this code?

Comments aren't permitted on DATA statements, memory serving.
When I get a moment, I'll double check that detail, though.

Jon

Bingo!  Kill the comment.

George H.

Yeah, I went off and installed XP mode and then dragged my
entire Microsoft development environment (VBDOS, QB45,
QBASIC, QC2, ML/MASM, and a bunch of other "old tools") over
from an old machine and set up something I could test with.
Needed to do that, anyway. And yes, I did a quick test with
and without the comments and it worked without and didn't
work with.

This goes back to the 1970's, by the way. I used the original
Microsoft papertape BASIC (which I may still have in
papertape form if you can believe it) and had been "shocked"
that comments on DATA statements caused it to have parsing
problems. I was used to (1) languages that didn't support
comments, such as HP 2000F BASIC, and (2) languages which had
no problem with dealing with comments on DATA statements -- I
believe it was on a PDP-10, but memory is vague now. But I'd
never experienced one that couldn't handle something it
permitted.

I just figured that Microsoft's BASIC treated a DATA
statement almost like a REM statement -- it didn't parse it
or anything. It just accepted ANYTHING you typed there. It
was "your problem" and not theirs, what you did. Only at
run-time did it check and parse things. And since it was
nothing more than a keyword followed by unchecked text, they
took the easy way out and didn't bother supporting comment
recognition.

Still holds with their later tools, I see.

Jon

I've got QB45 installed.  I run half a dozen programs.
It runs in this little minimalist screen resolution, which is kinda
quaint, reminds me of grad school.

QB45 will run with 50 lines, if you want. If you set the DOS
box properties so that it starts with 50 lines, then QB will
use it. If not, QB45 will still be able to use 50 lines, but
you have to write a few lines of code then to force the line
change.

Jon- Hide quoted text -

- Show quoted text -
Cool, I'll give it a try.

George H.
 
On Dec 22, 8:06 am, N0S...@daqarta.com (Bob Masta) wrote:
On Fri, 21 Dec 2012 10:23:31 -0800 (PST), George Herold

gher...@teachspin.com> wrote:

snip

   Robbie the Robot (a nice Asimov story.) was not on the screen with
Will Robinson.  (Undoubtedly the worst Sci-fi series ever!)

Robbie the Robot was from "Forbidden Planet", which was a
classic sci-fi version of Shakespeare's "The Tempest".
Robbie appeared in numerous other movie and TV productions
over the years.  (Regarding "The Tempest" / "Forbidden
Planet", Michael Crichton also "borrowed" the same basic
"creatures from the id" theme for "Sphere".)

Best regards,

Bob Masta

              DAQARTA  v7.10
   Data AcQuisition And Real-Time Analysis
             www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
 Frequency Counter, Pitch Track, Pitch-to-MIDI
   FREE Signal Generator, DaqMusic generator
          Science with your sound card!
Oops, my fault I was thinking of Robbie
http://en.wikipedia.org/wiki/Robbie_(short_story)

George H.
 
On Sat, 22 Dec 2012 15:52:42 -0800 (PST), George Herold
<gherold@teachspin.com> wrote:

On Dec 21, 9:57 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 18:38:46 -0800 (PST), George Herold





gher...@teachspin.com> wrote:
On Dec 21, 3:06 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 06:55:59 -0800 (PST), George Herold

gher...@teachspin.com> wrote:
On Dec 21, 1:32 am, Jon Kirwan <j...@infinitefactors.org> wrote:
On Thu, 20 Dec 2012 21:28:36 -0800 (PST), Bill Bowden

bper...@bowdenshobbycircuits.info> wrote:
Why does QBasic give me a syntax error with this code?

Comments aren't permitted on DATA statements, memory serving.
When I get a moment, I'll double check that detail, though.

Jon

Bingo!  Kill the comment.

George H.

Yeah, I went off and installed XP mode and then dragged my
entire Microsoft development environment (VBDOS, QB45,
QBASIC, QC2, ML/MASM, and a bunch of other "old tools") over
from an old machine and set up something I could test with.
Needed to do that, anyway. And yes, I did a quick test with
and without the comments and it worked without and didn't
work with.

This goes back to the 1970's, by the way. I used the original
Microsoft papertape BASIC (which I may still have in
papertape form if you can believe it) and had been "shocked"
that comments on DATA statements caused it to have parsing
problems. I was used to (1) languages that didn't support
comments, such as HP 2000F BASIC, and (2) languages which had
no problem with dealing with comments on DATA statements -- I
believe it was on a PDP-10, but memory is vague now. But I'd
never experienced one that couldn't handle something it
permitted.

I just figured that Microsoft's BASIC treated a DATA
statement almost like a REM statement -- it didn't parse it
or anything. It just accepted ANYTHING you typed there. It
was "your problem" and not theirs, what you did. Only at
run-time did it check and parse things. And since it was
nothing more than a keyword followed by unchecked text, they
took the easy way out and didn't bother supporting comment
recognition.

Still holds with their later tools, I see.

Jon

I've got QB45 installed.  I run half a dozen programs.
It runs in this little minimalist screen resolution, which is kinda
quaint, reminds me of grad school.

QB45 will run with 50 lines, if you want. If you set the DOS
box properties so that it starts with 50 lines, then QB will
use it. If not, QB45 will still be able to use 50 lines, but
you have to write a few lines of code then to force the line
change.

Jon- Hide quoted text -

- Show quoted text -

Cool, I'll give it a try.

George H.
If you want, you can just start up the DOS box, then type:

MODE CON: LINES=50

Then start up QB45.

Jon
 
On Dec 22, 6:36 pm, Phil Hobbs
<pcdhSpamMeSensel...@electrooptical.net> wrote:
On 12/21/2012 1:23 PM, George Herold wrote:





On Dec 21, 11:22 am, Phil Hobbs
pcdhSpamMeSensel...@electrooptical.net> wrote:
On 12/21/2012 01:44 AM, Tim Wescott wrote:

On Thu, 20 Dec 2012 21:28:36 -0800, Bill Bowden wrote:

Why does QBasic give me a syntax error with this code?

---------------------------------------------------------------------------­­-------------

DATA 0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2  '11100001011100

CLS

WHILE TI<  2 AND INKEY$ = ""

    READ TI

    IF TI = 0 THEN

           IF I = 0 AND P = 1 THEN PRINT "1";
           IF I = 1 AND P = 1 THEN PRINT "0";
           P = P + 1
           IF P = 2 THEN P = 0

    END IF

    IF TI = 1 THEN

           I = I + 1
           IF I = 2 THEN I = 0
           IF I = 0 THEN PRINT "0";
           IF I = 1 THEN PRINT "1";

    END IF

WEND

      IF P = 0 THEN END
      IF I = 1 THEN PRINT "0" ELSE PRINT "1"

END

acause you're using BASIC.  Do the job in C and you'll get more syntax
errors at first, but once you have them straightened out your program
will run faster (and be much more cool).

Also it won't be shouting blather at the top of its little lungs.  When
I read this sort of code, I always think of Robbie the Robot.

10 WHILE 1
20 PRINT "DANGER WILL ROBINSON!!!!!"
30 WEND

;)

Cheers

Phil Hobbs
- Show quoted text -

Now, now... for 'we bears of very little brain'* basic is a fine
language.
I've got several little programs that help me on my way.

GOSUB nitpick

All in good fun :^)
Hey there's this white fluffy stuff falling outside my window.
What's that?
And here's wishing all the SEBers a wonderful Holiday season!
I'm cutting out early to go decorate Xmas cookies at granma's with the
kids.

George H.

SUB nitpick
     basic doesn't need line numbers anymore
     the commands are still in caps, but I use lower case for variables
       which makes it easier to read.
     Robbie the Robot (a nice Asimov story.) was not on the screen with
Will Robinson.  (Undoubtedly the worst Sci-fi series ever!)
RETURN

  *no insult intended for other basic users.

Okay, I checked, the one in Lost In Space was "Robby", not "Robbie".
Being Canadian, obviously my ear for American accents missed the
distinction. ;)
Wow.. OK, apparently I screwed up too. All I can say is that Asimov's
Robbie (sans Robot) dates to 1939.

I never knew there were so many...
I have no big issue with BASIC--old FORTRAN code has the same problem.

Oh it's just the 'hammer' I'm comfortable with.

But Merry Christmas to you and your family as well.
Thanks, we had a great time at granma's, another family with twin boys
always joins us. They're six now, nothing like a pair of six year old
boys
to spice up the evening! I parked myself in a corner with a beer and
enjoyed the show.

George H.
Cheers

Phil Hobbs

--
Dr Philip C D Hobbs
Principal Consultant
ElectroOptical Innovations LLC
Optics, Electro-optics, Photonics, Analog Electronics

160 North State Road #203
Briarcliff Manor NY 10510 USA
+1 845 480 2058

hobbs at electrooptical dot nethttp://electrooptical.net- Hide quoted text -

- Show quoted text -
Wow.. OK, apparently I screwed up too. All I can say is that Asimov's
Robbie (sans Robot) dates to 1939.
 
On Dec 22, 6:58 pm, George Herold <gher...@teachspin.com> wrote:
On Dec 22, 8:06 am, N0S...@daqarta.com (Bob Masta) wrote:





On Fri, 21 Dec 2012 10:23:31 -0800 (PST), George Herold

gher...@teachspin.com> wrote:

snip

   Robbie the Robot (a nice Asimov story.) was not on the screen with
Will Robinson.  (Undoubtedly the worst Sci-fi series ever!)

Robbie the Robot was from "Forbidden Planet", which was a
classic sci-fi version of Shakespeare's "The Tempest".
Robbie appeared in numerous other movie and TV productions
over the years.  (Regarding "The Tempest" / "Forbidden
Planet", Michael Crichton also "borrowed" the same basic
"creatures from the id" theme for "Sphere".)

Best regards,

Bob Masta

              DAQARTA  v7.10
   Data AcQuisition And Real-Time Analysis
             www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
 Frequency Counter, Pitch Track, Pitch-to-MIDI
   FREE Signal Generator, DaqMusic generator
          Science with your sound card!

Oops, my fault I was thinking of Robbiehttp://en.wikipedia.org/wiki/Robbie_(short_story)
double oops, I missed a )

http://en.wikipedia.org/wiki/Robbie_(short_story)

George H.- Hide quoted text -

- Show quoted text -
 
Bill Bowden wrote:
Ok Jon, I added a colon at the end of the DATA statement followed by
the comment, and the problem went away. Still strange why Borland
Turbo Basic behaves differently. Jasen also had the right answer.

Why is it strange? They were written by different people.
 
On Dec 21, 10:24 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 20:33:10 -0800 (PST), Bill Bowden





bper...@bowdenshobbycircuits.info> wrote:
On Dec 21, 7:42 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 17:55:42 -0800 (PST), Bill Bowden

bper...@bowdenshobbycircuits.info> wrote:

On Dec 20, 10:32 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Thu, 20 Dec 2012 21:28:36 -0800 (PST), Bill Bowden

bper...@bowdenshobbycircuits.info> wrote:

Why does QBasic give me a syntax error with this code?

Comments aren't permitted on DATA statements, memory serving.
When I get a moment, I'll double check that detail, though.

Jon

I forget to mention the code works ok with Borland Turbo Basic. I did
find that adding an extra '2' to the data list fixes the problem so it
runs right in QBasic. I'm just wondering why I need an extra data
character in one case and not the other?

-Bill

Because QBASIC doesn't accept comments. Borland most
certainly does, by comparison.

Jon

I don't think the comments are the problem. In one case with Turbo
Basic the line reads "DATA
0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2  '11100001011100"

In the second case with QBasic, the line reads "DATA
0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2,2  '11100001011100 "

All I did was add an extra 2 which fixed the problem. But looking at
the code, the extra 2 at the end is not needed, but QBasic says it is.

Comments are the problem. I went through a bunch of trouble
to set up a VM with a 32-bit Virtual XP and then copy all my
QBASIC stuff over from an older machine to try it out after
posting my response.

It was pretty easy to test. I didn't use just your code. I
used some I wrote, too, just to be absolutely sure.

No comments on DATA statements in QBASIC. The documentation
even mentions it: "A remark can be inserted on a line after
an executable statement if it is preceded by the single-quote
form of REM or if REM is preceded by a colon." Note the use
of "executable statement" in the above description. DATA is
not an executable statement.

Besides. I tried a lot of different ways to check this out.
You can't do it. Check it out yourself. It will actually read
up the comment, if you try using a string variable instead of
a numeric one. It is NOT a comment on a DATA statement. It is
part of the data, like it or not.

Jon
Ok Jon, I added a colon at the end of the DATA statement followed by
the comment, and the problem went away. Still strange why Borland
Turbo Basic behaves differently. Jasen also had the right answer.

-Bill
 
On Sat, 22 Dec 2012 19:01:18 -0800 (PST), Bill Bowden
<bperryb@bowdenshobbycircuits.info> wrote:

On Dec 21, 10:24 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 20:33:10 -0800 (PST), Bill Bowden





bper...@bowdenshobbycircuits.info> wrote:
On Dec 21, 7:42 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Fri, 21 Dec 2012 17:55:42 -0800 (PST), Bill Bowden

bper...@bowdenshobbycircuits.info> wrote:

On Dec 20, 10:32 pm, Jon Kirwan <j...@infinitefactors.org> wrote:
On Thu, 20 Dec 2012 21:28:36 -0800 (PST), Bill Bowden

bper...@bowdenshobbycircuits.info> wrote:

Why does QBasic give me a syntax error with this code?

Comments aren't permitted on DATA statements, memory serving.
When I get a moment, I'll double check that detail, though.

Jon

I forget to mention the code works ok with Borland Turbo Basic. I did
find that adding an extra '2' to the data list fixes the problem so it
runs right in QBasic. I'm just wondering why I need an extra data
character in one case and not the other?

-Bill

Because QBASIC doesn't accept comments. Borland most
certainly does, by comparison.

Jon

I don't think the comments are the problem. In one case with Turbo
Basic the line reads "DATA
0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2  '11100001011100"

In the second case with QBasic, the line reads "DATA
0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,2,2  '11100001011100 "

All I did was add an extra 2 which fixed the problem. But looking at
the code, the extra 2 at the end is not needed, but QBasic says it is.

Comments are the problem. I went through a bunch of trouble
to set up a VM with a 32-bit Virtual XP and then copy all my
QBASIC stuff over from an older machine to try it out after
posting my response.

It was pretty easy to test. I didn't use just your code. I
used some I wrote, too, just to be absolutely sure.

No comments on DATA statements in QBASIC. The documentation
even mentions it: "A remark can be inserted on a line after
an executable statement if it is preceded by the single-quote
form of REM or if REM is preceded by a colon." Note the use
of "executable statement" in the above description. DATA is
not an executable statement.

Besides. I tried a lot of different ways to check this out.
You can't do it. Check it out yourself. It will actually read
up the comment, if you try using a string variable instead of
a numeric one. It is NOT a comment on a DATA statement. It is
part of the data, like it or not.

Jon

Ok Jon, I added a colon at the end of the DATA statement followed by
the comment, and the problem went away. Still strange why Borland
Turbo Basic behaves differently. Jasen also had the right answer.
Why strange? There is no standard BASIC, or I guess it's really
"there's so many to choose from".
 
On 23 Dec 2012 00:23:09 GMT, Jasen Betts <jasen@xnet.co.nz> wrote:

On 2012-12-22, John Larkin <jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:

One of my guys wrote a C program (GCC, linux) that involved some signal
averaging. One subroutine added 4 million 16-bit ADC samples to a 32-bit array.
It seemed awfully slow to me, so I did it on my PC in PowerBasic, just a FOR
loop with the obvious subscripts, no pointers or anything, 8 lines of code or
some such. It took a minute or two to code and compile. Mine was 4x faster than
his. After a day of futzing with compiler optimizations and stuff, he got his
runtime down to 1.2x of mine.

there's no shortage of bad programmers.
He wrote the obvious c code, a loop with pointers and an add.


What's cool about an ugly, hazardous, 40 year old programming language? What's
good about syntax errors?

So you think an older programming language is better?
PowerBasic isn't old.

Modern Basics have all sorts of goodies. Like TRY/CATCH, PRINT USING, jillions
of cool intrinsic string functions, all sorts of data types, great graphics
built in. Basic has evolved a lot, and c has hardly evolved at all.

The best programming language around is probably Ada, but few people are willing
to invest the modest amount of discipline that it requires. Most people prefer
to type fast and debug until they have to ship.


--

John Larkin Highland Technology Inc
www.highlandtechnology.com jlarkin at highlandtechnology dot com

Precision electronic instrumentation
Picosecond-resolution Digital Delay and Pulse generators
Custom timing and laser controllers
Photonics and fiberoptic TTL data links
VME analog, thermocouple, LVDT, synchro, tachometer
Multichannel arbitrary waveform generators
 
On Sat, 22 Dec 2012 21:23:06 -0800, John Larkin
<jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:

On 23 Dec 2012 00:23:09 GMT, Jasen Betts <jasen@xnet.co.nz> wrote:

On 2012-12-22, John Larkin <jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:

One of my guys wrote a C program (GCC, linux) that involved some signal
averaging. One subroutine added 4 million 16-bit ADC samples to a 32-bit array.
It seemed awfully slow to me, so I did it on my PC in PowerBasic, just a FOR
loop with the obvious subscripts, no pointers or anything, 8 lines of code or
some such. It took a minute or two to code and compile. Mine was 4x faster than
his. After a day of futzing with compiler optimizations and stuff, he got his
runtime down to 1.2x of mine.

there's no shortage of bad programmers.

He wrote the obvious c code, a loop with pointers and an add.



What's cool about an ugly, hazardous, 40 year old programming language? What's
good about syntax errors?

So you think an older programming language is better?

PowerBasic isn't old.

Modern Basics have all sorts of goodies. Like TRY/CATCH, PRINT USING, jillions
of cool intrinsic string functions, all sorts of data types, great graphics
built in. Basic has evolved a lot, and c has hardly evolved at all.

The best programming language around is probably Ada, but few people are willing
to invest the modest amount of discipline that it requires. Most people prefer
to type fast and debug until they have to ship.
Why stop then? Certainly bugs don't care that the product was
shipped. IME, they rather like a new set of hands to uncover them.
 
On Sat, 22 Dec 2012 18:38:05 -0500, Phil Hobbs
<pcdhSpamMeSenseless@electrooptical.net> wrote:

On 12/21/2012 4:40 PM, John Fields wrote:
On Fri, 21 Dec 2012 10:23:31 -0800 (PST), George Herold
gherold@teachspin.com> wrote:


---
Power BASIC's Console Compiler commands are all lower case and the
source code is gorgeous.

Here's an example, the application being a 2 resistor voltage divider
solver, with the executable at abse:


snip

If you think that's gorgeous, you need to get out more.

;)
---
Hmm...

Dr Phil wants to play, eh?

--
JF
 
On Sun, 23 Dec 2012 01:14:59 -0500, krw@att.bizzz wrote:

On Sat, 22 Dec 2012 21:23:06 -0800, John Larkin
jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:

On 23 Dec 2012 00:23:09 GMT, Jasen Betts <jasen@xnet.co.nz> wrote:

On 2012-12-22, John Larkin <jjlarkin@highNOTlandTHIStechnologyPART.com> wrote:

One of my guys wrote a C program (GCC, linux) that involved some signal
averaging. One subroutine added 4 million 16-bit ADC samples to a 32-bit array.
It seemed awfully slow to me, so I did it on my PC in PowerBasic, just a FOR
loop with the obvious subscripts, no pointers or anything, 8 lines of code or
some such. It took a minute or two to code and compile. Mine was 4x faster than
his. After a day of futzing with compiler optimizations and stuff, he got his
runtime down to 1.2x of mine.

there's no shortage of bad programmers.

He wrote the obvious c code, a loop with pointers and an add.



What's cool about an ugly, hazardous, 40 year old programming language? What's
good about syntax errors?

So you think an older programming language is better?

PowerBasic isn't old.

Modern Basics have all sorts of goodies. Like TRY/CATCH, PRINT USING, jillions
of cool intrinsic string functions, all sorts of data types, great graphics
built in. Basic has evolved a lot, and c has hardly evolved at all.

The best programming language around is probably Ada, but few people are willing
to invest the modest amount of discipline that it requires. Most people prefer
to type fast and debug until they have to ship.

Why stop then? Certainly bugs don't care that the product was
shipped. IME, they rather like a new set of hands to uncover them.
Sure, let the users find the bugs for you. Microsoft does that. Next rev, fix a
few of the worst ones and add a bunch more. Step and repeat.

http://www.theregister.co.uk/2012/12/21/financial_software_disasters/


I love those examples on page 2.








--

John Larkin Highland Technology Inc
www.highlandtechnology.com jlarkin at highlandtechnology dot com

Precision electronic instrumentation
Picosecond-resolution Digital Delay and Pulse generators
Custom timing and laser controllers
Photonics and fiberoptic TTL data links
VME analog, thermocouple, LVDT, synchro, tachometer
Multichannel arbitrary waveform generators
 

Welcome to EDABoard.com

Sponsor

Back
Top