This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - Quigibo
Pages: 1 ... 6 7 [8] 9 10 ... 135
106
« on: December 17, 2011, 11:19:20 pm »
So surprise surprise, I added a switch statement last minute, it took me under an hour to have it fully functional. Its also probably the only new feature this version that needs a tiny bit of explaining. So basically, Z-Test() is a command to built what's called a "jump-table", or if you prefer, a "goto-table". It basically creates an array of places to "jump" to and then jumps to the Nth item in that list. That's about it. The reason this is useful is that otherwise, you have to do something like: :If A=0: :<code> :ElseIf A=1: :<code> :ElseIf A=2: :...and so on... So when you have a lot of consecutive comparisons, it saves a lot of space in the program. But the best part is the speed savings. Normally, you would have to make N comparisons (or log(N) if you're smart ) in order to figure out which of N pieces of code to execute. This method however, makes a single comparison! So no matter how large your jump table is, it always takes the same amount of time to get to the code you want to run. All of this fun is overhead though, and I will say you should only switch over to a Z-Test() if you have 4 or more cases to check against, otherwise it could be larger and slower. If you want this to be a call table instead of a jump table, simply put it in a subroutine and call it: :MyTbl(A) : :Lbl MyTbl : Z-Test(r1,A,B,C,...) : <handle errors> The error handling is for when the number you're testing is outside the range of the table. This isn't necessarily an error if you're going to use that to your advantage, but its a good sanity check to have if you're expecting the number to be in the range of your labels. If you are absolutely positively sure your number is in this range (like you just read a nibble which is always in the 0-15 range and you have 16 labels) then you don't need any code there. Also as I was typing this, I just realized I forgot to show an error when you try to use this in a For(expr) loop. DO NOT USE Z-TEST HERE! You will get a memory leak and eventually a ram clear.
107
« on: December 17, 2011, 10:22:58 pm »
Axe Parser Omega 1.1.1
I was surprised how fast I was able to fix things an add some of these features... New Features:- Sexy new compiling progress bar.
- See the name of subprograms currently being parsed.
- See the total size so far of the executable.
- See progress when writing a compiled program to an app.
- Faster multiplication.
- New "Switch"-like statement to generate jump-tables.
- Now able to chain static declarations.
- Added a * in the compile menu to indicate archived programs.
Changed:- Fixed scrolling to errors in large programs!
- Fixed issue with the getkeyr command not resetting.
- Fixed random errors occurring when parsing archived programs.
- Fixed empty brackets causing an error.
- Press [clear] to skip seeing the source error, otherwise it will show.
108
« on: December 17, 2011, 09:55:51 pm »
Oh wait, you're right. You just have to change the sprite beforehand to map transparent to 0,0 on the sprite+mask and white to 0,1 which is easy because you don't have to do that at runtime, just import your sprites in this format.
109
« on: December 17, 2011, 09:32:07 pm »
Yeah, the best option is to work with the "Light" version of the screen and use the standard Pt-Mask()r, but right before the DispGraph, do a DrawInv. If you don't clear the screen after that and need to continue working with it, just call another DrawInv to convert it back again to the light version.
110
« on: December 16, 2011, 09:10:40 pm »
Is there any way to "re-declare" an array? For example, doing "Data(0,0,0)->GDB0" at one point, then doing "Data(6,3,5)->GDB0" later? Or, after the array has been declared, would I need to do something like "6->{GDB0+0}:3->{GDB0+1}:5->{GDB0+2}" to change values?
If your program doesn't writeback, then this is okay. It would be much easier to store values to a free RAM space, then alter them there.
Alternatively, you can store data to a variable instead of a constant and then your can re-assign pointers all you want.
111
« on: December 16, 2011, 07:34:20 pm »
If you're thinking of combining strings in Axe... you're probably doing something wrong Just display them one after the other. Axe doesn't add newlines unless you specify them so its perfectly okay to do "Disp Str1,Str2" or "Text Str1,Str2" and it will print them to the screen as if they were a single string. You never actually need to "combine them".
112
« on: December 16, 2011, 03:10:06 pm »
I had a quick question about editing programs in archive. I assume that what it does is make a copy in RAM and then copy it back if changes were made. But what happens if there's not enough room in RAM to hold the copy? Are other programs temporarily archived to make space or will it not let you edit the program?
You mentioned you had an entry point in zStart so Axe errors could be shown in archived programs, but the routine sounds like it could be small enough to just include it in the app since I still have a lot of space. But I don't know how you're implementing it so maybe I'm wrong or there are other advantages to calling it through zStart that I'm forgetting.
113
« on: December 16, 2011, 02:51:22 pm »
The only restriction is that you can't flip it twice without a copy, but the main advantage of pre-flipping the sprite before compiling is the speed gain because flipping a sprite takes some time. It also makes sprite animation easier since you can reference sprites by a simple offset instead of extra conditionals for which direction to flip.
Of course the disadvantage is that you will have 2-4 times as many sprites that needed flipping than before, but when you only have a few sprites that need flipping (like a main character for instance) its probably smaller than including the flip routine in code.
There is also a hybrid compromise approach when you have a ton of sprites that need flipping, but you still want the fast speed without the extra size. Just use the flip command to flip all the sprites in the beginning and copy them to a free ram location when the program loads. Then, you can use that location with the speed of the preflip method, but with the program size of the runtime flip (minus the decompression routine).
114
« on: December 16, 2011, 02:40:18 pm »
Bounds checking is not built into the routine anyway. In fact, it uses modular checking meaning that pxl-Test(300,10) will test the same pixel as pxl-Test(44,10). Technically, behavior outside the screen is considered undefined and could change in future versions. But due to the way it optimizes, I'm 99% sure it will stay the same as it is now.
115
« on: December 15, 2011, 05:29:05 am »
You can change it as much as you want. It just has to be read in order, not arbitrarily. Enforcing this leads to HUGE optimizations in size and speed, plus it makes coding clean and compact. If you need to access an X,Y pair you should be using a 2d array structure instead. What this is more similar to is an object List (java), Table (SQL), or Vector (C++).
116
« on: December 15, 2011, 05:17:26 am »
I can't elaborate much because I don't know the exact specifications for it yet since its still in planning stages. But basically a table is a data structure with objects. There will be a special iterator loop structure, probably something similar in syntax to "For([A])". You can add, remove, access, and modify only the current object from the iteration. Order cannot matter during the iteration because the positions might change around during these operations. You can access the Nth data byte of your custom objects, but you cannot access the Nth object because this would be unstable during the above operations and it requires a multiply.
This is all speculation so far. I might also have to introduce the concept of "binders" to make this nestable.
117
« on: December 15, 2011, 04:04:58 am »
A random access array is too complicated to implement and wouldn't be as efficient as accessing native Axe data so I don't think you will see that soon unless I have some new revelation. However, an expandable table of fixed size objects that only needs iterative access you will see in the near future because this is both simpler to program and can be made equally or more efficient than current native methods. I also feel that out of all the data structures, this is used the most by Axe programmers.
EDIT: In the future if I support macros, writing your own array accessing like your example would be pretty simple.
118
« on: December 14, 2011, 08:01:48 pm »
Drawing 9 sprites in a for loop is about 20% faster than using the bitmap command, so only slightly. However, this is the first version of that command, so there are likely to be optimizations in the future.
119
« on: December 14, 2011, 05:53:22 pm »
That creates Str1 (because it has 2 arguments instead of 1). But if you had less than 148 bytes of ram left on your calculator and Str1 couldn't be created, it will safely quit. EDIT: Draw the picture on the computer and send it over. It shouldn't distort anything, otherwise its probably an issue with TI-Connect or something.
120
« on: December 14, 2011, 05:45:52 pm »
Pages: 1 ... 6 7 [8] 9 10 ... 135
|