Disable test for -mmcs51 --stack-auto, due to bug #3804.
[sdcc.git] / sdcc / sim / ucsim / src / sims / p1516.src / p1516cl.h
blobc5c83e59823b2f61667a3e4e91e21d845a21f4b6
1 /*
2 * Simulator of microcontrollers (p1516cl.h)
4 * Copyright (C) 2020 Drotos Daniel
5 *
6 * To contact author send email to dr.dkdb@gmail.com
8 */
10 /* This file is part of microcontroller simulator: ucsim.
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.
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.
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@*/
28 #ifndef P1516CL_HEADER
29 #define P1516CL_HEADER
31 #include "uccl.h"
32 #include "memcl.h"
36 * Base of P1516 processor
39 enum flags
41 S= 1,
42 N= 1,
43 C= 2,
44 Z= 4,
45 O= 8,
46 V= 8,
47 // p2223 flags
48 P= 0x10, // 1:Pre 0:Post
49 U= 0x20 // 1:Up 0:Down
53 enum res2btn_t {
54 r2b_none= 0,
55 r2b_alarmed= 1,
56 r2b_activated= 2
60 class cl_pc_write: public cl_memory_operator
62 protected:
63 class cl_uc *uc;
64 public:
65 cl_pc_write(class cl_memory_cell *acell, class cl_uc *the_uc);
66 virtual t_mem write(t_mem val);
70 class cl_p1516: public cl_uc
72 public:
73 u32_t F;
74 u32_t R[16];
75 cl_memory_cell *RC[16];
76 cl_cell32 cF;
77 cl_address_space *regs;
78 class cl_porto *pa, *pb, *pc, *pd;
79 class cl_porti *pi, *pj;
80 class cl_brd_ctrl *bc;
81 class cl_memory_chip *rom_chip;
82 enum res2btn_t r2b_state;
83 public:
84 //class cl_address_space *rom;
85 public:
86 cl_p1516(class cl_sim *asim);
87 virtual int init(void);
88 virtual const char *id_string(void);
89 virtual void reset(void);
90 virtual void set_PC(t_addr addr);
92 virtual void mk_hw_elements(void);
93 virtual void make_memories(void);
94 virtual int clock_per_cycle(void) { return 1; }
95 virtual double def_xtal(void) { return 25000000; }
97 virtual struct dis_entry *dis_tbl(void);
98 virtual char *disassc(t_addr addr, chars *comment);
99 virtual void analyze_start(void);
100 virtual void analyze(t_addr addr);
101 virtual int inst_length(t_addr addr) { return 1; }
102 virtual void print_regs(class cl_console_base *con);
104 virtual bool cond(t_mem code);
105 virtual t_mem inst_ad(t_mem ra, t_mem rb, u32_t c);
106 virtual int inst_alu(t_mem code);
107 virtual int exec_inst(void);
109 virtual void btn_edge(int btn, bool press);
112 #define SET_C(v) ( cF.W( (F&~C) | ((v)?C:0) ))
113 #define SET_Z(v) ( cF.W( (F&~Z) | (((v)==0)?Z:0) ))
114 #define SET_S(v) ( cF.W( (F&~S) | ((v)?S:0) ))
116 #endif
118 /* End of p1516.src/p1516cl.h */