www.retrosoftware.co.uk
http://www.retrosoftware.co.uk/forum/

Problem compiling a program with the define NOTE_B0
http://www.retrosoftware.co.uk/forum/viewtopic.php?f=17&t=688
Page 1 of 1

Author:  PitfallJ [ Thu Oct 06, 2011 12:41 pm ]
Post subject:  Problem compiling a program with the define NOTE_B0

Hi There,

The following program:

NOTE_B0 = 0
.START:
EQUB NOTE_B0
.END:
SAVE "PROG",START,END


will not compile with the error:

test.asm:3: error: Symbol not defined.

EQUB NOTE_B0
^

Is the word NOTE special?

Thanks for any help

- PJ

Author:  RichTW [ Thu Oct 06, 2011 12:46 pm ]
Post subject:  Re: Problem compiling a program with the define NOTE_B0

No, but the function NOT is :) BeebAsm is interpreting that line as EQUB NOT(E_B0), i.e. looking for a symbol called E_B0. BBC BASIC is the same - that wouldn't have allowed you to have a variable 'NOTE' either.

In lower case, 'note' would be fine.

However you have found a bug, in that the variable declaration on line 1 is working without problems. I'll have to have a look at that.

Author:  RichTW [ Thu Oct 06, 2011 1:09 pm ]
Post subject:  Re: Problem compiling a program with the define NOTE_B0

I'm thinking that perhaps the solution here is to require all function keywords to be followed directly by an open bracket, i.e.
Code:
NOT(x)
rather than
Code:
NOTx

This is different to BBC BASIC, in which most functions need not enclose their parameter in brackets.

But it might fix these kind of problems (in particular those caused by starting variables with LO and HI).

Any thoughts, anyone? Would this break anyone's source code?

Author:  mga1103 [ Thu Oct 06, 2011 5:42 pm ]
Post subject:  Re: Problem compiling a program with the define NOTE_B0

I like the parenthesis suggestion! If this change breaks any existing code, it's an easy fix ;)

I've been bitten by this previously - I believe it was some label starting with LOOPBlahBlah, being reported as not being defined, when it clearly was! (I assumed LOOP was somehow causing grief - the LO keyword never dawned on me :roll: ). Once I converted this code (not mine!) to lowercase (my preference), the problem went away.

Personally, I don't really mind either way. I know what to look out for now :) .

Author:  RichTW [ Thu Oct 06, 2011 6:03 pm ]
Post subject:  Re: Problem compiling a program with the define NOTE_B0

'tis done! version 1.07 is available right now with this change.

Author:  mga1103 [ Fri Oct 07, 2011 2:19 pm ]
Post subject:  Re: Problem compiling a program with the define NOTE_B0

You certainly don't hang around. Thank you for the update :)

Author:  PitfallJ [ Fri Oct 07, 2011 3:15 pm ]
Post subject:  Re: Problem compiling a program with the define NOTE_B0

Thanks - works great - and that was fast!

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/