3 ** Shows the ASCII (or ATASCII, PETSCII) codes of typed characters.
5 ** 2003-03-09, Greg King <gngking@erols.com>
8 /* Define USE_STDIO, when you want to use the stdio functions.
9 ** Do not define it, when you want to use the conio functions.
10 ** NOTE: stdin on some targets is line-bufferred. You might need to type
11 ** a key, then tap the return(enter)-key, in order to see each code.
24 /* r -- row. t -- table-column.
26 static unsigned char height, width, r, t;
31 # define PRINT cprintf
32 # define PUT(c) cputc((char)(c))
34 /* conio doesn't echo typed characters.
35 ** So, this function does it.
37 static int GET(void) {
38 PUT(c = (int)cgetc());
52 /* conio doesn't scroll! Avoid trouble by starting at the top
53 ** of the screen, and never going "below" the bottom of the screen.
56 r = 7; /* allow for prompt */
59 /* This prompt fits on the VIC-20's narrow screen.
61 PRINT("Type characters to see\r\ntheir hexadecimal code\r\nnumbers:\r\n\n");
62 screensize(&width, &height); /* get the screen's dimensions */
63 width /= 6; /* get number of codes on a line */
66 while ((c = GET()) != EOF) {
72 PUT(c); /* echo char. again because screen was erased */