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 ... 8 9 [10] 11 12 ... 135
136
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 12, 2011, 02:58:15 am »
@jacobly
Your p_DrawBmp optimizations don't do the same thing as the original code (which is why you're confused about the use of e).  For instance, right after __DrawBmpColWall, my original routine checks if c is zero, then checks if c is one.  Yours checks if c is zero, then if its non-zero.  The e register, which is the left aligned byte to be shifted, is only loaded with c as an optimization in the case that c is zero because the sprite is clipped on that wall.  This is always the same as doing ld e,0.

But thanks for the other optimizations, I have added all of them :)

@Runer112
Mind == Blown.  That's unbelievably cool!  Modular arithmetic is quite a strange beast sometimes.  Anyway, I like that last suggestion best as well :)  However, even though removing the zero loading works for the 16 bit multiplication and (I presume) the 32 bit multiplication, I don't think that last optimization will work for 32-bit, unless you can think of another method?

137
Axe / Re: Axe Q&A
« on: December 12, 2011, 12:55:41 am »
Select() is one of the smallest commands at only 2 bytes.  Loading a variable takes 3.  However, the speed is slightly slower using select verses a single load, but its probably not noticeable.  You would want to optimize it like this:

Original:
X*2+3→G:X+2→X

Notice how X is loaded twice before storing to it.  Why reload it when we can just store it away in a safe place?
Select(X,*2+3→G)+2→X

So this saves 1 byte in the example.

138
The Axe Parser Project / Re: Bug Reports
« on: December 11, 2011, 03:57:48 pm »
Although the new getKeyʳ is more useful, it can also now be very confusing. For example:
Code: [Select]
:Repeat getKeyʳ=64
:End
Could cause an infinite loop that may be impossible to get out of, if lowercase is enabled.

The reason for this is that if you type a lowercase letter, it is stored at $8446, but if you type any other key, it does not reset the value at $8446. (Edit: This causes all of the other keycodes to change to different values every time a lowercase letter is typed.) On the plus side, its value does seem to always be reset at the beginning of the program.

Some fixes for this are to only read $8446 if a >= $fc, reset $8446 after it is read, or to change checks for any key that is not a lowercase letter to getKeyʳ^256=key code.
Edit: And in the last case, it should probably be documented somewhere, since it is not obvious just from playing around with getKeyʳ.

That's weird, it was getting reset in all of my testing so I assumed it would always reset.  I'll fix that.

Also its weird those issues with archive are occurring again.  I fixed that a while ago, but maybe something changed.  It definitely sounds like a page boundary issue to me.

139
The Axe Parser Project / Re: Axe Parser
« on: December 10, 2011, 09:02:37 pm »
Here are some cool things you can do with the new version:

Code: [Select]
prgmAA
:.A
:ClrHome
:[prgmAA]->A
:While {A}
:Disp >Tok
:A+1->A
:End
This one prints out its own source code.  Try it :P

And now 3 examples of places the Select() command can be useful.

Code: [Select]
Select(A,B->A)->BSwaps the values of A and B faster and without needing any extra temporaries.

Code: [Select]
Select(A,+1->A)This is the C style "A++" meaning it increments A but returns the value of A before you actually incremented it.
Note: A+1->A-1 is more efficient in this case, but if it was A+8 for instance, the above is better.

Code: [Select]
:Lbl FOO
:Select(r1,Select(r2,MYLBL()->A)->r2)->r1
:Return A
:Lbl MYLBL
:<stuff including more calls to FOO>
You have now created a recursive subroutine that doesn't need to be called in any special format.  Just call FOO(1,2) or whatever.  Something similar to this will eventually replace the current "recursive subroutine" because it has way more advantages:
 - You only need to save values you know are going to change.
 - Optimizes better when used more than one place.
 - Compatible with non sub() form calling.
 - You don't have to remember or get confused that a certain subroutine requires being called a special way.

EDIT:
Quote
This used to be an error (because it wouldn't work):
For(10)
If A+1→A=B
Return
End
End
Now, Quigibo has found some amazing way to make it work, so it is allowed ;D.
That was super easy.  I was already keeping track of how large the stack was.  All I had to do was pop N times for every N nested for loops (the single argument variety) prior to returning.  ;D

140
The Axe Parser Project / Re: Latest Updates (***DO NOT POST HERE!***)
« on: December 10, 2011, 08:41:27 pm »
Axe Parser
Omega 1.1.0



The largest changelog since 1.0.0!  So many bug fixes... anyway, special thanks to jacobly who has been helping a lot with the development recently.  Also thanks Runer112 for the constant issue tracking and debugging.

New Features:
  • New Select() command for simple and powerful optimization and storage.
  • Redesigned Bitmap() command is clipped, faster, and works with any buffer.
  • Axioms can now make page 0 jumps and calls.
  • Toggle upper and lower case in your programs with the new Fix command.
  • 8.8 to 8.8 sqrt.
  • Single argument for loops can now take any expression as an argument.
  • Now able to use Return in a single argument for loop.
  • The Axe app disables G-T mode on startup.
  • Conditional comment blocks. (aka preprocessor conditionals)
  • Absorb appvars, programs, and strings directly into an executable.
  • Zoom option now controllable through the API.

Changed:
  • Added slightly more delay to direct key input.
  • Function calls have a higher precedence over operations.
  • Fixed multiple bugs with peephole optimizations.
  • Fixed auto-replacements for inline Axioms.
  • getkeyr handles lowercase more usefully.
  • Fixed weird negative sign problem in brackets.
  • Labels cannot be placed in a single argument for statement.
  • Fixed horizontal-() bug causing crashes.
  • Fixed random wrong num of args issue.
  • Fixed a few mistakes in the commands list.
  • Fixed custom list token in getcalc strings.
  • Fixed constant store on last line.
  • Throws an error when no digits entered for hex and binary constants.
  • Buff() can only be defined with known constants.
  • Fixed occasional tilemap sprite import glitch.
  • Fixed *^ operation.
  • Fixed cumsum() command.

141
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 10, 2011, 07:20:44 pm »
Oh I forgot to mention that I've optimized division now by having the long division routine call the modulus subroutine to save space...  I do see what you mean now about the sorting, so I added that change. :)

Generally I don't do peephole optimizations unless all the registers are the same, but I'm 99% sure that this particular one should be okay and that nothing else in the Axe protocol currently relies on the "a" register after a zero check, so I'll add that one.  That second one seems rare, it would only occur if you added 1 after a signed greater than or equal to zero comparison.    So at least until make it faster, I'm only trying to do the most common/significant optimizations because each one I add slows down parsing.

142
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 10, 2011, 05:06:35 pm »
Thanks for the optimizations :)

Unfortunately that p_SortD won't work because ldi also increases de.  Also, the p_Mod won't work because c's right bit will never be set in either of those cases.

143
The Axe Parser Project / Re: Axe Parser
« on: December 10, 2011, 08:11:50 am »
I know I said I'd release it tonight, but I think it will have to wait until the morning.  I crossed every single thing off the list that needed to be done except for one thing which came up recently, which is the tilemap sprite format bug.  That and updating the doc/commands list.  I won't have time for table stuff until the next release, but everything else should be in this one as well as some other really cool features.  One thing I just added; you can now easily write a tiny program that can print its own source code using a more general var absorption (which used to be limited to just picture vars).  No you can can import Pics, Programs, Appvars, and Strings directly into the executable!

Anyway, its past 5am here now so I have to get to bed.

144
The Axe Parser Project / Re: Bug Reports
« on: December 09, 2011, 07:57:45 pm »
Oh crap, thanks!  I forgot about that command when I split up the multiply.  Fixed.

145
The Axe Parser Project / Re: Bug Reports
« on: December 09, 2011, 04:57:19 pm »
I'm not 100% sure of this one, but I think Axe might use some bcalls that aren't present in older operating systems. In this case, Axe should either avoid those bcalls or check the OS version before running.

Runer, I have regexed out all the bcalls that the Axe app uses and included them here.  I'm pretty sure these all work in all OS versions, but if you want to double check, they're listed below.

Spoiler For Spoiler:
5083h
8075h
_Arc_UnArc
_BufClr
_BufLeft
_BufRight
_ChkFindSym
_ClearTokenHook
_CloseProg
_ClrLcdFull
_ClrScrnFull
_CreateAppVar
_CreateProg
_CreateProtProg
_CursorRight
_cxPutAway
_DeleteApp
_DelVarArc
_DisableApd
_DispEOL
_DispEOW
_DispHL
_DisplayImage
_DispOP1A
_EditProg
_EnableApd
_EnoughMem
_EraseFlashPage
_FindApp
_FindSwapSector
_FlashWriteDisab
_ForceFullScreen
_Get_Tok_Strng
_GetCertificateS
_GetCSC
_GetKey
_GrBufClr
_GrBufCpy
_HomeUp
_IsA2ByteTok
_LoadAIndPaged
_LoadCIndPaged
_NewContext
_NewLine
_Op2ToOP1
_PutC
_ReloadAppEntry
_RunIndicOff
_SetFlashLower
_SetTokenHook
_SetXXXXOP2
_VPutMap
_WriteAByte
_WriteAByteSafe

146
Axe / Re: Exiting For-loop in a search-subroutine
« on: December 09, 2011, 03:54:06 pm »
The only problem with using hackish effects is that anything not specified explicitly by the commands list or documentation (like the inside/outside "ans" value in a for loop) might change from version to version, especially as more optimizations are made.  So use at your own risk, you just have a small possibility of losing the portability. :)

147
The Axe Parser Project / Re: Axiom Requests
« on: December 08, 2011, 04:06:44 pm »
By the way I corrected my previous post because I had accidentally posted Horizontal+

148
The Axe Parser Project / Re: Axiom Requests
« on: December 08, 2011, 03:57:28 pm »
For Vertical+ or Vertical-, you can code that in pure Axe.

Vertical-
Copy(48*12+L6,47*12+L6,47*12)r

Vertical+
Copy(L6+12,L6,47*12)

EDIT: Oops, the following is Horizontal +:

Asm(214093AF0606CB1E2310FBC60420F5)

The part I bolded you can change to shift the first N column groups of 8 pixels.  So right now, 6*8 = 48 pixels shift.  Changing it up to 0C (which is 12 in decimal) shifts the full 96 pixels and is the original Horizontal+ command.

149
The Axe Parser Project / Re: Features Wishlist
« on: December 07, 2011, 09:47:18 pm »
That's exactly what I wanted to do and I tried that originally, but it was extremely difficult because then I can't just search for an "End" like I could with comments.  But even so, suppose I could count the number of statements that require an end minus the number of ends and only quit when that count is zero.  Unfortunately, this also involves me parsing single line comments, character constants, and quotes all of which can contain those tokens I'm searching for.  I'd basically have to parse the whole thing as though it were normal code, except without writing anything.  But if I do this, I have to add special code in lots of places to ignore non-executable writing things like data, not erroring on undefined constants, defining new constants, etc.  So in either case, it complicates things immensely and I'm bound to get something wrong with all these special cases.

EDIT: @epic7
Sort of, except that when the thing you're checking is constant (doesn't change the entire time in the program) you can remove the entire code block completely rather than just skipping over it.  Now why would you want to do something like "If 1" knowing its always true?  Its because if you have different versions of your game, or different parts of a library to use, you switch from including them to not including them by changing a single number instead of having to remove/reinclude code.

150
The Axe Parser Project / Re: Features Wishlist
« on: December 07, 2011, 09:25:49 pm »
Yup, I already have that working :)  I'm using the Select() token btw so I won't have to make a new token for it.

Also, I decided the best syntax for preprocessor conditionals is to represent them as "conditional comment blocks".  This makes it easy for beginners to understand and easy for me to parse.  It looks like this:

Code: [Select]
:...If <const>
:<code>
:...

So it will only do the stuff in the comment block if the constant is true (non-zero) but otherwise it is treated as a comment.  I will hopefully also add the "!If" and "Else" comment conditionals.  "End" isn't needed because you can just end it like you normally end a block comment.  Also, this will not allow nesting, but I think that's probably okay.  You can technically nest one level deep using external source though.

Pages: 1 ... 8 9 [10] 11 12 ... 135