Author Topic: Un Tuto Pour Grammer  (Read 38311 times)

0 Members and 2 Guests are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Un Tuto Pour Grammer
« Reply #30 on: April 26, 2012, 03:59:14 pm »
1)  What is the "Gray" method for displaying sprites ? (   Pt-On(7   ) Do you explain it in the topic about grayscale ? If yes, don't answer, I'll see.
You form the sprite data like the MASK version, except it is gray byte, black byte, gray byte, black byte, et cetera. It lets you draw gray sprites without using two buffers (but you need to constantly draw the sprite and update the screen).

2) You told talk several times about buffers to display. I didn't know that we could create custom buffers at custom adresses. I heard about the buffer and the backbuffer in Axe, but that's all. It's not very limpid, can you re-explain me what is exactly a buffer and how it works ?
A buffer can be any area of RAM that you work with for storing data. For example, the particle buffer and drawing buffers. What you are interested in are drawing buffers, I think.

Drawing buffers are the size of the graph screen and you can draw on them, erase them, display them, or do anything else. The OS has three of these at:
pi9872 (Grammer uses this for the default particle buffer. If you aren't using this for particles, feel free to use it for drawing)
pi86EC (Grammer uses this for some functions like converting hex to sprites or executing AsmPrgm code)
pi9340 (This is the normal graph buffer).

Additionally, you can create your own by making a variable with 768 bytes (or if you want two buffers or more, use 1536, 2304, ...).

In Grammer, to set a new buffer, you can do Disp <<pointer>>. Then, all drawing you do after that is drawn to that buffer and every time you use DispGraph, that buffer is shown. Most of the drawing commands let you draw to another buffer, too.

For Grayscale, you have two buffers, the main buffer and the graybuffer. If a pixel is turned on in the gray buffer but not the black buffer, it will show as gray. If it is turned on in the black buffer or both buffers, it will show as black.
Here is an example of the gray layer, black layer, and the result:

You will need to be updating the screen regularly, too, to see it as gray.

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Un Tuto Pour Grammer
« Reply #31 on: April 26, 2012, 04:06:07 pm »
Allright !! Good answer... I'll put this in the tutorial, it helps a lot.

just one precision: about gray sprites, you said in the doc that it's 3-grayscales. So the data should be 30gray-60gray-black-30gray-60gray-black-30gray-60gray-black...  ?

EDIT: I uprank your post ;D
« Last Edit: April 26, 2012, 04:07:13 pm by persalteas »


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Un Tuto Pour Grammer
« Reply #32 on: April 26, 2012, 04:17:32 pm »
3 level means white, gray (50%), black :[ I don't have four level gray yet (which is white, 33% gray, 66% gray, black).

 And thanks :)

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Un Tuto Pour Grammer
« Reply #33 on: April 26, 2012, 04:23:32 pm »
ok.

3rd question: What is the pattern with the "Circle(" command ?

EDIT:
4) What is the difference between ClrDraw and ClrHome ?

« Last Edit: April 26, 2012, 05:24:26 pm by persalteas »


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Un Tuto Pour Grammer
« Reply #34 on: April 26, 2012, 05:12:24 pm »
3rd question: What is the pattern with the "Circle(" command ?
The pattern is the bit pattern. If the value you input has an ON bit, the pixel won't be drawn in the circle. For example, if you want every other pixel drawn in the circle:
Code: [Select]
Circle(Y,X,R,1,E10101010     ;The E is [2nd][,]
If you want 2 pixels off, two pixels on, use E10011001 (which is 153). Remember, the 1s mean to skip the pixel, 0s mean to draw it.

4th question: What is the difference between ClrDraw and ClrHome ?
ClrDraw clears the graph screen
ClrHome clears the home screen

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Un Tuto Pour Grammer
« Reply #35 on: April 26, 2012, 05:27:25 pm »
Thanks.

Quote
ClrDraw clears the graph screen
ClrHome clears the home screen

ClrDraw clears the screen, or a buffer ? The display is automatically modified, or I need a DispGraph ?

And about ClrHome: How do you put anything in the home screen ? Text( and drawing commands don't...
Is there a buffer for  the home screen ?


5) What does exactly Fill(4 ?

6) and Fill(14 ?

7) If I use augment(4,0,"DStr5"  , for example, it creates 4 new bytes at the beginning of the Str5, isn't it ? So, the string with start with...nothing ? empty bytes ?

8) [strike]You said E was used to introduce a binary string.  Is it the E from [2nd][ln]  ,   [2nd][/]  or   [2nd][,]  ?[/strike] I know the answer, now :D

9) About AsmPrgm. What is the exact syntax ?

Code: [Select]
:Asmprgmassembly-hex-code

or

:AsmPrgm
:assembly-hex-code
« Last Edit: April 26, 2012, 05:28:33 pm by persalteas »


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Un Tuto Pour Grammer
« Reply #36 on: April 26, 2012, 05:36:34 pm »
ClrDraw does not clear the LCD, just the graph buffer.
ClrHome lets you clear the homescreen in case you want to (sometimes I don't like the screen scrolling up afeter running a program >7 times)

There is actually a buffer for the homescreen, it is 128 bytes.

5) Fill(4,x draws a byte using OR logic to every byte of the buffer.I cannot easily explain, but you can test it (all values are safe)
6) Fill(14,x:
     Uses the whole screen like a sprite. Copies it with OR logic, X pixels down on the graph screen. X should be 0 to 62.
7) Yes, it fills it with empty bytes
8)
9) AsmPrgmassembly-hex-code

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Un Tuto Pour Grammer
« Reply #37 on: April 26, 2012, 05:51:19 pm »
okay. Thanks x9.

I Stop for today. I upload the new one. goodnight.


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Un Tuto Pour Grammer
« Reply #38 on: April 26, 2012, 05:53:55 pm »
Good night, and thank you!

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Un Tuto Pour Grammer
« Reply #39 on: April 26, 2012, 06:27:54 pm »

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Un Tuto Pour Grammer
« Reply #40 on: April 27, 2012, 04:36:36 am »
double post...

On continue les questions ? ;D

10) Why does the not( command compare all the 16 bits, and the xor don't ?

11) Does the "StorePic" command work, or I should store my Pics with solve( ?
Code: [Select]
:solve(1, buffer-adress , Pic1-adress , 768

12) Can you give me an example of what to do with inString ? I'm not sure I understand its role.

13) idem, for length('... :/

14) explain Fix 32 ... What is the "text mode" ?

15) explain conj(' .  I understand conj( , but not the 2 syntaxes of conj('.

Thanks for your help...


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Un Tuto Pour Grammer
« Reply #41 on: April 27, 2012, 05:23:46 am »
10) Why does the not( command compare all the 16 bits, and the xor don't ?
xor does use all 16-bits, as well.
11) Does the "StorePic" command work, or I should store my Pics with solve( ?
Code: [Select]
:solve(1, buffer-adress , Pic1-adress , 768
StorePic does not work, so you will need to use your above code.
12) Can you give me an example of what to do with inString ? I'm not sure I understand its role.
Code: [Select]
.0:Return
":CAT:4CHAT:HELLO:7BONJOUR:I:2JE→A
inString(A,":HELLO:
+Ɵ'→S                ;Ɵ' is the length of ":HELLO:", S points to the 07BONJOUR part, now
IS>(S→B
ClrDraw
Text(0,0,S,B
DispGraph
Stop
13) idem, for length('... :/
This is like det(5 in Celtic3.
Code: [Select]
Get("EPROG→Z
length(Z,0,3
That will return a pointer to line 3 in EPROG and the number of bytes in the line in Ɵ'.

14) explain Fix 32 ... What is the "text mode" ?
I don't know, actually. I think I may have forgotten to remove that o.O

15) explain conj(' .  I understand conj( , but not the 2 syntaxes of conj('.
I don't know how to explain it except that it is like Axe :/

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: Un Tuto Pour Grammer
« Reply #42 on: April 27, 2012, 05:48:22 am »
allright, thanks again.

Quote
I don't know how to explain it except that it is like Axe

:/ I don't know how Axe works about sound. I'll ask Matrefeytontias or kindermoumoute.
Quote
This is like det(5 in Celtic3.
Code: [Select]
Get("EPROG→Z
length(Z,0,3
That will return a pointer to line 3 in EPROG and the number of bytes in the line in Ɵ'.

Okay, but I think it's not like det(5 ;D
I thought (not sure, but I thought) that det(5 was able to read  the code-lines, not just giving a pointer.

What is the zero ? length(Z,0,3 ...


Anyway, I asked about length(prime , not length...

« Last Edit: April 27, 2012, 09:14:59 am by persalteas »


Offline mdr1

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 303
  • Rating: +21/-2
    • View Profile
Re: Un Tuto Pour Grammer
« Reply #43 on: April 27, 2012, 07:20:16 am »
Bonjour à tous !
On serait pas dans une section francophone par hasard ?

Bon, sinon, j'apporte une correction de la langue :

Quote
Je voudrai qu'il y ait un tutoriel pour Grammer en français ; je commence donc le projet mais ne parle pas très bien le français.
Grammer
(tutoriel français)
   Bonjour, je m'appelle Zeda et j'ai inventé le langage de programmation "Grammer." Premièrement, je ne parle pas français, donc la documentation peut-être mauvaise (et aussi la grammaire). Le Grammer est un langage pour les TI-83+/84+/SE.
Il y a une version sous forme de programme assembleur ici, mais l'application a plus de fonctions, de vitesse, et d'options.

Qu'est-ce que Grammer? Grammer est un langage interprété.
Comment faire un programme? Utiliser l'éditeur de TI-BASIC en mettant à la première ligne :
Code: [Select]
.0:
Ajouter également le token Return (pour que ça quitte si vous l'exécutez en tant que Basic) :
Code: [Select]
.0:Return

Comment arrêter un programme Grammer ? Il suffit d'utiliser le token Stop.

Concevoir un programme
   Je voudrais commencer le tuto par un exemple. Vous pouvez "parler" au programme à travers des fonctions et des tokens, mais le programme peut lui aussi vous "parler". Donc, il y a des fonctions pour les calculs, les entrées et les sorties. Par exemple:
Code: [Select]
:.0:Return
:.LOOP            ; une étiquette
:getKey→A         ; stockage du code de la touche pressée dans A
:If A=0           ; si A vaut zéro
:Goto Lbl "LOOP   ; aller à l'étiquette "LOOP"
:ClrDraw          ; efface l'écran
:Text(0,0,A       ; affiche la valeur de A
:DispGraph        ; affiche l'écran
:Stop             ; arrête le programme
[/color]

Rassure-toi, ton niveau de français n'est pas exécrable !
Il s'agit essentiellement de corrections de genre, de grammaire, et de tournures de phrase.

@+



Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Un Tuto Pour Grammer
« Reply #44 on: April 27, 2012, 07:31:26 am »
Bonjour à tous !
On serait pas dans une section francophone par hasard ?

Bon, sinon, j'apporte une correction de la langue :

...

Rassure-toi, ton niveau de français n'est pas exécrable !
Il s'agit essentiellement de corrections de genre, de grammaire, et de tournures de phrase.

@+
Lol :P
-Si tu regardes le 2e post du topic, quelqu'un a déjà fait ce que tu as fait.
-Maintenant on parle plus ici du tutorial de Persalteas (aidé de Xeda) que de celui de Xeda seule, donc corriger celui de Xeda est hors-sujet (mais c'est sympa de vouloir aider).

Mais tu as raison, c'est une section francophone donc ils devraient en théorie parler français :)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s