1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-18 00:07:21 +00:00
cc65/samples/lynx/hello.c
Greg King 9f2d27d9c1 Added Atari Lynx versions of three sample programs.
The Lynx target can't build the usual versions because its library doesn't have conio output and stdio.
2022-03-19 01:21:52 -04:00

44 lines
1.2 KiB
C

/* Atari Lynx version of samples/hello.c, using TGI instead of conio */
#include <tgi.h>
/*****************************************************************************/
/* Data */
/*****************************************************************************/
static const char Text[] = "Hello world!";
/*****************************************************************************/
/* Code */
/*****************************************************************************/
void main (void)
{
unsigned int XMax, YMax;
tgi_install (tgi_static_stddrv);
tgi_init ();
/* Set screen color. */
tgi_setcolor (TGI_COLOR_WHITE);
/* Clear the screen. */
tgi_clear();
/* Ask for the screen size. */
XMax = tgi_getmaxx ();
YMax = tgi_getmaxy ();
/* Draw a frame around the screen. */
tgi_line (0, 0, XMax, 0);
tgi_lineto (XMax, YMax);
tgi_lineto (0, YMax);
tgi_lineto (0, 0);
/* Write the greeting in the middle of the screen. */
tgi_outtextxy ((tgi_getxres () - tgi_gettextwidth (Text)) / 2,
(tgi_getyres () - tgi_gettextheight (Text)) / 2, Text);
}