View Single Post
Old 01 February 2015, 02:38   #5
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 470
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 05:46. Reason: more text, updates
Cylon is offline  
 
Page generated in 0.08871 seconds with 11 queries