ccb0abd343d0b6e233f24d87f6e2b6ba03b40d45
[fw/sdcc] / sim / ucsim / s51.src / timer1.cc
1 /*
2  * Simulator of microcontrollers (s51.src/timer1.cc)
3  *
4  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
5  * 
6  * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
7  *
8  */
9
10 /* This file is part of microcontroller simulator: ucsim.
11
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING.  If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 02111-1307, USA. */
26 /*@1@*/
27
28 #include "timer1cl.h"
29 #include "regs51.h"
30
31
32 cl_timer1::cl_timer1(class cl_uc *auc, int aid, char *aid_string):
33   cl_timer0(auc, aid, aid_string)
34 {
35   make_partner(HW_UART, 0);
36 }
37
38 /*int
39 cl_timer1::init(void)
40 {
41   return(0);
42 }*/
43
44 /*void
45 cl_timer1::added(class cl_hw *new_hw)
46 {
47   if (new_hw->cathegory == HW_UART)
48     hws_to_inform->add(new_hw);
49 }*/
50
51 int
52 cl_timer1::do_mode3(int cycles)
53 {
54   return(0);
55 }
56
57 /*void
58 cl_timer1::overflow(void)
59 {
60   inform_partners(EV_OVERFLOW, 0);
61 }*/
62
63 void
64 cl_timer1::print_info(class cl_console *con)
65 {
66   char *modes[]= { "13 bit", "16 bit", "8 bit autoreload", "stop" };
67   //int tmod= cell_tmod->get();
68   int on;
69
70   con->dd_printf("%s[%d] 0x%04x", id_string, id,
71                  256*cell_th->get()+cell_tl->get());
72   //int mode= (tmod & (bmM11|bmM01)) >> 4;
73   con->dd_printf(" %s", modes[mode]);
74   con->dd_printf(" %s", (/*tmod&bm*/C_T/*1*/)?"counter":"timer");
75   if (/*tmod&bm*/GATE/*1*/)
76     {
77       con->dd_printf(" gated");
78       on= /*uc->get_mem(MEM_SFR, P3) & uc->port_pins[3] & mask_*/INT/*bm_INT1*/;
79     }
80   else
81     on= cell_tcon->get() & mask_TR/*bmTR1*/;
82   con->dd_printf(" %s", on?"ON":"OFF");
83   con->dd_printf(" irq=%c", (cell_tcon->get()&mask_TF)?'1':'0');
84   con->dd_printf(" %s", (uc->get_mem(MEM_SFR, IE)&bmET1)?"en":"dis");
85   con->dd_printf(" prio=%d", uc->it_priority(bmPT1));
86   con->dd_printf("\n");
87 }
88
89
90 /* End of s51.src/timer1.cc */