]> git.sur5r.net Git - cc65/blob - testcode/lib/apple2/hgrshow.c
Adjusted style.
[cc65] / testcode / lib / apple2 / hgrshow.c
1 // cl65 -t apple2 --start-addr 0x4000 hgrshow.c
2
3 #include <tgi.h>
4 #include <conio.h>
5 #include <fcntl.h>
6 #include <string.h>
7 #include <unistd.h>
8 #include <dirent.h>
9
10 void main (void)
11 {
12     DIR *dir;
13     struct dirent *ent;
14
15     tgi_install (a2_hi_tgi);
16     tgi_init ();
17
18     dir = opendir (".");
19     while (ent = readdir (dir)) {
20         char *ext;
21         int hgr;
22
23         ext = strrchr (ent->d_name, '.');
24         if (!ext || strcasecmp (ext, ".hgr"))
25             continue;
26
27         hgr = open (ent->d_name, O_RDONLY);
28         read (hgr, (void*)0x2000, 0x2000);
29         close (hgr);
30
31         if (cgetc () == '\r')
32             break;
33     }
34     closedir (dir);
35
36     tgi_uninstall ();
37 }