home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s082 / 1.img / DEMO.P98 < prev    next >
Encoding:
Text File  |  1992-04-20  |  2.3 KB  |  62 lines

  1. $pagelength(5000)
  2. start: do;
  3. declare hhhh byte;
  4. $include(8096.plm)
  5. tttt0: procedure interrupt 2; declare d byte; d=0; return; end tttt0;
  6. key00: procedure; call time(10); end key00;
  7. key01: procedure; call time(20); end key01;
  8. key02: procedure; call time(30); end key02;
  9. key03: procedure; call time(40); end key03;   
  10. key$p: procedure (pa1) byte;
  11.        declare pa1 byte; 
  12.        declare (p8279d,p8279c) byte at(0e000h);
  13.        p8279c=(pa1 and 07h) or 40h;
  14.        do case (p8279d and 03h);
  15.           call key00;
  16.           call key01;
  17.           call key02;
  18.           call key03;    
  19.        end;
  20.        return p8279d;
  21. end key$p;
  22. proc2: procedure (pb1,pb2);    /* if then do;  else do;  */
  23.        declare (pb1,pb2) byte;
  24.        if ((((pb1+pb2) and 03h)=03h) or (((pb1-pb2) and 07h)=07h))
  25.           then do;   pb1=pb2;  end;
  26.        else    do;   pb2=pb1;  end;
  27.        pb2=(pb2+4)*(pb1+4);
  28. end proc2;
  29. proc3: procedure (pc1,pc2) word;
  30.        declare (pc1,pc2) word, i byte;
  31.        do i=1 to 10;
  32.           pc1=pc1+2;
  33.        end;
  34.        do while pc2=0;
  35.           pc1=pc1+1; pc2=pc2-1;
  36.        end;
  37.        return pc1;
  38. end proc3;
  39. mainp: do;
  40.     declare (a,b,start$a$d) byte; 
  41.     declare (c,d,samp$v) word, v(4) word;
  42.     declare (K,PK,TI,TD,pr) dword;  declare (e,f,j) longint;
  43.     declare (g,h,l) integer, (aa,bb,cc) dword;
  44.     declare m$array(6) real, (dd,ee,ff) real;
  45.     declare adr1 address;
  46.     call init$real$math$unit;  call set$real$mode(033eh);
  47.     K=164; PK=5; TI=235; TD=22; 
  48.     v(1)=0; v(2)=0; v(3)=0;
  49.   do while 1=1;  watchdog=1eh; watchdog=0e1h;
  50.     a=123;      b=456;   c=12345;     d=(c+b)/a;   /* byte and word  */
  51.     g=-3;       h=5;       l=g*h;     h=l/g;       /*    integer     */
  52.     e=4;     f=2222222h;   j=f*e;     f=j/2;       /* long (32 bit)  */
  53.     dd=2.1101e+12;    ee=2.0e+4;      ff=dd*ee;    /* real multiply  */
  54.     dd=4.2468e+12;    ee=2.0e+6;      ff=dd/ee;    /* real devide    */
  55.     a=key$p(b);    call proc2(a,b);  c=proc3(c,d); /* procedure      */
  56.     start$a$d=05;  v(0)=double(samp$v);            /* sample         */
  57.     pr=K*((v(0)-v(1))+TI*v(0)+TD*(v(0)+v(2)-2*v(1))); /*    P I D    */   
  58.     do a=1 to 3;   b=0;   v(a)=v(a-1);   end;      /*    loop        */
  59.     c=proc3(c,d);  aa=123456789;  bb=4;  cc=aa/bb; /* dword (32 bit) */
  60.   end;
  61. end mainp;
  62. end start;