Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: Quigibo on April 19, 2010, 10:40:01 pm

Title: ASM Routines - Source Code
Post by: Quigibo on April 19, 2010, 10:40:01 pm
I've decided to release the source code for all templated commands the compiler uses when parsing.  I challenge anyone to improve the code :)

You'll have to ignore the cryptic scripts that surround the routines and it probably won't be very obvious what is being done in each one of them.  If you see any routine you think you can get from the start to the finish more efficiently with equal or lesser size, alert me!  If you have any specific question just ask.

Some of the inefficiencies I can't do anything about by the nature of the way the parser currently works, but I plan to correct this eventually (like the jr's at the beginning of the subroutines)

This might also benefit anyone who is trying to transition from Axe to assembly since Axe is for the most part just cookie-cut out of this template.
Title: Re: ASM Routines - Source Code
Post by: DJ Omnimaga on April 19, 2010, 11:30:19 pm
oooh nice to see you are releasing the source for the routines. It might come handy for some people. :)
Title: Re: ASM Routines - Source Code
Post by: Builderboy on April 20, 2010, 02:11:27 am
This could be a great way to improve the speed and efficiency of Axe :) it's so cool how you could just recompile a game and make it faster automaticaly ifyou did it with a new version ^^
Title: Re: ASM Routines - Source Code
Post by: Galandros on April 20, 2010, 09:54:06 am
I will have a look at the routines. ;)
Title: Re: ASM Routines - Source Code
Post by: SirCmpwn on April 20, 2010, 11:21:57 am
Question:
If you have fastCopy impemented, then why does CopyBuffer use GrBufCpy?
Title: Re: ASM Routines - Source Code
Post by: Quigibo on April 20, 2010, 12:24:36 pm
Question:
If you have fastCopy impemented, then why does CopyBuffer use GrBufCpy?
What is called "Fastcopy" in the routines is actually safe copy.  Copybuffer was what I used to use but I don't use it anymore.  I'm just keeping it there becasue in the future there will be more settings on how to optimize the code for efficiency on the size-speed spectrum.  Not all the routines in the list are actually used.
Title: Re: ASM Routines - Source Code
Post by: SirCmpwn on April 20, 2010, 12:37:47 pm
Oh, I understand more now.  Thanks for the clarification.
Title: Re: ASM Routines - Source Code
Post by: Quigibo on April 25, 2010, 10:45:50 pm
These routines might actually need some optimizing.  I couldn't find an algorithm for signed division anywhere on the internet, so I had to do it the really bulky/lazy way with taking the absolute value and then adding the sign at the end.  The line drawing I just translated the pseudo-code from Wikipedia directly into assembly, but there might be a better way for that as well.
Title: Re: ASM Routines - Source Code
Post by: _player1537 on May 14, 2010, 12:41:00 am
Quigibo, could you help me understand your "getkey(x)" command.  I found it in the routines, and skipped the "jp" and ".db" parts, but I don't understand what H and L mean in the routine.  Could you help?
Title: Re: ASM Routines - Source Code
Post by: Quigibo on May 14, 2010, 01:10:00 am
That one is actually really complicated, the Parser itself uses an algorithm to determine what to make H and L.  That's why I require the number for direct keys to be constant instead of variable becasue it would be way too slow to have to convert it each time its trying to detect a key.

Anyway, H is the key group and L is the bit inverse of the key code I think.  There's a chart on day 22 of the learn z80 in 28 days tutorial you can use for reference.

By the way, I haven't updated the list with new commands since the last few versions.  If anyone wants any just ask and I'll post them up here.
Title: Re: ASM Routines - Source Code
Post by: ztrumpet on May 16, 2010, 04:48:53 pm
This looks like it would be very neat to look at/learn from, so if you don't mind, I'd appreciate it if you attached an updated list.  Thanks! :D
Title: Re: ASM Routines - Source Code
Post by: Quigibo on May 17, 2010, 01:53:06 am
Sure thing!  I also included a list of some of my macros since I think I use a few of them in my routines.
Title: Re: ASM Routines - Source Code
Post by: Galandros on May 17, 2010, 04:45:40 am
I also included a list of some of my macros since I think I use a few of them in my routines.
I especially liked the min and max macros. Mind if I release some of the macros and routines in a z80 library? (I put credit in the source code and readme, it is my habit)

The adding and multiplying hl by constants can help out some beginners (drawback of some not understanding exactly what are doing) or copy/paste to spare time.
Title: Re: ASM Routines - Source Code
Post by: Quigibo on May 17, 2010, 09:09:48 pm
Sure, use as many as you want.