0 Members and 4 Guests are viewing this topic.
Runer, how do you suggest I do the token replacement? The first problem I had was that you have to know ahead of time what Axioms are being used in the program so it knows what to replace. That can easily be solved with your first suggestion of always requiring the Axioms to come first, but this does remove a possible convenience, however its probably worth it. The next problem is that for each token the Axioms have to be searched for in the symbol table to find their pointers, which could be costly with a large number of programs. Then, when finally found, each Axiom would have to be scanned completely to find if the token matches by transversing the offset list (again, for each token). So if you had 2 Axioms with 25 new commands each, and about 20 tokens on the screen, that's 40 symbol table searches + 1000 checks + the built in checks. I could definitely see this causing lag in the scrolling. There might be another way of caching the data in ram somewhere, and maybe setup a binary search, but this would greatly complicate things. The token hook is only called when tokens are being printed and I don't want to use other hooks so its difficult to have some sort of "pre-parsing". I am however still open to suggestions of what to name the rest of the custom override tokens.
Your other suggestion, If I'm reading this correctly, is a static offset to optimize doing ld hl,dynamic_ptr; ld de,offset; add hl,de; correct? This might be an option in the future. There are other useful features I can think of too, like adding the ability to create Axioms that take a label as their first argument, like how the current interrupt setup command works.
OFS_NEXT(7) call sub_Axiom1
That is great, thanks. Does that optimize the program or just the source size?
.db $C0,$DE ;Header bytes reversed so old Axe applications won't accept the Axiom.db Axiom_version;Possibly additional header data
!If A-1sub(FOO)End
sub(FOO)!If A-1
In other news, Frey continues kicking unprecedented levels of ass.
Here's a request that shouldn't be hard to implement: adding If conditionals to sub and Goto.
Also, I would like For loops to work with negative numbers (as a seperate option). For example, For(I,-1,1) is a legitimate loop (check the positions to the left, center, and right, for instance) but would end immediately. So, I would like to specify For(I,-1,1)r to show that the indexes are signed.
⁻1-2While 1 +2→I ;Your code goes hereEnd!If I-1
Oh, and I would also like to specify custom steps in For loops, like we can in TI-BASIC.
As an addition to the signed For Loop, Could there be a loop that automatically increments negatively or positively so that the loop always runs?Like, say,For(Q,A,B,C)rrwhere C>0, would increment by -C if A>B and C if A<B
Quote from: Compynerd255 on April 26, 2011, 10:29:02 amOh, and I would also like to specify custom steps in For loops, like we can in TI-BASIC.I've been wondering why Quigibo hasn't added that as well.
Quote from: Freyaday on April 26, 2011, 10:42:15 amAs an addition to the signed For Loop, Could there be a loop that automatically increments negatively or positively so that the loop always runs?Like, say,For(Q,A,B,C)rrwhere C>0, would increment by -C if A>B and C if A<BThis doesn't seem like a loop structure that would be widely used, especially since modern programming languages don't have loops like this. This is the kind of thing that you would best build a custom loop for.
Quote from: Compynerd255 on April 26, 2011, 10:29:02 amQuote from: Freyaday on April 26, 2011, 10:42:15 amAs an addition to the signed For Loop, Could there be a loop that automatically increments negatively or positively so that the loop always runs?Like, say,For(Q,A,B,C)rrwhere C>0, would increment by -C if A>B and C if A<BThis doesn't seem like a loop structure that would be widely used, especially since modern programming languages don't have loops like this. This is the kind of thing that you would best build a custom loop for.Why shouldn't Axe be the first, then?
Quote from: Compynerd255 on April 26, 2011, 10:29:02 amHere's a request that shouldn't be hard to implement: adding If conditionals to sub and Goto.I agree, that would be nice. I think Quigibo was contemplating adding this feature not long ago.
For the goto-if and goto-!if I think I will auto-optimize the existing commands instead of creating entirely new syntax. It would actually be easier I think to read and write and no one would have to change their syntax. Same thing with sub().
You could get their pointers from the symbol table and cache them at the start, and you'd only need 3 bytes * 5 Axioms of cache storage.
Actually I was planning to have for-loops have a step size parameter, but it will most likely have to be a non-negative constant in order to actually optimize.