|
Submitted By: LincolnB Date: August 20, 2011, 03:56:45 pm Views: 2079 | |||
Summary: Tutorial about creating and effectively utilizing buffers in Axe Parser 1.0.2. by Butts Fredkin. | |||
NOTE:For this tutorial, I'm using Axe 1.0.2. Check the Commands.htm of your current version of Axe to make sure the commands are supported So. There's this thing that you can use in Axe. It's called a Buffer, and it's basically a chunk of memory, and appvar, or some other form of an Array. By definition, it is 768 bytes in size. By using the appropriate commands in Axe Parser, buffers can be displayed on the screen of your calculator to output graphics in monochrome, 3, or 4 level grayscale. Using the Default Buffers In Axe, there is a location in saferam or freeram or whatever you want to call it, called L6. Check the commands list - L6 is 768 bytes in size! Perfect for a buffer. L6 (and also L3, for grayscale) are known as the Default Buffers. Whenever you use a command such as Pt-On(X,Y,Pic1) or Pxl-On(44,36) or Drawinv or something like that, you are drawing to the Default Buffer. Line(0,0,10,10) doesn't 'draw a Line' per se, it sets and edits data in L6, the default buffer (for more on how computers draw lines, you might want to read this). Then, when you call DispGraph, it looks at the data in L6, and displays it. Check this out: Code: [Select]
Try it! If you understand how sprites work, you can see that Pt-On just copies your sprite hex data into a buffer! Experiment with this -- you could even write your own Pt-On subroutine, completely in Axe! (not that it would be extremely useful, just fun to make) Grayscale So how does grayscale work in Axe? This is where the Back-Buffer comes in. L3 is referred to as the Back Buffer, or Secondary Buffer. When you call commands such as Pt-On(X,Y,Pic1)r, it does the exact same thing as without the little r, but it draws to the Back-Buffer instead of the Default Buffer. And when you call DispGraphr, it displays all the data in L3 as gray, and all the data in L6 as black. For more on how grayscale works, I recommend reading this And for four-level grayscale, L3 is displayed as light gray, L6 is used for dark gray, where they overlap is displayed as black, and where they are both blank is white. So to display four blocks right next to each other, progressively getting lighter, do this: Code: [Select]
Using Alternate Buffers If you understand that Line(0,0,10,10) isn't technically drawing a line on the screen it's really just editing and setting data in a Buffer, then using Alternate Buffers should not be hard to understand. All that's different is a slight syntax change. To initialize a buffer (let's call it GDB1, just for fun), we do the following: Zeros(768)->GDB1 This creates an array in memory that is 768 bytes large and fills it with zeros. To clear the buffer, do the following: ClrDraw(GDB1) and other than that, it's really easy. I'll just show you some code examples, instead of explaining in words. Monochrome Buffers: Code: [Select]
The same code, with 3 level gray: Code: [Select]
I'm not 100% sure on the syntax here (I use 0.5.3 |
|||
Rating: This article has not been rated yet. |
|||
|