Show Posts

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 ... 11 12 [13] 14 15 ... 135
181
Axe / Re: Axe Q&A
« on: November 09, 2011, 05:53:20 am »
Code: [Select]
:λ(EXPR)→A
Is shorthand for:

Code: [Select]
:ʟTEMP→A
:
:Lbl TEMP
:Return EXPR

With the added convenience that you don't need to create a new label name, thus you can think of lambdas as creators of unnamed functions.  This is mainly useful when you have a high order subroutine (one that takes another subroutine as an argument) that you want to pass a simple function inline instead of having to create one somewhere far away in your code and pass the reference.

For instance here is a useful high order subroutine I thought of:

Code: [Select]
:Lbl Merge
:r₁→r₆
:L₆→A
:For(768)
: (r₆)({A},{A+L₃-L₆})→{A}+1→A
:End
:Return

This subroutine "Merge" takes only one argument: A function of 2 variables.  It then applies this function to corresponding bytes of the front and back buffers and writes the result to the front buffer.  So here are some things we can pass to it:

Code: [Select]
:Merge(λ(r₁ or r₂))    ."or" the buffers together.
:Merge(λ(r₁ xor r₂))    ."xor" the buffers together.
:Merge(λ(r₁ and r₂))    ."and" the buffers together.
:Merge(λ(not(r₁) and r₂))  .some other logic
:Merge(λ(0))         .Clear the buffer
:Merge(λ(255))       .Fill the buffer with black
:Merge(λ(r₂))         .Replace front buffer with back buffer
:Merge(λ(not(r₂)))    .Replace front buffer with the inverse of the back buffer

And so on... Notice how we were able to do all these similar functions without having to re-type a ton of code with tons of separate subroutines.  Also notice how easy this was using lambdas.  The high order function are really great for repetitive code and can be used to reduce code size with only a small overhead cost in speed.

182
Miscellaneous / My Room
« on: November 07, 2011, 10:20:44 pm »
Here it is

Some of you may have seen one of the wall pictures I made a couple months ago, but I have now finished my entire room (other than the ceiling).  I took pictues and uploaded them to tumblr.  I estimate that I've used 2,200 post-its (Only $20 worth), but I haven't actually counted.


183
The Axe Parser Project / Re: Features Wishlist
« on: November 06, 2011, 02:21:48 pm »
Yes.  If you're using 'e' it will ignore the high byte of a 16-bit variable.  However, if you use 'ee' you can pick from the entire 16 bits.

184
The Axe Parser Project / Re: Features Wishlist
« on: November 05, 2011, 07:35:09 pm »
Don't forget the 'e' operator.  It accesses the Nth bit of a number.  Its been around for a long time now...

185
Axe / Re: Some questions: Toggle button, Buffers, Appvars
« on: November 04, 2011, 03:52:07 pm »
By the way, I had to make a correction to the buffer xoring routine earlier.  The value returned after storing a 2 byte number to an address is the address plus one.  So only one a +1 is required to get to the next byte.

I cannot make the repeater loop (one argument for loop) work with a variable.  The reason is that the registers that are used as counters in the loop change depending on the the number of times to loop for maximum optimization.  If you don't know the value ahead of time, the parser can't know which method to use, and you end up forcing a more unoptimized one to account for this.  Also, you wouldn't be able to bring in a value into the loop, like in my example, unless I add some extra code to it.  Lastly, the format of the loop counter's register is NOT the same as the number of loops that need to be made.  I would have to include code to convert the value into the right format.  This is done at compile time for constants so conversions aren't needed at runtime.  Add all of these extra bytes together, and you get code that is just as big as a regular for loop.

I could add it anyway because it would still be slightly faster than a typical for loop, but you certainly lose any size optimization.

186
Axe / Re: Some questions: Toggle button, Buffers, Appvars
« on: November 04, 2011, 08:17:58 am »
1. jacobly's solution is what I would do too.

2. You can do it even faster with the new speed loop: ;D
Code: [Select]
L₆
For(383)
 {➔A}ʳ﹢{A+L₃-L₆}ʳ➔{A}ʳ+1
End

3. If your saved data takes a standard form like "appvSAVE1", "appvSAVE2", "appvSAVE3", etc.  Then you can construct the first part of the string in some memory by doing copy("appvSAVE0",L1,7) and then make the string the Nth file by doing N+'0'➔{L1+5}.  Now all you have to do to load the file is just GetCalc(L1) which uses the string you just constructed.  If you want to list all the appvars on the calculator that start with your custom header and choose from those, you'll have to use memkit.

187
ASM / Re: More USB Information?
« on: November 04, 2011, 02:17:06 am »
Brandonw has a semi-commented full disassembly on his website, but I'm not supposed to share the link.  Its not too hard to find it if you know where to look ;)

188
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: November 04, 2011, 01:58:14 am »
Not an optimization, but I'm posting this here since more assembly people will read it.  Since the Bitmap() command is being replaced with something actually useful, that means the "Fix 8" and "Fix 9" will also need to be replaced.  Are there any useful flags (particularly for text) that would be useful to Axe programmers that I haven't already covered with the other fix commands?  A couple I can think of are an APD toggle or Lowercase toggle.

189
The Axe Parser Project / Re: Features Wishlist
« on: November 03, 2011, 05:05:24 pm »
The sin and cos routines are very fast, about the speed of doing one multiplication (because that's essentially what it does).  It uses the fact that sin(x) when x is in the range [0 to 180 degrees] has a hump that is approximately a parabola.  For the domain and range that I'm using in Axe, sin(x) is approximately: x*(128 - x)/32.  This is then just replicated with alternating sign periodically.

A look-up table is always faster, they are even faster than regular multiplication.  If you have 16 values, then done right it could be slightly faster and about the same size to use a look-up table, but you have to be good at Axe optimization to achieve this.  However, unless you are computing sin and cos more than 1000 times per second, I wouldn't even bother because it won't make a difference.

190
The Axe Parser Project / Re: Axe Parser
« on: November 02, 2011, 01:21:22 pm »
I think I'm getting rid of the old one... it makes me uncomfortable including a command can cause a crash even though its used in an intuitive way because TI doesn't know how to code right.

And yes, I have my own list as well as the issue tracker.  Since the current version is stable, expect the next version mid-November.  The focus of 1.1 will be "Ease of use" to make coding more basic.  The two largest things I'm tackling are arbitrary-sized sprites and tables.  So other than bug fixes, the rest of the feature suggestions will be on an "If I have time" basis.

191
The Axe Parser Project / Re: Axe Parser
« on: November 01, 2011, 11:56:58 pm »
Good news everybody!  I'm almost done with the new Bitmap() command! ;D

I've been working on it for nearly 2 weeks and it now handles all of my test cases and just needs some optimizing.  At just over 200 bytes, its definitely the largest and most complex piece of assembly I have ever written.  It uses no shadow registers or iy so its interrupt safe and compatible with any buffer.

You can draw sprites as small as 1x1 and as large as 224x192 which means you can move larger-than-buffer images across the screen for cut-scenes and stuff like that with ease.  Its not super fast though, its probably only slightly faster than drawing the 8x8 spites individually, but I'll benchmark it once I finish optimizing.

192
TI Z80 / Re: Text compression for AXE programs
« on: October 31, 2011, 05:52:54 pm »
Another idea, during decompression, you can automatically make the first letter of every sentence uppercase, and the rest lowercase. That way it still looks nice, but it takes up the same amount of space.  You can use other rules too to capitalize things in quotes.  Also, don't forget about characters '0' through '9', those are probably important too.

193
TI Z80 / Re: Fullrene
« on: October 31, 2011, 05:10:31 am »
As far as optimizations, I found one byte for the all models case:

Code: ("old") [Select]
        ld de,pagedBuf+1
        ld bc,49 ;so lucky VV
push bc
        ldir
        ld hl,(iMathPtr5)
push hl
        ld de,9A00h
        ld bc,50

Code: ("new") [Select]
        ld de,pagedBuf+1
        ld bc,49 ;so lucky VV
push bc
        ldir ;bc is now zero
        ld hl,(iMathPtr5)
push hl
        ld de,9A00h
        ld c,50 ;since b is already zero...

By the way, if you need absolute addressing in the $0000 to $3FFF range, I can add a new prefix to ignore the automatic replacements if that's convenient.  I didn't think anyone would ever need to jump or call addresses there, but I guess for hacks like this that could be important.

194
The Axe Parser Project / Re: Features Wishlist
« on: October 26, 2011, 07:31:35 pm »
Both good ideas.  I was planning to add a token string eventually, but I forgot about it since nobody was really using tokens.

195
Axe / Re: Storing Pics
« on: October 26, 2011, 07:27:55 pm »
Are you using the latest Axe version?  Some older versions referenced floats incorrectly due to overcompensating for the size field.

Pages: 1 ... 11 12 [13] 14 15 ... 135