It would be quite convenient to add an operand allowing us to reverse the LSB & MSB of a WORD, for example:
WORD &0BEB ; write &EB,&0B
RWORD &0BEB ; write &0B,&EB
But there is maybe already a way to do that without a new operand?
Be creative!
MACRO RWORD m
BYTE m/&100,m and &ff
ENDM
RWORD(&0bed - 2) ; Writes &0b,&eb
Good idea, it fits very well!
With repeated blocs, it will be convenient to be able to shorter the last one, for example like that:
8 ** [
ld (hl),a
set 3,h
ld (hl),a
res 3,h
...
ld (hl),a
add hl,bc
] - 1
Here, 7 complete blocs, and the last one without the last byte (-1) because 'add hl,bc' is useless. Or something equivalent.
Maybe more elegant than:
IF # < 7
add hl,bc
END
In the example you suggest, is it better that the "-1" means -1 byte or -1 instruction?
If it's instruction related, it's easier to use (however, in some cases it could prevent clever tricks).
Not sure about the elegance of
« -1 »:
• Error prone
• Not self documenting (Exhibit A: Toms' question)
Considering
« # » is already known,
« if #<7 » is more explicit.
By the way, a label should be used, to prevent changing the number of iteration while overlooking the test.
Another option to 'exit' the loop: C-like 'break'.
width ** [
ld (de),a
BREAK if #=width-1
inc e
]
Another option to know we've reached the last iteration: implicit pseudo-label.
width ** [
ld (de),a
BREAK if __LAST__
inc e
]
Or, a bit more cryptic:
width ** [ ld (de),a / inc e ]
Don't forget code is more often read than written, some verbosity doesn't hurt.
What's with the set 3 / res 3 by the way?
More precisely: what's with the res 3 ?
In the next version "Erratic Endeavour", one shall be able to enter RSXs in monogams.
Thus, I consider switching to firmware screen dimensions (80x25).
WDYT?
Important!
Version EE will allow to include source files. Actually, I plan to name the directive IMPORT, since it doesn't strictly account to textual inclusion (by design, the included source cannot see the labels of the parent source).
Now there is another point: If two sources (A and B) both import a source L (useful routines, aka library) and a main root source imports A and B. We don't want L to be duplicated.
* For MACROs it's not a big deal since Orgams could reconcile them.
* For routines it's annoying.
We might use a "PRAGMA ONCE" directive, but I'm not fond of it.
The default should correspond to the most frequent usage.
So, I'm considering: only the first occurence of an import loads the source. In the rare case we actually want to include something several time, we'll just put it in a MACRO and invoke the MACRO at each place.
WDYT?
Oh, set 3/res 3 was a mistake, I would like to write set 3/set 4 (classical '2us' BC26).
Thanks for the workaround solution for last iteration of a repeated code. But am I wrong or they are not yet implanted in Orgams? Is there already other implicit pseudo-labels (__LAST__) to know? (if yes, useful to include in the documentation?)
Firmware screen dimensions for Monogams (not Trace I guess): I think that's ok, a high height was mostly useful for the dump.
Nice news for the EE version!
'IMPORT library' is cool, but do you plan something like 'FROM library IMPORT keytest'? But it will be needed to put some balises to define 'keytest' in the source...
The situation you are mentionning won't be very commun I think so it seems to be ok for the MACRO tips to bypass the problem.
None of these is available. The incoming priority is arithmetic comparators, so we'll stick to
« if # < width-1 » option. No other pseudo label than $, $$, #, ##, ### yet.
Thanks for the screen dimensions feedback. Anyway, the futurs prepares a full-blown hex editor (for files, snapshots or memory views), which will have it's own format (likely 25 lines of a customizable number of bytes up to 16. 25x16 > 31*8).
« 'IMPORT library' is cool, but do you plan something like 'FROM library IMPORT keytest'?
»
No, because I think it's best to put such routines in macro which don't emit code anyway. You might write:
import "toolbox"
ld a,&45:call test_key
test_key TEST_KEY():RET
The interesting point is that you could inline instead:
ld a,&45:TEST_KEY()
Which is might be beneficial for compression purpose, even if used more than once.
Also you'll be able to pass flags to imported source in order to activate or deactivated some part with conditional assembling.
Tip of the day. Expressions work uniformly.
BYTE "!" ; &21
ld a,"!" ; &3e,&21
And in Monogams
?"!"
&0021 33 %00000000 00100001
Bug report (maybe already know): using # pseudo-label outside [ and ] bounds = olala (source corrupted!).
Cannot reproduce:
Line 1: Unexpected # here
>>> ld a,#
Please indicate which version you are using and the snippet producing the failure.
Oh, thanks for the exploration!
I've found a way to reproduce: bug #E9.
So I hope that to be fixed soon.
Is it possible to add rsx access into monogams ?
Yes, incoming! Todo #21
Preventive warning: there will be a small mismatch for memory in &axxx-&bfff.
* m#b000 will continue to show program's memory.
* |burn,&b000,&e000,&100,13 will read firmware's memory.
I would like to avoid to have to copy and paste at the begining of my sources all my macros.
At the moment, what is the clever way to avoid this with Orgams?
Two sources? Import? Include?
Since import isn't available yet, macros must be in the source using them.
You could either have a skeleton source or a macros.txt file to include (CTRL-I) when needed.
Any help is welcome to make the import directive available.
Incoming: Call stack.
So if you have for instance:
test_insert_row
[...]
call prepare_row
call insert_row
[...]
insert_row
[...]
call new_chunk
call update_checksum
[...]
new_chunk
[...]
ASSERT(every_is_fine) <-- Breakpoint here.
[...]
We will see in trace:
-- Main entry ---
test_insert_row +&12
insert_row +&1a
> new_chunk +&0f (most recent)
I haven't found yet which shortcut to use to navigate up/down to call stack.
Something + up/down.
Users, speak!
Hesitation between:
Shift Up/Down
C Up/Down ('C' as call stack)
Mini-feedback: it's sometimes useful to do CTRL+DEL, load a new source, and CTRL+P just in order to copy one line from one source to another, but the inserted line is empty...