home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / ace_basic / ace / prgs / mc / ledfade.b < prev    next >
Text File  |  1977-12-31  |  995b  |  49 lines

  1. '...Calling a machine code subroutine from ACE with ALLOC.
  2.  
  3. '...Thanks goes to Juergen Weinelt for the fade algorithm.
  4.  
  5. declare function Delay library dos
  6.  
  7. const bytes=50&
  8. const ANY=6
  9.  
  10. power& = ALLOC(bytes,ANY)
  11.  
  12. '...store machine code
  13. for i&=0 to 39
  14.  read a%
  15.  poke power&+i&,a% 
  16. next
  17.  
  18. data &H2f,0,&H20,&H2f,0,8,&Hb0,&H3c,0,1,&H67,0,0,&He,0,&H39,0,2,0,&Hbf
  19. data &He0,1,&H60,0,0,&Ha,2,&H39,0,&Hfd,0,&Hbf,&He0,1,&H20,&H1f,&H4e,&H75,0,0
  20.  
  21. '..cause the power LED to fade out and back in
  22. '..until the left mouse button is pressed.
  23. repeat
  24.   '..fade out.
  25.   counter%=0
  26.   repeat
  27.     call power&(0&)
  28.     for a%=0 to 255
  29.       if a%=counter% then call power&(1&)
  30.     next
  31.     ++counter%
  32.     finished&=mouse(0)
  33.   until counter%=256 or finished&
  34.  
  35.   '..fade in.
  36.   counter%=255
  37.   repeat
  38.     call power&(0&)
  39.     for a%=0 to 255
  40.       if a%=counter% then call power&(1&)
  41.     next
  42.     --counter%
  43.     finished&=mouse(0)
  44.   until counter%=-1 or finished&
  45. until finished&
  46.  
  47. '..make sure LED is left ON.
  48. call power&(1&)
  49.