view final_isi/time.c @ 71:a87eb778f225

Improvements to the MinGW crossbuild. Should now build with default tools from Debian mingw packages, though you need Win32 version of libSDL with the necessary headers and so on in addition. 64-bit builds not tested and probably won't work. Tested on Debian 7.0, earlier won't work. binutils-mingw-w64-i686 gcc-mingw-w64-i686 mingw-w64-i686-dev
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 14 Aug 2012 03:08:10 +0300
parents c13a2f8c5b10
children 96dd9b4e3fe7
line wrap: on
line source

#include "musa.h"

#define NUMCH 3

char cord=0,cpat=0,crow=0,drmt=0xff,drms=0;

char auditype;

int plrbeep[2];
int musatempo=5;

int freku[12] = {
		0x157,0x16b,0x181,0x198,0x1b0,0x1ca,
		 0x1e5,0x202,0x220,0x241,0x263,0x287
		 };
char plst=0;

/*char ison[3]={1,1,1};*/
char hvilk[3]={0xfe,0xfe,0xfe};

int lizayz=0;


void playtick()
{
      plst++;

      if (plst==musatempo) {
         int l;
         unsigned char mark,mkrl;

         for(l=0;l<NUMCH;l++) {

               mkrl=mark=trax[cpat][l][crow];

               if(mark<0xf0)mkrl=mark+=lizayz;

               if (auditype==2) plrbeep[l]=mark;

               if(mark==0xfa){musatempo=8;lizayz=-16;}

               if (mark==0xfb)if(auditype==2){
                     if(crow&1)mark=0xfe;else
                               mark=hvilk[l];
                               plrbeep[l]=mark;
                               }

               if (mark==0xfe)
                   gbsound(l,0);

               if (mark==0xfd) musatempo=16;
               if (mark==0xfc) musatempo=4;

               if (mark<0xf0) {

                   if(mark==mkrl)hvilk[l]=mark;
                   if((mark&15)>=12)mark+=4;

                 gbsound(l,(mark&15)+((mark>>4)*12));

         }       }

        crow++;   if (crow==64) {
                   crow=0;cord++;
                   cpat=patord[cord];
                   if (cpat==99) { cord=0; cpat=patord[cord]; }}
       plst=0;
      }
}