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

Query on QUERY?
http://www.retrosoftware.co.uk/forum/viewtopic.php?f=17&t=704
Page 1 of 1

Author:  mga1103 [ Sat Nov 05, 2011 5:40 am ]
Post subject:  Query on QUERY?

Hi Rich,
Just thought I'd throw another wishlist item into the pot (for whenever you get that free time) and feel like tweaking BeebASM just a little more... ;)

You've already got the PRINT directive for displaying a string and value of an expression during assembly. Well, how about a corresponding directive (e.g. QUERY), that operates on the 1st pass assembly that accepts an input at assembly time that displays a string and accepts an input, evaluated as a numeric expression?

Code:
QUERY "Debug Mode", debug_mode

If the resulting expression is invalid or contains a forward reference, the question/prompt is repeated.

So, for example, you normally define a symbol within your code such as :
Code:
"debug_mode = FALSE"

and subsequently test within your code if the symbol is TRUE or FALSE and take the appropriate (conditional assembly) action based on the value of the expression.
Thus, rather than have to hard-code a specific value into your code, you "QUERY" at assembly time and set a value based on the input, thus saving the trouble of editing the source code each time you want to change a given expression!

This can also be very useful for other conditional assembly options, such as ROM .vs. RAM, (etc.,etc.,...). Furthermore, within your code, assuming the input is evaluated as an expression and can contain symbols, you can then define within your code:

Code:
YES = -1
NO = 0

thus the answers to a "QUERY" can be more "English like" as opposed to requiring a numeric expression as a valid response (0 or -1, in this instance)...

Just a thought...

(I'm probably thinking too much... :roll: )

Definitely not a show stopper, but more of a "nice to have"...

As always, thoughts appreciated...

Martin.

Author:  RichTW [ Mon Nov 07, 2011 9:31 am ]
Post subject:  Re: Query on QUERY?

I don't have much time to work on BeebAsm at the moment, but I'll bear it in mind for a later release.

In Blurp, I have a boolean symbol called DEBUG which determines whether certain development features are built into the code or not. I then just have two files, BlurpDebug.6502 and BlurpRelease.6502, which look like this:
Code:
; BlurpDebug.6502
DEBUG = TRUE
INCLUDE "Blurp.6502"
Code:
; BlurpRelease.6502
DEBUG = FALSE
INCLUDE "Blurp.6502"
where of course Blurp.6502 is the actual source code.

I use a Makefile to make Blurp builds and launch B-Em, so then it's just a case of typing 'make debug' or 'make release' at the command line to get the right type of build.

Another thing I've considered is the ability to define symbols on the command line, much like gcc, so you could say:
Code:
beebasm -i Blurp.6502 -do Blurp.ssd -DDEBUG=1

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