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/calculator.h> 00019 00020 00021 void 00022 calculator::on_opcode_pro_che(opcode_t op, const location::pointer &where) 00023 { 00024 switch (op) 00025 { 00026 case opcode_zero: 00027 assert(!"this isn't supposed to be possible"); 00028 break; 00029 00030 case opcode_plus_equals: 00031 case opcode_minus_equals: 00032 case opcode_mul: 00033 case opcode_div: 00034 case opcode_sqrt: 00035 case opcode_ent: 00036 case opcode_sj: 00037 case opcode_ej: 00038 case opcode_mj: 00039 case opcode_uj: 00040 case opcode_fj: 00041 case opcode_suj: 00042 case opcode_sfj: 00043 case opcode_srj: 00044 case opcode_m1: 00045 case opcode_m2: 00046 case opcode_m3: 00047 case opcode_m4: 00048 case opcode_m5: 00049 case opcode_m6: 00050 case opcode_m7: 00051 case opcode_m8: 00052 case opcode_m9: 00053 case opcode_m10: 00054 case opcode_m11: 00055 case opcode_m12: 00056 case opcode_m13: 00057 case opcode_m14: 00058 case opcode_mm1: 00059 case opcode_mm2: 00060 case opcode_sm3: 00061 case opcode_sm4: 00062 case opcode_sm5: 00063 case opcode_sm6: 00064 case opcode_sm7: 00065 case opcode_sm8: 00066 case opcode_sm9: 00067 case opcode_sm10: 00068 case opcode_sm11: 00069 case opcode_sm12: 00070 case opcode_sm13: 00071 case opcode_sm14: 00072 case opcode_rm1: 00073 case opcode_rm2: 00074 case opcode_rm3: 00075 case opcode_rm4: 00076 case opcode_rm5: 00077 case opcode_rm6: 00078 case opcode_rm7: 00079 case opcode_rm8: 00080 case opcode_rm9: 00081 case opcode_rm10: 00082 case opcode_rm11: 00083 case opcode_rm12: 00084 case opcode_rm13: 00085 case opcode_rm14: 00086 case opcode_clear_indicator: 00087 case opcode_cm1: 00088 case opcode_cm2: 00089 case opcode_cm3: 00090 case opcode_cm4: 00091 case opcode_cm5: 00092 case opcode_cm6: 00093 case opcode_cm7: 00094 case opcode_cm8: 00095 case opcode_cm9: 00096 case opcode_cm10: 00097 case opcode_cm11: 00098 case opcode_cm12: 00099 case opcode_cm13: 00100 case opcode_cm14: 00101 case opcode_dot: 00102 case opcode_rv: 00103 case opcode_right: 00104 case opcode_chg_sign: 00105 case opcode_round_down: 00106 case opcode_round_off: 00107 case opcode_round_up: 00108 case opcode_print: 00109 case opcode_fd: 00110 case opcode_n0: 00111 case opcode_n1: 00112 case opcode_n2: 00113 case opcode_n3: 00114 case opcode_n4: 00115 case opcode_n5: 00116 case opcode_n6: 00117 case opcode_n7: 00118 case opcode_n8: 00119 case opcode_n9: 00120 case opcode_n10: 00121 case opcode_n11: 00122 case opcode_n12: 00123 case opcode_n13: 00124 case opcode_n14: 00125 // Change the stored opcode, but do not advance the address. 00126 if (!address) 00127 address = wrap_address(address); 00128 programme[address] = op; 00129 break; 00130 00131 case opcode_extended_c: 00132 // Instruction Manual, p. 9 00133 // 00134 // "When the program is in CHECK MODE (Program Mode Switch is 00135 // set in PRO CHE), the program is returned to eitehr the 1st or 00136 // 121st step according to the Program Selector Switch." 00137 address = 0; 00138 break; 00139 00140 case opcode_extended_start: 00141 // Instruction Manual, p. 12 00142 // 00143 // "If this key is depressed with the Program Mode Switch set in 00144 // PRO CHE position, the contents of the program can be checked. 00145 // The program is advanced one step each time the [START] key is 00146 // depressed, and simultaneously the immediate step number' and 00147 // program instruction code are indicated together." 00148 // 00149 if (!address) 00150 address = wrap_address(address); 00151 address = wrap_address(address + 1); 00152 break; 00153 00154 case opcode_extended_m3_tilde: 00155 case opcode_extended_sm3_tilde: 00156 case opcode_extended_rm3_tilde: 00157 case opcode_extended_cm3_tilde: 00158 assert(!"interpose_stateful was meant to fix this"); 00159 break; 00160 00161 case opcode_extended_off: 00162 same_as_ope: 00163 on_opcode_ope(op, where); 00164 break; 00165 00166 case opcode_extended_program_print: 00167 program_print(); 00168 break; 00169 00170 case opcode_extended_display_print: 00171 case opcode_extended_paper_feed: 00172 on_opcode_lrn(op, where); 00173 break; 00174 00175 case opcode_extended_rounding_switch_up: 00176 case opcode_extended_rounding_switch_off: 00177 case opcode_extended_rounding_switch_down: 00178 case opcode_extended_decimal_point_selector_0: 00179 case opcode_extended_decimal_point_selector_1: 00180 case opcode_extended_decimal_point_selector_2: 00181 case opcode_extended_decimal_point_selector_3: 00182 case opcode_extended_decimal_point_selector_4: 00183 case opcode_extended_decimal_point_selector_5: 00184 case opcode_extended_decimal_point_selector_6: 00185 case opcode_extended_decimal_point_selector_7: 00186 case opcode_extended_decimal_point_selector_8: 00187 case opcode_extended_decimal_point_selector_9: 00188 case opcode_extended_decimal_point_selector_10: 00189 case opcode_extended_decimal_point_selector_11: 00190 case opcode_extended_decimal_point_selector_12: 00191 case opcode_extended_decimal_point_selector_float: 00192 goto same_as_ope; 00193 00194 case opcode_extended_goto_000: 00195 case opcode_extended_goto_001: 00196 case opcode_extended_goto_002: 00197 case opcode_extended_goto_003: 00198 case opcode_extended_goto_004: 00199 case opcode_extended_goto_005: 00200 case opcode_extended_goto_006: 00201 case opcode_extended_goto_007: 00202 case opcode_extended_goto_008: 00203 case opcode_extended_goto_009: 00204 case opcode_extended_goto_010: 00205 case opcode_extended_goto_011: 00206 case opcode_extended_goto_012: 00207 case opcode_extended_goto_013: 00208 case opcode_extended_goto_014: 00209 case opcode_extended_goto_015: 00210 case opcode_extended_goto_100: 00211 case opcode_extended_goto_101: 00212 case opcode_extended_goto_102: 00213 case opcode_extended_goto_103: 00214 case opcode_extended_goto_104: 00215 case opcode_extended_goto_105: 00216 case opcode_extended_goto_106: 00217 case opcode_extended_goto_107: 00218 case opcode_extended_goto_108: 00219 case opcode_extended_goto_109: 00220 case opcode_extended_goto_110: 00221 case opcode_extended_goto_111: 00222 case opcode_extended_goto_112: 00223 case opcode_extended_goto_113: 00224 case opcode_extended_goto_114: 00225 case opcode_extended_goto_115: 00226 case opcode_extended_goto_200: 00227 case opcode_extended_goto_201: 00228 case opcode_extended_goto_202: 00229 case opcode_extended_goto_203: 00230 case opcode_extended_goto_204: 00231 case opcode_extended_goto_205: 00232 case opcode_extended_goto_206: 00233 case opcode_extended_goto_207: 00234 case opcode_extended_goto_208: 00235 case opcode_extended_goto_209: 00236 case opcode_extended_goto_210: 00237 case opcode_extended_goto_211: 00238 case opcode_extended_goto_212: 00239 case opcode_extended_goto_213: 00240 case opcode_extended_goto_214: 00241 case opcode_extended_goto_215: 00242 case opcode_extended_goto_300: 00243 case opcode_extended_goto_301: 00244 case opcode_extended_goto_302: 00245 case opcode_extended_goto_303: 00246 case opcode_extended_goto_304: 00247 case opcode_extended_goto_305: 00248 case opcode_extended_goto_306: 00249 case opcode_extended_goto_307: 00250 case opcode_extended_goto_308: 00251 case opcode_extended_goto_309: 00252 case opcode_extended_goto_310: 00253 case opcode_extended_goto_311: 00254 case opcode_extended_goto_312: 00255 case opcode_extended_goto_313: 00256 case opcode_extended_goto_314: 00257 case opcode_extended_goto_315: 00258 case opcode_extended_goto_400: 00259 case opcode_extended_goto_401: 00260 case opcode_extended_goto_402: 00261 case opcode_extended_goto_403: 00262 case opcode_extended_goto_404: 00263 case opcode_extended_goto_405: 00264 case opcode_extended_goto_406: 00265 case opcode_extended_goto_407: 00266 case opcode_extended_goto_408: 00267 case opcode_extended_goto_409: 00268 case opcode_extended_goto_410: 00269 case opcode_extended_goto_411: 00270 case opcode_extended_goto_412: 00271 case opcode_extended_goto_413: 00272 case opcode_extended_goto_414: 00273 case opcode_extended_goto_415: 00274 case opcode_extended_goto_500: 00275 case opcode_extended_goto_501: 00276 case opcode_extended_goto_502: 00277 case opcode_extended_goto_503: 00278 case opcode_extended_goto_504: 00279 case opcode_extended_goto_505: 00280 case opcode_extended_goto_506: 00281 case opcode_extended_goto_507: 00282 case opcode_extended_goto_508: 00283 case opcode_extended_goto_509: 00284 case opcode_extended_goto_510: 00285 case opcode_extended_goto_511: 00286 case opcode_extended_goto_512: 00287 case opcode_extended_goto_513: 00288 case opcode_extended_goto_514: 00289 case opcode_extended_goto_515: 00290 case opcode_extended_goto_600: 00291 case opcode_extended_goto_601: 00292 case opcode_extended_goto_602: 00293 case opcode_extended_goto_603: 00294 case opcode_extended_goto_604: 00295 case opcode_extended_goto_605: 00296 case opcode_extended_goto_606: 00297 case opcode_extended_goto_607: 00298 case opcode_extended_goto_608: 00299 case opcode_extended_goto_609: 00300 case opcode_extended_goto_610: 00301 case opcode_extended_goto_611: 00302 case opcode_extended_goto_612: 00303 case opcode_extended_goto_613: 00304 case opcode_extended_goto_614: 00305 case opcode_extended_goto_615: 00306 case opcode_extended_goto_700: 00307 case opcode_extended_goto_701: 00308 case opcode_extended_goto_702: 00309 case opcode_extended_goto_703: 00310 case opcode_extended_goto_704: 00311 case opcode_extended_goto_705: 00312 case opcode_extended_goto_706: 00313 case opcode_extended_goto_707: 00314 case opcode_extended_goto_708: 00315 case opcode_extended_goto_709: 00316 case opcode_extended_goto_710: 00317 case opcode_extended_goto_711: 00318 case opcode_extended_goto_712: 00319 case opcode_extended_goto_713: 00320 case opcode_extended_goto_714: 00321 case opcode_extended_goto_715: 00322 on_error("'%s' not valid at the moment", opcode_name(op).c_str()); 00323 00324 default: 00325 on_error("%s: %d: undefined 0x%02X opcode", __FILE__, __LINE__, op); 00326 break; 00327 } 00328 }