mattgodbolt / owlet-editor

A modern BBC BASIC editor inspired by the BBC Micro Bot (https://bbcmicrobot.com)
https://bbcmic.ro
54 stars 4 forks source link

Not executing code like on a real BBC #102

Closed yqxq closed 3 weeks ago

yqxq commented 4 months ago

I found this way of writing code in a BBC micro program:

10 a=2
20 DEF FN cheese
30 IF a=2 a=3 =-1 ELSE 0
40 IF FN cheese PRINT "Yes it is cheese!"

I find line 30 to be very cryptic, but it works on a real machine. In the online environment I get the error Bad call at line 40 How do you interpret the a=2 a=3. Is it OR if you leave away OR's or AND's?

mattgodbolt commented 3 weeks ago

I get "bad call at line 40" on the emulators I tried. I only have a real BBC Master, and I can try it on that later but I'd like to know where you're running this code and on what real machine (BBC B, Master or Electron?).

I'm not aware of what line 30 is doing, it's been too long since I did BASIC.

ojwb commented 3 weeks ago

The error is because you can't have a space between FN and the function name like that (possibly some later version of BBC BASIC relaxed that?)

Your cryptic line 30 is unconnected to your problem here, but FWIW it's equivalent to this:

30 IF a=2 THEN a=(3=-1) ELSE GOTO 0
mattgodbolt commented 3 weeks ago

Thanks @ojwb - going to close : if @yqxq can confirm on which real hardware this code works we can reopen.