home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cc65v261.zip / cc65.zip / samples / hello.c < prev    next >
C/C++ Source or Header  |  2000-12-18  |  2KB  |  83 lines

  1. /*
  2.  * Fancy hello world program using cc65.
  3.  *
  4.  * Ullrich von Bassewitz (ullrich@von-bassewitz.de)
  5.  *
  6.  */
  7.  
  8.  
  9.  
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <conio.h>
  13. #include <dbg.h>
  14.  
  15.  
  16.  
  17. /*****************************************************************************/
  18. /*                                      Data                          */
  19. /*****************************************************************************/
  20.  
  21.  
  22.  
  23. static const char Text [] = "Hello world!";
  24.  
  25.  
  26.  
  27. /*****************************************************************************/
  28. /*                                      Code                          */
  29. /*****************************************************************************/
  30.  
  31.  
  32.  
  33. int main (void)
  34. {
  35.     unsigned char XSize, YSize;
  36.  
  37.     /* Set screen colors, hide the cursor */
  38.     textcolor (COLOR_WHITE);
  39.     bordercolor (COLOR_BLACK);
  40.     bgcolor (COLOR_BLACK);
  41.     cursor (0);
  42.  
  43.     /* Clear the screen, put cursor in upper left corner */
  44.     clrscr ();
  45.  
  46.     /* Ask for the screen size */
  47.     screensize (&XSize, &YSize);
  48.  
  49.     /* Draw a border around the screen */
  50.  
  51.     /* Top line */
  52.     cputc (CH_ULCORNER);
  53.     chline (XSize - 2);
  54.     cputc (CH_URCORNER);
  55.  
  56.     /* Vertical line, left side */
  57.     cvlinexy (0, 1, YSize - 2);
  58.  
  59.     /* Bottom line */
  60.     cputc (CH_LLCORNER);
  61.     chline (XSize - 2);
  62.     cputc (CH_LRCORNER);
  63.  
  64.     /* Vertical line, right side */
  65.     cvlinexy (XSize - 1, 1, YSize - 2);
  66.  
  67.     /* Write the greeting in the mid of the screen */
  68.     gotoxy ((XSize - strlen (Text)) / 2, YSize / 2);
  69.     cprintf ("%s", Text);
  70.  
  71.     /* Wait for the user to press a key */
  72.     (void) cgetc ();
  73.  
  74.     /* Clear the screen again */
  75.     clrscr ();
  76.  
  77.     /* Done */
  78.     return EXIT_SUCCESS;
  79. }
  80.  
  81.  
  82.  
  83.