Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Floats are going to be a great addition to Grammer Smile
I've been fixing more bugs added at least one new command, and modified a few more. Of note:

    ▪ ▶Dec has been added to convert text to a float. This is particularly needed for user input (for example, with the Input command Razz). I struggled with this, because I want to add in an int-to-float conversion, but this seemed more important. I'm still not sure what token to use (or if I should just modify the ▶Dec token for both).

    ▪ I documented a bunch of the available float commands. Many of them have been available, but are still incomplete so I didn't want to document them.

    ▪ e and π can now act as floating-point constants. Of course, π is also used to prefix hexadecimal numbers, so this only works when π is not followed by a hexadecimal digit.

    ▪ I absorbed the Grampkg appvar into the main app for now. The appvar was made as a way to extend Grammer as available space got small. Now that I am using two app pages, this isn't necessary. The way it is set up, the appvar code is literally just sitting inside the app, so it still interfaces like the original appvar, just faster to locate.

Here is a screenshot that uses the ►Dec token to convert user input numbers (so that they don't need to use decimals as would be needed for expr( ):

Download Grammer v2.50.2.0
Weirdly enough, Grammer hasn't had real stack operations yet. In my most recent updates, I added two stack variables and three stack-related commands.

Initially, I wanted these to be mostly used for subroutines and parameter parsing and what not, and so I went with some tokens that look pretty similar to the word "parameter."

    Pmt_Bgn defines the base of the stack. When storing to Pmt_Bgn, the stack pointer will be reset to this value, too! In Grammer, this stack grows upward. The current default is saveSScreen+256, but this may change in the future.
    Pmt_End defines the top of the stack. The current default is saveSScreen+768, but this may change in the future.

These tokens are found in the finance app. Just press [up] on the first page and they are there.

Please note that saveSScreen is used by many routines as a scrap location. Inline assembly opcode snippets are copied there, the Menu( command stores info there, module routines are copied there, and I'm sure a bunch of other things. If you aren't using these routines, between push and pop operations, then you should be fine, otherwise your code might be unpredictable and you should relocate the stack to a safer location.

As for commands:

    Param uses the ? variable as a pointer to parameters and pares them. For example, in a subroutine called with prgm(Z,0,1+3,2, then ParamA,B,C will set A to 0, B to 4, and C to 2. This is a much cleaner and easier than the existing method.
    Param' pushes values to the stack. This takes expressions as arguments and is comma delimited.
    Param° pops values off the stack. This takes variable names as arguments and is comma delimited.

The Param token is in the mode menu as "PAR" or the first catalog entry under P.

So as an example of swapping vars:



Finally, we now have the ▶Nom( command which actually operates like a code block so it needs a matching End. It basically takes a list of variable names and pushes them to the stack. When its End is reached, it restores those variables.


:<<do stuff>>

While adding this in, I actually found a long-standing bug in the code that finds matching End tokens. It didn't skip over both bytes of the two-byte tokens, so if the second byte happened to be the same as, say, a While token, then it would look for one too many Ends.

Download v2.50.4.0
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 4 of 4
» All times are GMT - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum