nice! I would download now, but i'm in school... -.- But I got a question: Is it the same speed?Yes, it is the same speed :)
.0:Asm(prgmGRAMMER ;Still using this for later versions
Lbl "SPRITE→Z
0→X
→Y
Repeat A=15
Pt-Off(10,Z,Y,X,1,8
DispGraph
Pt-Off(10,Z,Y,X,1,8
Repeat A
getKey→A
End
X+A=3
-A=2
If >88
X
→X
Y+A=1
-A=4
If >56
Y
→Y
End
Goto Lbl "Stop
.SPRITE
3C4281818181423C
.Stop
Stop
Feature request:Genius. Do this. It would help for the goalsetting feature I need to add to the GGRPHJMP program.
is there a way so we can use loops within the argument of commands, like:
If Pxl-Test(B+11, For(A,1,7):A:End)
I want to clone Tetris and I want more compact codes instead of C0C0C0C0C0C0C0C0... etc.Your a bit late, sorry, I am already almost finished.... If you still want to make one, you could make instead it with rectangles. :)
Feature request:Hmm, I can try to add the seq( command, then. That would do something similar. It might be an ideal notation for algorithms, too..
is there a way so we can use loops within the argument of commands, like:
If Pxl-Test(B+11, For(A,1,7):A:End)
Another feature request:Hmm, I like the idea, but I am not sure if/when I will add it. However, that did remind me of some features to add...
Sprite widths of multiples of 4 instead of 8, considering that's how hex works. I want to clone Tetris and I want more compact codes instead of C0C0C0C0C0C0C0C0... etc.
Your a bit late, sorry, I am already almost finished.... If you still want to make one, you could make instead it with rectangles. :)Or I could make it with... CIRCLES! :O
ClrDraw
Line(0,1,2,4,2
Line(1,0,4,2,2
Oh, right, sorry! I actually have a version I forgot to upload XD I wanted to add some more before releasing it though, but I do really have a version that has those features finished!Sprite widths of multiples of 4? :D
No, not those features, sorry XD Just the ones Sorunome was talking about :/Oh... Okay... :( Well, no rush! :D
No, not those features, sorry XD Just the ones Sorunome was talking about :/Cool! Please upload it! :)
If H=10
Then
For(H,0,3
Line(4,0,O*4,40,11
End
End
NNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOO I was not the first one to download! ;( But I download still, want always to have the newest version! ;)>:D
expr(Input →N
Hmm? What do you mean yeong?the autocell one.
I should try this. What are the advantages of grammer vs. axe?Grammer is interpreted, like TI-Basic.
Erm, I accidentally posted the update in the regular Grammer topic, so I am pretty much copying and pasting x.xGood thing: we can give you twice as much +1s :D
sub(7,0,"UAvar
This code should not delete any data from outside the program. If you try to delete 7 bytes of the last 3 bytes of the var, only the last 3 are deleted. If you try to delete 4 bytes and there is only 1 byte left in the var, only that 1 byte is deleted. See below for negative effects..0:
ClrDraw
0→A
solve(3,Lbl "EH
Repeat 0
augment(120,0,"EB
Text('0,0,A
A+1→A
DispGraph
End
.EH
→Ɵ' ;Stores the error code to Ɵ'
Disp π9872 ;so that we don't mess up the graph buffer
ClrDraw
If !Ɵ'
Text(º"ERR:BREAK":DispGraph:Stop
Text(º"ERR:MEM
Text(6,1,"Ignore
Text(12,1,"Quit
1→Z'
Repeat getKey(54 ;Use 2nd to select an option
Line(0,Z'*6,6,28,2
DispGraph
Line(0,Z'*6,6,28,2
Repeat getKey
End
2*getKey(1 +getKey(4
If ;There is a space here
→Z'
End
If Z'-1
Stop
Disp π9340
End
solve(3,0 will reset the handler so Grammer handles it.Text(0,0,'248
solve(4,2,"Something
Also, I was wrong before, I did manage to get the Goto option to work, too :
length('A,0,7
The default linebyte is 63 (the byte the OS uses for BASIC programs for a newline). The optional argument lets you read data that has a different byte separating them. For example, if you have a space between words and you want to read each word, then you can use 41 as the line byte.221>Frac
Ans would be 17 and Ɵ' would be 13..0:
.A
ClrDraw
Text(0,0,"HI
DispGraph
End
Stop
.0:
solve(0,"EA0","VTEMP
prgmLbl "A
Stop
Erm, that is not intentional in the least and I believe what it is doing is finding the RAM of the program (it isn't erased when archived).I actually got the idea(code) when I found out that when I forget to put "Stop" on Grammer program, it just "jumps" to next program in line. :P
This is only experimental and I am not sure if I will keep them or not. Do you think I should?The problem is: They don't seem to work with zstart so I didn't test it yet
*iMo downloadsUm, you have a Casio calc, or did you happen to purchase a TI-8x plus without me knowing? :P
YES!!!
But unfortunatly it doesn't work far to good with zstart, as they are killed (the hooks) everytime you press on+clear... :(Ah, I didn't expect that to work :/ I can try to see if I can get token hooks to work with other apps, but that might cause some lag with tokens.
Or maybe you should just get penguin into making zstart compatible with grammer :DBut unfortunatly it doesn't work far to good with zstart, as they are killed (the hooks) everytime you press on+clear... :(Ah, I didn't expect that to work :/ I can try to see if I can get token hooks to work with other apps, but that might cause some lag with tokens.
A[0,0,1,2,3 ;this writes the bytes to A as normal
A[0,1,-1º,2,3 ;this stores the bytes to A, but -1 is stored as two bytes
A[[0,1,2,3 ;the bytes are stored as two bytes (little endian)
A[(EEFF0011 ;the hex is converted and stored (good for data)
A[5,6
[2,3 ;these are output directly after the 5 and 6
"Hello→Str33'
Text(0,0,Str33
A→Str213
!Repeat checks if the statement is false in order to end. For example,it should be clear :P
to remain in the loop while Enter is being pressed:
:!Repeat getkey=15
:End
0→X→Y
For(A,0,9999
pxl-Test(X,Y
End
Stop
That was in 6MHz, too :DI just ran this code and it took 8 seconds to pixel test 10 000 times:therefore about 5 seconds to check the entire contents of the screen(not as if that's actually needed)Code: [Select]0→X→Y
That was in 6MHz, too :D
For(A,0,9999
pxl-Test(X,Y
End
Stop
{3,3,3,3,3,3→L1 ;Y-coordinates
Ans→L2 ;X-coordinates
Repeat getKey=45
For(A,1,6
L2(A→X
L1(A→Y
If pxl-Test(Ans+1,X
Then ;This checks left/right
2randInt(0,1)-1→B ;B becomes 1 or -1
If pxl-Test(Y,X+B
-B→B
If not(pxl-Test(Y,X+B
Then
Pxl-Off(Y,X
X+B→L2(A
Pxl-On(Y,Ans
End
Else
Y+1→L1(A
Pxl-Off(Y,X
Pxl-On(Ans,X
End
End
End
ClrDraw ;Clears graph screen and sets text coordinates to zero
Text(2,,"ax ;Displays text at Y=2, leave X unchanged
Text(-2,,"2 ;Draws the 2 as a superscript (though really, you could use 0 instead of -2 in this case)
Text(+2,,"bx+c ;Draws the rest back down 2 pixels
As a note, that is minus 2, not negative 2. Also, you see the trick that is new for Text( where you have no argument between the commas. That is essentially "+0" and was not a trick previously available.The main reason for those was that I wanted to easily be able to do pretty-print styled writing :) It also allows for much finer control for text effects, especially for inputs and menus.Ok thanks for the info. And yeah I could see this used for example in RPGs where you type names or if someone wants to do something like Ultima, where you type commands to talk to NPCs and other stuff.
do you have other apps installed that might conflict?
.0:Disp "ERR:Grammer prgmGammer2 needed.":Return
Also, you need to exit the program some way. Grammer cannot tell if it has reached the end of the program, so you need a "Stop" to tell it. I have bad understood about what interrupts are (En Français, "interrupteurs" ??), it allows the prog to execute 2 code parts at the same time ?Interrupts do not work well in Grammer, but for some short pieces of code they will work. They let you run a subroutine automatically several times per second. This feature is not finished and will change in the future. (In fact, I am going to try to change it today to make programs run a tiny bit faster and have extremely good control of the interrupts).
And I don't understand too what you mean by "*By adding 8 to the Method, the data will be read as hexadecimal". Is there another mean to code sprites than hexadecimal ?There are two ways to store sprite data. One is by making pure data, and the other is by using hexadecimal. Using hexadecimal is easier, but the data is twice as big. Thank of it like taking a hexcode and using AsmComp(. Also, using hexadecimal code requires Grammer to convert the data before drawing it.
bugs:The first bug should not occur D: Which version do you have? It still works fine for me The last update was here:
1) I can't quit the app by pressing [F4] (EXIT) or [CLEAR] ----> RAM Cleared
2) When a Grammer program finishes, I can't shutdown my calculator until I press a key which displays a menu ( like [prgm], [stats]...)
and then I had other crashes, but while a program execution. Maybe it was my fault, if I try bad commands. (like displaying a number in base 1)
Ou presque: on ne peut plus désactiver le Hook une fois activé...Ouai, je n'ajoute pas le fonction pour désactiver le Hook. (sorry)
Et à quoi servent les onglets AppV et Asm ?Ces ne sont pas encore implémenté, mais AppV cherchera pour les appvars avec Grammer code et Asm cherchera pour les (Grammer Assembly programs?).
I'm just curious, but is it possible to run apps from grammer program? (or just any kind of program)
If you know the assembly code to run an app, then yes, you can actually run an app from Grammer. I never even thought about that because it is complicated to do in Assembly.QuoteI'm just curious, but is it possible to run apps from grammer program? (or just any kind of program)
I'm not sure, but If you can find a pointer to the App, you may execute the code like an assembly program.
(I don't know how to run assembly programs in a Grammer code...If a Grammer code runs with expr( , maybe an assembly prog needs Asm(expr( ? )
PS: Quite good readme, now :) There is much more info.
.0:
Get("EAppName ;Yes, actually use E. I'm hacking Grammer >.>
AsmPrgm2178843614EF4E4CD8D306C38040
solve(4,2,"App Not Found
Stop
This will leave garbage on the screen in some cases, just as a warning. Also, if the App name does not work, try adding spaces until their are 8 chars. For example, Axe is really namedSymbolic will be nice, but I don't think xlib is not needed with Grammer, since Grammer can do almost everything that xlib can do already. :DIt would be cool so you have everything in one, so that your calc is all-compatible
P?Ry(2,"D,LR,U
That sets the rule to check the down direction first, if it cannot move down, try left and right, if that fails, check up :D
:Disp piXXXX
:StorePic 1
1) using StorePic or RecallPic : I suppose it's for the OS variables, it's not pointers ?That code should work :)
It it posible to store a specified buffer with StorePic ?
MaybeCode: [Select]:Disp piXXXX
:StorePic 1
2) P▶Ry(2,"D,LR,U is exactly the same as P▶Ry(2,2145 ? So why did you implement 2 syntaxes ?It is because number are easier to modify than strings. However, using a string like that is much easier for the programmer. Also, the letters correspond to Down, Left, Right, Up.
.0:Return
ClrDraw
Text(°"(x,y)=( ;ClrDraw sets the cursor to (0,0), so I can use °
expr(Input ",)→X ;I get the next input here. The string is ,)
Text(,+1 ;This increments the X coordinate.
expr(Input ")→Y ;This gets the Y value.
Pxl-On(Y,X ;Or whatever you want to do with the coordinates.
DispGraph
Stop
.0:
If Menu(3,3,48,"Header","Item0","Item1","Item2","Exit→A=3
Stop
!If A
Goto Lbl "ITEM0
...
As for Grammer 3, I am not starting it yet (I won't start for another year, probably).
Lbl ".→Z
prgm(Z,X,Y,S
Stop
..
]?→x
]?→y
]?→s
If and 1
Pxl-On(y,x
If s and 2
Pxl-On(y,x,39026
End
I just wish that it could support multiple keypresses, though.You can test directly for keys. For example, getKey(3 lets you test for right and getKey(2 lets you test for left. If you are pressing both keys, a 1 will be returned in both cases.
With the "Full" mode (just like Axe), Grammer programs can be run at amazing 15MHz speed(Of course, the 15MHz limited to 84+SEFull works on the TI-83+SE, TI-84+, TI-84+SE. Basically, the only calc in the series it won't work on is the TI-83+.
@Yeong: I saw your review on TICalc, by the way and I've forgotten to mention this:1. Oh. It didn't work for me last time. Maybe my version is old? /me upgradesQuoteI just wish that it could support multiple keypresses, though.You can test directly for keys. For example, getKey(3 lets you test for right and getKey(2 lets you test for left. If you are pressing both keys, a 1 will be returned in both cases.QuoteWith the "Full" mode (just like Axe), Grammer programs can be run at amazing 15MHz speed(Of course, the 15MHz limited to 84+SEFull works on the TI-83+SE, TI-84+, TI-84+SE. Basically, the only calc in the series it won't work on is the TI-83+.
If A=B
Then
<<do stuff>>
Else
<<do stuff>>
End
While A>3
A-1→A
If A=5
Else ;This will skip over everything until it finds the correct End
If A=4
Then
<<do stuff>>
End ;not the correct End!
End ;The correct End!
If you don't uderstand that, don't worry. As well, you can do something like this:While A
A-1→A
Text(0,A,"O
Else
DispGraph
End
That is actually a neat trick to help you understand how Else works, but it isn't optimised :P That basically does this:While A
A-1→A
Text(0,A,"O
End
DispGraph
Personally, I would just stick with the first use. The other methods will just complicate your code and probably cause confusion when parts of code don't work.oZ ;o is supposed to be the degree token
Text(0,0,"HI!
Text(6,0,"This is on another buffer.
Pxl-On(3,3
Text(0,0,"HI! ;This is now drawn on the main buffer since the Pxl-On( command resets the temporary draw buffer
It also happens that this works for the particle commands as well, so now you can draw particles on back buffers without using complicated techniques.:<stuff>
:°Z
:AddPart(stuff
:RunPart
:PxlOn(stuff
13 Nov. 2018
- Cleaning up code, removing (at least temporarily)
routines that aren't vital, or useful.
- Fire graphics code. **Probably temporary.
- Factoring code. **Probably permanent.
- Optimized CopyHex
- ConvHexStr is reorganized to be smaller
14 Nov. 2018
- Optimized ConvOP1 to be smaller, updated performance
analysis
- Optimized GetPixelLoc 3 bytes smaller, 10cc faster
- Optimized ReadArc routine. 3 bytes smaller, 18cc
faster for archived data, 3cc slower for data in RAM.
- Removed LoadTSA as the only internal usage was to load
the ReadArc routine. Instead it is a specialized routine
that no longer destroys IX. Next savings of 11 bytes,
even after extended the mov9 LDI chain to a mov13. Saves
172cc overall (186cc, actually, since no more ld ix,**)
- Error also takes advantage of mov13, saving 2 bytes.
- Added a few more fixed-size moves, including mov768.
Total cost was 6 bytes.
- ClrHome uses the faster SetSmallMem, saves a byte.
Makes it 901cc faster, roughly 21% faster
- I removed the unknown routine I labeled "lbl000", as it
isn't used anywhere (or shouldn't be!) It looks like an
attempt at making an off-page call, probably when the
low mem scared me.
- Optimized and fixed IsHexTok. It used to accept the
' and ' token as equivalent to 9. Saved a byte and 2cc
when the token was 0~9.
- Optimized DE_Times_BC. No change in size, 120cc faster
in the average case. No longer leaves A=0.
- optimized HL_Div_BC to be 264cc faster on average, with
a net cost of five bytes. DE_Div_BC is now the
subroutine, though, and is 272cc faster than if you had
called it previously. Nearly 18% speed up
- Fixed SearchString at a cost of 8 bytes, but should
perform roughly 4 times faster. Also, there is now no
risk of it entering an infinite loop, an issue the
previous routine had.
- SqrtHL is optimized. Actually replaced with SqrtDE.
Saved 2 bytes, on average 261cc faster (20.17% faster).
Worst case is still 165cc faster (12.75% faster).
15 Nov. 2018
- I replaced the Sqrt routine with Runer112's from Axe.
It is 221cc faster with the small modifications on my
part to fit the output registers, and 2 bytes smaller.
That's roughly 21.5% faster.
- Removed ConvNumBase and HL_Div_C. HL_Div_C was only
used by ConvNumBase, and ConvNumBase wasn't used
anywhere in the code.
- Changed Is_2_Byte. It's no faster or slower, just
a little more sensible and readable.
- Removed HexTok and GetHexAtDE.
- Moved CompatCall so it didn't have to JP to
IsOP1GrammerProg, saving 3 bytes and 10cc
- Removed EndHook2 as it appears unused?
- Optimized ONErr to be 1 byte less, 2cc faster.
- Optimized TileMap1. 21cc faster, 2 bytes smaller.
- Removed HL_SDiv_BC replacing the only use of it
with a wrapper around a call to HL_Div_BC.
Net 21 bytes smaller. Signed division command now
averages about 47cc faster.
- Removed PutIM, ParseFullArgI, CallI, CopyZStr,
CreateZVar, FindVar.
- Renamed memory addresses in the Menu command.
May have messed something up.
- vPutscr is 1 byte smaller, 3cc faster.
- Optimized DrawRectToGraphI since it didn't need
to preserve registers. Saved 9 bytes.
19 Nov. 2011
- Did some testing and fixed some new bugs.
- Fixed LoadReadArc. Needed 6 more bytes, saves
another 76cc.
- Opted to use interrupts for the Pause routine. It
isn't as close to 1/100 seconds, but it is more
energy efficient, smaller, and more reliable.
No screenshots as it's just behind-the-scenes code modifications.
.0:Return
ClrDraw
ClrHome
"5GFLOAT→$
π8800→X+4→Y
$π→.X
$e→.Y
For(A,0,7
√(.X*.Y→.X
Text(A*6,0,.X
DispGraph
End
Stop
Param'A,B
Param°A,B
]?→A
]?→B
]?→C
But now you can do:ParamA,B,C
:▶Nom(x,y,z
:<<do stuff>>
:End
What it does is it pushes the list of variables to the stack and when it's End is reached, pops them back off.Menu('"Title",y,x,height,width,GET_ELEMENT_ptr,SELECT_ELEMENT_ptr
The subroutine for GET_ELEMENT will receive the index in Ans. Return 0 if it is out-of-bounds, else return a pointer to the string to display. The subroutine for SELECT_ELEMENT will receive the index in Ans. Modify this as you want, the result will be returned as the result of the menu. 0 is returned if the menu exited due to [CLEAR] or [ON]. An example is:Lbl "GET→A
Lbl "SEL→B
Menu('"Title",2,33,59,30,A,B→M
Text('0,0,M
Stop
.GET
→X<26
If !
End
"ITEM A→Z
int(Z+5,X+65
Z
End
.SEL
+1
End
That will display items with the name "ITEM A" through "ITEM Z".
If <condition>
Then
<<do stuff>>
<<While, Repeat, For, or If/Then (but not If/Then/Else)>>
End:End
If the condition evaluates false, Grammer would search for the matching End token. However, I tried to be clever, and combined it with the code for when it is If without Then, and so it seeked the end of the line (specifically the newline token, colons (":") didn't count). Unfortunately, this meant that the second End was skipped, causing an outer loop to End prematurely. Oof.Inputs:
- Ans is a string: Then it is the name of the Grammer program to execute.
- Ans is not a string: Then the code following Asm(prgmG250 is executed as Grammer code up to a Stop,
then it continues as TI-BASIC code.
<TI-BASIC code>
Asm(prgmG250
<Grammer code>
Goto Lbl "Stop
<subroutines>
.Stop
Stop
<TI-BASIC code>