Welcome, Guest. Please login or register.

Author Topic: New improved intuition.library version from the Kickstart 3.1  (Read 73723 times)

Description:

0 Members and 9 Guests are viewing this topic.

Offline Cosmos AmigaTopic starter

  • Hero Member
  • *****
  • Join Date: Jan 2007
  • Posts: 954
    • Show only replies by Cosmos Amiga
    • http://leblogdecosmos.blogspot.com
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #149 on: August 29, 2014, 05:18:59 AM »
New beta 7 maybe this day...

I removed all 68000/010 support : take a lot of cycles for nothing for me...

There is a big difference between 000/010 and 020+ : I cannot lay good code anymore with all the 000/010 limitations...



:)

Offline LoadWB

  • Hero Member
  • *****
  • Join Date: Jul 2006
  • Posts: 2901
  • Country: 00
    • Show only replies by LoadWB
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #150 on: August 29, 2014, 05:40:31 AM »
Cosmos, when you talk about being ROMable, can I assume it can be put into flash RAM like on the Deneb?
 

Offline Cosmos AmigaTopic starter

  • Hero Member
  • *****
  • Join Date: Jan 2007
  • Posts: 954
    • Show only replies by Cosmos Amiga
    • http://leblogdecosmos.blogspot.com
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #151 on: August 29, 2014, 05:49:16 AM »
Romable = firmwareable = Denebable = epromable = eepromable...

===> http://warpclassic68k.blogspot.fr/2013/01/romability-eng.html (in english)



:)

Offline Thorham

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1150
    • Show only replies by Thorham
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #152 on: August 29, 2014, 06:30:44 AM »
Optimizing that crap code example Cosmos showed is still useful, simply because it's easier to read :)

What would you rather deal with in your source code, this:

Code: [Select]
R_DrawImage
    move.l  d1,-(sp)
    move.l  d0,-(sp)
    move.l  a1,-(sp)
    move.l  a0,-(sp)
    jsr     _DrawImage
    lea     $10(sp),sp
    rts

_DrawImage
    move.l  d2,-(sp)
    move.l  8(sp),d0
    move.l  $C(sp),d1
    move.l  $10(sp),d2
    clr.l   -(sp)
    clr.l   -(sp)
    move.l  $1C(sp),-(sp)
    move.l  d2,-(sp)
    move.l  d1,-(sp)
    move.l  d0,-(sp)
    bsr.w   _DrawImageState
    lea     $18(sp),sp
    move.l  (sp)+,d2 ; make the wrong CCR for BenchTrash 1.73
    rts
Or this:

Code: [Select]
R_DrawImage
    clr.l   -(sp)
    clr.l   -(sp)
    move.l  d1,-(sp)
    move.l  d0,-(sp)
    move.l  a1,-(sp)
    move.l  a0,-(sp)
    bsr.w   _DrawImageState
    lea     $18(sp),sp
    rts
« Last Edit: August 29, 2014, 06:37:18 AM by Thorham »
 

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show only replies by Georg
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #153 on: August 29, 2014, 07:12:21 AM »
Quote from: Thomas Richter;771947

The point is: At the time layers was written, the CPU was slow, the blitter was fast, and chipmem was an expensive resource. Thus, layers was designed with these goals in mind: Use as little buffer memory as possible, probably of the expense of additional data manipulations to be made by the fast blitter.


Don't know. Hidden parts of smart refresh layers may end up being backed up in offscreen bitmaps three times. If there is an installed clipregion and the layer is in BeginUpdate state.
Instead it would have been better to just add some offsetx,offsety fields to cliprect struct so that if layer has clipregion installed and/or is in in beginupdate state the normal "hidden cliprect offscreen bitmaps" can be reused.
 

guest11527

  • Guest
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #154 on: August 29, 2014, 07:14:33 AM »
Quote from: Thorham;771971
Optimizing that crap code example Cosmos showed is still useful, simply because it's easier to read :)

What would you rather deal with in your source code, this:

Nothing. It goes right into SYS:Trashcan. That code is not source code, and its not for reading. I don't maintain code at that level.  
Code: [Select]
 DrawImage(rport, image, xoffset, yoffset)
struct RastPort *rport;
struct Image *image;
int xoffset, yoffset;
{
    D( printf("DI\n") );
    DrawImageState(rport, image, xoffset, yoffset, IDS_NORMAL, NULL);
}
  but at *that* level. That's easy to read, it's not assembly because it is not needed, there are no magic constants, there is even a bit of debugging in it if I should need it, and it's a lot shorter and nicer. Ok, except for the old K&R style C.
 

Offline Thorham

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1150
    • Show only replies by Thorham
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #155 on: August 29, 2014, 07:34:15 AM »
Quote from: Thomas Richter;771976
Nothing. It goes right into SYS:Trashcan. That code is not source code, and its not for reading. I don't maintain code at that level.
You don't, because you don't write in assembly language. Cosmos is obviously using assembly language, so that shorter, cleaner code is an improvement. Not to mention that he's probably working with a resourced intuition.library. Making the code more readable is important.

Quote from: Thomas Richter;771976
That's easy to read, it's not assembly because it is not needed
Assembly language IS needed when you LIKE assembly language. That's all that's relevant when you're doing something as a hobbyist, that you like what you're doing.

I'll say again: Hobbyists write in assembly language because they like doing that. If you don't like assembly language, then that's perfectly fine.
 

guest11527

  • Guest
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #156 on: August 29, 2014, 08:20:45 AM »
Quote from: Thorham;771977
You don't, because you don't write in assembly language.  
'course I do if have to or want to - if it makes a difference. The mmulib is assembler because it was needed. ViNCEd was assembler because that was what I wanted back then. BenchTrash is also assembler (probably the wrong approach to begin with, given that there was still a bug).  
Quote from: Thorham;771977
Cosmos is obviously using assembly language, so that shorter, cleaner code is an improvement. Not to mention that he's probably working with a resourced intuition.library. Making the code more readable is important.
But as I already said, that's the wrong approach to begin with. If you want to rewrite intuition, you're moving on dangerous ice by taking the disassembly of the original. You don't "remove copyright" by this activity. Instead, reverse engineer from the interface (which is actually well documented). AROS does that - perfectly fine. So why doesn't he contribute there?

You can hardly complain that the code doesn't look like assembler code because that's what it isn't. It is compiler generated code. If you want clean code, start from the sources. If you cannot get the original sources, start from the AROS sources. You're then safe in many perspectives and have the freedom you want. I *really* don't get it, sorry.
 

Offline olsen

Re: New improved intuition.library version from the Kickstart 3.1
« Reply #157 on: August 29, 2014, 08:41:05 AM »
Quote from: Thorham;771971
Optimizing that crap code example Cosmos showed is still useful, simply because it's easier to read :)

What would you rather deal with in your source code, this:

Code: [Select]
R_DrawImage
    move.l  d1,-(sp)
    move.l  d0,-(sp)
    move.l  a1,-(sp)
    move.l  a0,-(sp)
    jsr     _DrawImage
    lea     $10(sp),sp
    rts

_DrawImage
    move.l  d2,-(sp)
    move.l  8(sp),d0
    move.l  $C(sp),d1
    move.l  $10(sp),d2
    clr.l   -(sp)
    clr.l   -(sp)
    move.l  $1C(sp),-(sp)
    move.l  d2,-(sp)
    move.l  d1,-(sp)
    move.l  d0,-(sp)
    bsr.w   _DrawImageState
    lea     $18(sp),sp
    move.l  (sp)+,d2 ; make the wrong CCR for BenchTrash 1.73
    rts

Or this:

Code: [Select]

R_DrawImage
    clr.l   -(sp)
    clr.l   -(sp)
    move.l  d1,-(sp)
    move.l  d0,-(sp)
    move.l  a1,-(sp)
    move.l  a0,-(sp)
    bsr.w   _DrawImageState
    lea     $18(sp),sp
    rts


Actually, what the DrawImage() stub should do is the following:
Code: [Select]

    include "exec/macros.i"
    include "intuition/imageclass.i"

    section text,code

    xdef    _DrawImageStub

_DrawImageStub:

    movem.l a2/d2,-(sp)
    move.l  #IDS_NORMAL,d2
    move.l  #0,a2
    JSRLIB  DrawImageState
    movem.l (sp)+,a2/d2
    rts

    end

The DrawImage() stub in intuition.library calls the local DrawImageState() function and bypasses the LVO, which means that if you should patch DrawImageState() through SetFunction(), then DrawImage() will not invoke the patched function. I'd call this a bug in intuition.library V40.

Even that bit of code could shortened by taking advantage of the fact that IDS_NORMAL=0, so you could use moveq to fill in d2 and then set a2 to zero by copying d2 into it.
 

Offline psxphill

Re: New improved intuition.library version from the Kickstart 3.1
« Reply #158 on: August 29, 2014, 08:43:51 AM »
Quote from: itix;771922
No, I am assuming CopyMem() is highly optimized just like CopyMemQuick(). If CopyMemQuick() is using better memory copy routine than its CopyMem() counterpart then there is something seriously wrong.

Why would you assume that? CopyMemQuick() is obviously supposed to be more optimised, because it has the word "Quick" in it.
 

Offline Thorham

  • Hero Member
  • *****
  • Join Date: Oct 2009
  • Posts: 1150
    • Show only replies by Thorham
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #159 on: August 29, 2014, 08:51:11 AM »
Quote from: Thomas Richter;771978
But as I already said, that's the wrong approach to begin with. If you want to rewrite intuition, you're moving on dangerous ice by taking the disassembly of the original. You don't "remove copyright" by this activity. Instead, reverse engineer from the interface (which is actually well documented). AROS does that - perfectly fine. So why doesn't he contribute there?
That's a good point.
 

Offline OlafS3

Re: New improved intuition.library version from the Kickstart 3.1
« Reply #160 on: August 29, 2014, 09:18:26 AM »
Quote from: Thorham;771982
That's a good point.

+1

I would integrate any improvements in my distribution, it would help everyone and of course it would be perfectly legal

@Thomas

You see it too much as a engineer but AmigaOS on 68k is completely dead, there will be no development anymore there, noone paying for coordination. AmigaInc. are not interested in it, the same for Hyperion and the old sources sticking legally between both. That developers like you are hindered to help by old contracts just because they have had access to the old sources just show me that this community only has future if we move on with open sources (and there is only Aros) and forget all that were part of the past. For me AmigaOS 68k is dead and future only with Aros 68k. I know that some still think different but I hope people in the 68k community start to change mind in future.
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #161 on: August 29, 2014, 09:38:00 AM »
Quote from: psxphill;771981
Why would you assume that? CopyMemQuick() is obviously supposed to be more optimised, because it has the word "Quick" in it.


Why not optimize CopyMem() ?

Look at this readme and check benchmarks. Using so called "optimized" CopyMemQuick() only pays off when you are copying small buffers (16 bytes or less) but then if you want really good performance for such small copies it is better inline it.
My Amigas: A500, Mac Mini and PowerBook
 

Offline Cosmos AmigaTopic starter

  • Hero Member
  • *****
  • Join Date: Jan 2007
  • Posts: 954
    • Show only replies by Cosmos Amiga
    • http://leblogdecosmos.blogspot.com
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #162 on: August 29, 2014, 10:15:01 AM »
Quote from: olsen;771980

The DrawImage() stub in intuition.library calls the local DrawImageState() function and bypasses the LVO, which means that if you should patch DrawImageState() through SetFunction(), then DrawImage() will not invoke the patched function. I'd call this a bug in intuition.library V40


There is a lot of "direct" calls with bsr in the intuition.library (R_RemakeDisplay and R_RethinkDisplay for example) and in many other libraries in the Kick 3.1...


Quote from: Itix

Why not optimize CopyMem() ?

Look at this readme and check benchmarks. Using so called "optimized" CopyMemQuick() only pays off when you are copying small buffers (16 bytes or less) but then if you want really good performance for such small copies it is better inline it.


Done since a long time directly in the 68060.library... And better code from Matthey a bit optimized by me (faster lsr instead of btst and only one move16 in the loop...)


:)

guest11527

  • Guest
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #163 on: August 29, 2014, 01:10:32 PM »
Quote from: itix;771986
CopyMemQuick() only pays off when you are copying small buffers (16 bytes or less) but then if you want really good performance for such small copies it is better inline it.

Large buffers... But actually, yes, compilers do that. If you run SAS with a high optimization setting, it will inline memory copies if the number of bytes to be copied is small enough. Otherwise, it performs its own copy. gcc does the same. It shouldn't be overly hard to tell the compiler to use CopyMem() if applicable, which again calls CopyMemQuick() when applicable.

For the "generic" type of memory copy you need - copy a structure from A to B - the compiler approach is quite fine. There's not much to be gained to begin with. If your program copies a lot of data, or quite frequently (e.g. you're writing a device and need to copy the user data to a DMA buffer), then you're most likely better off by calling CopyMemQuick() manually (if you can, i.e. proper alignment given) instead of depending on the compiler. Then again, if you *know the size* of the block in advance, you're probably *even better off* to write your own memory copy in a small assembler stub and call this instead.

Thus, after all, CopyMem() and CopyMemQuick() are unfortunately only half as useful as it may seem. If you need a really good memory copy, you're probably writing your own for your specific application anyhow, and if you're happy with the "Ford Escord" of memory copy, just use the one supplied by the compiler.
 

guest11527

  • Guest
Re: New improved intuition.library version from the Kickstart 3.1
« Reply #164 from previous page: August 29, 2014, 01:20:43 PM »
Quote from: olsen;771980
The DrawImage() stub in intuition.library calls the local DrawImageState() function and bypasses the LVO, which means that if you should patch DrawImageState() through SetFunction(), then DrawImage() will not invoke the patched function. I'd call this a bug in intuition.library V40.


I agree. That's at least sub-optimal. Then, however, one shouldn't really depend on patching the function in first place... except if there would be a bug.