]> git.sur5r.net Git - cc65/blobdiff - samples/ascii.c
atari5200: update docs for recent conio changes
[cc65] / samples / ascii.c
index 190025e9d265eb91ce3abb73e7809f49b3767642..0d191c966c5b515d2ff46da376185704640c11c4 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 
-#define QUIT   'Q'
+#define QUIT    'Q'
 
 /* r -- row.  t -- table-column.
 */
@@ -28,63 +28,63 @@ static int c;
 
 #ifndef USE_STDIO
 
-# define PRINT cprintf
-# define PUT(c)        cputc((char)(c))
+# define PRINT  cprintf
+# define PUT(c) cputc((char)(c))
 
 /* conio doesn't echo typed characters.
 ** So, this function does it.
 */
 static int GET(void) {
-       PUT(c = (int)cgetc());
-       return c;
-       }
+        PUT(c = (int)cgetc());
+        return c;
+        }
 
 #else
 
-# define PRINT printf
-# define GET   getchar
+# define PRINT  printf
+# define GET    getchar
 
 #endif
 
 int main(void) {
 
-#      ifndef USE_STDIO
-       /* conio doesn't scroll!  Avoid trouble by starting at the top
-       ** of the screen, and never going "below" the bottom of the screen.
-       */
-       clrscr();
-       r = 7;                          /* allow for prompt */
-#      endif
+#       ifndef USE_STDIO
+        /* conio doesn't scroll!  Avoid trouble by starting at the top
+        ** of the screen, and never going "below" the bottom of the screen.
+        */
+        clrscr();
+        r = 7;                          /* allow for prompt */
+#       endif
 
-       /* This prompt fits on the VIC-20's narrow screen.
-       */
-       PRINT("Type characters to see\r\ntheir hexadecimal code\r\nnumbers:\r\n\n");
-       screensize(&width, &height);    /* get the screen's dimensions */
-       width /= 6;                     /* get number of codes on a line */
-       cursor(true);
-       t = 0;
-       while ((c = GET()) != EOF) {
+        /* This prompt fits on the VIC-20's narrow screen.
+        */
+        PRINT("Type characters to see\r\ntheir hexadecimal code\r\nnumbers - 'Q' quits:\r\n\n");
+        screensize(&width, &height);    /* get the screen's dimensions */
+        width /= 6;                     /* get number of codes on a line */
+        cursor(true);
+        t = 0;
+        while ((c = GET()) != EOF) {
 
-#              ifndef USE_STDIO
-               if (r == height) {
-                       clrscr();
-                       t = 0;
-                       PUT(c); /* echo char. again because screen was erased */
-                       r = 1;
-                       }
-               if (c == '\n')
-                       ++r;
-#              endif
+#               ifndef USE_STDIO
+                if (r == height) {
+                        clrscr();
+                        t = 0;
+                        PUT(c); /* echo char. again because screen was erased */
+                        r = 1;
+                        }
+                if (c == '\n')
+                        ++r;
+#               endif
 
-               PRINT("=$%02x ", c);
-               if (c == QUIT)
-                       break;
-               if (++t == width) {
-                       PRINT("\r\n");
-                       ++r;
-                       t = 0;
-                       }
-               }
-       PRINT("\r\n");
-       return EXIT_SUCCESS;
-       }
+                PRINT("=$%02x ", c);
+                if (c == QUIT)
+                        break;
+                if (++t == width) {
+                        PRINT("\r\n");
+                        ++r;
+                        t = 0;
+                        }
+                }
+        PRINT("\r\n");
+        return EXIT_SUCCESS;
+        }