Canola
0.8.D001
|
00001 // 00002 // canola - canon canola 1614p emulator 00003 // Copyright (C) 2011 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License, version 3, as 00007 // published by the Free Software Foundation. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License along 00015 // with this program. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #include <lib/ac/stdio.h> 00019 #include <lib/ac/stdlib.h> 00020 #include <lib/ac/unistd.h> 00021 #include <libexplain/program_name.h> 00022 00023 #include <lib/opcode.h> 00024 #include <lib/print_version.h> 00025 00026 00027 static void 00028 usage(void) 00029 { 00030 const char *prog = explain_program_name_get(); 00031 fprintf(stderr, "Usage: %s [ <option>... ]\n", prog); 00032 fprintf(stderr, " %s -V\n", prog); 00033 exit(1); 00034 } 00035 00036 00037 int 00038 main(int argc, char **argv) 00039 { 00040 for (;;) 00041 { 00042 int c = getopt(argc, argv, "V"); 00043 if (c == EOF) 00044 break; 00045 switch (c) 00046 { 00047 case 'V': 00048 print_version(); 00049 return 0; 00050 00051 default: 00052 usage(); 00053 } 00054 } 00055 if (optind != argc) 00056 usage(); 00057 00058 printf("<html>\n"); 00059 printf("<body>\n"); 00060 printf("<h1> Canon Canola 1614P Opcode Table </h1>\n"); 00061 printf("<table>\n"); 00062 printf("<tr><th></th>"); 00063 for (int col = 0; col < 8; ++col) 00064 printf("<th>%d</th>", col); 00065 printf("</tr>\n"); 00066 for (int row = 0; row < 16; ++row) 00067 { 00068 printf("<tr>\n"); 00069 printf("<th>%d:</th>\n", row); 00070 for (int col = 0; col < 8; ++col) 00071 { 00072 int n = (col << 4) + row; 00073 printf("<td align=\"center\">\n"); 00074 if (opcode_valid(n)) 00075 { 00076 printf("%s\n", opcode_name(opcode_t(n)).c_str()); 00077 } 00078 printf("</td>\n"); 00079 } 00080 printf("</tr>\n"); 00081 } 00082 printf("</table>\n"); 00083 printf("</body>\n"); 00084 printf("</html>\n"); 00085 00086 return 0; 00087 }