home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / a / armbob / !ArmBob / progs / Lines < prev    next >
Text File  |  1994-02-26  |  892b  |  66 lines

  1. /* Lines */
  2. /* Jerkiness comes from use of C buffers */
  3. main()
  4. {
  5.  local t;
  6.  out = fopen("rawvdu:","w");
  7.  mode(28);   // 256 colours needed
  8.  cursor(0);
  9.  for(t=rnd()%24;t<32;t++)
  10.   do_lines(t);
  11.  fclose(out);
  12.  cursor(1);
  13. }
  14.  
  15. do_lines(t)
  16. {
  17.  local x,y;
  18.  for(x=0;x<1280;x+=4)
  19.  {
  20.   gcol(3,(t*(x>>2))%64);
  21.   line(x,0,1280-x,1024);
  22.   line(1280-x,0,x,1024);
  23.  }
  24.  for(y=1024;y>=0;y-=4)
  25.  {
  26.   gcol(3,(t*(y>>2))%64);
  27.   line(0,y,1280,1024-y);
  28.   line(0,1024-y,1280,y);
  29.  }
  30.  for(y=0;y<1024;y+=4)
  31.  {
  32.   gcol(3,(t+1)%64);
  33.   line((5*y)/4,y,1280-(5*y)/4,y);
  34.   line((5*y)/4,1024-y,1280-(5*y)/4,1024-y);
  35.  }
  36. }
  37.  
  38. vdu(s)
  39. {
  40.  local i;
  41.  for(i=0;i<sizeof(s);putc(s[i++],out));
  42. }
  43.  
  44. mode(n)
  45. { vdu(""+22+n); }
  46.  
  47. gcol(k,n)
  48. { vdu(""+18+k+n); }
  49.  
  50. plot(k,x,y)
  51. { vdu(""+25+k+(x%256)+(x/256)+(y%256)+(y/256)); }
  52.  
  53. move(x,y)
  54. { plot(4,x,y); }
  55.  
  56. line(x1,y1,x2,y2)
  57. {
  58.  move(x1,y1);
  59.  plot(5,x2,y2);
  60. }
  61.  
  62. cursor(n)
  63. {
  64.  vdu(""+23+1+(n%256)+(n/256));
  65. }
  66.