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 ... 113 114 [115] 116 117 ... 135
1711
« on: April 12, 2010, 02:33:58 pm »
When you do this:
{E/5*16+(D/5)+L4}
You can do half as many divisions by combining them first then dividing:
{E*16+D/5+L4}
Depends on how big E is already though, if its always less than 4096 then you can.
EDIT:hmm... I'm actually not sure now it will work, you might have to add a constant somewhere since it needs to be an exact number.
1712
« on: April 12, 2010, 04:11:39 am »
Yeah it doesn't account for the variable loading. Its 3 bytes to load variables or constants before you actually do the operation.
Also Axe is much much much faster than BASIC. Remember that it requires a whole new mindset. The only time you ever have to worry about speed is with very intensive drawing and computation. For instance more than 20 sprites with collision detection, event handling, and maybe some AI code. And even then, the speed increase is usually a very small fraction of the total cycles. Most cycles go into displaying sprites usually. That's why I always optimize for size.
And of course I say "usually". You can always optimize these things yourself even though its not automatic.
1713
« on: April 12, 2010, 03:57:42 am »
Its from Chrono Trigger right? Welcome by the way.
1714
« on: April 12, 2010, 03:53:29 am »
The full list is included in the zip file in the optimizations file. I know its easy to miss, so here is a copy of it:
================================================ List of expressions with automatic optimizations ================================================ Expression______Bytes___________ +VAR 5 +CONST 4 +1 1 +2 2 +3 3 +256 1 -VAR 7 -CONST 4 -1 1 -2 2 -3 3 -256 1 *VAR 7 + sub *CONST 6 + sub *2 1 *3 4 *4 2 *5 5 *6 5 *7 6 *8 3 *9 6 *10 6 *12 6 *16 4 *32 5 *64 6 *256 3 /VAR 7 + sub /CONST 6 + sub /2 4 /128 5 /256 3 ^VAR 7 + sub ^CONST 6 + sub ^2 5 ^4 6 ^8 6 ^16 6 ^32 6 ^64 6 ^128 4 ^256 2 =VAR 12 =CONST 11 =SHORT 10 =0 8 =1 8 =/=VAR 12 =/=CONST 11 =/=SHORT 10 =/=0 7 =/=1 8
SHORT means less than 256 bytes CONST means any size =/= is a "not equal sign" I'm aware there's more I can add, I'm just focusing on other more important things at the moment.
1715
« on: April 12, 2010, 02:41:52 am »
Well, /2 is optimized and so is /256. /4 is not since its 8 bytes. A load and call to the subroutine is only 6. If you want a speed optimized command instead of a size one, you can just do /2/2 and chain them for higher powers of 2.
1716
« on: April 12, 2010, 02:29:56 am »
Its simple:
;A holds the value to be multiplied in the range 0 to 255 ;B holds angle
sin(B)*A/256 ;You can do this right now, but its unsigned sin(B)*A//256 ;You can do this in the future as signed
1717
« on: April 12, 2010, 02:12:55 am »
You ended it with a question mark so I thought you were asking me if that was what I was going to do. Sorry if I misunderstood...
1718
« on: April 12, 2010, 02:02:45 am »
Remember that Ion doesn't support thumbnails, tho, even when its programs are ran in Mirage. Maybe for now have the compiled program name as first line, description, and for now Axe logo for thumbnail if compiled for MirageOs. Later, maybe add support for custom logos?
That's essentially exactly what I just said
1719
« on: April 12, 2010, 01:27:25 am »
Quigibo, I think you should have an operator to multiply by an 8.8 fixed point value (because this type of value is what sin and cos return, right?)
Kind of. Since the range is 127 to -127 its really half of the actual sine value. By the way, thanks for the sin routine! I modified it a little to get it in the right range, but it's a pretty cool optimization. I don't know if you were aware I used it. Someone gave it to me in IRC and said you made it. I don't know if 8.8 multiplication is really that essential. There's already a way to multiply by fractions (a multiplication then a division like Builderboy's example) and I've never actually needed to use 8.8 it in any of my asm programs before. A little off topic: I'm trying to think of a way to make shell support and I'm not sure how to do the menu because I think it'll be too complicated to have that information built into the source. There's a lot of information in descriptions and thumbnails, both of which are hard to input. So unless I make it real simple: Description is the first comment in the program and the thumbnail is an Axe logo, I'm not sure how to go about this and still be easy to use. I think I'll just go with the simple way for now and do the more complicated way later.
1720
« on: April 11, 2010, 11:05:59 pm »
There is a very simple optimization you can do:
{A+B^7+L1}
Will return the Ath player after B turns (where both start at zero). I guess it would require you to keep track of how many turns are played so far, but its pretty simple. You can even make it a subroutine if you call it a lot to save space.
1721
« on: April 11, 2010, 10:53:02 pm »
@Quigibo I was looking at prgmCOUNTER and was trying to retype it in by hand (for practice and such) and wasn't able to make it work because the "v" you store in Str1 at the beginning of the string was a different one. Where is that token found or is it something else that is going wrong? Anyone can answer this, just wasn't sure what was going on and it's his example.
I shall quote myself. That 'v' is the prefix for appvars and is not the lowercase 'v', its the one on the [2nd][8] button.
1722
« on: April 11, 2010, 08:03:16 pm »
Actually, you can do decimals (for the most part). Since variables are 2 bytes, the low byte can be the decimal part and the high byte can be the integer part. It requires some knowledge of hexadecimal though and the math might be a little confusing at first, but its almost the same as regular math.
1723
« on: April 11, 2010, 07:53:10 pm »
Its exactly the same as appvars. It would have to be like this:
Prgm A: :RAWR <--No quotes here, we're reading raw data.
PrgmAXE: :"prgmA"->Str1 :GetCalc(Str1)->P :For(A,0,3) :Disp {P+A}>Frac :End
Since the string isn't zero terminated you can't just display it like a regular string. (or maybe it is at the end of the program, I dunno)
1724
« on: April 11, 2010, 04:08:24 pm »
also excludes multiplication of 3,4,5,6,7,8,9,10,12,16,32,256 and more in the future. (see optimization tips) Also, the multiplication is only optimized if the constant is on the right! So 2*A is just as slow as regular multiplication. You need to do A*2 to get the speed and size benefits.
1725
« on: April 11, 2010, 04:03:44 pm »
While you can run executable code from another program, its way too dangerous, so I'm not going to support it right now. But you can with assembly commands. Anyway, the main usage is for reading and writing to programs. Like if you made a new program with HELLO as the first line, you can read that just like you read an appvar, and also write over and modify it. The advantage is that appvars are not easily editable. So if you want to make an external level pack come with your game, you might want to consider using a program instead so levels can easily be edited.
Pages: 1 ... 113 114 [115] 116 117 ... 135
|