09 June 2013, 11:57 | #1 |
Gets there in the end...
Join Date: Sep 2005
Location: Wales
Posts: 862
|
How to do AGA copperbars in Blitz using display library
Hi,
I know it's very old hat but I'm retro through and through . Anyone know if it's possible to do the classic bouncing AGA copper bars in Blitz using the display library? Coagulus |
02 November 2013, 19:03 | #2 |
Gets there in the end...
Join Date: Sep 2005
Location: Wales
Posts: 862
|
Well, I decided to play with the Displayrainbow command and bars can be done. The code is not the best I'm sure, but it produces AGA bars!
Code:
; AGA copperbars by Coagulus InitPalette 0,256 BitMap 0,320,256,8 For a=0 To 255 AGAPalRGB 0,a,0,0,0 Next Dim bar(32) Dim bary(3) ; 1-red 2-green 3-blue Dim baryt(3) Dim barydir(3) For a=1 To 16 bar(a-1)=(a*16)-1 Next For a=16 To 1 Step -1 bar(15+(17-a))=(a*16)-1 Next baryt(0)=-3 baryt(2)=3 barydir(0)=1 barydir(1)=1 barydir(2)=1 VWait 150 BLITZ SpriteMode 2 InitCopList 0,34,256,$10000|$08|$10|$400,8,256,-4 CreateDisplay 0 DisplayPalette 0,0 Cls 0 Repeat DisplayBitMap 0,0 DisplayRainbow 0,0,0 For a=0 To 255 AGAPalRGB 0,a,0,0,0 ; blank the palette Next For a=0 To 2 bary(a)=bary(a)+baryt(a) baryt(a)=baryt(a)+barydir(a) If Abs(baryt(a))=13 Then barydir(a)=0-barydir(a) Next For a=0 To 31 AGAPalRGB 0,32+a+bary(0),bar(a),0,0 Next For a=0 To 31 AGAPalRGB 0,32+a+bary(1),0,bar(a),0 Next For a=0 To 31 AGAPalRGB 0,32+a+bary(2),0,0,bar(a) Next VWait Until Joyb(0) OR Joyb(1) End |
11 January 2015, 21:39 | #3 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 470
|
(dig out)
I hope you use Newtypes for this kind of stuff nowadays? It looks a little bit Amos-like to me.... |
13 January 2015, 00:02 | #4 |
Gets there in the end...
Join Date: Sep 2005
Location: Wales
Posts: 862
|
Haha, I have been known to use them. I'm afraid my code hasn't changed much since the zx spectrum!
|
01 February 2015, 02:38 | #5 | |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 470
|
Quote:
Adding only 4 bytes to your src makes a big speedup: Code:
For a=0 To 31 AGAPalRGB 0,32+a+bary(0),bar(a),0,0 ;Next ;For a=0 To 31 AGAPalRGB 0,32+a+bary(1),0,bar(a),0 ;Next ;For a=0 To 31 AGAPalRGB 0,32+a+bary(2),0,0,bar(a) Next Code:
DisplayBitMap 0,0 Repeat ;DisplayBitMap 0,0 DisplayRainbow 0,0,0 ;For a=0 To 255 ; AGAPalRGB 0,a,0,0,0 ; blank the palette ;Next InitPalette 0,256 ;< this is an ASM routine inside the blitzlib! trust me: it is faster! For a=0 To 2 bary(a)=bary(a)+baryt(a) baryt(a)=baryt(a)+barydir(a) If Abs(baryt(a))=13 Then barydir(a)=0-barydir(a) Next this Code:
For a=1 To 16 bar(a-1)=(a*16)-1 Next For a=16 To 1 Step -1 bar(15+(17-a))=(a*16)-1 Next Code:
;we try to create bars of 32pixl height: ;the saturation value should spread from 0to255 (AGA), ;the bar appears to be 3d-like. For a=0 To 15 bar(a) = (a*16) ;we donot reach 255 here... bar(a+15)= ((16-a)*16) Next Last edited by Cylon; 01 February 2015 at 05:46. Reason: more text, updates |
|
01 February 2015, 03:32 | #6 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 470
|
AGA Copper Bars by Coagulus
So, my edits would lead to this:
Code:
; AGA copperbars by Coagulus (EAB) ; modified by Cylon (EAB) DEFTYPE.w InitPalette 0,256 BitMap 0,320,256,1 ;just 1 bplane needed! saves chipmem! Dim bar(32) ;saturation value (0-255) of bar y line Dim bary(3) ; 1-red 2-green 3-blue Dim baryt(3) Dim barydir(3) ;we create bars of 32pixl height: For a=0 To 15 bar(a) = (a*16) bar(a+15)= ((16-a)*16) Next baryt(0)=-3 baryt(2)=3 barydir(0)=1 barydir(1)=1 barydir(2)=1 VWait 100 ;two seconds is enough before takin' the machine over BLITZ ;SpriteMode 2 ;not needed. ;1bitplane 24bit(256,256,256) aga coplist ;again: we use the copper only, so 1 bplane is enough. InitCopList 0,34,256,$10000|$01|$10|$400,8,1,-4 CreateDisplay 0 DisplayPalette 0,0 DisplayBitMap 0,0 Repeat VWait DisplayRainbow 0,0,0 InitPalette0,256 For a=0 To 2 bary(a) +baryt(a) baryt(a)+barydir(a) If Abs(baryt(a)) = 13 Then barydir(a)=0-barydir(a) Next For a=0 To 31 AGAPalRGB 0,32+a+bary(0),bar(a),0,0 AGAPalRGB 0,32+a+bary(1),0,bar(a),0 AGAPalRGB 0,32+a+bary(2),0,0,bar(a) Next Until Joyb(0) OR Joyb(1) End CloseEd Next, we make it newtype style...maybe Last edited by Cylon; 01 February 2015 at 04:34. Reason: adds, screenshot+exe |
01 February 2015, 17:13 | #7 |
Gets there in the end...
Join Date: Sep 2005
Location: Wales
Posts: 862
|
That's cool, far more efficient!
|
22 January 2016, 15:38 | #8 |
Registered User
Join Date: Dec 2015
Location: italy
Posts: 13
|
Hello guys,
what about an OCS/ECS version of the above example? |
24 January 2016, 22:47 | #9 | |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 470
|
Quote:
Code:
; AGA copperbars by Coagulus (EAB) ; modified by Cylon (EAB) ; chg: added ecs support ( quick and dirty :P ) DEFTYPE.w InitPalette 0,256 BitMap 0,320,256,1 ;just 1 bplane needed! saves chipmem! Dim bar(32) ;saturation value (0-255) of bar y line Dim bary(3) ; 1-red 2-green 3-blue Dim baryt(3) Dim barydir(3) ;we create bars of 32pixl height: If CheckAGA Then fact.w=16 Else fact.w=1 For a=0 To 15 bar(a) = (a*fact) bar(a+15)= ((16-a)*fact) Next baryt(0)=-3 baryt(2)=3 barydir(0)=1 barydir(1)=1 barydir(2)=1 VWait 100 ;two seconds is enough before takin' the machine over BLITZ ;SpriteMode 2 ;not needed. ;1bitplane 24bit(256,256,256) aga coplist ;again: we use the copper only, so 1 bplane is enough. InitCopList 0,34,256,$10000|$01|$10|$400,8,1,-4 CreateDisplay 0 DisplayPalette 0,0 DisplayBitMap 0,0 Repeat VWait DisplayRainbow 0,0,0 InitPalette0,256 ;256 cols eq 256 lines vertical For a=0 To 2 bary(a) +baryt(a) baryt(a)+barydir(a) If QAbs(baryt(a)) = 13 Then barydir(a)=0-barydir(a) Next If CheckAGA For a=0 To 31 AGAPalRGB 0,32+a+bary(0),bar(a),0,0 AGAPalRGB 0,32+a+bary(1),0,bar(a),0 AGAPalRGB 0,32+a+bary(2),0,0,bar(a) Next Else For a=0 To 31 PalRGB 0,32+a+bary(0),bar(a),0,0 PalRGB 0,32+a+bary(1),0,bar(a),0 PalRGB 0,32+a+bary(2),0,0,bar(a) Next EndIf Until Joyb(0) OR Joyb(1) QAMIGA VWait50 End CloseEd ;eof Code:
CheckAGA=1 |
|
25 January 2016, 15:53 | #10 |
Registered User
Join Date: Dec 2015
Location: italy
Posts: 13
|
so noobs like me can learn from the masters :P
thanks! |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Issue with Indivision AGA 1200 on NTSC system (no display) | zombie10k | support.Hardware | 2 | 25 March 2010 20:54 |
Indivision AGA all Display modes test and problems | doble07 | support.Hardware | 9 | 03 December 2009 08:56 |
Silly OCS/ECS/AGA display question | Fingerlickin_B | support.Hardware | 6 | 11 September 2008 11:35 |
Question about AGA display data fetches | FrenchShark | Coders. General | 7 | 30 December 2007 16:40 |
AGA display | Dela | support.WinUAE | 4 | 06 October 2002 21:59 |
|
|