2 * Simulator of microcontrollers (p1516cl.h)
4 * Copyright (C) 2020 Drotos Daniel
6 * To contact author send email to dr.dkdb@gmail.com
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
28 #ifndef P1516CL_HEADER
29 #define P1516CL_HEADER
36 * Base of P1516 processor
48 P
= 0x10, // 1:Pre 0:Post
49 U
= 0x20 // 1:Up 0:Down
60 class cl_pc_write
: public cl_memory_operator
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
75 cl_memory_cell
*RC
[16];
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
;
84 //class cl_address_space *rom;
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) ))
118 /* End of p1516.src/p1516cl.h */