Author Topic: REALLY old basic code question  (Read 3976 times)

0 Members and 1 Guest are viewing this topic.

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
REALLY old basic code question
« on: June 07, 2019, 06:08:20 pm »
From 1971  -  what does this mean?

Code: QB64: [Select]
  1. if x > 400 then .2343

is this the same as

Code: QB64: [Select]
  1. if x > 400 then x = .2343

??

Thanks
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Marked as best answer by xra7en on June 07, 2019, 02:54:52 pm

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: REALLY old basic code question
« Reply #1 on: June 07, 2019, 06:48:57 pm »
The .2343 is probably a label to jump to. I think i remember that leading dots were used to denote labels (it's still used todays in assembly for local labels for instance).

The IF THEN statement makes a GOTO if it recognizes a label, today we would need to write IF xxx GOTO label instead.

That's my best guess, maybe somebody of the older fellows here on the forum can confirm or dismiss it for sure.
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: REALLY old basic code question
« Reply #2 on: June 07, 2019, 06:55:29 pm »
that be it. I looks through the spaghetti code and found the line number, and it matched the flow!
thanks!
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: REALLY old basic code question
« Reply #3 on: June 07, 2019, 08:11:19 pm »
Hi xra7en
IMHO in my little experience of very old code
Quote
IF condition THEN NumberOfLine/Label

It's new for me the use of a point as starter of the name of the label, but it is possible to make a similar name label in QB Qbasic and QB64, I have tested it. And RhoSigma is smarter than me!
Programming isn't difficult, only it's  consuming time and coffee

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: REALLY old basic code question
« Reply #4 on: June 08, 2019, 12:45:21 pm »
well one thing it might be is a smudge. it is an old copy I found in my days of xeroxing pages from the library(eons ago when I had my TIMEX SINCLAIR hehe). It could just be a "dot" as in smudge too LOL - it's from an old tandy book LOL thats all I remember
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: REALLY old basic code question
« Reply #5 on: June 08, 2019, 12:49:40 pm »
two others I ran across were

Code: QB64: [Select]
  1. A=B=C=D=F=0

I assume that makes ALL those vars = 0?

and this one is a stumper

Code: QB64: [Select]
  1. CHANGE M$ M(I) ' or something to that effect
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: REALLY old basic code question
« Reply #6 on: June 09, 2019, 06:02:36 am »
About
Multiple assignations and initializations in one row
A=B=C=D=F=0

I never met any BASIC that do it.
You must split the assignations and initializations

About the other syntax It seems to be  convertion from String to Integer
Here info about tour Sinclair
https://it.m.wikipedia.org/wiki/Sinclair_BASIC     
Programming isn't difficult, only it's  consuming time and coffee

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: REALLY old basic code question
« Reply #7 on: June 09, 2019, 06:57:10 am »
About
Multiple assignations and initializations in one row
A=B=C=D=F=0

I never met any BASIC that do it.
You must split the assignations and initializations

About the other syntax It seems to be  convertion from String to Integer
Here info about tour Sinclair
https://it.m.wikipedia.org/wiki/Sinclair_BASIC     

It’s perfectly valid; it’s just not assignments.  It’s mathematical calculations.  Think of it as:

A = (B = (C = (D = (E = (F = 0)))))

So if F = 0, that innermost result is -1, basically making the calculation: A = (B = (C = (D = (E = -1))))

And, if F <> 0, that innermost result is 0, basically making the calculation: A = (B = (C = (D = (E = 0))))

And it just continues to solve the formula until it ends up giving A a final value of either -1 (TRUE) or 0 (FALSE).

**************************

I’ve seen this type of logic in the past before, and if I remember correctly, it’s basically a quick way to determine if all the values are set, or not.  If B, C, D, E, F are all 0, A should be (either 0 or -1, but I’m not certain what the result actually is, without testing it.). If one value is non-zero, the value of A should  be reversed. 

If the values are anything other than Boolean truth values (0 or -1), I can’t really see such a formula having any meaning at all.  I guess more of the code would have to be shared, to try and actually sort out what it’s supposed to do, but it’s basically an assignment structure to determine if A is 0 or -1, in the end.

For easy reference, think of A = B = C.  If B = C, then A = -1, otherwise A = 0...

It’s the same principle; just carried out to an extreme level.

In the end, you can think of it as a formula which calculates the value of A from:

E = F = 0
D = E = F
C = D = E
B = C = D
A = B = C
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: REALLY old basic code question
« Reply #8 on: June 09, 2019, 08:02:01 am »
Thanks Steve

I have thought that it was a  dialect basic feature!

I try code in our QB64Ide
Code: QB64: [Select]
  1. PRINT A = (B = (C = (D = (E = (F = 0)))))
  2. PRINT A = B = C = D = F = 0
  3.  
it is possible to use either  formulas (with and without parenthesis) with no syntax error

I think it is useful in a control statement like IF or SELECT CASE or ON.. GOTO...
here attachment of code
  [ You are not allowed to view this attachment ]  

as you can see I am not so able to copy and paste because I have two different output for line 1 and line 2 of code! Sorry
Programming isn't difficult, only it's  consuming time and coffee

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: REALLY old basic code question
« Reply #9 on: June 09, 2019, 10:58:53 am »
Here are a couple of pics of the code in quesiton (sorry for the quality)

I think this is 1979 TANDY book. I have one coming from amazon.
CHANGE code
https://ibb.co/F8HYVrs

The x = y= z etc..
https://ibb.co/CV4WWJc

That is very interesting with the shortcut just making sure all the vars are zero (check) or all the vars are zero (assign - which is what I thought it was)

I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: REALLY old basic code question
« Reply #10 on: June 09, 2019, 11:52:45 am »
Ah! Your CHANGE looks like VAL() change a string into a number.
« Last Edit: June 09, 2019, 11:55:42 am by bplus »

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: REALLY old basic code question
« Reply #11 on: June 09, 2019, 12:17:22 pm »
Ah! Your CHANGE looks like VAL() change a string into a number.

hmmm insteresting... I might try that (soon as I run this mosnter LOL) still building it
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!