home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_22_1988_Transactor_Publishing.d64 / doodle.c < prev    next >
Text File  |  2023-02-26  |  2KB  |  81 lines

  1. Char PlotType;
  2.  
  3. main ()
  4. {SHIFT-+}
  5.    char *Pointer, Key, Store1, Store2, Store3;
  6.    unsigned int Loop, X, Y;
  7.  
  8.    highmem (0xCC00);
  9.  
  10.    Pointer = 0xDD00;
  11.    *Pointer = (Store1 = *Pointer) & 252;
  12.    Pointer = 0xD011;                    /* Turn on Graphics */
  13.    *Pointer = (Store2 = *Pointer) {CBM-*} 32;
  14.    Pointer = 0xD018;
  15.    Store3 = *Pointer;
  16.    *Pointer = 0x38;
  17.  
  18.    Pointer = 0x028a;                    /* Turn on key repeat */
  19.    *Pointer = 128;
  20.    FastKeys ();
  21.  
  22.    Clear (0xCC00, 1000, 93);            /* Clear color screen */
  23.    Clear (0xE000, 8000, 0);             /* Clear bitmap */
  24.    PlotType = 1;
  25.    X = 160;
  26.    Y = 100;
  27.    Plot (X,Y);
  28.    while ((Key = waitkey()) != 3)
  29.    {SHIFT-+}
  30.       switch (Key)
  31.       {SHIFT-+}
  32.          case 'i':
  33.          case 'I': Plot (X,--Y);        /* Allow user to draw lines  */
  34.                    break;               /* by using the I, J, K, M   */
  35.          case 'm':                      /* diamond.  -, +, and / set */
  36.          case 'M': Plot (X,++Y);        /* clear, set, or flip mode  */
  37.                    break;               /* respectively.  STOP exits */
  38.          case 'j':
  39.          case 'J': Plot (--X,Y);
  40.                    break;
  41.          case 'k':
  42.          case 'K': Plot (++X,Y);
  43.                    break;
  44.          case '-': PlotType = 0;
  45.                    Plot (X, Y);
  46.                    break;
  47.          case '+': PlotType = 1;
  48.                    Plot (X, Y);
  49.                    break;
  50.          case '/': PlotType = 2;
  51.                    Plot (X, Y);
  52.       {SHIFT--}
  53.    {SHIFT--}
  54.  
  55.    SlowKeys ();
  56.  
  57.    Pointer = 0xDD00;
  58.    *Pointer = Store1;
  59.    Pointer = 0xD011;                    /* Restore Text mode */
  60.    *Pointer = Store2;
  61.    Pointer = 0xD018;
  62.    *Pointer = Store3;
  63. {SHIFT--}
  64.  
  65.  
  66. #define GETIN  0xFFE4
  67.  
  68. char a, x, y,
  69.      *numkeys = 198;
  70.  
  71. /* Waits for user to press a key */
  72.  
  73. int waitkey ()
  74.  
  75. {SHIFT-+}
  76.    while (*numkeys == 0)
  77.       ;
  78.    sys (GETIN, &a, &x, &y);
  79.    return a;
  80. {SHIFT--}
  81.