Canola  0.8.D001
lib/opcode.h
Go to the documentation of this file.
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 #ifndef LIB_OPCODE_H
00019 #define LIB_OPCODE_H
00020 
00021 #include <lib/config.h>
00022 #include <string>
00023 
00024 enum opcode_t
00025 {
00031     opcode_zero,
00032 
00040     opcode_plus_equals,
00041 
00050     opcode_minus_equals,
00051 
00057     opcode_mul,
00058 
00064     opcode_div,
00065 
00075     opcode_sqrt,
00076 
00077     // "Explanation of Program Keys
00078     //
00079     // "Program keys are the keys which function primarily in storing programs
00080     // in manual LRN, for the execution of programs already stored or checking
00081     // the contents of a program.  Most of the keys explained in section
00082     // 2-1 for ordinary operation are used as program keys and function
00083     // identically.
00084     //
00085     // "There are some keys, however, which are used exclusively for program
00086     // operation.  These are [ENT], [SJ], [EJ], [MJ], [FJ], and [START] keys,
00087     // and are distinguished by their blue color."
00088     //
00089 
00104     opcode_ent = 0x11,
00105 
00120     opcode_sj,
00121 
00137     opcode_ej,
00138 
00150     opcode_mj = 0x15,
00151 
00170     opcode_uj,
00171 
00187     opcode_fj,
00188 
00192     opcode_suj,
00193 
00197     opcode_sfj,
00198 
00202     opcode_srj,
00203 
00209     opcode_m1 = 0x21,
00210 
00216     opcode_m2,
00217     opcode_m3,
00218     opcode_m4,
00219     opcode_m5,
00220     opcode_m6,
00221     opcode_m7,
00222     opcode_m8,
00223     opcode_m9,
00224     opcode_m10,
00225     opcode_m11,
00226     opcode_m12,
00227     opcode_m13,
00228     opcode_m14,
00229 
00235     opcode_mm1 = 0x31,
00236 
00242     opcode_mm2,
00243     opcode_sm3,
00244     opcode_sm4,
00245     opcode_sm5,
00246     opcode_sm6,
00247     opcode_sm7,
00248     opcode_sm8,
00249     opcode_sm9,
00250     opcode_sm10,
00251     opcode_sm11,
00252     opcode_sm12,
00253     opcode_sm13,
00254     opcode_sm14,
00255 
00261     opcode_rm1 = 0x41,
00262 
00268     opcode_rm2,
00269     opcode_rm3,
00270     opcode_rm4,
00271     opcode_rm5,
00272     opcode_rm6,
00273     opcode_rm7,
00274     opcode_rm8,
00275     opcode_rm9,
00276     opcode_rm10,
00277     opcode_rm11,
00278     opcode_rm12,
00279     opcode_rm13,
00280     opcode_rm14,
00281 
00288     opcode_clear_indicator = 0x50,
00289 
00295     opcode_cm1,
00296 
00302     opcode_cm2,
00303     opcode_cm3,
00304     opcode_cm4,
00305     opcode_cm5,
00306     opcode_cm6,
00307     opcode_cm7,
00308     opcode_cm8,
00309     opcode_cm9,
00310     opcode_cm10,
00311     opcode_cm11,
00312     opcode_cm12,
00313     opcode_cm13,
00314     opcode_cm14,
00315 
00325     opcode_dot = 0x60,
00326 
00341     opcode_rv,
00342 
00353     opcode_right,
00354 
00369     opcode_chg_sign,
00370 
00384     opcode_round_down = 0x65,
00385 
00388     opcode_round_off,
00389 
00392     opcode_round_up,
00393 
00396     opcode_print,
00397 
00400     opcode_fd,
00401 
00411     opcode_n0 = 0x70,
00412     opcode_n1,
00413     opcode_n2,
00414     opcode_n3,
00415     opcode_n4,
00416     opcode_n5,
00417     opcode_n6,
00418     opcode_n7,
00419     opcode_n8,
00420     opcode_n9,
00421     opcode_n10,
00422     opcode_n11,
00423     opcode_n12,
00424     opcode_n13,
00425     opcode_n14,
00426 
00427     // The extended opcodes are for handling keys and events that cannot
00428     // be stored on the punched cards.
00429 
00448     opcode_extended_c = 512,
00449 
00474     opcode_extended_start,
00475 
00494     opcode_extended_m3_tilde,
00495 
00509     opcode_extended_sm3_tilde,
00510 
00521     opcode_extended_rm3_tilde,
00522 
00533     opcode_extended_cm3_tilde,
00534     opcode_extended_off,
00535     opcode_extended_program_print,
00536     opcode_extended_display_print,
00537     opcode_extended_paper_feed,
00538 
00539     opcode_extended_rounding_switch_up,
00540     opcode_extended_rounding_switch_off,
00541     opcode_extended_rounding_switch_down,
00542 
00543     opcode_extended_decimal_point_selector_0,
00544     opcode_extended_decimal_point_selector_1,
00545     opcode_extended_decimal_point_selector_2,
00546     opcode_extended_decimal_point_selector_3,
00547     opcode_extended_decimal_point_selector_4,
00548     opcode_extended_decimal_point_selector_5,
00549     opcode_extended_decimal_point_selector_6,
00550     opcode_extended_decimal_point_selector_7,
00551     opcode_extended_decimal_point_selector_8,
00552     opcode_extended_decimal_point_selector_9,
00553     opcode_extended_decimal_point_selector_10,
00554     opcode_extended_decimal_point_selector_11,
00555     opcode_extended_decimal_point_selector_12,
00556     opcode_extended_decimal_point_selector_float,
00557 
00562     opcode_extended_goto_000,
00563     opcode_extended_goto_001,
00564     opcode_extended_goto_002,
00565     opcode_extended_goto_003,
00566     opcode_extended_goto_004,
00567     opcode_extended_goto_005,
00568     opcode_extended_goto_006,
00569     opcode_extended_goto_007,
00570     opcode_extended_goto_008,
00571     opcode_extended_goto_009,
00572     opcode_extended_goto_010,
00573     opcode_extended_goto_011,
00574     opcode_extended_goto_012,
00575     opcode_extended_goto_013,
00576     opcode_extended_goto_014,
00577     opcode_extended_goto_015,
00578     opcode_extended_goto_100,
00579     opcode_extended_goto_101,
00580     opcode_extended_goto_102,
00581     opcode_extended_goto_103,
00582     opcode_extended_goto_104,
00583     opcode_extended_goto_105,
00584     opcode_extended_goto_106,
00585     opcode_extended_goto_107,
00586     opcode_extended_goto_108,
00587     opcode_extended_goto_109,
00588     opcode_extended_goto_110,
00589     opcode_extended_goto_111,
00590     opcode_extended_goto_112,
00591     opcode_extended_goto_113,
00592     opcode_extended_goto_114,
00593     opcode_extended_goto_115,
00594     opcode_extended_goto_200,
00595     opcode_extended_goto_201,
00596     opcode_extended_goto_202,
00597     opcode_extended_goto_203,
00598     opcode_extended_goto_204,
00599     opcode_extended_goto_205,
00600     opcode_extended_goto_206,
00601     opcode_extended_goto_207,
00602     opcode_extended_goto_208,
00603     opcode_extended_goto_209,
00604     opcode_extended_goto_210,
00605     opcode_extended_goto_211,
00606     opcode_extended_goto_212,
00607     opcode_extended_goto_213,
00608     opcode_extended_goto_214,
00609     opcode_extended_goto_215,
00610     opcode_extended_goto_300,
00611     opcode_extended_goto_301,
00612     opcode_extended_goto_302,
00613     opcode_extended_goto_303,
00614     opcode_extended_goto_304,
00615     opcode_extended_goto_305,
00616     opcode_extended_goto_306,
00617     opcode_extended_goto_307,
00618     opcode_extended_goto_308,
00619     opcode_extended_goto_309,
00620     opcode_extended_goto_310,
00621     opcode_extended_goto_311,
00622     opcode_extended_goto_312,
00623     opcode_extended_goto_313,
00624     opcode_extended_goto_314,
00625     opcode_extended_goto_315,
00626     opcode_extended_goto_400,
00627     opcode_extended_goto_401,
00628     opcode_extended_goto_402,
00629     opcode_extended_goto_403,
00630     opcode_extended_goto_404,
00631     opcode_extended_goto_405,
00632     opcode_extended_goto_406,
00633     opcode_extended_goto_407,
00634     opcode_extended_goto_408,
00635     opcode_extended_goto_409,
00636     opcode_extended_goto_410,
00637     opcode_extended_goto_411,
00638     opcode_extended_goto_412,
00639     opcode_extended_goto_413,
00640     opcode_extended_goto_414,
00641     opcode_extended_goto_415,
00642     opcode_extended_goto_500,
00643     opcode_extended_goto_501,
00644     opcode_extended_goto_502,
00645     opcode_extended_goto_503,
00646     opcode_extended_goto_504,
00647     opcode_extended_goto_505,
00648     opcode_extended_goto_506,
00649     opcode_extended_goto_507,
00650     opcode_extended_goto_508,
00651     opcode_extended_goto_509,
00652     opcode_extended_goto_510,
00653     opcode_extended_goto_511,
00654     opcode_extended_goto_512,
00655     opcode_extended_goto_513,
00656     opcode_extended_goto_514,
00657     opcode_extended_goto_515,
00658     opcode_extended_goto_600,
00659     opcode_extended_goto_601,
00660     opcode_extended_goto_602,
00661     opcode_extended_goto_603,
00662     opcode_extended_goto_604,
00663     opcode_extended_goto_605,
00664     opcode_extended_goto_606,
00665     opcode_extended_goto_607,
00666     opcode_extended_goto_608,
00667     opcode_extended_goto_609,
00668     opcode_extended_goto_610,
00669     opcode_extended_goto_611,
00670     opcode_extended_goto_612,
00671     opcode_extended_goto_613,
00672     opcode_extended_goto_614,
00673     opcode_extended_goto_615,
00674     opcode_extended_goto_700,
00675     opcode_extended_goto_701,
00676     opcode_extended_goto_702,
00677     opcode_extended_goto_703,
00678     opcode_extended_goto_704,
00679     opcode_extended_goto_705,
00680     opcode_extended_goto_706,
00681     opcode_extended_goto_707,
00682     opcode_extended_goto_708,
00683     opcode_extended_goto_709,
00684     opcode_extended_goto_710,
00685     opcode_extended_goto_711,
00686     opcode_extended_goto_712,
00687     opcode_extended_goto_713,
00688     opcode_extended_goto_714,
00689     opcode_extended_goto_715,
00690 };
00691 
00699 std::string opcode_name(opcode_t n);
00700 
00708 std::string opcode_uname(opcode_t n);
00709 
00718 std::string opcode_raw_name(opcode_t n);
00719 
00730 bool opcode_valid(int n);
00731 
00742 bool opcode_valid_label(int n);
00743 
00748 bool opcode_red(opcode_t op);
00749 
00750 #endif // LIB_OPCODE_H