Author Topic: Multi-line "FOR"/"NEXT" statement?  (Read 3167 times)

0 Members and 1 Guest are viewing this topic.

Offline vitcunha

  • Newbie
  • Posts: 2
    • View Profile
Multi-line "FOR"/"NEXT" statement?
« on: September 16, 2020, 08:17:19 pm »
Hello there QB64 community!

Happy to be here, this is my first post! So I apologize in advance if this is not the right place to post this!

I'm currently on a journey to revive lots of programs from the 80s/90s my electronics teacher wrote back in the day and recompile them in modern architectures so we can access them in modern computers.

All these programs are finished and run - or at least they did, when using other basic interpreters. I first made a Dosbox port with the BASICAMA interpreter he also provided me, and I could run them all. BASICAMA died and there is no documentation out there, but I found PC-BASIC (http://robhagemans.github.io/pcbasic/doc/2.0/) which is basically the perfect modern spiritual successor and it is almost identical. Same menus, functionalities... and memory restrictions. (and it's an interpreter, I need a compiler)

Thing is, I've been using QB64 and it has been working wonders so far - by the way, I am truly thankful for the hard work here - but there are some commands that or syntaxes that qb64 simply doesn't support. (I must say in advance that I am totally noob around types of BASIC, its evolution and which version supports which commands - but I think this info may help you guys see where I'm coming from).

Well, that's it for the introduction. In summary, I want to run and compile this code I'm pasting here but I'm getting a "NEXT without FOR" error. Here's the snippet around the error:

Code: QB64: [Select]
  1. 16350 FOR N=0 TO 120 STEP 1 : REM  * * * PLOTTING * * *
  2. 16360  D3=(N-120)*LOG(FMAX/FMIN)/120
  3. 16370  FX=FMAX*EXP(D3)  : FMO=FX/FO  : FMF=FF/FX
  4. 16380  D1=FMO^8+B1*FMO^6+B2*FMO^4+B3*FMO^2+1 : D2=ABS(D1)
  5. 16382  F1=(1-FMF*FMF)*(1-FMF*FMF)+FMF*FMF/QF/QF
  6. 16384  PAF=-10*LOG(F1)/LOG(10)
  7. 16390  PA4=80/LOG(10)*LOG(FMO)-10/LOG(10)*LOG(D2) : PA6=PA4+PAF
  8. 16400  IF (P$="P" OR P$="p")  THEN  GOTO 16420   ELSE 16410
  9. 16410  XDD4=FMO^4/H/H+FMO*FMO/H/QL/QL-2*FMO*FMO/H+1 : XD4=SQR(XDD4/D2)
  10. 16420  X=240*LOG(FX/FMAX)/LOG(FMAX/FMIN)+270
  11. 16430  Y4=-45*PA4/KPA+47 : YXD4=-90*XD4+182 : YF=-45*PAF/KPA+47:XD6=XD4/SQR(F1):       Y6=-45*PA6/KPA+47 : YXD6=-90*XD6+182
  12. 16435  IF (YF>2   AND YF<182)    THEN PSET (X,YF),3   : REM FILTER
  13. 16440  IF (Y4>2   AND Y4=<182)   THEN PSET (X,Y4),2   : REM RESP BR-4
  14. 16442  IF (Y6>2   AND Y6=<182)   THEN PSET (X,Y6),1   : REM RESP BR-6
  15. 16444  IF (YXD6>2 AND YXD6=<182) THEN PSET (X,YXD6),1 : REM DISP BR-6
  16. 16450  IF (YXD4>2 AND YXD4=<182) THEN PSET (X,YXD4),2 : REM DISP BR-4
  17.  

And I get it - they ain't in the same line. How can I make the "FOR" in 16350 talk to the "NEXT" 16460?

How should I proceed to make this code work?

Thanks a lot!
V






« Last Edit: September 16, 2020, 08:30:56 pm by vitcunha »

Marked as best answer by vitcunha on September 16, 2020, 09:55:25 pm

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Multi-line "FOR"/"NEXT" statement?
« Reply #1 on: September 16, 2020, 08:35:01 pm »
16460 IF INKEY$ <> “” THEN RETURN
16470 NEXT
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline vitcunha

  • Newbie
  • Posts: 2
    • View Profile
Re: Multi-line "FOR"/"NEXT" statement?
« Reply #2 on: September 17, 2020, 01:55:07 am »
16460 IF INKEY$ <> “” THEN RETURN
16470 NEXT

It worked, thanks a lot SMcNeill!