English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 03 April 2017, 18:21   #21
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by ross View Post
Each cycle counts in fast routine
Don't worry, this routine can not be fast

Knowing the intended use case would also help - mere palette fades don't need fast code and 68000 is too slow for alpha blending (which would be faster in 24-bit anyway) so i don't see any use.
But perhaps it's just for the sake of the coding compo ?
meynaf is online now  
Old 03 April 2017, 18:55   #22
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
Quote:
Originally Posted by meynaf View Post
Don't worry, this routine can not be fast

Knowing the intended use case would also help - mere palette fades don't need fast code and 68000 is too slow for alpha blending (which would be faster in 24-bit anyway) so i don't see any use.
But perhaps it's just for the sake of the coding compo ?
I always hope that routines written for fun can serve somewhere (or that may point the way to most significative routines).
I remember when I was fourteen (1984..) I wrote an interpolation routine in 6502 for the C64 that just made me realize what was linear interpolation.
My editor was a sheet of paper.

So to answer You: I do not know if it will never be anything, I do it for fun and competition.
I'm so enthusiastic to returning to write code to 68000 after more than 20 years. An architecture so beautiful!
I hope I never get tired soon, burdened by my work and life.

Bye,


PS: another thing I like is that this forum is full of old farts, I feel at ease
ross is offline  
Old 03 April 2017, 20:53   #23
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
Quote:
Originally Posted by ross View Post
Hi Dan, sorry to be pedantic...
all other registers are in an undetermined state
d0-d2 can be trashed

result needs to be returned in d0

all other registers will need saving / restoring if you use them
DanScott is offline  
Old 03 April 2017, 20:56   #24
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
Quote:
Originally Posted by meynaf View Post
Don't worry, this routine can not be fast

Knowing the intended use case would also help - mere palette fades don't need fast code and 68000 is too slow for alpha blending (which would be faster in 24-bit anyway) so i don't see any use.
But perhaps it's just for the sake of the coding compo ?
I thought it was a nice one for the compo... but it could certainly be useful to have a fast or short routine...
DanScott is offline  
Old 05 April 2017, 02:22   #25
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by meynaf View Post
Don't worry, this routine can not be fast

Knowing the intended use case would also help - mere palette fades don't need fast code and 68000 is too slow for alpha blending (which would be faster in 24-bit anyway) so i don't see any use.
But perhaps it's just for the sake of the coding compo ?
I would use the small version in my games if it is accurate.

I agree the fast version doesn't have an immediately obvious use case (but I guess there might be a good use).

For me, after I call the equivalent of this for each color, I wait for up to 100 scan lines to control the speed of the color fade.

Looking forward to seeing the results.
alpine9000 is offline  
Old 05 April 2017, 06:49   #26
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by DanScott View Post
it could certainly be useful to have a fast or short routine...
Then it would be better if d2 would range from 0 - 16 (or 0 - 17). That way you don't need divisions.
Thorham is online now  
Old 05 April 2017, 09:13   #27
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by alpine9000 View Post
I would use the small version in my games if it is accurate.
Unless someone has made something really unexpected, it will be accurate enough for a game. At least my version is. Fade in/out is very common in games and is always more or less the same thing.


Quote:
Originally Posted by alpine9000 View Post
For me, after I call the equivalent of this for each color, I wait for up to 100 scan lines to control the speed of the color fade.
You should be waiting a whole VBL even if your fade must be faster than that. Else you'll end up with display tearing due to parts of the screen having a different lightness (or you will needlessly alter your coplist).
It is also more OS friendly.


Quote:
Originally Posted by Thorham View Post
Then it would be better if d2 would range from 0 - 16 (or 0 - 17). That way you don't need divisions.
Assuredly.
There is such a routine in my last game port. It uses range 0-128 instead.
meynaf is online now  
Old 05 April 2017, 11:33   #28
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by meynaf View Post
You should be waiting a whole VBL even if your fade must be faster than that. Else you'll end up with display tearing due to parts of the screen having a different lightness (or you will needlessly alter your coplist).
It is also more OS friendly.
Yes, as soon as I posted that I wondered why I wasn't waiting for the vblank, and I think it was just because my first fade routine had too many steps so I just sped it up and never went back and fixed it.
alpine9000 is offline  
Old 05 April 2017, 21:43   #29
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by meynaf View Post
68000 is too slow for alpha blending
256kb table
Thorham is online now  
Old 06 April 2017, 02:33   #30
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,376
Deleted. Sorry for being OT ! No more questions.

Last edited by PeterK; 06 April 2017 at 17:18.
PeterK is offline  
Old 06 April 2017, 04:14   #31
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
Quote:
Originally Posted by PeterK View Post
Do you mean a 256 byte table?
No, I mean 256 kilobytes (68020, untested):
Code:
;
; in:
;
; d0.w = 0rgb
; d1.w = 0rgb
; d2.w = alpha (0 - 15)
;
; out:
;
; d0.w = 0rgb
; 
    lsl.w   #4,d0
    or.w    d2,d0
    lsl.w   #4,d1
    or.b    #15,d1
    sub.b   d2,d1
    move.l  (a0,d0.w*4),d0
    add.l   (a0,d1.w*4),d0
    lsr.l   #4,d0
    lsl.b   #4,d0
    lsl.w   #4,d0
    lsr.l   #8,d0
Not very practical, I know
Thorham is online now  
Old 06 April 2017, 09:41   #32
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by PeterK View Post
What?? Math precise Accuracy ??
I could only imagine integer calculations in this task. Simple Multiplies and Divisions with completely accurate integer results. No floating point required at all! Wrong?
No floating point required at all, but fixed point yes.
meynaf is online now  
Old 06 April 2017, 10:04   #33
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
Quote:
Originally Posted by PeterK View Post
I don't want to join this competition
Why? The reward is so good!

Quote:
but why do you need more than 15x15=225 or if you really want 16x16=256 bytes for a table? (maybe 512 bytes, if you want to avoid another substract or neg command)
I ended up just under 1KB table, but if I had more I would have used them.

Quote:
What?? Math precise Accuracy ??
I could only imagine integer calculations in this task. Simple Multiplies and Divisions with completely accurate integer results. No floating point required at all!
With enough fractional bit in fixed-point arithmetic You can have math-precise results (easy demonstrable).

Bye!
ross

Last edited by ross; 06 April 2017 at 11:21. Reason: no reference :)
ross is offline  
Old 06 April 2017, 11:22   #34
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
Please refrain from turning this thread into a rambling discussion and potentially going off topic....

Last edited by DanScott; 06 April 2017 at 12:20.
DanScott is offline  
Old 09 April 2017, 22:01   #35
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
Entries will close tomorrow morning (UK time) at around 9am... still time for that kick-ass fast or small routine.

Results will be posted during the week, after I've had time to check through them all.
DanScott is offline  
Old 17 April 2017, 18:21   #36
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
Still tied up with things post "Revision" (got 2nd Place in the Amiga demo comp with an OCS demo btw!!) 6 points behind the winner (a rather nice AGA production)

Will try and get the results of THIS competition tied up and posted here this week
DanScott is offline  
Old 18 April 2017, 15:27   #37
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,771
Correctly fading shall be done in linearized RGB color space (and all computer hardware also Amiga use non linear - gamma corrected RGB color space - first RGB need to have applied inverted gamma function fade then apply gamma correction).
https://en.wikipedia.org/wiki/Gamma_correction
pandy71 is offline  
Old 18 April 2017, 17:45   #38
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
Quote:
Originally Posted by pandy71 View Post
Correctly fading shall be done in linearized RGB color space (and all computer hardware also Amiga use non linear - gamma corrected RGB color space - first RGB need to have applied inverted gamma function fade then apply gamma correction).
Yes, and then make 100 cycle, 50 byte, 68k code! Sorry pandy71, I'm just joking

You are right, but in this competition we are subjected to severe constraints (small code, integer math, pure 68k, 12 bit RGB, calculated table..).
And in any case I think nobody would notices the difference by using a linear interpolation compared to a real RGB space fading on Amiga OCS.

Bye
ross
ross is offline  
Old 19 April 2017, 12:20   #39
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,771
Quote:
Originally Posted by ross View Post
Yes, and then make 100 cycle, 50 byte, 68k code! Sorry pandy71, I'm just joking

You are right, but in this competition we are subjected to severe constraints (small code, integer math, pure 68k, 12 bit RGB, calculated table..).
And in any case I think nobody would notices the difference by using a linear interpolation compared to a real RGB space fading on Amiga OCS.
Seem you allowed for LUT at least for larger code class. Visibility depends on viewer but some people can notice this (only 16 levels may emphasize this).
pandy71 is offline  
Old 19 April 2017, 12:54   #40
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
Quote:
Originally Posted by pandy71 View Post
Seem you allowed for LUT at least for larger code class. Visibility depends on viewer but some people can notice this (only 16 levels may emphasize this).
It will be visible as lag (irregular timing) because 16 levels aren't enough.
meynaf is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone up for an ASM coding competition? DanScott Coders. Asm / Hardware 526 22 September 2018 21:38
What gives you coding inspiration? pmc Coders. General 55 16 November 2009 21:45
Need help with audio coding. Thorham Coders. General 6 05 March 2008 08:38
Help coding alexh Coders. General 14 15 August 2006 09:24
Coding a Trainer redblade Coders. General 10 25 January 2005 21:52

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:25.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11361 seconds with 16 queries