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>
|
2015-07-20 05:46:18 +00:00
|
|
|
#include <joystick.h>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
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;
|
|
|
|
|
2016-06-12 20:56:26 +00:00
|
|
|
/* Set screen colors */
|
|
|
|
(void) textcolor (COLOR_WHITE);
|
|
|
|
(void) bordercolor (COLOR_BLACK);
|
|
|
|
(void) bgcolor (COLOR_BLACK);
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2015-11-30 18:48:10 +00:00
|
|
|
#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__)
|
2015-07-20 05:46:18 +00:00
|
|
|
|
|
|
|
/* Wait for the user to press a button */
|
|
|
|
joy_install (joy_static_stddrv);
|
|
|
|
while (!joy_read (JOY_1)) ;
|
|
|
|
joy_uninstall ();
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Wait for the user to press a key */
|
2016-06-18 21:39:21 +00:00
|
|
|
cgetc ();
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2015-07-20 05:46:18 +00:00
|
|
|
#endif
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Clear the screen again */
|
|
|
|
clrscr ();
|
|
|
|
|
|
|
|
/* Done */
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|