stefan-b-jakobsson / basload-rom

BSD 2-Clause "Simplified" License
4 stars 0 forks source link

IF statement - GOSUB issue #6

Closed jakebullet70 closed 3 months ago

jakebullet70 commented 3 months ago

Its me again... :)

REM ------------------------------ CLS IF 1 = 1 THEN LINE001 REM --- IF 1 = 1 THEN GOSUB LINE001 END

LINE001: LOCATE 10,10 PRINT "GOSUB ME!" RETURN REM ----------------------------

BASLOADS runs fine but with no error. then when running the program you get: image

THE line ---> IF 1 = 1 THEN LINE001 needs to be IF 1 = 1 THEN GOSUB LINE001

it thinks its a goto.... not sure how you really fix that

stefan-b-jakobsson commented 3 months ago

Hi,

I believe that this is the behavior of BASIC v 2. THEN followed by a line number is an implied GOTO, not GOSUB.

jakebullet70 commented 3 months ago

You are correct.

I will close this - It is just a BASIC V2 idiosyncrasy. Been 40 years since I have written any BASIC V2 code and I am only 5 days into the X16 and BASLOAD utility.
I am having fun! :)