Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
my first palette and asm program :P
#1
sry, felt like sharing... maybesome someone might find it even useful Tongue
Code:
option explicit
   option static
   declare sub asmtest( )
   defint a-z
   asmtest
   end

'******************************************************************************'
sub asmtest ( )

   dim pal(255) as integer, k as integer ptr
   dim i, t, counter
   dim ts#, te#
   dim c!
  
   screenres 640, 480, 8
   setmouse , , 0
   k = @pal(255)
  
   'set up palette
   pal(0) = rgb(63,63,63)
   for i = 1 to 64
      t = iif(i<=32, t+1, t-1)
      pal(i)       = rgb(t-1, 0,   0)
      pal(64  + i) = rgb(0,   t-1, 0)
      pal(128 + i) = rgb(0,   0,   t-1)
      pal(192 + i) = rgb(t-1, t-1, t-1)
   next i
  
   'Set up image
   c! = 1
   for i = 0 to 400
      c! +=  (255! / 402!)
      circle (320, 240), i, c!
      circle (320, 241), i, c!
   next
  
   ts# = timer
   do

      'rotate palette
      asm
        
         mov ecx, 253
         mov edi, dword ptr [k]
        
         rotpal:
            mov eax, dword ptr [edi-4]
            mov dword ptr [edi], eax
            sub edi, 4
         dec ecx
         jnz rotpal
        
         mov esi, dword ptr [k]
         mov eax, dword ptr [esi]
         mov dword ptr [edi], eax
        
      end asm

      'FPS counter
      counter += 1
      sleep 15
      palette using pal
      
   loop until len( inkey$ )
   te# = timer
  
   color 0, 1
   print "FPS: "; counter / (te# - ts#)
   sleep
  
end sub
url]http://fbide.sourceforge.net/[/url]
Reply
#2
That's cool!
.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
Reply
#3
To VonGodric:

Man, that is a truly and *uniquely* good way of rotating your palette in a custom group of colors and using ASM features on that as well to make it all work in FB. Very nicely done! Big Grin=b

Catch you again, and you keep it up now!! :king:



[Image: file.php?id=32]
- Adigun Azikiwe Polack
One of the Founders of “Aura Flow” ::: Continuing Developer of “Frantic Journey”
Current Developer of “Star Angelic Slugger” ::: Webmaster of the “AAP Official Projects Squad”
Original Creator of the “The New FreeBASIC 8-Bit Palette Machine”



P.S. By the way, VonGodric, my wonderful congrats to you on your 20th birthday today!!! ;*) !
url=http://dhost.hopto.org/aapproj/][Image: file.php?id=194][/url]
Your *official* home of the FreeBasic GFX Demo Central, now holding over 150 FB graphics demos so far!!! Big Grin !
Reply
#4
tnx Adigun!
url]http://fbide.sourceforge.net/[/url]
Reply
#5
Cool!!!
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)