English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 09 June 2013, 12:57   #1
Coagulus
Gets there in the end...

Coagulus's Avatar
 
Join Date: Sep 2005
Location: Wales
Posts: 607
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
Coagulus is offline  
AdSense AdSense  
Old 02 November 2013, 20:03   #2
Coagulus
Gets there in the end...

Coagulus's Avatar
 
Join Date: Sep 2005
Location: Wales
Posts: 607
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
Coagulus is offline  
Old 11 January 2015, 22:39   #3
Cylon
Banned

 
Join Date: Oct 2014
Location: Europe
Posts: 466
(dig out)

I hope you use Newtypes for this kind of stuff nowadays? It looks a little bit Amos-like to me....
Cylon is offline  
Old 13 January 2015, 01:02   #4
Coagulus
Gets there in the end...

Coagulus's Avatar
 
Join Date: Sep 2005
Location: Wales
Posts: 607
Haha, I have been known to use them. I'm afraid my code hasn't changed much since the zx spectrum!
Coagulus is offline  
Old 01 February 2015, 03:38   #5
Cylon
Banned

 
Join Date: Oct 2014
Location: Europe
Posts: 466
Quote:
Originally Posted by Coagulus View Post
Haha, I have been known to use them. I'm afraid my code hasn't changed much since the zx spectrum!
Well, you should consider upgrading your mind!

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
also,

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
And, while setting up the bars:
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
becomes
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
Isn't that nice?

Last edited by Cylon; 01 February 2015 at 06:46. Reason: more text, updates
Cylon is offline  
Old 01 February 2015, 04:32   #6
Cylon
Banned

 
Join Date: Oct 2014
Location: Europe
Posts: 466
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
Try it, please.
Next, we make it newtype style...maybe
Attached Thumbnails
Click image for larger version

Name:	coagulusagacops.png
Views:	201
Size:	8.4 KB
ID:	43087  
Attached Files
File Type: lha CoagulusAGAcops.lha (9.9 KB, 68 views)

Last edited by Cylon; 01 February 2015 at 05:34. Reason: adds, screenshot+exe
Cylon is offline  
Old 01 February 2015, 18:13   #7
Coagulus
Gets there in the end...

Coagulus's Avatar
 
Join Date: Sep 2005
Location: Wales
Posts: 607
That's cool, far more efficient!
Coagulus is offline  
Old 22 January 2016, 16:38   #8
nirvan75
Registered User

nirvan75's Avatar
 
Join Date: Dec 2015
Location: italy
Posts: 13
Hello guys,

what about an OCS/ECS version of the above example?
nirvan75 is offline  
Old 24 January 2016, 23:47   #9
Cylon
Banned

 
Join Date: Oct 2014
Location: Europe
Posts: 466
Quote:
Originally Posted by nirvan75 View Post
Hello guys,

what about an OCS/ECS version of the above example?
That is easy to adapt, why didn't you try it for yourself?

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
Note: if you don't have the CheckAGA command than make it a variable like:
Code:
CheckAGA=1
Attached Files
File Type: lha CoagulusCopBars.lha (10.5 KB, 35 views)
Cylon is offline  
Old 25 January 2016, 16:53   #10
nirvan75
Registered User

nirvan75's Avatar
 
Join Date: Dec 2015
Location: italy
Posts: 13
so noobs like me can learn from the masters :P
thanks!
nirvan75 is offline  
AdSense AdSense  
 


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 21:54
Indivision AGA all Display modes test and problems doble07 support.Hardware 9 03 December 2009 09:56
Silly OCS/ECS/AGA display question Fingerlickin_B support.Hardware 6 11 September 2008 12:35
Question about AGA display data fetches FrenchShark Coders. General 7 30 December 2007 17:40
AGA display Dela support.WinUAE 4 06 October 2002 22:59

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 06:29.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.14867 seconds with 13 queries