]> git.sur5r.net Git - cc65/blobdiff - samples/hello.c
Fixed LinuxDoc Tools issues in some verbatim blocks in the Atari document.
[cc65] / samples / hello.c
index cdbfab73a452dbf1989191e319885e322fcd0057..dd15128d2b4410efdf30ba68ea0d3f1aac1a851c 100644 (file)
@@ -1,21 +1,21 @@
 /*
- * Fancy hello world program using cc65.
- *
- * Ullrich von Bassewitz (ullrich@von-bassewitz.de)
- *
- */
+** Fancy hello world program using cc65.
+**
+** Ullrich von Bassewitz (ullrich@von-bassewitz.de)
+**
+*/
 
 
 
 #include <stdlib.h>
 #include <string.h>
 #include <conio.h>
-#include <dbg.h>
+#include <joystick.h>
 
 
 
 /*****************************************************************************/
-/*                                          Data                                    */
+/*                                   Data                                    */
 /*****************************************************************************/
 
 
@@ -25,7 +25,7 @@ static const char Text [] = "Hello world!";
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
@@ -34,11 +34,10 @@ int main (void)
 {
     unsigned char XSize, YSize;
 
-    /* Set screen colors, hide the cursor */
-    textcolor (COLOR_WHITE);
-    bordercolor (COLOR_BLACK);
-    bgcolor (COLOR_BLACK);
-    cursor (0);
+    /* Set screen colors */
+    (void) textcolor (COLOR_WHITE);
+    (void) bordercolor (COLOR_BLACK);
+    (void) bgcolor (COLOR_BLACK);
 
     /* Clear the screen, put cursor in upper left corner */
     clrscr ();
@@ -68,8 +67,19 @@ int main (void)
     gotoxy ((XSize - strlen (Text)) / 2, YSize / 2);
     cprintf ("%s", Text);
 
+#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__)
+
+    /* Wait for the user to press a button */
+    joy_install (joy_static_stddrv);
+    while (!joy_read (JOY_1)) ;
+    joy_uninstall ();
+
+#else
+
     /* Wait for the user to press a key */
-    (void) cgetc ();
+    cgetc ();
+
+#endif
 
     /* Clear the screen again */
     clrscr ();
@@ -77,6 +87,3 @@ int main (void)
     /* Done */
     return EXIT_SUCCESS;
 }
-
-
-