1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-20 01:31:51 +00:00
8bitworkshop/presets/nes-conio/conio.c

55 lines
1.1 KiB
C
Raw Normal View History

2017-05-20 19:13:23 +00:00
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <joystick.h>
const char Text [] = "Hello world!";
2017-05-20 19:13:23 +00:00
int main (void)
{
unsigned char width, height;
2017-05-20 19:13:23 +00:00
/* Set screen colors */
(void) bgcolor (COLOR_BLUE);
2017-05-20 19:13:23 +00:00
/* Clear the screen, put cursor in upper left corner */
clrscr ();
/* Ask for the screen size */
screensize (&width, &height);
2017-05-20 19:13:23 +00:00
/* Draw a border around the screen */
/* Top line */
cputc (CH_ULCORNER);
chline (width - 2);
2017-05-20 19:13:23 +00:00
cputc (CH_URCORNER);
/* Vertical line, left side */
cvlinexy (0, 1, height - 2);
2017-05-20 19:13:23 +00:00
/* Bottom line */
cputc (CH_LLCORNER);
chline (width - 2);
2017-05-20 19:13:23 +00:00
cputc (CH_LRCORNER);
/* Vertical line, right side */
cvlinexy (width - 1, 1, height - 2);
2017-05-20 19:13:23 +00:00
/* Write the greeting in the mid of the screen */
gotoxy ((width - strlen (Text)) / 2, height / 2);
2017-05-20 19:13:23 +00:00
cprintf ("%s", Text);
/* Wait for the user to press a button */
joy_install (joy_static_stddrv);
while (!joy_read (JOY_1)) ;
joy_uninstall ();
/* Clear the screen again */
clrscr ();
/* Done */
return EXIT_SUCCESS;
}