Author Topic: Z80 Optimized Routines Repository  (Read 13919 times)

0 Members and 2 Guests are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Z80 Optimized Routines Repository
« on: August 13, 2019, 02:38:20 pm »
Hi folks! I've noticed that the "Z80 Optimized Routines" threads and their equivalents on various sites aren't very easy to navigate. I am starting a repository on GitHub in the hopes of addressing these three issues:

  • Organization! "Is this routine documented? What page is it on?
  • Collaboration! "Is there a better version later in the thread? On what page!? Here is yetanotherversion!"
  • Cleanliness! "What is this random request doing in the middle of the thread?"

I initialized the repository here.

My plan is to start porting Cemtech's thread, Omnimaga's thread, UnitedTI's thread, Z80 Heaven's routines, and my private routines folder.


If you want to help port documentation, I only ask that you cite the original author if possible, except when the original author doesn't care to be cited. If you want to add your own routines, keep it organized! And please, if you see an optimization, please make it!


A final note: I think it would be great to have an eZ80 and TI-BASIC repository, too, but I don't think I'm up for maintaining that!

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: Z80 Optimized Routines Repository
« Reply #1 on: August 14, 2019, 02:32:49 pm »
Rich idea!
Wish i had the time to help you on that...
Anyway, not sure who's the creator, but the labels on getKey.z80 are probably wrong.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Z80 Optimized Routines Repository
« Reply #2 on: August 14, 2019, 02:46:30 pm »
On this one? The labels are in the right places, but I do notice that sometimes pressing a key will read as the wrong group :(

EDIT: Also, I'm hoping to put your routines in the repository if you'd like!

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: Z80 Optimized Routines Repository
« Reply #3 on: August 14, 2019, 04:52:22 pm »
Yes, that one.
I thought that having 2 identical labels looked weird, my first thought was that it was some kind of weird syntax compatible with a specific assembler or something.

Using SLA allows you to bypass the need for any delay, because it just enables further groups.
However, yes, it's pretty inaccurate, because you end up potentially reading duplicate key bits at once.
The safest way to do this is to actually use RLC or RLCA, so that only 1 clear bit is sent to the port at a time.
However, that implies entering the "delay madness", more specifically using the safe values of 8 or 32 cycles between OUTs & INs (6 or 15mhz).
There is a trick to really optimise that, which is to design your code so that your INs are immediately followed by OUTs, but it's not easy to explain.
Feel free to check my keybscan.z80 if you need some inspiration.

About adding my routines, sounds great, though each of my .zip file has some separate info (.txt file) that definitely need to be read, so i guess it would probably be wise to wait until i manage to include that as comments in each .z80.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Z80 Optimized Routines Repository
« Reply #4 on: August 14, 2019, 06:04:00 pm »
Good news! I've finished Cemetech's thread and it was tedious as heck. I've also added a bunch of my personal stash that I think is in an acceptable state :P Currently at about 100 routines.

EDIT: Finished porting from the other sites.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Z80 Optimized Routines Repository
« Reply #5 on: August 19, 2019, 08:42:56 am »
It would probably be a good idea to contact all the users and get permission to MIT license the whole repository. Right now it's unlicensed, which technically means that nobody can use it without permission.
/e

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Z80 Optimized Routines Repository
« Reply #6 on: August 19, 2019, 02:36:11 pm »
That's a good point.
At the moment, all but three of the routines are from myself or the calculator forums in their useful routines threads. The ones from UTI  are explicitly free to use.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Z80 Optimized Routines Repository
« Reply #7 on: August 19, 2019, 03:29:31 pm »
That's a good point.
At the moment, all but three of the routines are from myself or the calculator forums in their useful routines threads. The ones from UTI  are explicitly free to use.
Well I'd suggest adding a license to cover it all that also states that any file with a separate license header is covered by that license instead. On all the ones you haven't heard from the owner about yet, add a license header with text similar to this https://releases.eeems.codes/license.php
For the UTI one, is there a post with something that could be considered a license? If so, just add a license header pointing at that for all of those.
/e

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Z80 Optimized Routines Repository
« Reply #8 on: August 19, 2019, 03:41:23 pm »
Okay, thanks! There are 26 routines that I'll need to investigate later when I get out of work. Nine of them I don't know if I'll be able to contact the author, but one of those I plan to make a better implementation of anyways.

EDIT:
How does this sound?
Quote
1. This License does not apply to any file with a separate License header.
2. Permission is granted, free of charge, to use, modify, and/or distribute any part of this software for any purpose.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Written by Zeda Thomas <[email protected]>, Aug 2019

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Z80 Optimized Routines Repository
« Reply #9 on: August 19, 2019, 10:34:19 pm »
Looks good to me.
/e

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: Z80 Optimized Routines Repository
« Reply #10 on: August 23, 2019, 05:00:55 am »
Updated my snacks, and finally managed to make each file standalone, as far as documentation & warnings are concerned.
I prepared everything in 1 attached zip for the occasion, without the 3 files that aren't code.
Thanks in advance for the boring ctrl+c|v job, we all know the feeling, i guess.
« Last Edit: August 27, 2020, 06:02:29 am by the_mad_joob »

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Z80 Optimized Routines Repository
« Reply #11 on: October 08, 2019, 11:17:54 am »
This is really useful. Can we get it sticked so it doesn't fade away into obscurity?
I'm still around... kind of.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Z80 Optimized Routines Repository
« Reply #12 on: October 08, 2019, 01:13:56 pm »
This is really useful. Can we get it sticked so it doesn't fade away into obscurity?
Done
/e