Author Topic: Grammer 2-The APP  (Read 146600 times)

0 Members and 1 Guest are viewing this topic.

Offline C0deH4cker

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 258
  • Rating: +11/-1
    • View Profile
    • iNinjas Forum/Repo
Re: Grammer 2-The APP
« Reply #120 on: November 18, 2011, 07:50:04 pm »
Looking good. I might look into grammer, but im learning axe atm.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Grammer 2-The APP
« Reply #121 on: November 18, 2011, 07:50:33 pm »
Same....

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #122 on: November 18, 2011, 08:29:04 pm »
Cool :D There are a few differences with syntax (especially math), but learning Axe should help you to understand the more advanced functions in Grammer :)

(such as memory editing and access and whatnot)

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #123 on: November 21, 2011, 01:03:34 am »
Okay, so update-wise, before I make the next official release, I want to put this out for testing. It seems there have been a lot of issues lately (mostly sprites). I have been hard at work making sure these bugs have been fixed (I am not sure they have been, though) as well as making sure these next commands are safe and in working order. Anyway, here are the next commands:
sub( deletes data from a variable. The syntax is:
sub(#ofbytes,Offset,"VarName
So an example of using this might be to delete 7 bytes from the beginning of an appvar:
Code: [Select]
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.
augment( is used to insert data into a variable. It has the same syntax as sub( and it will cause a memory error (see next command) if there is not enough memory available.
solve(3, is used to create a Custom Error Handler. The argument for this is a pointer to the error handler. Whenever Grammer throws an error (there is a Memory error and ON Break error), code will be diverted here. The error code is passed in Ans as either 0 for ON or 1 for Memory. For example, here is an error handler that will display the error if ON is pressed and then quit and a menu to quit or continue for a Memory error:
Code: [Select]
.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.
Here are the changes and bug fixes:
-Changed the Send( command so that it now creates a var filled with zeros (instead of unknown data)
-Changed UnArchive command to return a pointer to the var data in RAM
-Fixed Pt-On( and Pt-Off( command up (any bugs that I found).

So the negative effects of augment( and sub( deal with the fact that these might shift your program around in memory. Don't worry, this won't affect the parser, but what it can do is mess around with labels. For example, if you get the pointer to a label and store it to P, then you delete some data from a var and your program is shifted down some bytes, then P will no longer point to the correct location!

So here are proposed ideas on my part:
1) Make a "Relative Pointer Mode" that will use Goto , Return, Lbl , Func, and prgm, based on relative addressing. (This means that it won't matter where in memory the program is because these will all work as offsets from teh start of the program).
2) Add a ' modifier to the commands to tell it to use relative addressing. So Lbl '"Hello will find the offset into the program that the label .Hello is at. Then prgm' will call the offset into the program.

So technical stuff aside, here is the download, currently.

the circle command in this version will let you use an optional argument as the byte pattern for drawing >.> I don't know if this will be changed or not, so it is not documented. So don't use it in a game!

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Grammer 2-The APP
« Reply #124 on: November 21, 2011, 11:01:05 am »
Nice! Feature requests:
1) Fix the For( error :P
2) Make it possible to draw lines out of the screen, so it influences what pixel test returns outside of the screen
3) Make that if you have e.g. a rectangle drawn to the half outside the screen and to the half inside that it still draws everything that inside the screen

Oh, and downloaded grammer! ;)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #125 on: November 21, 2011, 01:00:28 pm »
I am actually still not sure what the error is D:
Lines can be drawn off screen
I forgot to add that Fix 16 would set the mode so that pxl-Text( returns 1 if it is outside the screen.
The rectangle command... I will see if I can fix up the clipping :/

EDIT: There was no For( error :P It was just my own coding fault. (I did the math wrong in Grammer code, so it was pixel testing non existent pixels)

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Grammer 2-The APP
« Reply #126 on: November 21, 2011, 03:10:58 pm »
If you draw off screen, will a pixel test return correctly?

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #127 on: November 21, 2011, 04:35:42 pm »
No, it will not because the buffer is only the size of the screen.
Because of this, on screen pixels are either ON or OFF. Off screen they are undefined. Normally, 0 is returned of you pixel test off screen. If you set mode Fix 16, 1 is returned instead.

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Grammer 2-The APP
« Reply #128 on: November 21, 2011, 05:21:11 pm »
Can drawing off screen cause a crash?

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #129 on: November 21, 2011, 11:49:30 pm »
I believe the last case of that being possible has been fixed in the latest version (drawing a sprite to specific coordinates caused it to crash).

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #130 on: November 27, 2011, 05:19:07 pm »
Okay folks, as promised (on IRC I believe), I got very little done during my 5 day break. However, what I did manage was to add in a signed division routine that is the same exact speed as the regular division routine for positive values (up to 50 to 71 cycles slower depending on if 1 or both are negative). So for that, I need to figure out what modifier I should add to signify signed versus unsigned division. For now, I am using / (there is a space after the division sign).

The other thing I remember adding was something that I got the drive to do from my best friend from back home-- custom font size. Right now I am making a font and a font editor, but it does work. characters can only be up to 8 pixels wide and 32 pixels tall. The display routine right now wraps the letters the same as before, but they can be drawn to pixel coordinates (and the font can all be varying size).

Also, because I added this command, I made the Output( token grant you the power of using custom fonts :)
Now I need to add font documentation somewhere and create a font editor >.>

Here is a screenie of the text (I only have the numbers and the letters A~J finished) and you can see it is a little slower than the fixed sized font:

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Grammer 2-The APP
« Reply #131 on: November 28, 2011, 11:53:26 pm »
Sorry for the triple post, but this is a decent update, I believe :/

So some of the new commands are:
Fix 32
     TextMode. 0 is the default, fixed width font. 1 is the variable width font.

The ' modifier can now be used in the Text( command to display an individual character by number. So to display char 248:
Code: [Select]
Text(0,0,'248

Output( can now be used to change the font as well as set a font (for the duration of the program).

/ can be used for signed division. This is a division sign with a space after it. This is still tentative and may not remain backwards compatible, though, so any other suggestions are welcome.

solve(4,Error# will create an error. This is useful if you have a custom error handler where you want some errors to be handled by the program and others by Grammer.

I should also note that errors now have a Goto option if the program is not archived or protected. In the first Grammer, this was always the case, but since it has become an app, I have only just added the code to do this. It will jump to the offending line as it would in BASIC :)

I'm not really sure what other screenies to add, so I will just use one with the incomplete fontset (complete enough for most text).

See this Font Editor, too!

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Grammer 2-The APP
« Reply #132 on: November 29, 2011, 02:15:15 am »
Very cool, I like that you can do custom fonts with this now too! =)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Grammer 2-The APP
« Reply #133 on: November 29, 2011, 02:37:41 am »
Awesome updates Xeda and I'm happy this finally got a sub-forum. Congrats! It deserved it! :)

(I was planning to make a sub-forum when I was still admin, but then Grammer 1 got released and I didn't know a 2nd one would be made)

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Grammer 2-The APP
« Reply #134 on: November 29, 2011, 08:10:46 am »
Feature request: custom errors? :D
Sig wipe!