I'm planning to add the GET/SET directives pretty "soon".
Here's what the doc would look like.
- GET
Allow to receive a value from a script or host source.
Given a source MEGADOTS.O:
GET debug_mode = 0 ; Default value, passing value is optional
GET nb_dots ;
The (BASIC) script version could look like:
10 |ORGLOAD,"megadots.o"
20 |ORGSET,"nb_dots",4096
30 |ORGASS,nb_errors
40 IF nb_errors THEN goto 777
If nb_dots is not set, the assembler will return an error.
From the host source, please see next paragraph.
- SET
Pass a value to an imported source (which by design doesn't see its host's labels).
Only works in IMPORT context, which is delimited by square brackets.
Example:
IMPORT "megadots.o" [
SET debug_mode = 1
SET nb_dots = 8
]
Pre-feedbacl welcome!
Hi
Get is not really compatible with other assembler for sources supposed to be be assembler agnostic
Ifndef debug_mode
debug_mode=0
endif
Ifndef nb_dots
assert(0==1)
Endif
Is more verbose, but compatible with almost all other assembler
Of course macros could reduce code length
So, I would vote for using a macro for that
Regarding set, it is really orgams specific. however other assembler.have export/no export directives. Maybe there is a way to play with them
Thanks for the feelback, muck appreciated.
I actively dislike the fact that symbols can be undefined. It's an error prone ugly remnant of the past. I already struggle with explicit code, I don't want some implicit stuff that comes from who knows where, needing build systems, static analyzers and AI assistant (*) to decipher what's going on.
Compatibility is a non-goal for me and all Orgams users as far as I know. I'm already too far down the road of incompatibility anyway.
I hence declare this objection overruled!
Oh! Those directives should be compatible with MaXaM, i have to double check.
(*) Even if it's a female humanoid also preparing crepes (which is an anagram of creeps).
Ouch! Maxam 1.5 uses GET/PUT.
Anyway i need to be incompatible to avoid RSX conflict!
And I don't see the need for a SET to pass a variable to BASIC. All labels will be readable.
e.g |ORGGETLABEL,"toto",@toto
In that case I don't feel an "export" should be explicit. Too cumbersome.
@TotO is present everywhere ! that's CRAZY !