2000-05-28 13:40:48 +00:00
|
|
|
/*
|
2014-06-30 09:10:35 +00:00
|
|
|
** Fancy hello world program using cc65.
|
|
|
|
**
|
|
|
|
** Ullrich von Bassewitz (ullrich@von-bassewitz.de)
|
|
|
|
**
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <conio.h>
|
|
|
|
#include <dbg.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Data */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const char Text [] = "Hello world!";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Code */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main (void)
|
|
|
|
{
|
|
|
|
unsigned char XSize, YSize;
|
|
|
|
|
|
|
|
/* Set screen colors, hide the cursor */
|
|
|
|
textcolor (COLOR_WHITE);
|
|
|
|
bordercolor (COLOR_BLACK);
|
|
|
|
bgcolor (COLOR_BLACK);
|
|
|
|
cursor (0);
|
|
|
|
|
|
|
|
/* Clear the screen, put cursor in upper left corner */
|
|
|
|
clrscr ();
|
|
|
|
|
|
|
|
/* Ask for the screen size */
|
|
|
|
screensize (&XSize, &YSize);
|
|
|
|
|
|
|
|
/* Draw a border around the screen */
|
|
|
|
|
|
|
|
/* Top line */
|
|
|
|
cputc (CH_ULCORNER);
|
|
|
|
chline (XSize - 2);
|
|
|
|
cputc (CH_URCORNER);
|
|
|
|
|
|
|
|
/* Vertical line, left side */
|
|
|
|
cvlinexy (0, 1, YSize - 2);
|
|
|
|
|
|
|
|
/* Bottom line */
|
|
|
|
cputc (CH_LLCORNER);
|
|
|
|
chline (XSize - 2);
|
|
|
|
cputc (CH_LRCORNER);
|
|
|
|
|
|
|
|
/* Vertical line, right side */
|
|
|
|
cvlinexy (XSize - 1, 1, YSize - 2);
|
|
|
|
|
|
|
|
/* Write the greeting in the mid of the screen */
|
|
|
|
gotoxy ((XSize - strlen (Text)) / 2, YSize / 2);
|
|
|
|
cprintf ("%s", Text);
|
|
|
|
|
|
|
|
/* Wait for the user to press a key */
|
|
|
|
(void) cgetc ();
|
|
|
|
|
|
|
|
/* Clear the screen again */
|
|
|
|
clrscr ();
|
|
|
|
|
|
|
|
/* Done */
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|