Jump to content

Recommended Posts

could the description texts include the target machine within them as well as what each is as a program and what the optimization thoughts would be?

Edited by _The Doctor__

Share this post


Link to post
Share on other sites

I was referring to your programs, themselves, not the other examples. I had clicked the first link in the thread, not the one that came later... 😮

so it makes more sense now.

Share this post


Link to post
Share on other sites

I'm glad for the good response from people downloading my program.  Does anybody out there have any ideas on how to better optimize the program?

Share this post


Link to post
Share on other sites

As this has just been written, I would have expected it to run under SDX, but it crashes Altirra

(130XE, SDX, U1M & SIDE3 emulation).

 

The only way I can get it to run is to boot from the floppy.

Share this post


Link to post
Share on other sites

danwinslow, I looked at the link you gave me and am wondering which one(s) to download.  I have the Altirra demulator.  Should I get another version also?

Share this post


Link to post
Share on other sites

You can download one of the cartridge versions and install in Altirra as a cartridge. There's an emulators selection at the very bottom of that list.

 

 

Share this post


Link to post
Share on other sites
23 hours ago, TGB1718 said:

SDX is ... the standard DOS these days :)

 

 

Not here.

SDX is the standard DOS that comes on every new A8 hardware (if you like it or not).

Still I avoid using it and use DOS 2.x instead.

 

  • Confused 1

Share this post


Link to post
Share on other sites

Appreciate what you say, but once you start using SDX and all it's features, most other DOS's become

clumsy by comparison.

Share this post


Link to post
Share on other sites

there was a time when programs stopped appearing on Amiga, you could see that the only form of using this computer was configuring the desktop, arranging icons, etc. around this activity, even a mini community was created, articles, photos of active user desktops appeared, etc.


I notice that this stagnation also affected this community, the manifestation of which is configuring DOS, creating directories, copying between directories, the command line - the highest degree of initiation ;-) etc.

 

"have you create directory today?"  ;-)

  • Haha 1

Share this post


Link to post
Share on other sites
On 9/30/2021 at 10:54 PM, xxl said:

I notice that this stagnation also affected this community, the manifestation of which is configuring DOS, creating directories, copying between directories, the command line - the highest degree of initiation ;-) etc.

I agree here.

 

I feel that most users want to be able to just pick something up and use it.

 

It is ok to go off doing those other tasks, but you should then present the results of your work as something people can instantly use again.

 

Not a big problem though, if it requires too much effort, I will avoid the software.

 

It is like PC software that is distributed as source only. Then someone says that you also need to download a compiler, so you Download that and then you need a version of make, then you need some extra dll..... pahh forget it....

Edited by snicklin
Added text

Share this post


Link to post
Share on other sites
12 hours ago, snicklin said:

It is like PC software that is distributed as source only. Then someone says that you also need to download a compiler, so you Download that and then you need a version of make, then you need some extra dll..... pahh forget it...

Agreed, Visual Studio Code to program a Raspberry Pi Pico, it's ridiculous what needs to be installed and I

have to admit I never got to get it working other than to compile the examples :(

 

Share this post


Link to post
Share on other sites
On 9/25/2021 at 1:39 PM, Harry Potter said:

I have a lot of cc65 C code optimization techniques at c65 additions - Manage Files at SourceForge.net.  Does anybody have any other suggestions?

The document describing optimizations in a way "do this instead of that because it's faster" is not very useful.

  • It's lacking information to which version of CC65 it applies
  • It's not explaining why specific construct is faster than the other
  • It's not showing difference in generated code by different code alternatives
  • It's not providing information how much faster/smaller generated code is
  • You use bizarre way of versioning - your documents have numbers 1.00, 1.10, 1.20... like with software versioning, however they are NOT new versions of the same document, but each document has different content. It's misleading (I initially checked only "the newest" version).

Also your recommendations are very strange... Example:

[Incremental Switch Returns]

    When you use a switch to return an incremetal value where each
condition returns one more (or less) than the previous, reorganize the code by
putting the highest (or lowest if less than the previous), using an increment/
decrement instead and remove the breaks on all except the last if necessary.
An example follows:

        Instead of:
        -------------------------------
        char c=0, d;
        switch (c) {
        case 1: d=1; break;
        case 3: d=2; break;
        case 2: d=3; break;
        case 4: d=4; break;
        }
        -------------------------------
        Try:
        -------------------------------
        char c=0, d=0;
        switch (c) {
        case 4: ++d;
        case 2: ++d;
        case 3: ++d;
        case 1: ++d; break;
        }
        -------------------------------

in case of the first switch code the whole switch(c) can be replaced by expression:

d=c

Your second code looks like a strange version of Duff's device but it's not used for code unrolling in your case, so it's pointless. Additionally the code has bug (case 2 and case 3) should change positions.

 

Also your optimization tips contain ones like "Ints are shorter and faster than strings" - seriously?

or 

[Optimizing Longs]
    On an 8-bit computer, longs are very slow and require alot of code.
Fortunately, using pointers to longs instead seems to produce tighter code. I
think this is because it allows your program to handle words, while the
compiler provides the routines to handle the longs referenced.  This, however,
should slow down your code even more.

...what? 🙂

I'm afraid it's hard to give other suggestion than "remove it from the Internet with hope that nobody will ever find it"

Edited by ilmenit
  • Like 1

Share this post


Link to post
Share on other sites

ilmenit, I think you missed the case labels in the first switch.
Case 3 gives d=2 and case 2 gives d=3, which means d=c doesn't work for c==2 or c==3 .
Which makes the second switch code functionally correct.

 

The 2nd switch minimises the jumps required (notice the missing breaks) but would give interesting results if d was a pointer to a register (even worse if it is a write only register).
I'm too lazy to evaluate code size and execution time.

Harry,
Perhaps rename files as:

  • Optimizing_cc65_Code-part-1.txt
  • Optimizing_cc65_Code-part-2.txt
  • etc

 

Share this post


Link to post
Share on other sites
3 hours ago, stepho said:

ilmenit, I think you missed the case labels in the first switch.
Case 3 gives d=2 and case 2 gives d=3, which means d=c doesn't work for c==2 or c==3 .
Which makes the second switch code functionally correct.

you are correct, still the example seems to be totally artificial. The second case (without breaks) makes sense only to set the value of 'd' according to 'c', because if there are other operations in the original switch (before the breaks), then in the second all the following operations would be executed (making it incorrect). For having functionality of dictionary translating one value into other, a simple lookup table is shorter and faster:

unsigned char get_d_for_c[] = { 0,1,3,2,4 };

d=get_d_for_c[c];

 

Edited by ilmenit

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...