Canola  0.8.D001
lib/calculator/program_print.cc
Go to the documentation of this file.
00001 //
00002 // canola - canon canola 1614p emulator
00003 // Copyright (C) 2011, 2012 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::program_print(void)
00023 {
00024     int min = 0;
00025     int max = 256;
00026     switch (program_selector)
00027     {
00028     default:
00029     case program_selector_i_ii:
00030         min = 1;
00031         max = 240;
00032         break;
00033 
00034     case program_selector_i:
00035         min = 1;
00036         max = 120;
00037         break;
00038 
00039     case program_selector_ii:
00040         min = 121;
00041         max = 240;
00042         break;
00043     }
00044 
00045     // Strangely, actually using a 1614P, it prints from the
00046     // *current* address to the end.
00047     int start = (address < min || address > max ? min : address);
00048 
00049     for (int n = start; n <= max; ++n)
00050     {
00051         unsigned char op = programme[n];
00052         if (op)
00053         {
00054             display value;
00055             calculate_display_lrn(value, n, op);
00056             value.tubes[15].dot = false;
00057             derived_print(value);
00058         }
00059     }
00060 }